# Changeset 9477:de11ce1a5f4b in orange

Ignore:
Timestamp:
08/12/11 19:45:26 (3 years ago)
Branch:
default
Convert:
697d0370778e2867f3bf04c007699c1f716f553b
Message:

Add some annotations for the methods

Location:
orange
Files:
8 edited

Unmodified
Removed
• ## orange/Orange/multilabel/br.py

 r9475 ######################################################################################### # Test the code, run from DOS prompt # assume the data file is in proper directory if __name__ == "__main__": data = Orange.data.Table("emotions.tab")
• ## orange/Orange/multilabel/brknn.py

 r9475 ######################################################################################### # Test the code, run from DOS prompt # assume the data file is in proper directory if __name__ == "__main__": data = Orange.data.Table("emotions.tab")
• ## orange/Orange/multilabel/label.py

 r9476 domain = data.domain newdomain =  [domain[i] for i, var in enumerate(data.domain.variables) if var.attributes.has_key('label')] if not var.attributes.has_key('label')] new_data = data.translate(newdomain) return new_data def get_label_bitstream(data,example): """ get the labels in terms of a string of 0 and 1 """ """ get the labels in a 0/1 string. For example, if the first char in the string is '1', then the example belongs to the first label""" if not isinstance(data, Orange.data.Table): raise TypeError('data must be of type \'Orange.data.Table\'')
• ## orange/Orange/multilabel/lp.py

 r9476 LabelPowerset Classification is another transformation method for multi-label classification. It consideres each different set of labels that exist in the multi-label data as a It considers each different set of labels that exist in the multi-label data as a single label. It so learns one single-label classifier :math:H:X \\rightarrow P(L), where :math:P(L) is the power set of L. ######################################################################################### # Test the code, run from DOS prompt # assume the data file is in proper directory if __name__ == "__main__": data = Orange.data.Table("emotions.tab")
• ## orange/Orange/multilabel/mlknn.py

 r9475 ML-kNN Classification is a kind of adaptation method for multi-label classification. It is an adaptation of the kNN lazy learning algorithm for multi-label data. In essence, ML-kNN uses the kNN algorithm independently for each label :math:'l': It finds the k nearest examples to the test instance and considers those that are labelled at least with :math:'l' as positive and the rest as negative. Actually this method follows the paradigm of Binary Relevance (BR). What mainly differentiates this method from BR is the use of prior probabilities. ML-kNN has also It is an adaptation of the kNN lazy learning algorithm for multi-label data. In essence, ML-kNN uses the kNN algorithm independently for each label :math:'l': It finds the k nearest examples to the test instance and considers those that are labelled at least with :math:'l' as positive and the rest as negative. Actually this method follows the paradigm of Binary Relevance (BR). What mainly differentiates this method from BR is the use of prior probabilities. ML-kNN has also the capability of producing a ranking of the labels as an output. For more information, see Zhang, M. and Zhou, Z. 2007. ML-KNN: A lazy learning approach to multi-label learning _. For more information, see Zhang, M. and Zhou, Z. 2007. ML-KNN: A lazy learning approach to multi-label learning _. Pattern Recogn. 40, 7 (Jul. 2007), 2038-2048. ######################################################################################### # Test the code, run from DOS prompt # assume the data file is in proper directory if __name__ == "__main__": data = Orange.data.Table("emotions.tab")
• ## orange/Orange/multilabel/mulan.py

 r9467 ############################################################################## # Test the code, run from DOS prompt # assume the data file is in proper directory if __name__=="__main__":
• ## orange/OrangeWidgets/Multilabel/OWLP.py

 r9476 self.classifier = self.learner(self.data) self.classifier.name = self.name for i in range(10): c,p = self.classifier(self.data[i],Orange.classification.Classifier.GetBoth) print c,p #for i in range(10): #    c,p = self.classifier(self.data[i],Orange.classification.Classifier.GetBoth) #    print c,p except Exception, (errValue): self.classifier = None
• ## orange/doc/Orange/rst/code/mlc-label-example.py

 r9460 #test getlabelIndices print "#test getlabelIndices:" for id in label.get_label_indices(data): print data.domain[id].name, print # print Sports Religion Science Politics #test remove_labels print "#test remove_labels:" data3 = label.remove_labels(data) for e in data3: print e #test removeIndices #['3', '1', '3'] #['4', '0', '4']
Note: See TracChangeset for help on using the changeset viewer.