Esempio n. 1
0
"""Config for a linear regression model evaluated on a diabetes dataset."""
from dbispipeline.evaluators import GridEvaluator
import dbispipeline.result_handlers as result_handlers
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler
from sklearn.svm import LinearSVR

from nlp4musa2020.dataloaders.alf200k import ALF200KLoader, genre_target_labels
from nlp4musa2020.dataloaders.vectorizer import tfidf
import nlp4musa2020.evaluators as evaluators
from nlp4musa2020.models.simplenn_genre import SimpleGenreNN

dataloader = ALF200KLoader('data/processed/dataset-lfm-genres.pickle',
                           load_feature_groups=[],
                           text_vectorizers=tfidf(),
                           target=genre_target_labels())

pipeline = Pipeline([
    ('scaler', StandardScaler()),
    ('model', SimpleGenreNN(epochs=50)),
])

evaluator = GridEvaluator(
    parameters={
        'model__dense_sizes': [
            (32, 32),
            (64, 64),
        ],
        'model__dropout_rate': [
            0.1,
        ],
from sklearn.preprocessing import StandardScaler

from nlp4musa2020.dataloaders.vectorizer import lda, tfidf
from nlp4musa2020.dataloaders.alf200k import ALF200KLoader, genre_target_labels
import nlp4musa2020.evaluators as evaluators
from sklearn.svm import LinearSVC
from sklearn.multioutput import MultiOutputClassifier

dataloader = ALF200KLoader(path='data/processed/dataset-lfm-genres.pickle',
                           load_feature_groups=[
                               'rhymes',
                               'statistical',
                               'statistical_time',
                               'explicitness',
                           ],
                           text_vectorizers=lda() + tfidf(),
                           target=genre_target_labels())

pipeline = Pipeline([
    ('scaler', StandardScaler()),
    ('model', MultiOutputClassifier(LinearSVC())),
])

evaluator = GridEvaluator(
    parameters={
        'model__estimator__C': [
            0.1,
            0.5,
            1.0,
            2.0,
            5.0,
Esempio n. 3
0
"""tf-idf plan for a random forest classifier model."""
from dbispipeline.evaluators import GridEvaluator
import dbispipeline.result_handlers as result_handlers
from sklearn.ensemble import RandomForestClassifier
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler

from nlp4musa2020.dataloaders import vectorizer
from nlp4musa2020.dataloaders.alf200k import ALF200KLoader
from nlp4musa2020.dataloaders.alf200k import genre_target_labels
import nlp4musa2020.evaluators as evaluators

dataloader = ALF200KLoader(
    path='data/processed/dataset-lfm-genres.pickle',
    load_feature_groups=[],
    text_vectorizers=vectorizer.tfidf(),
    target=genre_target_labels(),
)

pipeline = Pipeline([
    ('scaler', StandardScaler()),
    ('model', RandomForestClassifier(n_jobs=-1)),
])

evaluator = GridEvaluator(
    parameters={
        'model__n_estimators': [10, 100, 300],
    },
    grid_parameters=evaluators.grid_parameters_genres(),
)
from nlp4musa2020.dataloaders import vectorizer
from nlp4musa2020.dataloaders.alf200k import ALF200KLoader
from nlp4musa2020.dataloaders.alf200k import genre_target_labels
import nlp4musa2020.evaluators as evaluators

dataloader = ALF200KLoader(
    path='data/processed/dataset-lfm-genres.pickle',
    load_feature_groups=[
        'rhymes',
        'statistical',
        'statistical_time',
        'explicitness',
        'audio',
    ],
    text_vectorizers=vectorizer.lda() + vectorizer.tfidf(),
    target=genre_target_labels(),
)

pipeline = Pipeline([
    ('scaler', StandardScaler()),
    ('model', ExtraTreesClassifier(n_jobs=-1)),
])

evaluator = GridEvaluator(
    parameters={
        'model__n_estimators': [10, 100, 300],
    },
    grid_parameters=evaluators.grid_parameters_genres(),
)