Skip to content

Commit

Permalink
use Perceptron classifier which supports partial_fit
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastiankliem committed Dec 13, 2016
1 parent 507aa59 commit 51eec9e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion core/data_provider/twitter_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ def _get_api_status_updates(self, user_id):

def _get_dataset_status_updates(self, dataset_path):
status_updates = []
with open(dataset_path, 'r') as dataset_file:
with open(dataset_path, 'r', encoding='utf8') as dataset_file:
csv_reader = csv.DictReader(dataset_file)
for row in csv_reader:
status_updates.append(StatusUpdate.from_dict(row))
Expand Down
6 changes: 3 additions & 3 deletions core/training/decision_tree.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
from sklearn import tree
from sklearn import linear_model


def train_classifier(samples, labels):
classifier = tree.DecisionTreeClassifier()
classifier = classifier.fit(samples, labels)
classifier = linear_model.Perceptron()
classifier = classifier.partial_fit(samples, labels, classes=labels)

return classifier

0 comments on commit 51eec9e

Please sign in to comment.