コード例 #1
0
ファイル: lars.py プロジェクト: sreev/lale
class LarsImpl():
    def __init__(self,
                 fit_intercept=True,
                 verbose=False,
                 normalize=True,
                 precompute='auto',
                 n_nonzero_coefs=500,
                 eps=2.220446049250313e-16,
                 copy_X=True,
                 fit_path=True,
                 positive=False):
        self._hyperparams = {
            'fit_intercept': fit_intercept,
            'verbose': verbose,
            'normalize': normalize,
            'precompute': precompute,
            'n_nonzero_coefs': n_nonzero_coefs,
            'eps': eps,
            'copy_X': copy_X,
            'fit_path': fit_path,
            'positive': positive
        }
        self._wrapped_model = SKLModel(**self._hyperparams)

    def fit(self, X, y=None):
        if (y is not None):
            self._wrapped_model.fit(X, y)
        else:
            self._wrapped_model.fit(X)
        return self

    def predict(self, X):
        return self._wrapped_model.predict(X)
コード例 #2
0
    def connectWidgets(self):
        # LARS/         # LARSCV

        lars = Lars()
        self.fit_interceptCheckBox.setChecked(lars.fit_intercept)
        self.normalizeCheckBox.setChecked(lars.normalize)
        self.n_nonzero_coefsSpinBox.setValue(lars.n_nonzero_coefs)
コード例 #3
0
    def run(self):
        if self.cVCheckBox.isChecked():
            params = {
                'fit_intercept': self.fit_interceptCheckBox.isChecked(),
                'positive': self.positiveCheckBox.isChecked(),
                'max_iter': self.max_iterSpinBox.value(),
                'verbose': self.verboseCheckBox.isChecked(),
                'normalize': self.normalizeCheckBox.isChecked(),
                'precompute': self.precomputeComboBox.currentText(),
                'copy_X': self.copy_XCheckBox.isChecked(),
                'cv': self.cvSpinBox.value(),
                'max_n_alphas': self.max_n_alphasSpinBox.value(),
                'n_jobs': self.n_jobsSpinBox.value(),
                'CV': self.cVCheckBox.isChecked(),
            }
            return params, self.getChangedValues(params, LarsCV())

        else:
            params = {
                'fit_intercept': self.fit_interceptCheckBox.isChecked(),
                'verbose': self.verboseCheckBox.isChecked(),
                'normalize': self.normalizeCheckBox.isChecked(),
                'precompute': {
                    'True': True,
                    'False': False,
                    'auto': 'auto',
                    'array-like': 'array-like'
                }.get(self.precomputeComboBox.currentText()),
                'n_nonzero_coefs': self.n_nonzero_coefsSpinBox.value(),
                'copy_X': self.copy_XCheckBox.isChecked(),
                'fit_path': self.fit_pathCheckBox.isChecked(),
                'positive': self.positiveCheckBox.isChecked(),
                'CV': self.cVCheckBox.isChecked(),
            }
            return params, self.getChangedValues(params, Lars())
コード例 #4
0
ファイル: lars.py プロジェクト: yutarochan/lale
 def fit(self, X, y=None):
     self._sklearn_model = SKLModel(**self._hyperparams)
     if (y is not None):
         self._sklearn_model.fit(X, y)
     else:
         self._sklearn_model.fit(X)
     return self
コード例 #5
0
 def connectWidgets(self):
     lars = Lars()
     self.fit_intercept_listWidget.setCurrentItem(
         self.fit_intercept_listWidget.findItems(str(lars.fit_intercept),
                                                 QtCore.Qt.MatchExactly)[0])
     self.normalize_list.setCurrentItem(
         self.normalize_list.findItems(str(lars.normalize),
                                       QtCore.Qt.MatchExactly)[0])
     self.n_nonzero_coefsLineEdit.setText(str(lars.n_nonzero_coefs))
コード例 #6
0
 def run(self):
     params = {
         'fit_intercept': self.fit_interceptCheckBox.isChecked(),
         'verbose': False,
         'normalize': self.normalizeCheckBox.isChecked(),
         'precompute': 'auto',
         'n_nonzero_coefs': self.n_nonzero_coefsSpinBox.value(),
         'copy_X': True,
         'fit_path': True
     }
     return params, self.getChangedValues(params, Lars())
コード例 #7
0
    def connectWidgets(self):
        # LARS/         # LARSCV

        lars = Lars()
        larscv = LarsCV()
        self.fit_interceptCheckBox.setChecked(lars.fit_intercept)
        self.verboseCheckBox.setChecked(lars.verbose)
        self.normalizeCheckBox.setChecked(lars.normalize)
        self.setComboBox(self.precomputeComboBox, ['True', 'False', 'auto', 'array-like'])
        self.defaultComboItem(self.precomputeComboBox, lars.precompute)
        self.n_nonzero_coefsSpinBox.setValue(lars.n_nonzero_coefs)
        self.copy_XCheckBox.setChecked(lars.copy_X)
        self.fit_pathCheckBox.setChecked(lars.fit_path)
        self.positiveCheckBox.setChecked(lars.positive)
        self.max_iterSpinBox.setValue(larscv.max_iter)
        self.max_n_alphasSpinBox.setValue(larscv.max_n_alphas)
        self.n_jobsSpinBox.setValue(larscv.n_jobs)
コード例 #8
0
ファイル: lars.py プロジェクト: sreev/lale
 def __init__(self,
              fit_intercept=True,
              verbose=False,
              normalize=True,
              precompute='auto',
              n_nonzero_coefs=500,
              eps=2.220446049250313e-16,
              copy_X=True,
              fit_path=True,
              positive=False):
     self._hyperparams = {
         'fit_intercept': fit_intercept,
         'verbose': verbose,
         'normalize': normalize,
         'precompute': precompute,
         'n_nonzero_coefs': n_nonzero_coefs,
         'eps': eps,
         'copy_X': copy_X,
         'fit_path': fit_path,
         'positive': positive
     }
     self._wrapped_model = SKLModel(**self._hyperparams)
コード例 #9
0
			'HuberRegressor':HuberRegressor(),
			'Imputer':Imputer(),
			'IncrementalPCA':IncrementalPCA(),
			'IsolationForest':IsolationForest(),
			'Isomap':Isomap(),
			'KMeans':KMeans(),
			'KNeighborsClassifier':KNeighborsClassifier(),
			'KNeighborsRegressor':KNeighborsRegressor(),
			'KernelCenterer':KernelCenterer(),
			'KernelDensity':KernelDensity(),
			'KernelPCA':KernelPCA(),
			'KernelRidge':KernelRidge(),
			'LSHForest':LSHForest(),
			'LabelPropagation':LabelPropagation(),
			'LabelSpreading':LabelSpreading(),
			'Lars':Lars(),
			'LarsCV':LarsCV(),
			'Lasso':Lasso(),
			'LassoCV':LassoCV(),
			'LassoLars':LassoLars(),
			'LassoLarsCV':LassoLarsCV(),
			'LassoLarsIC':LassoLarsIC(),
			'LatentDirichletAllocation':LatentDirichletAllocation(),
			'LedoitWolf':LedoitWolf(),
			'LinearDiscriminantAnalysis':LinearDiscriminantAnalysis(),
			'LinearRegression':LinearRegression(),
			'LinearSVC':LinearSVC(),
			'LinearSVR':LinearSVR(),
			'LocallyLinearEmbedding':LocallyLinearEmbedding(),
			'LogisticRegression':LogisticRegression(),
			'LogisticRegressionCV':LogisticRegressionCV(),