Changeset 9946:96ed77f7d97f in orange


Ignore:
Timestamp:
02/07/12 19:59:36 (2 years ago)
Author:
markotoplak
Branch:
default
Message:

Updated examples (remove Orange.core).

Location:
docs/reference/rst/code
Files:
17 edited

Legend:

Unmodified
Added
Removed
  • docs/reference/rst/code/datatable2.py

    r9927 r9946  
    1212    data.append([i]) 
    1313 
    14 cv_indices = Orange.core.MakeRandomIndicesCV(data, 4) 
     14cv_indices = Orange.data.sample.SubsetIndicesCV(data, 4) 
    1515print "Indices: ", cv_indices, "\n" 
    1616 
  • docs/reference/rst/code/imputation-complex.py

    r9945 r9946  
    145145for i in original.domain: 
    146146    print "%s: %s -> %s" % (original.domain[i].name, original[i], imputed[i.name]), 
    147     if original.domain[i].varType == Orange.core.VarTypes.Continuous: 
     147    if original.domain[i].var_type == Orange.feature.Type.Continuous: 
    148148        print "(%s)" % imputed[i.name+"_def"] 
    149149    else: 
  • docs/reference/rst/code/knnExample1.py

    r9638 r9946  
    22iris = Orange.data.Table("iris") 
    33 
    4 rndind = Orange.core.MakeRandomIndices2(iris, p0=0.8) 
     4rndind = Orange.data.sample.SubsetIndices2(iris, p0=0.8) 
    55train = iris.select(rndind, 0) 
    66test = iris.select(rndind, 1) 
     
    88knn = Orange.classification.knn.kNNLearner(train, k=10) 
    99for i in range(5): 
    10     instance = test.randomexample() 
     10    instance = test.random_example() 
    1111    print instance.getclass(), knn(instance) 
  • docs/reference/rst/code/knnExample2.py

    r9823 r9946  
    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): 
    9     instance = iris.randomexample() 
     9    instance = iris.random_example() 
    1010    print instance.getclass(), knn(instance) 
  • docs/reference/rst/code/knnInstanceDistance.py

    r9936 r9946  
    44 
    55nnc = Orange.classification.knn.FindNearestConstructor() 
    6 nnc.distanceConstructor = Orange.core.ExamplesDistanceConstructor_Euclidean() 
     6nnc.distance_constructor = Orange.distance.Euclidean() 
    77 
    88did = Orange.feature.Descriptor.new_meta_id() 
  • docs/reference/rst/code/knnlearner.py

    r9823 r9946  
    99 
    1010print "Testing using euclidean distance" 
    11 rndind = Orange.core.MakeRandomIndices2(iris, p0=0.8) 
     11rndind = Orange.data.sample.SubsetIndices2(iris, p0=0.8) 
    1212train = iris.select(rndind, 0) 
    1313test = iris.select(rndind, 1) 
     
    1515knn = Orange.classification.knn.kNNLearner(train, k=10) 
    1616for i in range(5): 
    17     instance = test.randomexample() 
     17    instance = test.random_example() 
    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_example() 
    2929    print instance.getclass(), knn(instance) 
  • docs/reference/rst/code/mds-advanced.py

    r9891 r9946  
    1212 
    1313# Construct a distance matrix using Euclidean distance 
    14 dist = Orange.core.ExamplesDistanceConstructor_Euclidean(iris) 
     14dist = Orange.distance.Euclidean(iris) 
    1515matrix = Orange.misc.SymMatrix(len(iris)) 
    1616for i in range(len(iris)): 
  • docs/reference/rst/code/optimization-thresholding2.py

    r9823 r9946  
    22 
    33bupa = Orange.data.Table("bupa") 
    4 ri2 = Orange.core.MakeRandomIndices2(bupa, 0.7) 
     4ri2 = Orange.data.sample.SubsetIndices2(bupa, 0.7) 
    55train = bupa.select(ri2, 0) 
    66test = bupa.select(ri2, 1) 
  • docs/reference/rst/code/optimization-tuningm.py

    r9823 r9946  
    55tuner = Orange.optimization.TuneMParameters(object=learner, 
    66             parameters=[("minSubset", [2, 5, 10, 20]), 
    7                          ("measure", [Orange.core.MeasureAttribute_gainRatio(),  
    8                                       Orange.core.MeasureAttribute_gini()])], 
     7                         ("measure", [Orange.feature.scoring.GainRatio(),  
     8                                      Orange.feature.scoring.Gini()])], 
    99             evaluate = Orange.evaluation.scoring.AUC) 
    1010 
  • docs/reference/rst/code/randomindices2.py

    r9823 r9946  
    2222 
    2323print "\nIndices with random generator" 
    24 indices2.random_generator = Orange.core.RandomGenerator(42)     
     24indices2.random_generator = Orange.misc.Random(42)     
    2525for i in range(5): 
    2626    print indices2(lenses) 
  • docs/reference/rst/code/reliability-basic.py

    r9875 r9946  
    1919instance = housing[0] 
    2020 
    21 value, probability = restimator(instance, result_type=Orange.core.GetBoth) 
     21value, probability = restimator(instance, result_type=Orange.classification.Classifier.GetBoth) 
    2222 
    2323for estimate in probability.reliability_estimate: 
  • docs/reference/rst/code/reliability-long.py

    r9875 r9946  
    3737                                 estimate[0], estimate[1]) 
    3838 
    39 indices = Orange.core.MakeRandomIndices2(prostate, p0=0.7) 
     39indices = Orange.data.sample.SubsetIndices2(prostate, p0=0.7) 
    4040train = prostate.select(indices, 0) 
    4141test = prostate.select(indices, 1) 
  • docs/reference/rst/code/reliability_basic.py

    r9906 r9946  
    1313instance = housing[0] 
    1414 
    15 value, probability = restimator(instance, result_type=Orange.core.GetBoth) 
     15value, probability = restimator(instance, result_type=Orange.classification.Classifier.GetBoth) 
    1616 
    1717for estimate in probability.reliability_estimate: 
  • docs/reference/rst/code/selection-bayes.py

    r9878 r9946  
    3030        self.__dict__.update(kwds) 
    3131     
    32     def __call__(self, example, resultType = Orange.core.GetValue): 
     32    def __call__(self, example, resultType = Orange.classification.Classifier.GetValue): 
    3333        return self.classifier(example, resultType) 
    3434 
  • docs/reference/rst/code/testing-test.py

    r9894 r9946  
    2424print "\nproportionsTest that will give different results, \ 
    2525but the same each time the script is run" 
    26 myRandom = Orange.core.RandomGenerator() 
     26myRandom = Orange.misc.Random() 
    2727for i in range(3): 
    2828    res = Orange.evaluation.testing.proportion_test(learners, voting, 0.7, 
    29         randomGenerator=myRandom) 
     29        random_generator=myRandom) 
    3030    printResults(res) 
    3131# End 
     
    5959 
    6060print "\nLearning curve with pre-separated data" 
    61 indices = Orange.core.MakeRandomIndices2(voting, p0=0.7) 
     61indices = Orange.data.sample.SubsetIndices2(voting, p0=0.7) 
    6262train = voting.select(indices, 0) 
    6363test = voting.select(indices, 1) 
  • docs/reference/rst/code/unusedValues.py

    r9869 r9946  
    22data = Orange.data.Table("unusedValues") 
    33 
    4 new_variables = [Orange.core.RemoveUnusedValues(var, data) for var in data.domain.variables] 
     4new_variables = [Orange.preprocess.RemoveUnusedValues(var, data) for var in data.domain.variables] 
    55 
    66print 
  • docs/reference/rst/code/variable-get_value_from.py

    r9897 r9946  
    1919print Orange.feature.scoring.InfoGain(e2, monks) 
    2020 
    21 dist = Orange.core.Distribution(e2, monks) 
     21dist = Orange.statistics.distribution.Distribution(e2, monks) 
    2222print dist  
    2323 
    2424# Split the data into training and testing set 
    25 indices = Orange.core.MakeRandomIndices2(monks, p0=0.7) 
     25indices = Orange.data.sample.SubsetIndices2(monks, p0=0.7) 
    2626train_data = monks.select(indices, 0) 
    2727test_data = monks.select(indices, 1) 
     
    3232 
    3333# Construct a tree and classify unmodified instances 
    34 tree = Orange.core.TreeLearner(new_train) 
     34tree = Orange.classification.tree.TreeLearner(new_train) 
    3535for ex in test_data[:10]: 
    3636    print ex.getclass(), tree(ex) 
Note: See TracChangeset for help on using the changeset viewer.