Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-564: regression datasets #756

Merged
merged 5 commits into from
May 27, 2019
Merged

GH-564: regression datasets #756

merged 5 commits into from
May 27, 2019

Conversation

alanakbik
Copy link
Collaborator

This PR fixes a problem with the loss function in the (still beta) TextRegressor and adds 4 regression datasets.

You can now train a regression model like this:

# get the corpus
from flair.datasets import WASSA_SADNESS
corpus = WASSA_SADNESS()
print(corpus)

# choose some word embedding or stack of embeddings
embeddings = OneHotEmbeddings(corpus)

# choose some document embedding
document_embedding = DocumentPoolEmbeddings([embeddings], fine_tune_mode='none')

# init text regressor
classifier = TextRegressor(document_embedding)

# init model trainer
trainer = ModelTrainer(classifier, corpus)

trainer.train(
    f"resources/taggers/test-regression",
    mini_batch_size=4,
    max_epochs=20,
)

@alanakbik
Copy link
Collaborator Author

👍

@alanakbik alanakbik merged commit 723ecbe into master May 27, 2019
@alanakbik alanakbik deleted the GH-564-regression-datasets branch May 28, 2019 12:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant