Ignore:
Files:
1 added
2 deleted
53 edited

Legend:

Unmodified
Added
Removed
  • Orange/classification/knn.py

    r9671 r9724  
    3030 
    3131        component that constructs the object for measuring distances between 
    32         instances. Defaults to :class:`~Orange.distance.instances.EuclideanConstructor`. 
     32        instances. Defaults to :class:`~Orange.distance.Euclidean`. 
    3333 
    3434    .. attribute:: weight_id 
  • Orange/clustering/__init__.py

    r9671 r9725  
    1414import orange 
    1515import random 
    16 import statc 
     16from Orange import statc 
    1717     
    1818__docformat__ = 'restructuredtext' 
  • Orange/clustering/hierarchical.py

    r9671 r9724  
    310310The most common things to cluster are certainly examples. To show how to 
    311311this is done, we shall now load the Iris data set, initialize a distance 
    312 matrix with the distances measure by :class:`ExamplesDistance_Euclidean` 
     312matrix with the distances measure by :class:`Euclidean` 
    313313and cluster it with average linkage. Since we don't need the matrix, 
    314314we shall let the clustering overwrite it (not that it's needed for 
     
    321321    matrix = Orange.core.SymMatrix(len(data)) 
    322322    matrix.setattr("objects", data) 
    323     distance = Orange.distance.EuclideanConstructor(data) 
     323    distance = Orange.distance.Euclidean(data) 
    324324    for i1, instance1 in enumerate(data): 
    325325        for i2 in range(i1+1, len(data)): 
     
    475475 
    476476def clustering(data, 
    477                distance_constructor=orange.ExamplesDistanceConstructor_Euclidean, 
     477               distance_constructor=Orange.distance.Euclidean, 
    478478               linkage=AVERAGE, 
    479479               order=False, 
     
    484484    :type data: :class:`Orange.data.Table` 
    485485    :param distance_constructor: Instance distance constructor 
    486     :type distance_constructor: :class:`Orange.distance.ExamplesDistanceConstructor` 
     486    :type distance_constructor: :class:`Orange.distance.DistanceConstructor` 
    487487    :param linkage: Linkage flag. Must be one of global module level flags: 
    488488     
     
    15111511 
    15121512def instance_distance_matrix(data, 
    1513             distance_constructor=orange.ExamplesDistanceConstructor_Euclidean, 
     1513            distance_constructor=Orange.distance.Euclidean, 
    15141514            progress_callback=None): 
    15151515    """ A helper function that computes an :class:`Orange.core.SymMatrix` of all 
     
    15191519    :type data: :class:`Orange.data.Table` 
    15201520     
    1521     :param distance_constructor: An ExamplesDistance_Constructor instance. 
    1522     :type distance_constructor: :class:`Orange.distance.ExampleDistConstructor` 
     1521    :param distance_constructor: An DistanceConstructor instance. 
     1522    :type distance_constructor: :class:`Orange.distance.DistanceConstructor` 
    15231523     
    15241524    :param progress_callback: A function (taking one argument) to use for 
  • Orange/clustering/kmeans.py

    r9671 r9725  
    120120import orange 
    121121import random 
    122 import statc 
     122from Orange import statc 
    123123 
    124124import Orange.clustering.hierarchical 
     
    294294    :param k: the number of clusters. 
    295295    :type k: integer 
    296     :param distfun: a distance function. 
    297     :type distfun: :class:`orange.ExamplesDistance` 
    298      """ 
     296    """ 
    299297    return data.getitems(random.sample(range(len(data)), k)) 
    300298 
     
    307305    :type k: integer 
    308306    :param distfun: a distance function. 
    309     :type distfun: :class:`orange.ExamplesDistance` 
     307    :type distfun: :class:`Orange.distance.Distance` 
    310308    """ 
    311309    center = data_center(data) 
     
    338336        :type k: integer 
    339337        :param distfun: a distance function. 
    340         :type distfun: :class:`orange.ExamplesDistance` 
     338        :type distfun: :class:`Orange.distance.Distance` 
    341339        """ 
    342340        sample = orange.ExampleTable(random.sample(data, min(self.n, len(data)))) 
     
    393391    def __init__(self, data=None, centroids=3, maxiters=None, minscorechange=None, 
    394392                 stopchanges=0, nstart=1, initialization=init_random, 
    395                  distance=orange.ExamplesDistanceConstructor_Euclidean, 
     393                 distance=Orange.distance.Euclidean, 
    396394                 scoring=score_distance_to_centroids, inner_callback = None, 
    397395                 outer_callback = None): 
     
    404402        :type nstart: integer 
    405403        :param distance: an example distance constructor, which measures the distance between two instances. 
    406         :type distance: :class:`orange.ExamplesDistanceConstructor` 
     404        :type distance: :class:`Orange.distance.DistanceConstructor` 
    407405        :param initialization: a function to select centroids given data instances, k and a example distance function. This module implements different approaches (:func:`init_random`, :func:`init_diversity`, :class:`init_hclustering`).  
    408406        :param scoring: a function that takes clustering object and returns the clustering score. It could be used, for instance, in procedure that repeats the clustering nstart times, returning the clustering with the lowest score. 
  • Orange/distance/__init__.py

    r9671 r9725  
    11import Orange 
    22 
     3#%s/ExamplesDistanceConstructor/DistanceConstructor/gc 
     4#%s/ExamplesDistance_Normalized/DistanceNormalized/gc 
     5#ExampleDistance -> Distance 
     6#Hamming -> HammingDistance 
     7#DTW -> DTWDistance 
     8#Euclidean -> EuclideanDistance 
     9#Manhattan -> ... 
     10#Maximal -> ... 
     11#Relief -> .. 
     12#DTWConstructor 
     13#EuclideanConstructor 
     14#HammingConstructor 
     15#ManhattanConstructor 
     16#MaximalConstructor 
     17#ReliefConstructor 
     18#PearsonRConstructor -> PearsonR 
     19#PearsonR -> PearsonRDistance 
     20#SpearmanRConstructor -> SpearmanR 
     21#SpearmanR -> SpearmanRDistance 
     22#MahalanobisConstructor ->  Mahalanobis 
     23#Mahalanobis -> MahalanobisDistance 
     24 
    325from Orange.core import \ 
    4      AlignmentList, \ 
    5      DistanceMap, \ 
    6      DistanceMapConstructor, \ 
    7      ExampleDistConstructor, \ 
    8      ExampleDistBySorting, \ 
    9      ExampleDistVector, \ 
    10      ExamplesDistance, \ 
    11      ExamplesDistance_Normalized, \ 
    12      ExamplesDistanceConstructor 
    13  
    14 from Orange.core import ExamplesDistance_Hamming as Hamming 
    15 from Orange.core import ExamplesDistance_DTW as DTW 
    16 from Orange.core import ExamplesDistance_Euclidean as Euclidean 
    17 from Orange.core import ExamplesDistance_Manhattan as Manhattan 
    18 from Orange.core import ExamplesDistance_Maximal as Maximal 
    19 from Orange.core import ExamplesDistance_Relief as Relief 
    20  
    21 from Orange.core import ExamplesDistanceConstructor_DTW as DTWConstructor 
    22 from Orange.core import ExamplesDistanceConstructor_Euclidean as EuclideanConstructor 
    23 from Orange.core import ExamplesDistanceConstructor_Hamming as HammingConstructor 
    24 from Orange.core import ExamplesDistanceConstructor_Manhattan as ManhattanConstructor 
    25 from Orange.core import ExamplesDistanceConstructor_Maximal as MaximalConstructor 
    26 from Orange.core import ExamplesDistanceConstructor_Relief as ReliefConstructor 
    27  
    28 import statc 
     26    DistanceMap, \ 
     27    DistanceMapConstructor, \ 
     28    ExamplesDistance as Distance, \ 
     29    ExamplesDistance_Normalized as DistanceNormalized, \ 
     30    ExamplesDistanceConstructor as DistanceConstructor, \ 
     31    ExamplesDistance_Hamming as HammingDistance, \ 
     32    ExamplesDistance_DTW as DTWDistance, \ 
     33    ExamplesDistance_Euclidean as EuclideanDistance, \ 
     34    ExamplesDistance_Manhattan as ManhattanDistance, \ 
     35    ExamplesDistance_Maximal as MaximalDistance, \ 
     36    ExamplesDistance_Relief as ReliefDistance, \ 
     37    ExamplesDistanceConstructor_DTW as DTW, \ 
     38    ExamplesDistanceConstructor_Euclidean as Euclidean, \ 
     39    ExamplesDistanceConstructor_Hamming as Hamming, \ 
     40    ExamplesDistanceConstructor_Manhattan as Manhattan, \ 
     41    ExamplesDistanceConstructor_Maximal as Maximal, \ 
     42    ExamplesDistanceConstructor_Relief as Relief 
     43 
     44from Orange import statc 
    2945import numpy 
    3046from numpy import linalg 
    3147 
    32 class PearsonRConstructor(ExamplesDistanceConstructor): 
    33     """Constructs an instance of PearsonR. Not all the data needs to be given.""" 
     48class PearsonR(DistanceConstructor): 
     49    """Constructs an instance of :obj:`PearsonRDistance`. Not all the data needs to be given.""" 
    3450     
    3551    def __new__(cls, data=None, **argkw): 
    36         self = ExamplesDistanceConstructor.__new__(cls, **argkw) 
     52        self = DistanceConstructor.__new__(cls, **argkw) 
    3753        self.__dict__.update(argkw) 
    3854        if data: 
     
    4460        indxs = [i for i, a in enumerate(table.domain.attributes) \ 
    4561                 if a.varType==Orange.data.Type.Continuous] 
    46         return PearsonR(domain=table.domain, indxs=indxs) 
    47  
    48 class PearsonR(ExamplesDistance): 
     62        return PearsonRDistance(domain=table.domain, indxs=indxs) 
     63 
     64class PearsonRDistance(Distance): 
    4965    """ 
    5066    `Pearson correlation coefficient 
     
    7793            return 1.0 
    7894 
    79 class SpearmanRConstructor(ExamplesDistanceConstructor): 
     95class SpearmanR(DistanceConstructor): 
    8096    """Constructs an instance of SpearmanR. Not all the data needs to be given.""" 
    8197     
    8298    def __new__(cls, data=None, **argkw): 
    83         self = ExamplesDistanceConstructor.__new__(cls, **argkw) 
     99        self = DistanceConstructor.__new__(cls, **argkw) 
    84100        self.__dict__.update(argkw) 
    85101        if data: 
     
    91107        indxs = [i for i, a in enumerate(table.domain.attributes) \ 
    92108                 if a.varType==Orange.data.Type.Continuous] 
    93         return SpearmanR(domain=table.domain, indxs=indxs) 
    94  
    95 class SpearmanR(ExamplesDistance):   
     109        return SpearmanRDistance(domain=table.domain, indxs=indxs) 
     110 
     111class SpearmanRDistance(Distance):   
    96112 
    97113    """`Spearman's rank correlation coefficient 
     
    122138            return 1.0 
    123139 
    124 class MahalanobisConstructor(ExamplesDistanceConstructor): 
     140class Mahalanobis(DistanceConstructor): 
    125141    """ Construct instance of Mahalanobis. """ 
    126142     
    127143    def __new__(cls, data=None, **argkw): 
    128         self = ExamplesDistanceConstructor.__new__(cls, **argkw) 
     144        self = DistanceConstructor.__new__(cls, **argkw) 
    129145        self.__dict__.update(argkw) 
    130146        if data: 
     
    149165        inverse_covariance_matrix = linalg.pinv(covariance_matrix, rcond=1e-10) 
    150166         
    151         return Mahalanobis(domain=newdomain, icm=inverse_covariance_matrix) 
    152  
    153 class Mahalanobis(ExamplesDistance): 
     167        return MahalanobisDistance(domain=newdomain, icm=inverse_covariance_matrix) 
     168 
     169class MahalanobisDistance(Distance): 
    154170    """`Mahalanobis distance 
    155171    <http://en.wikipedia.org/wiki/Mahalanobis_distance>`_""" 
     
    178194     
    179195     
    180 class PearsonRAbsoluteConstructor(PearsonRConstructor): 
     196class PearsonRAbsolute(PearsonR): 
    181197    """ Construct an instance of PearsonRAbsolute example distance estimator. 
    182198    """ 
     
    184200        indxs = [i for i, a in enumerate(data.domain.attributes) \ 
    185201                 if a.varType==Orange.data.Type.Continuous] 
    186         return PearsonRAbsolute(domain=data.domain, indxs=indxs) 
    187      
    188      
    189 class PearsonRAbsolute(PearsonR): 
     202        return PearsonRAbsoluteDistance(domain=data.domain, indxs=indxs) 
     203     
     204     
     205class PearsonRAbsoluteDistance(PearsonRDistance): 
    190206    """ An example distance estimator using absolute value of Pearson 
    191207    correlation coefficient. 
     
    213229         
    214230         
    215 class SpearmanRAbsoluteConstructor(SpearmanRConstructor): 
     231class SpearmanRAbsolute(SpearmanR): 
    216232    """ Construct an instance of SpearmanRAbsolute example distance estimator. 
    217233    """ 
     
    219235        indxs = [i for i, a in enumerate(data.domain.attributes) \ 
    220236                 if a.varType==Orange.data.Type.Continuous] 
    221         return SpearmanRAbsolute(domain=data.domain, indxs=indxs) 
    222      
    223      
    224 class SpearmanRAbsolute(SpearmanR): 
     237        return SpearmanRAbsoluteDistance(domain=data.domain, indxs=indxs) 
     238     
     239     
     240class SpearmanRAbsoluteDistance(SpearmanRDistance): 
    225241    def __call__(self, e1, e2): 
    226242        """ 
     
    252268    :type data: :obj:`Orange.data.Table` 
    253269     
    254     :param distance_constructor: An ExamplesDistance_Constructor instance. 
    255     :type distance_constructor: :obj:`Orange.distances.ExampleDistConstructor` 
     270    :param distance_constructor: An DistanceConstructor instance. 
     271    :type distance_constructor: :obj:`Orange.distances.DistanceConstructor` 
    256272     
    257273    """ 
  • Orange/evaluation/reliability.py

    r9697 r9725  
    22 
    33import random 
    4 import statc 
     4from Orange import statc 
    55import math 
    66import warnings 
     
    400400    def __call__(self, instances, learner): 
    401401        nearest_neighbours_constructor = Orange.classification.knn.FindNearestConstructor() 
    402         nearest_neighbours_constructor.distanceConstructor = Orange.distance.EuclideanConstructor() 
     402        nearest_neighbours_constructor.distanceConstructor = Orange.distance.Euclidean() 
    403403         
    404404        distance_id = Orange.data.new_meta_id() 
     
    467467    def __call__(self, instances, learner): 
    468468        nearest_neighbours_constructor = Orange.classification.knn.FindNearestConstructor() 
    469         nearest_neighbours_constructor.distanceConstructor = Orange.distance.EuclideanConstructor() 
     469        nearest_neighbours_constructor.distanceConstructor = Orange.distance.Euclidean() 
    470470         
    471471        distance_id = Orange.data.new_meta_id() 
     
    514514    def __call__(self, instances, *args): 
    515515        nnm = Orange.classification.knn.FindNearestConstructor() 
    516         nnm.distanceConstructor = Orange.distance.MahalanobisConstructor() 
     516        nnm.distanceConstructor = Orange.distance.Mahalanobis() 
    517517         
    518518        mid = Orange.data.new_meta_id() 
     
    558558        instance_avg = numpy.average(X, 0) 
    559559         
    560         distance_constructor = Orange.distance.MahalanobisConstructor() 
     560        distance_constructor = Orange.distance.Mahalanobis() 
    561561        distance = distance_constructor(new_instances) 
    562562         
  • Orange/evaluation/scoring.py

    r9671 r9725  
    449449""" 
    450450 
    451 import statc, operator, math 
     451import operator, math 
    452452from operator import add 
    453453import numpy 
    454454 
    455455import Orange 
     456from Orange import statc 
    456457 
    457458 
  • Orange/fixes/fix_changed_names.py

    r9697 r9722  
    102102           "orange.ImputerConstructor_average": "Orange.feature.imputation.ImputerConstructor_average", 
    103103 
    104            "orange.ExamplesDistance_Normalized": "Orange.distance.ExamplesDistance_Normalized", 
    105            "orange.ExamplesDistanceConstructor": "Orange.distance.ExamplesDistanceConstructor", 
    106            "orange.ExamplesDistance_Hamming": "Orange.distance.Hamming", 
    107            "orange.ExamplesDistance_DTW": "Orange.distance.DTW", 
    108            "orange.ExamplesDistance_Euclidean": "Orange.distance.Euclidean", 
    109            "orange.ExamplesDistance_Manhattan": "Orange.distance.Manhattan", 
    110            "orange.ExamplesDistance_Maximal": "Orange.distance.Maximal", 
    111            "orange.ExamplesDistance_Relief": "Orange.distance.Relief", 
    112  
    113            "orange.ExamplesDistanceConstructor_DTW": "Orange.distance.DTWConstructor", 
    114            "orange.ExamplesDistanceConstructor_Euclidean": "Orange.distance.EuclideanConstructor", 
    115            "orange.ExamplesDistanceConstructor_Hamming": "Orange.distance.HammingConstructor", 
    116            "orange.ExamplesDistanceConstructor_Manhattan": "Orange.distance.ManhattanConstructor", 
    117            "orange.ExamplesDistanceConstructor_Maximal": "Orange.distance.MaximalConstructor", 
    118            "orange.ExamplesDistanceConstructor_Relief": "Orange.distance.ReliefConstructor", 
    119  
    120            "orngClustering.ExamplesDistanceConstructor_PearsonR": "Orange.distance.PearsonRConstructor", 
    121            "orngClustering.ExamplesDistance_PearsonR": "Orange.distance.PearsonR", 
    122            "orngClustering.ExamplesDistanceConstructor_SpearmanR": "Orange.distance.SpearmanRConstructor", 
    123            "orngClustering.ExamplesDistance_SpearmanR": "Orange.distance.SpearmanR", 
     104           "orange.ExampleDistance": "Orange.distance.Distance", 
     105           "orange.ExamplesDistance_Normalized": "Orange.distance.DistanceNormalized", 
     106           "orange.ExamplesDistanceConstructor": "Orange.distance.DistanceConstructor", 
     107           "orange.ExamplesDistance_Hamming": "Orange.distance.HammingDistance", 
     108           "orange.ExamplesDistance_DTW": "Orange.distance.DTWDistance", 
     109           "orange.ExamplesDistance_Euclidean": "Orange.distance.EuclideanDistance", 
     110           "orange.ExamplesDistance_Manhattan": "Orange.distance.ManhattanDistance", 
     111           "orange.ExamplesDistance_Maximal": "Orange.distance.MaximalDistance", 
     112           "orange.ExamplesDistance_Relief": "Orange.distance.ReliefDistance", 
     113 
     114           "orange.ExamplesDistanceConstructor_DTW": "Orange.distance.DTW", 
     115           "orange.ExamplesDistanceConstructor_Euclidean": "Orange.distance.Euclidean", 
     116           "orange.ExamplesDistanceConstructor_Hamming": "Orange.distance.Hamming", 
     117           "orange.ExamplesDistanceConstructor_Manhattan": "Orange.distance.Manhattan", 
     118           "orange.ExamplesDistanceConstructor_Maximal": "Orange.distance.Maximal", 
     119           "orange.ExamplesDistanceConstructor_Relief": "Orange.distance.Relief", 
     120 
     121           "orngClustering.ExamplesDistanceConstructor_PearsonR": "Orange.distance.PearsonR", 
     122           "orngClustering.ExamplesDistance_PearsonR": "Orange.distance.PearsonRDistance", 
     123           "orngClustering.ExamplesDistanceConstructor_SpearmanR": "Orange.distance.SpearmanR", 
     124           "orngClustering.ExamplesDistance_SpearmanR": "Orange.distance.SpearmanRDistance", 
    124125 
    125126           "orngClustering.KMeans": "Orange.clustering.kmeans.Clustering", 
  • Orange/misc/environ.py

    r9691 r9725  
    277277def add_orange_directories_to_path(): 
    278278    """Add orange directory paths to sys.path.""" 
     279 
     280    return 
    279281    paths_to_add = [install_dir] 
    280282 
  • Orange/multilabel/multiknn.py

    r9671 r9724  
    6868    def _build_knn(self, instances): 
    6969        nnc = Orange.classification.knn.FindNearestConstructor() 
    70         nnc.distanceConstructor = Orange.core.ExamplesDistanceConstructor_Euclidean() 
     70        nnc.distanceConstructor = Orange.distance.Euclidean() 
    7171         
    7272        weight_id = Orange.data.new_meta_id() 
  • Orange/orng/orngClustering.py

    r9671 r9723  
    22# from Orange.cluster.hierarchical import *  
    33 
    4 from Orange.distance import \ 
    5      AlignmentList, \ 
     4from Orange.core import \ 
    65     DistanceMap, \ 
    76     DistanceMapConstructor, \ 
    8      ExampleDistConstructor, \ 
    9      ExampleDistBySorting, \ 
    10      ExampleDistVector, \ 
    117     ExamplesDistance, \ 
    128     ExamplesDistance_Normalized, \ 
    139     ExamplesDistanceConstructor 
    1410 
    15 from Orange.distance import Hamming as ExamplesDistance_Hamming, \ 
    16     DTW as ExamplesDistance_DTW, \ 
    17     Euclidean as ExamplesDistance_Euclidean, \ 
    18     Manhattan as ExamplesDistance_Manhattan, \ 
    19     Maximal as ExamplesDistance_Maximal, \ 
    20     Relief as ExamplesDistance_Relief, \ 
    21     DTWConstructor as ExamplesDistanceConstructor_DTW, \ 
    22     EuclideanConstructor as ExamplesDistanceConstructor_Euclidean, \ 
    23     HammingConstructor as ExamplesDistanceConstructor_Hamming, \ 
    24     ManhattanConstructor as ExamplesDistanceConstructor_Manhattan, \ 
    25     MaximalConstructor as ExamplesDistanceConstructor_Maximal, \ 
    26     ReliefConstructor as ExamplesDistanceConstructor_Relief, \ 
    27     PearsonRConstructor as ExamplesDistanceConstructor_PearsonR, \ 
    28     PearsonR as ExamplesDistance_PearsonR, \ 
    29     SpearmanRConstructor as ExamplesDistanceConstructor_SpearmanR, \ 
    30     SpearmanR as ExamplesDistance_SpearmanR 
    31  
     11from Orange.distance import HammingDistance as ExamplesDistance_Hamming, \ 
     12    DTWDistance as ExamplesDistance_DTW, \ 
     13    EuclideanDistance as ExamplesDistance_Euclidean, \ 
     14    ManhattanDistance as ExamplesDistance_Manhattan, \ 
     15    MaximalDistance as ExamplesDistance_Maximal, \ 
     16    ReliefDistance as ExamplesDistance_Relief, \ 
     17    DTW as ExamplesDistanceConstructor_DTW, \ 
     18    Euclidean as ExamplesDistanceConstructor_Euclidean, \ 
     19    Hamming as ExamplesDistanceConstructor_Hamming, \ 
     20    Manhattan as ExamplesDistanceConstructor_Manhattan, \ 
     21    Maximal as ExamplesDistanceConstructor_Maximal, \ 
     22    Relief as ExamplesDistanceConstructor_Relief, \ 
     23    PearsonR as ExamplesDistanceConstructor_PearsonR, \ 
     24    PearsonRDistance as ExamplesDistance_PearsonR, \ 
     25    SpearmanR as ExamplesDistanceConstructor_SpearmanR, \ 
     26    SpearmanRDistance as ExamplesDistance_SpearmanR 
    3227 
    3328from Orange.clustering.kmeans import Clustering as KMeans 
  • Orange/preprocess/outliers.py

    r9671 r9725  
    3636 
    3737import Orange 
    38 import statc 
     38from Orange import statc 
    3939 
    4040class OutlierDetection: 
  • Orange/projection/linear.py

    r9671 r9725  
    6464 
    6565import Orange 
    66 import orangeom 
     66from Orange import orangeom 
    6767import math 
    6868import random 
     
    7070 
    7171from numpy.linalg import inv, pinv, eig      # matrix inverse and eigenvectors 
    72 from orngScaleLinProjData import orngScaleLinProjData 
    73 import orngVisFuncts 
     72from Orange.preprocess.scaling import ScaleLinProjData 
     73from Orange.misc import visfuncts 
    7474from Orange.misc import deprecated_keywords 
    7575from Orange.misc import deprecated_members 
     
    161161    def __init__(self, graph = None): 
    162162        if not graph: 
    163             graph = orngScaleLinProjData() 
     163            graph = ScaleLinProjData() 
    164164        self.graph = graph 
    165165 
     
    905905        # compute the quality of attributes only once 
    906906        if self.s2n_mix_data == None: 
    907             ranked_attrs, ranked_attrs_by_class = orngVisFuncts.findAttributeGroupsForRadviz(self.graph.rawData, 
    908                                                                                              orngVisFuncts.S2NMeasureMix()) 
     907            ranked_attrs, ranked_attrs_by_class = visfuncts.findAttributeGroupsForRadviz(self.graph.rawData, 
     908                                                                                         visfuncts.S2NMeasureMix()) 
    909909            self.s2n_mix_data = (ranked_attrs, ranked_attrs_by_class) 
    910910            class_count = len(ranked_attrs_by_class) 
  • Orange/projection/mds.py

    r9671 r9725  
    102102 
    103103import Orange.core 
    104 import orangeom as orangemds 
     104from Orange import orangeom as orangemds 
    105105from Orange.misc import deprecated_keywords 
    106106from Orange.misc import deprecated_members 
  • Orange/regression/linear.py

    r9671 r9725  
    5757    from scipy import stats 
    5858except ImportError: 
    59     import statc as stats 
     59    import Orange.statc as stats 
    6060 
    6161from numpy import dot, sqrt 
  • Orange/testing/regression/results_modules/PCA1.py.txt

    r9689 r9705  
    1717       3.1416         0.7854         0.7854 
    1818       0.7317         0.1829         0.9683 
    19  
    20 Loadings: 
    21  
    22       PC1      PC2 
    23    0.5045  -0.3742   sepal length                   
    24   -0.2826  -0.9222   sepal width                    
    25    0.5833  -0.0340   petal length                   
    26    0.5705  -0.0912   petal width                    
    2719 
    2820PCA on attributes sepal.length, sepal.width, petal.length, petal.width: 
     
    4537       0.9212         0.2303         0.9580 
    4638 
    47 Loadings: 
    48  
    49       PC1      PC2 
    50    0.5224  -0.3723   sepal length                   
    51   -0.2634  -0.9256   sepal width                    
    52    0.5813  -0.0211   petal length                   
    53    0.5656  -0.0654   petal width                    
    54  
    5539PCA on every second row: 
    5640PCA SUMMARY 
     
    7256       0.6101         0.1525         0.9603 
    7357 
    74 Loadings: 
    75  
    76       PC1      PC2 
    77    0.4872  -0.3967   sepal length                   
    78   -0.3539  -0.9020   sepal width                    
    79    0.5726  -0.0682   petal length                   
    80    0.5564  -0.1562   petal width                    
    81  
  • Orange/testing/regression/results_modules/PCA2.py.txt

    r9689 r9705  
    2424       0.2953         0.0268         0.9729 
    2525 
    26 Loadings: 
    27  
    28       PC1      PC2      PC3      PC4      PC5      PC6      PC7      PC8      PC9 
    29   -0.0771  -0.1561  -0.1615   0.8173   0.4523  -0.0438  -0.2240  -0.0538   0.0696   RIVER                          
    30   -0.4456   0.1859  -0.1115   0.0504   0.0818  -0.0782  -0.0163   0.3069  -0.2226   ERECTED                        
    31    0.0298  -0.4559   0.3819  -0.3336   0.4765  -0.4461  -0.1777  -0.1357  -0.1557   PURPOSE                        
    32   -0.0050  -0.6646  -0.0369   0.1684  -0.1732   0.0815   0.5660   0.2566  -0.2862   LENGTH                         
    33   -0.3030   0.1622  -0.0351   0.1610  -0.3472  -0.7959   0.1765  -0.1212  -0.0319   LANES                          
    34   -0.3491   0.0516   0.4680   0.0655   0.0863   0.1361   0.3488   0.2083   0.4696   CLEAR-G                        
    35   -0.1702  -0.2391  -0.6333  -0.2876   0.1889  -0.0713   0.1987  -0.2174   0.5397   T-OR-D                         
    36   -0.4331   0.0740   0.2288  -0.1225   0.2685   0.1073  -0.0026   0.0788   0.0819   MATERIAL                       
    37   -0.2609  -0.4143  -0.0175  -0.0442  -0.4431   0.0227  -0.6348   0.3164   0.2252   SPAN                           
    38   -0.3757  -0.1540   0.1731   0.0928  -0.2454   0.2992  -0.0264  -0.7734  -0.1411   REL-L                          
    39   -0.3939   0.0670  -0.3321  -0.2267   0.1984   0.1662  -0.0407   0.0938  -0.4994   TYPE                           
    40  
  • Orange/testing/regression/results_modules/PCA3.py.txt

    r9689 r9705  
    1919       0.1474         0.0368         0.9948 
    2020       0.0206         0.0052         1.0000 
    21  
    22 Loadings: 
    23  
    24       PC1      PC2      PC3      PC4 
    25    0.5224  -0.3723  -0.7210   0.2620   sepal length                   
    26   -0.2634  -0.9256   0.2420  -0.1241   sepal width                    
    27    0.5813  -0.0211   0.1409  -0.8012   petal length                   
    28    0.5656  -0.0654   0.6338   0.5235   petal width                    
    2921 
    3022As above, only with generalized vectors: 
     
    4941       0.8708         0.2177         1.0000 
    5042 
    51 Loadings: 
    52  
    53       PC1      PC2      PC3      PC4 
    54   -0.1498   0.0095   0.2943   0.7731   sepal length                   
    55   -0.1482   0.3272  -0.1768  -0.0358   sepal width                    
    56    0.8511  -0.5748  -0.8063  -0.0153   petal length                   
    57    0.4808   0.7500   0.4817  -0.6331   petal width                    
    58  
  • Orange/testing/regression/results_modules/classification-rules2.py.txt

    r9689 r9711  
    77IF status=['crew'] AND sex=['female'] THEN survived=yes<3.000, 20.000> 
    88IF status=['second'] THEN survived=yes<13.000, 80.000> 
    9 IF status=['third'] AND sex=['male'] AND age=['adult'] THEN survived=no<387.000, 75.000> 
     9IF sex=['male'] AND status=['third'] AND age=['adult'] THEN survived=no<387.000, 75.000> 
    1010IF status=['crew'] THEN survived=no<670.000, 192.000> 
    1111IF age=['child'] AND sex=['male'] THEN survived=no<35.000, 13.000> 
  • Orange/testing/regression/results_modules/classification_rules1.py.txt

    r9689 r9711  
    77IF status=['crew'] AND sex=['female'] THEN survived=yes<3.000, 20.000> 
    88IF status=['second'] THEN survived=yes<13.000, 80.000> 
    9 IF status=['third'] AND sex=['male'] AND age=['adult'] THEN survived=no<387.000, 75.000> 
     9IF sex=['male'] AND status=['third'] AND age=['adult'] THEN survived=no<387.000, 75.000> 
    1010IF status=['crew'] THEN survived=no<670.000, 192.000> 
    1111IF age=['child'] AND sex=['male'] THEN survived=no<35.000, 13.000> 
     
    1919IF status=['crew'] AND sex=['male'] THEN survived=no<670.000, 192.000> 
    2020IF status=['second'] THEN survived=yes<13.000, 104.000> 
    21 IF sex=['male'] THEN survived=no<153.000, 75.000> 
     21IF status=['third'] AND sex=['male'] THEN survived=no<35.000, 13.000> 
     22IF status=['first'] AND age=['adult'] THEN survived=no<118.000, 57.000> 
    2223IF status=['crew'] THEN survived=yes<3.000, 20.000> 
    23 IF age=['child'] THEN survived=no<17.000, 14.000> 
    24 IF TRUE THEN survived=no<89.000, 76.000> 
     24IF sex=['female'] THEN survived=no<106.000, 90.000> 
     25IF TRUE THEN survived=yes<0.000, 5.000> 
    2526**** 
    2627IF status=['second'] AND sex=['male'] AND age=['adult'] THEN survived=no<154.000, 14.000> 
  • Orange/testing/regression/results_modules/ensemble2.py.txt

    r9689 r9712  
    11Learner  CA     Brier  AUC 
    2 tree     0.594  0.812  0.584 
    3 forest   0.716  0.403  0.753 
     2tree     0.588  0.823  0.578 
     3forest   0.704  0.406  0.751 
  • Orange/testing/regression/results_modules/ensemble4.py.txt

    r9689 r9713  
    22 
    33different random seed 
    4 first: 2.32, second: 0.76 
     4first: 2.61, second: 0.72 
    55 
    66All importances: 
    7    sepal length:   2.32 
    8     sepal width:   0.76 
    9    petal length:  32.67 
    10     petal width:  23.30 
     7   sepal length:   2.61 
     8    sepal width:   0.72 
     9   petal length:  32.66 
     10    petal width:  23.73 
  • Orange/testing/regression/results_modules/fss7.py.txt

    r9689 r9714  
    11 
    22Learner         Accuracy  #Atts 
    3 disc bayes      0.854     14.40 
    4 bayes & fss     0.854      4.00 
     3disc bayes      0.858     15.00 
     4bayes & fss     0.854      4.10 
    55 
    66Attribute usage (in how many folds attribute was used?): 
     710 x A10 
     8 2 x A12 
     9 1 x A5 
     10 1 x A4 
     11 8 x A7 
     12 9 x A6 
    71310 x A9 
    8 10 x A6 
    9  9 x A10 
    10 10 x A7 
    11  1 x A12 
  • Orange/testing/regression/results_modules/hclust-colored-dendrogram.py.txt

    r9689 r9715  
    11[[5.1, 3.5, 1.4, 0.2, 'Iris-setosa'], [4.9, 3.0, 1.4, 0.2, 'Iris-setosa'], [4.7, 3.2, 1.3, 0.2, 'Iris-setosa'], [4.6, 3.1, 1.5, 0.2, 'Iris-setosa'], [5.0, 3.6, 1.4, 0.2, 'Iris-setosa'], [5.4, 3.9, 1.7, 0.4, 'Iris-setosa'], [4.6, 3.4, 1.4, 0.3, 'Iris-setosa'], [5.0, 3.4, 1.5, 0.2, 'Iris-setosa'], [4.4, 2.9, 1.4, 0.2, 'Iris-setosa'], [4.9, 3.1, 1.5, 0.1, 'Iris-setosa'], [5.4, 3.7, 1.5, 0.2, 'Iris-setosa'], [4.8, 3.4, 1.6, 0.2, 'Iris-setosa'], [4.8, 3.0, 1.4, 0.1, 'Iris-setosa'], [4.3, 3.0, 1.1, 0.1, 'Iris-setosa'], [5.8, 4.0, 1.2, 0.2, 'Iris-setosa'], [5.7, 4.4, 1.5, 0.4, 'Iris-setosa'], [5.4, 3.9, 1.3, 0.4, 'Iris-setosa'], [5.1, 3.5, 1.4, 0.3, 'Iris-setosa'], [5.7, 3.8, 1.7, 0.3, 'Iris-setosa'], [5.1, 3.8, 1.5, 0.3, 'Iris-setosa'], [5.4, 3.4, 1.7, 0.2, 'Iris-setosa'], [5.1, 3.7, 1.5, 0.4, 'Iris-setosa'], [4.6, 3.6, 1.0, 0.2, 'Iris-setosa'], [5.1, 3.3, 1.7, 0.5, 'Iris-setosa'], [4.8, 3.4, 1.9, 0.2, 'Iris-setosa'], [5.0, 3.0, 1.6, 0.2, 'Iris-setosa'], [5.0, 3.4, 1.6, 0.4, 'Iris-setosa'], [5.2, 3.5, 1.5, 0.2, 'Iris-setosa'], [5.2, 3.4, 1.4, 0.2, 'Iris-setosa'], [4.7, 3.2, 1.6, 0.2, 'Iris-setosa'], [4.8, 3.1, 1.6, 0.2, 'Iris-setosa'], [5.4, 3.4, 1.5, 0.4, 'Iris-setosa'], [5.2, 4.1, 1.5, 0.1, 'Iris-setosa'], [5.5, 4.2, 1.4, 0.2, 'Iris-setosa'], [4.9, 3.1, 1.5, 0.1, 'Iris-setosa'], [5.0, 3.2, 1.2, 0.2, 'Iris-setosa'], [5.5, 3.5, 1.3, 0.2, 'Iris-setosa'], [4.9, 3.1, 1.5, 0.1, 'Iris-setosa'], [4.4, 3.0, 1.3, 0.2, 'Iris-setosa'], [5.1, 3.4, 1.5, 0.2, 'Iris-setosa'], [5.0, 3.5, 1.3, 0.3, 'Iris-setosa'], [4.5, 2.3, 1.3, 0.3, 'Iris-setosa'], [4.4, 3.2, 1.3, 0.2, 'Iris-setosa'], [5.0, 3.5, 1.6, 0.6, 'Iris-setosa'], [5.1, 3.8, 1.9, 0.4, 'Iris-setosa'], [4.8, 3.0, 1.4, 0.3, 'Iris-setosa'], [5.1, 3.8, 1.6, 0.2, 'Iris-setosa'], [4.6, 3.2, 1.4, 0.2, 'Iris-setosa'], [5.3, 3.7, 1.5, 0.2, 'Iris-setosa'], [5.0, 3.3, 1.4, 0.2, 'Iris-setosa'], [7.0, 3.2, 4.7, 1.4, 'Iris-versicolor'], [6.4, 3.2, 4.5, 1.5, 'Iris-versicolor'], [6.9, 3.1, 4.9, 1.5, 'Iris-versicolor'], [5.5, 2.3, 4.0, 1.3, 'Iris-versicolor'], [6.5, 2.8, 4.6, 1.5, 'Iris-versicolor'], [5.7, 2.8, 4.5, 1.3, 'Iris-versicolor'], [6.3, 3.3, 4.7, 1.6, 'Iris-versicolor'], [4.9, 2.4, 3.3, 1.0, 'Iris-versicolor'], [6.6, 2.9, 4.6, 1.3, 'Iris-versicolor'], [5.2, 2.7, 3.9, 1.4, 'Iris-versicolor'], [5.0, 2.0, 3.5, 1.0, 'Iris-versicolor'], [5.9, 3.0, 4.2, 1.5, 'Iris-versicolor'], [6.0, 2.2, 4.0, 1.0, 'Iris-versicolor'], [6.1, 2.9, 4.7, 1.4, 'Iris-versicolor'], [5.6, 2.9, 3.6, 1.3, 'Iris-versicolor'], [6.7, 3.1, 4.4, 1.4, 'Iris-versicolor'], [5.6, 3.0, 4.5, 1.5, 'Iris-versicolor'], [5.8, 2.7, 4.1, 1.0, 'Iris-versicolor'], [6.2, 2.2, 4.5, 1.5, 'Iris-versicolor'], [5.6, 2.5, 3.9, 1.1, 'Iris-versicolor'], [5.9, 3.2, 4.8, 1.8, 'Iris-versicolor'], [6.1, 2.8, 4.0, 1.3, 'Iris-versicolor'], [6.3, 2.5, 4.9, 1.5, 'Iris-versicolor'], [6.1, 2.8, 4.7, 1.2, 'Iris-versicolor'], [6.4, 2.9, 4.3, 1.3, 'Iris-versicolor'], [6.6, 3.0, 4.4, 1.4, 'Iris-versicolor'], [6.8, 2.8, 4.8, 1.4, 'Iris-versicolor'], [6.7, 3.0, 5.0, 1.7, 'Iris-versicolor'], [6.0, 2.9, 4.5, 1.5, 'Iris-versicolor'], [5.7, 2.6, 3.5, 1.0, 'Iris-versicolor'], [5.5, 2.4, 3.8, 1.1, 'Iris-versicolor'], [5.5, 2.4, 3.7, 1.0, 'Iris-versicolor'], [5.8, 2.7, 3.9, 1.2, 'Iris-versicolor'], [6.0, 2.7, 5.1, 1.6, 'Iris-versicolor'], [5.4, 3.0, 4.5, 1.5, 'Iris-versicolor'], [6.0, 3.4, 4.5, 1.6, 'Iris-versicolor'], [6.7, 3.1, 4.7, 1.5, 'Iris-versicolor'], [6.3, 2.3, 4.4, 1.3, 'Iris-versicolor'], [5.6, 3.0, 4.1, 1.3, 'Iris-versicolor'], [5.5, 2.5, 4.0, 1.3, 'Iris-versicolor'], [5.5, 2.6, 4.4, 1.2, 'Iris-versicolor'], [6.1, 3.0, 4.6, 1.4, 'Iris-versicolor'], [5.8, 2.6, 4.0, 1.2, 'Iris-versicolor'], [5.0, 2.3, 3.3, 1.0, 'Iris-versicolor'], [5.6, 2.7, 4.2, 1.3, 'Iris-versicolor'], [5.7, 3.0, 4.2, 1.2, 'Iris-versicolor'], [5.7, 2.9, 4.2, 1.3, 'Iris-versicolor'], [6.2, 2.9, 4.3, 1.3, 'Iris-versicolor'], [5.1, 2.5, 3.0, 1.1, 'Iris-versicolor'], [5.7, 2.8, 4.1, 1.3, 'Iris-versicolor'], [6.3, 3.3, 6.0, 2.5, 'Iris-virginica'], [5.8, 2.7, 5.1, 1.9, 'Iris-virginica'], [7.1, 3.0, 5.9, 2.1, 'Iris-virginica'], [6.3, 2.9, 5.6, 1.8, 'Iris-virginica'], [6.5, 3.0, 5.8, 2.2, 'Iris-virginica'], [7.6, 3.0, 6.6, 2.1, 'Iris-virginica'], [4.9, 2.5, 4.5, 1.7, 'Iris-virginica'], [7.3, 2.9, 6.3, 1.8, 'Iris-virginica'], [6.7, 2.5, 5.8, 1.8, 'Iris-virginica'], [7.2, 3.6, 6.1, 2.5, 'Iris-virginica'], [6.5, 3.2, 5.1, 2.0, 'Iris-virginica'], [6.4, 2.7, 5.3, 1.9, 'Iris-virginica'], [6.8, 3.0, 5.5, 2.1, 'Iris-virginica'], [5.7, 2.5, 5.0, 2.0, 'Iris-virginica'], [5.8, 2.8, 5.1, 2.4, 'Iris-virginica'], [6.4, 3.2, 5.3, 2.3, 'Iris-virginica'], [6.5, 3.0, 5.5, 1.8, 'Iris-virginica'], [7.7, 3.8, 6.7, 2.2, 'Iris-virginica'], [7.7, 2.6, 6.9, 2.3, 'Iris-virginica'], [6.0, 2.2, 5.0, 1.5, 'Iris-virginica'], [6.9, 3.2, 5.7, 2.3, 'Iris-virginica'], [5.6, 2.8, 4.9, 2.0, 'Iris-virginica'], [7.7, 2.8, 6.7, 2.0, 'Iris-virginica'], [6.3, 2.7, 4.9, 1.8, 'Iris-virginica'], [6.7, 3.3, 5.7, 2.1, 'Iris-virginica'], [7.2, 3.2, 6.0, 1.8, 'Iris-virginica'], [6.2, 2.8, 4.8, 1.8, 'Iris-virginica'], [6.1, 3.0, 4.9, 1.8, 'Iris-virginica'], [6.4, 2.8, 5.6, 2.1, 'Iris-virginica'], [7.2, 3.0, 5.8, 1.6, 'Iris-virginica'], [7.4, 2.8, 6.1, 1.9, 'Iris-virginica'], [7.9, 3.8, 6.4, 2.0, 'Iris-virginica'], [6.4, 2.8, 5.6, 2.2, 'Iris-virginica'], [6.3, 2.8, 5.1, 1.5, 'Iris-virginica'], [6.1, 2.6, 5.6, 1.4, 'Iris-virginica'], [7.7, 3.0, 6.1, 2.3, 'Iris-virginica'], [6.3, 3.4, 5.6, 2.4, 'Iris-virginica'], [6.4, 3.1, 5.5, 1.8, 'Iris-virginica'], [6.0, 3.0, 4.8, 1.8, 'Iris-virginica'], [6.9, 3.1, 5.4, 2.1, 'Iris-virginica'], [6.7, 3.1, 5.6, 2.4, 'Iris-virginica'], [6.9, 3.1, 5.1, 2.3, 'Iris-virginica'], [5.8, 2.7, 5.1, 1.9, 'Iris-virginica'], [6.8, 3.2, 5.9, 2.3, 'Iris-virginica'], [6.7, 3.3, 5.7, 2.5, 'Iris-virginica'], [6.7, 3.0, 5.2, 2.3, 'Iris-virginica'], [6.3, 2.5, 5.0, 1.9, 'Iris-virginica'], [6.5, 3.0, 5.2, 2.0, 'Iris-virginica'], [6.2, 3.4, 5.4, 2.3, 'Iris-virginica'], [5.9, 3.0, 5.1, 1.8, 'Iris-virginica']] 
    2  
  • Orange/testing/regression/results_modules/kmeans-cmp-init.py.txt

    r9689 r9716  
    11           Rnd Div  HC 
    2       iris  11   2   3 
     2      iris  11   2  10 
    33   housing  13   5   3 
    44   vehicle  10   3   2 
  • Orange/testing/regression/results_orange25/ensemble.py.linux2.2.7.crash.txt

    r9689 r9718  
    11Traceback (most recent call last): 
    2   File "/home/miha/work/orange/testing/regressionTests/xtest_one.py", line 97, in <module> 
     2  File "/home/miha/work/orange/Orange/testing/regression/xtest_one.py", line 97, in <module> 
    33    execfile(t__name) 
    44  File "ensemble.py", line 16, in <module> 
    55    results = Orange.evaluation.testing.cross_validation(learners, lymphography, folds=3) 
    6   File "/home/miha/work/orange/orange/Orange/misc/__init__.py", line 454, in wrap_call 
     6  File "/home/miha/work/orange/Orange/misc/__init__.py", line 511, in wrap_call 
    77    return func(*args, **kwargs) 
    8   File "/home/miha/work/orange/orange/Orange/evaluation/testing.py", line 228, in cross_validation 
     8  File "/home/miha/work/orange/Orange/evaluation/testing.py", line 227, in cross_validation 
    99    store_examples=store_examples) 
    10   File "/home/miha/work/orange/orange/Orange/misc/__init__.py", line 454, in wrap_call 
     10  File "/home/miha/work/orange/Orange/misc/__init__.py", line 511, in wrap_call 
    1111    return func(*args, **kwargs) 
    12   File "/home/miha/work/orange/orange/Orange/evaluation/testing.py", line 295, in test_with_indices 
     12  File "/home/miha/work/orange/Orange/evaluation/testing.py", line 294, in test_with_indices 
    1313    results, classifiers = self.one_fold_with_indices(learners, examples, fold, indices, preprocessors, weight) 
    14   File "/home/miha/work/orange/orange/Orange/evaluation/testing.py", line 326, in one_fold_with_indices 
     14  File "/home/miha/work/orange/Orange/evaluation/testing.py", line 325, in one_fold_with_indices 
    1515    results = self._test_on_data(classifiers, test_set, testset_ids) 
    16   File "/home/miha/work/orange/orange/Orange/evaluation/testing.py", line 669, in _test_on_data 
     16  File "/home/miha/work/orange/Orange/evaluation/testing.py", line 668, in _test_on_data 
    1717    result = classifier(ex2, Orange.core.GetBoth) 
    18   File "/home/miha/work/orange/orange/Orange/ensemble/boosting.py", line 136, in __call__ 
     18  File "/home/miha/work/orange/Orange/ensemble/boosting.py", line 136, in __call__ 
    1919    index = Orange.misc.selection.selectBestIndex(votes) 
    20   File "/home/miha/work/orange/orange/Orange/misc/__init__.py", line 526, in wrapped 
     20  File "/home/miha/work/orange/Orange/misc/__init__.py", line 583, in wrapped 
    2121    return func(*args, **kwargs) 
    22   File "/home/miha/work/orange/orange/Orange/misc/__init__.py", line 454, in wrap_call 
     22  File "/home/miha/work/orange/Orange/misc/__init__.py", line 511, in wrap_call 
    2323    return func(*args, **kwargs) 
    24   File "/home/miha/work/orange/orange/Orange/misc/selection.py", line 209, in select_best_index 
     24  File "/home/miha/work/orange/Orange/misc/selection.py", line 209, in select_best_index 
    2525    bs=BestOnTheFly(compare, seed, call_compare_on_1st) 
    26   File "/home/miha/work/orange/orange/Orange/misc/__init__.py", line 454, in wrap_call 
     26  File "/home/miha/work/orange/Orange/misc/__init__.py", line 511, in wrap_call 
    2727    return func(*args, **kwargs) 
    28   File "/home/miha/work/orange/orange/Orange/misc/selection.py", line 105, in __init__ 
     28  File "/home/miha/work/orange/Orange/misc/selection.py", line 105, in __init__ 
    2929    self.randomGenerator = random.Random(seed) 
    3030AttributeError: 'module' object has no attribute 'Random' 
  • Orange/testing/unit/tests/test_distance.py

    r9679 r9724  
    33from Orange.misc.testing import datasets_driven, test_on_data 
    44 
    5 from Orange.distance import instances 
     5from Orange.distance import * 
    66 
    77@datasets_driven 
    88class TestEuclideanDistance(testing.DistanceTestCase): 
    9     DISTANCE_CONSTRUCTOR = instances.EuclideanConstructor() 
     9    DISTANCE_CONSTRUCTOR = Euclidean() 
    1010 
    1111@datasets_driven     
    1212class TestMannhatanDistance(testing.DistanceTestCase): 
    13     DISTANCE_CONSTRUCTOR = instances.ManhattanConstructor() 
     13    DISTANCE_CONSTRUCTOR = Manhattan() 
    1414     
    1515@datasets_driven 
    1616class TestHammingDistance(testing.DistanceTestCase): 
    17     DISTANCE_CONSTRUCTOR = instances.HammingConstructor() 
     17    DISTANCE_CONSTRUCTOR = Hamming() 
    1818     
    1919@datasets_driven 
    2020class TestReliefDistance(testing.DistanceTestCase): 
    21     DISTANCE_CONSTRUCTOR = instances.ReliefConstructor() 
     21    DISTANCE_CONSTRUCTOR = Relief() 
    2222 
    2323@datasets_driven 
    2424class TestPearsonRDistance(testing.DistanceTestCase): 
    25     DISTANCE_CONSTRUCTOR = instances.PearsonRConstructor() 
     25    DISTANCE_CONSTRUCTOR = PearsonR() 
    2626 
    2727@datasets_driven 
    2828class TestSpearmanRDistance(testing.DistanceTestCase): 
    29     DISTANCE_CONSTRUCTOR = instances.SpearmanRConstructor() 
     29    DISTANCE_CONSTRUCTOR = SpearmanR() 
    3030     
    3131@datasets_driven 
    3232class TestPearsonRAbsoluteDistance(testing.DistanceTestCase): 
    33     DISTANCE_CONSTRUCTOR = instances.PearsonRAbsoluteConstructor() 
     33    DISTANCE_CONSTRUCTOR = PearsonRAbsolute() 
    3434     
    3535@datasets_driven 
    3636class TestSpearmanRAbsoluteDistance(testing.DistanceTestCase): 
    37     DISTANCE_CONSTRUCTOR = instances.SpearmanRAbsoluteConstructor() 
     37    DISTANCE_CONSTRUCTOR = SpearmanRAbsolute() 
    3838     
    3939@datasets_driven 
    4040class TestMahalanobisDistance(testing.DistanceTestCase): 
    41     DISTANCE_CONSTRUCTOR = instances.MahalanobisConstructor() 
     41    DISTANCE_CONSTRUCTOR = Mahalanobis() 
    4242     
    4343if __name__ == "__main__": 
  • Orange/testing/unit/tests/test_hclustering.py

    r9679 r9724  
    55                       
    66from Orange.clustering import hierarchical as hier      
    7 from Orange.distance.instances import * 
     7from Orange.distance import * 
    88                            
    99import Orange.misc.testing as testing 
     
    1717    @testing.test_on_data 
    1818    def test_example_clustering_on(self, data): 
    19         constructors = [EuclideanConstructor, ManhattanConstructor] 
     19        constructors = [Euclidean, Manhattan] 
    2020        for distance_constructor in constructors: 
    2121            clust = clustering(data, distance_constructor, HierarchicalClustering.Single) 
     
    3333    @testing.test_on_datasets(datasets=["iris"]) 
    3434    def test_pickling_on(self, data): 
    35         cluster = clustering(data, EuclideanConstructor, HierarchicalClustering.Single) 
     35        cluster = clustering(data, Euclidean, HierarchicalClustering.Single) 
    3636        s = pickle.dumps(cluster) 
    3737        cluster_clone = pickle.loads(s) 
     
    4444            self.assert_(val >= 0 and val <=100) 
    4545            self.assertIsInstance(val, float) 
    46         matrix = instance_distance_matrix(data, EuclideanConstructor(), progress_callback=p) 
     46        matrix = instance_distance_matrix(data, Euclidean(), progress_callback=p) 
    4747        root1 = HierarchicalClustering(matrix, progress_callback=p) 
    4848        root2 = hier.clone(root1) 
  • Orange/testing/unit/tests/test_kmeans.py

    r9679 r9724  
    33from Orange.clustering import kmeans 
    44from Orange.clustering.kmeans import Clustering 
    5 from Orange.distance.instances import * 
     5from Orange.distance import * 
    66 
    77@testing.datasets_driven 
     
    2323    @testing.test_on_data 
    2424    def test_init_functs(self, table): 
    25         distfunc = EuclideanConstructor(table) 
     25        distfunc = Euclidean(table) 
    2626        for k in [1, 5, 10]: 
    2727            self._test_init_func(table, k, distfunc) 
  • Orange/testing/unit/tests/test_knn.py

    r9679 r9724  
    44from Orange.misc.testing import datasets_driven, test_on_data 
    55from Orange.classification import knn 
    6 from Orange.distance.instances import EuclideanConstructor 
     6from Orange.distance import Euclidean 
    77 
    88 
     
    1111class TestKNNLearner(testing.LearnerTestCase): 
    1212    def setUp(self): 
    13         self.learner = knn.kNNLearner(distance_constructor=EuclideanConstructor()) 
     13        self.learner = knn.kNNLearner(distance_constructor=Euclidean()) 
    1414     
    1515    @testing.test_on_data 
    1616    def test_learner_on(self, dataset): 
    1717        testing.LearnerTestCase.test_learner_on(self, dataset) 
    18         instance = dataset.randomexample() 
     18        instance = dataset.random_instance() 
    1919        self.assertEqual(len(self.classifier.find_nearest(3, instance)), 3) 
    2020         
  • Orange/testing/unit/tests/test_mds.py

    r9679 r9724  
    44import unittest 
    55from Orange.projection import mds 
    6 from Orange.distance.instances import distance_matrix, EuclideanConstructor 
     6from Orange.distance import distance_matrix, Euclidean 
    77     
    88@datasets_driven 
  • docs/reference/rst/Orange.classification.rst

    r9666 r9708  
    5656              tuple with both 
    5757 
     58You can often program learners and classifiers as classes or functions 
     59written entirely in Python and independent from Orange, as shown in 
     60Orange for Beginners. Such classes can participate, for instance, in 
     61the common evaluation functions like those available in modules orngTest 
     62and orngStat. 
     63 
     64On the other hand, these classes can't be used as components for pure C++ 
     65classes. For instance, TreeLearner's attribute nodeLearner should contain 
     66a (wrapped) C++ object derived from Learner, such as MajorityLearner 
     67or BayesLearner, and Variables's getValueFrom can only store classes 
     68derived from Classifier, like for instance ClassifierFromVar. They cannot 
     69accommodate Python's classes or even functions. 
     70 
     71There's a workaround, though. You can subtype Orange classes Learner 
     72or Classifier as if the two classes were defined in Python, but later 
     73use your derived Python classes as if they were written in Orange's 
     74core. That is, you can define your class in a Python script like this: 
     75 
     76    class MyLearner(orange.Learner):  
     77        def __call__(self, examples, weightID = 0):  
     78            <do something smart here> 
     79 
     80Such a learner can then be used as any regular learner written in 
     81Orange. You can, for instance, construct a tree learner and use your 
     82learner to learn node classifier: 
     83 
     84    treeLearner = orange.TreeLearner() 
     85    treeLearner.nodeLearner = MyLearner() 
     86 
     87If your learner or classifier is simple enough, you even don't need 
     88to derive a class yourself. You can define the learner or classifier 
     89as an ordinary Python function and assign it to an attribute of Orange 
     90class that would expect a Learner or a Classifier. Wrapping into a class 
     91derived from Learner or Classifier is done by Orange. ::  
     92 
     93    def myLearner(examples, weightID = 0):  
     94        <do something less smart here> 
     95     
     96    treeLearner = orange.TreeLearner() 
     97    treeLearner.nodeLearner = myLearner 
     98 
     99Finally, if your learner is really simple (that is, trivial :-), you 
     100can even stuff it into a lambda function. :: 
     101 
     102    treeLearner = orange.TreeLearner() 
     103    treeLearner.nodeLearner = lambda examples, weightID = 0: <do something trivial> 
     104 
     105Detailed description of the mechanisms involved and example scripts are 
     106given in a separate documentation on subtyping Orange classes in Python. 
     107 
    58108Orange contains implementations of various classifiers that are described in 
    59109detail on separate pages. 
  • docs/reference/rst/Orange.distance.rst

    r9663 r9720  
     1.. py:currentmodule:: Orange.distance 
     2 
    13.. automodule:: Orange.distance 
    24 
     
    57########################################## 
    68 
    7 This page describes a bunch of classes for different metrics for measure 
    8 distances (dissimilarities) between instances. 
     9Distance measures typically have to be adjusted to the data. For instance, 
     10when the data set contains continuous features, the distances between 
     11continuous values should be normalized to ensure that all features have 
     12similar impats, e.g. by dividing the distance with the range. 
    913 
    10 Typical (although not all) measures of distance between instances require 
    11 some "learning" - adjusting the measure to the data. For instance, when 
    12 the dataset contains continuous features, the distances between continuous 
    13 values should be normalized, e.g. by dividing the distance with the range 
    14 of possible values or with some interquartile distance to ensure that all 
    15 features have, in principle, similar impacts. 
    16  
    17 Different measures of distance thus appear in pairs - a class that measures 
    18 the distance and a class that constructs it based on the data. The abstract 
    19 classes representing such a pair are `ExamplesDistance` and 
    20 `ExamplesDistanceConstructor`. 
     14Distance measures thus appear in pairs - a class that measures 
     15the distance (:obj:`Distance`) and a class that constructs it based on the 
     16data (:obj:`DistanceConstructor`). 
    2117 
    2218Since most measures work on normalized distances between corresponding 
    23 features, there is an abstract intermediate class 
    24 `ExamplesDistance_Normalized` that takes care of normalizing. 
    25 The remaining classes correspond to different ways of defining the distances, 
    26 such as Manhattan or Euclidean distance. 
     19features, an abstract class `DistanceNormalized` takes care of 
     20normalizing. 
    2721 
    28 Unknown values are treated correctly only by Euclidean and Relief distance. 
    29 For other measure of distance, a distance between unknown and known or between 
    30 two unknown values is always 0.5. 
     22Unknown values are treated correctly only by Euclidean and Relief 
     23distance.  For other measures, a distance between unknown and known or 
     24between two unknown values is always 0.5. 
    3125 
    32 .. class:: ExamplesDistance 
     26.. class:: Distance 
    3327 
    3428    .. method:: __call__(instance1, instance2) 
    3529 
    36         Returns a distance between the given instances as floating point number. 
     30        Return a distance between the given instances (as a floating point number). 
    3731 
    38 .. class:: ExamplesDistanceConstructor 
     32.. class:: DistanceConstructor 
    3933 
    4034    .. method:: __call__([instances, weightID][, distributions][, basic_var_stat]) 
    4135 
    42         Constructs an instance of ExamplesDistance. 
    43         Not all the data needs to be given. Most measures can be constructed 
    44         from basic_var_stat; if it is not given, they can help themselves 
    45         either by instances or distributions. 
    46         Some (e.g. ExamplesDistance_Hamming) even do not need any arguments. 
     36        Constructs an :obj:`Distance`.  Not all the data needs to be 
     37        given. Most measures can be constructed from basic_var_stat; 
     38        if it is not given, they can help themselves either by instances 
     39        or distributions. Some do not need any arguments. 
    4740 
    48 .. class:: ExamplesDistance_Normalized 
     41.. class:: DistanceNormalized 
    4942 
    5043    This abstract class provides a function which is given two instances 
     
    7265        (continuous features only) 
    7366 
    74     .. attribute:: domainVersion 
     67    .. attribute:: domain_version 
    7568 
    76         Stores a domain version for which the normalizers were computed. 
    77         The domain version is increased each time a domain description is 
    78         changed (i.e. features are added or removed); this is used for a quick 
    79         check that the user is not attempting to measure distances between 
     69        The domain version increases each time a domain description is 
     70        changed (i.e. features are added or removed); this checks  
     71        that the user is not attempting to measure distances between 
    8072        instances that do not correspond to normalizers. 
    81         Since domains are practicably immutable (especially from Python), 
    82         you don't need to care about this anyway. 
    8373 
    84     .. method:: attributeDistances(instance1, instance2) 
     74    .. method:: attribute_distances(instance1, instance2) 
    8575 
    86         Returns a list of floats representing distances between pairs of 
     76        Return a list of floats representing distances between pairs of 
    8777        feature values of the two instances. 
    88  
    8978 
    9079.. class:: HammingConstructor 
     
    9584    is not really appropriate for instances that contain continuous features. 
    9685 
    97  
    9886.. class:: MaximalConstructor 
    9987.. class:: Maximal 
     
    10189    The maximal between two instances is defined as the maximal distance 
    10290    between two feature values. If dist is the result of 
    103     ExamplesDistance_Normalized.attributeDistances, 
     91    DistanceNormalized.attribute_distances, 
    10492    then Maximal returns max(dist). 
    105  
    10693 
    10794.. class:: ManhattanConstructor 
  • docs/reference/rst/code/distances-test.py

    r9663 r9724  
    55 
    66# Euclidean distance constructor 
    7 d2Constr = Orange.distance.EuclideanConstructor() 
     7d2Constr = Orange.distance.Euclidean() 
    88d2 = d2Constr(iris) 
    99 
    1010# Constructs  
    11 dPears = Orange.distance.PearsonRConstructor(iris) 
     11dPears = Orange.distance.PearsonR(iris) 
    1212 
    1313#reference instance 
  • docs/reference/rst/code/knnExample2.py

    r9638 r9724  
    44knn = Orange.classification.knn.kNNLearner() 
    55knn.k = 10 
    6 knn.distance_constructor = Orange.core.ExamplesDistanceConstructor_Hamming() 
     6knn.distance_constructor = Orange.distance.Hamming() 
    77knn = knn(iris) 
    88for i in range(5): 
  • docs/reference/rst/code/knnInstanceDistance.py

    r9638 r9724  
    44 
    55nnc = Orange.classification.knn.FindNearestConstructor() 
    6 nnc.distanceConstructor = Orange.core.ExamplesDistanceConstructor_Euclidean() 
     6nnc.distanceConstructor = Orange.distance.Euclidean() 
    77 
    88did = Orange.data.new_meta_id() 
  • docs/reference/rst/code/knnlearner.py

    r9638 r9724  
    1515knn = Orange.classification.knn.kNNLearner(train, k=10) 
    1616for i in range(5): 
    17     instance = test.randomexample() 
     17    instance = test.random_instance() 
    1818    print instance.getclass(), knn(instance) 
    1919 
     
    2323knn = Orange.classification.knn.kNNLearner() 
    2424knn.k = 10 
    25 knn.distanceConstructor = Orange.core.ExamplesDistanceConstructor_Hamming() 
     25knn.distance_constructor = Orange.distance.Hamming() 
    2626knn = knn(train) 
    2727for i in range(5): 
    28     instance = test.randomexample() 
     28    instance = test.random_instance() 
    2929    print instance.getclass(), knn(instance) 
  • docs/reference/rst/code/mds-advanced.py

    r9372 r9724  
    1212 
    1313# Construct a distance matrix using Euclidean distance 
    14 dist = Orange.core.ExamplesDistanceConstructor_Euclidean(table) 
     14dist = Orange.distance.Euclidean(table) 
    1515matrix = Orange.core.SymMatrix(len(table)) 
    1616for i in range(len(table)): 
  • docs/reference/rst/code/mds-euclid-torgerson-3d.py

    r9663 r9724  
    1111 
    1212# Construct a distance matrix using Euclidean distance 
    13 dist = Orange.distance.EuclideanConstructor(table) 
     13dist = Orange.distance.Euclidean(table) 
    1414matrix = Orange.core.SymMatrix(len(table)) 
    1515matrix.setattr('items', table) 
  • docs/reference/rst/code/outlier2.py

    r9663 r9724  
    33data = Orange.data.Table("bridges") 
    44outlier_det = Orange.preprocess.outliers.OutlierDetection() 
    5 outlier_det.set_examples(data, Orange.distance.EuclideanConstructor(data)) 
     5outlier_det.set_examples(data, Orange.distance.Euclidean(data)) 
    66outlier_det.set_knn(3) 
    77z_values = outlier_det.z_values() 
  • docs/reference/rst/code/svm-custom-kernel.py

    r9663 r9724  
    33 
    44from Orange.classification.svm import SVMLearner, kernels 
    5 from Orange.distance import EuclideanConstructor 
    6 from Orange.distance import HammingConstructor 
     5from Orange.distance import Euclidean 
     6from Orange.distance import Hamming 
    77 
    88table = data.Table("iris.tab") 
    99l1 = SVMLearner() 
    10 l1.kernel_func = kernels.RBFKernelWrapper(EuclideanConstructor(table), gamma=0.5) 
     10l1.kernel_func = kernels.RBFKernelWrapper(Euclidean(table), gamma=0.5) 
    1111l1.kernel_type = SVMLearner.Custom 
    1212l1.probability = True 
     
    1515 
    1616l2 = SVMLearner() 
    17 l2.kernel_func = kernels.RBFKernelWrapper(HammingConstructor(table), gamma=0.5) 
     17l2.kernel_func = kernels.RBFKernelWrapper(Hamming(table), gamma=0.5) 
    1818l2.kernel_type = SVMLearner.Custom 
    1919l2.probability = True 
     
    2323l3 = SVMLearner() 
    2424l3.kernel_func = kernels.CompositeKernelWrapper( 
    25     kernels.RBFKernelWrapper(EuclideanConstructor(table), gamma=0.5), 
    26     kernels.RBFKernelWrapper(HammingConstructor(table), gamma=0.5), l=0.5) 
     25    kernels.RBFKernelWrapper(Euclidean(table), gamma=0.5), 
     26    kernels.RBFKernelWrapper(Hamming(table), gamma=0.5), l=0.5) 
    2727l3.kernel_type = SVMLearner.Custom 
    2828l3.probability = True 
  • docs/reference/rst/conf.py

    r9615 r9708  
    255255 
    256256# Example configuration for intersphinx: refer to the Python standard library. 
    257 intersphinx_mapping = {'http://docs.python.org/': None} 
     257intersphinx_mapping = {'http://docs.python.org/': None, '../tutorial': None} 
    258258 
    259259import types 
Note: See TracChangeset for help on using the changeset viewer.