-
-
Notifications
You must be signed in to change notification settings - Fork 991
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #938 from VesnaT/log_coef
OWLogisticRegression: Add coefficients to output signals
- Loading branch information
Showing
5 changed files
with
67 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
|
26 changes: 26 additions & 0 deletions
26
Orange/widgets/classify/tests/test_owlogisticregression.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
import unittest | ||
import bottlechest as bn | ||
from Orange.data import Table | ||
from Orange.classification import LogisticRegressionLearner | ||
from Orange.widgets.classify.owlogisticregression import create_coef_table | ||
|
||
|
||
class LogisticRegressionTest(unittest.TestCase): | ||
def test_coef_table_single(self): | ||
data = Table("titanic") | ||
learn = LogisticRegressionLearner() | ||
classifier = learn(data) | ||
coef_table = create_coef_table(classifier) | ||
self.assertEqual(1, len(bn.stats(coef_table.metas, None))) | ||
self.assertEqual(len(coef_table), len(classifier.domain.attributes) + 1) | ||
self.assertEqual(len(coef_table[0]), 1) | ||
|
||
def test_coef_table_multiple(self): | ||
data = Table("zoo") | ||
learn = LogisticRegressionLearner() | ||
classifier = learn(data) | ||
coef_table = create_coef_table(classifier) | ||
self.assertEqual(1, len(bn.stats(coef_table.metas, None))) | ||
self.assertEqual(len(coef_table), len(classifier.domain.attributes) + 1) | ||
self.assertEqual(len(coef_table[0]), | ||
len(classifier.domain.class_var.values)) |