Skip to content

Commit

Permalink
Updated Documentation
Browse files Browse the repository at this point in the history
  • Loading branch information
SekouD committed Jul 10, 2018
1 parent 9fc4595 commit 68a1fb3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ mlconjug
:alt: Windows Continuous Integration Status

.. image:: https://readthedocs.org/projects/mlconjug/badge/?version=latest
:target: https://mlconjug.readthedocs.io/en/latest/?badge=latest
:target: https://mlconjug.readthedocs.io/en/latest
:alt: Documentation Status

.. image:: https://pyup.io/repos/github/SekouD/mlconjug/shield.svg
Expand Down
11 changes: 8 additions & 3 deletions docs/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,21 @@ To use MLConjug in a project and train a new model::
# Feature reduction
feature_reductor = SelectFromModel(LinearSVC(penalty="l1", max_iter=12000, dual=False, verbose=0))

#Prediction Classifier
# Prediction Classifier
classifier = SGDClassifier(loss="log", penalty='elasticnet', l1_ratio=0.15, max_iter=4000, alpha=1e-5, random_state=42, verbose=0)

# Initialize Data Set
dataset = DataSet(Verbiste().verbs)
dataset.construct_dict_conjug()
dataset.split_data(proportion=0.9)

# Initialize Conjugator
model = mlconjug.Model(vectorizer, feature_reductor, classifier)
conjugator = mlconjug.Conjugator(lang, model)

#Training and prediction
conjugator.model.train(conjugator.data_set.train_input, conjugator.data_set.train_labels)
predicted = conjugator.model.predict(conjugator.data_set.test_input)
conjugator.model.train(data_set.train_input, data_set.train_labels)
predicted = conjugator.model.predict(data_set.test_input)

# Assess the performance of the model's predictions
score = len([a == b for a, b in zip(predicted, conjugator.data_set.templates_list) if a == b]) / len(predicted)
Expand Down

0 comments on commit 68a1fb3

Please sign in to comment.