Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(4)  |  Call(3)  |  Derive(0)  |  Import(1)

src/m/o/mozsci-HEAD/test/test_map_train.py   mozsci(Download)
 
import unittest
import numpy as np
 
from mozsci.map_train import TrainModelCV, run_train_models
    def test_map_train_model(self):
        trainer = TrainModelCV([LogisticRegression, classification_error, '/tmp/logistic.json', (), {'lam':0.5}], X=self.X, y=self.y)
        errors = trainer.run()
 
        # load model
    def test_aggregate_error(self):
        # test an aggregate error function (that returns more than one value)
        trainer = TrainModelCV([LogisticRegression, TestTrainModelCV.agg_err, None, (), {'lam':0.5}],
                       X=self.X, y=self.y, Xtest=self.X[:50, :], ytest=self.y[:50])
        errors = trainer.run()
    def test_kfold_cv(self):
        trainer = TrainModelCV([LogisticRegression, classification_error, None, (), {'lam':0.5}],
                       X=self.X, y=self.y, folds=self.folds)
        errors = trainer.run()