Example #1
0
def plot_gp_pred(sigma, **fillargs):
#    pdb.set_trace()
    nugget = (sigma ** 2 / (0.1 + d.astype('float') ** 2))
    gp = GaussianProcess(corr='squared_exponential', nugget=nugget)
    gp.fit(np.atleast_2d(range(n)).T, np.atleast_2d(d).T)
    x = np.atleast_2d(np.linspace(0, n - 1)).T
    y_pred, MSE = gp.predict(x, eval_MSE=True)
    pylab.plot(x, y_pred)
    pylab.fill_between(x.T[0], y_pred + MSE, y_pred - MSE, **fillargs)
    def _calculate(self):
        from sklearn.gaussian_process.gaussian_process import GaussianProcess

        X = self.xs.reshape((self.xs.shape[0], 1))
        y = self.ys
        yserr = self.yserr
        nugget = (yserr / y) ** 2
        gp = GaussianProcess(
#                             nugget=nugget
                             )

        gp.fit(X, y)
        return gp
Example #3
0
    def function(self):
        params = {
            'reduce_dim': self.reductionMethodComboBox.currentText(),
            'n_components': self.numOfComponenetsSpinBox.value(),
            'regr': self.regrComboBox.currentText(),
            'corr': self.corrComboBox.currentText(),
            'storage_mode': self.storageModeComboBox.currentText(),
            'verbose': self.verboseCheckBox.isChecked(),
            'theta0': self.theta0DoubleSpinBox.value(),
            'normalize': self.normalizeCheckBox.isChecked(),
            'optimizer': self.optimizerComboBox.currentText(),
            'random_start': self.randomStartSpinBox.value(),
        }

        return params, self.getChangedValues(params, GaussianProcess())
Example #4
0
			'DictionaryLearning':DictionaryLearning(),
			'ElasticNet':ElasticNet(),
			'ElasticNetCV':ElasticNetCV(),
			'EmpiricalCovariance':EmpiricalCovariance(),
			'ExtraTreeClassifier':ExtraTreeClassifier(),
			'ExtraTreeRegressor':ExtraTreeRegressor(),
			'ExtraTreesClassifier':ExtraTreesClassifier(),
			'ExtraTreesRegressor':ExtraTreesRegressor(),
			'FactorAnalysis':FactorAnalysis(),
			'FastICA':FastICA(),
			'FeatureAgglomeration':FeatureAgglomeration(),
			'FunctionTransformer':FunctionTransformer(),
			'GMM':GMM(),
			'GaussianMixture':GaussianMixture(),
			'GaussianNB':GaussianNB(),
			'GaussianProcess':GaussianProcess(),
			'GaussianProcessClassifier':GaussianProcessClassifier(),
			'GaussianProcessRegressor':GaussianProcessRegressor(),
			'GaussianRandomProjection':GaussianRandomProjection(),
			'GenericUnivariateSelect':GenericUnivariateSelect(),
			'GradientBoostingClassifier':GradientBoostingClassifier(),
			'GradientBoostingRegressor':GradientBoostingRegressor(),
			'GraphLasso':GraphLasso(),
			'GraphLassoCV':GraphLassoCV(),
			'HuberRegressor':HuberRegressor(),
			'Imputer':Imputer(),
			'IncrementalPCA':IncrementalPCA(),
			'IsolationForest':IsolationForest(),
			'Isomap':Isomap(),
			'KMeans':KMeans(),
			'KNeighborsClassifier':KNeighborsClassifier(),
Example #5
0
    print("Sklearn RT")
    t0 = time.time()
    rt_sklearn = DecisionTreeRegressor(max_depth=7,
                                       max_features="sqrt",
                                       random_state=2016).fit(
                                           X_train, y_train)
    y_pred = rt_sklearn.predict(X_test)
    print("Time taken: %0.3f" % (time.time() - t0))
    score = mean_absolute_error(y_test, y_pred)
    print("Error: %0.3f" % score)
    print("")

    print("Skearn GP")
    gp = GaussianProcess(regr="constant",
                         corr='absolute_exponential',
                         beta0=None,
                         storage_mode='full',
                         verbose=False,
                         theta0=0.1,
                         thetaL=None,
                         thetaU=None,
                         optimizer='fmin_cobyla',
                         random_start=1,
                         normalize=True,
                         nugget=0.05,
                         random_state=2016).fit(X_train, y_train)
    y_pred = gp.predict(X_test)
    print("Time taken: %0.3f" % (time.time() - t0))
    score = mean_absolute_error(y_test, y_pred)
    print("Error: %0.3f" % score)
    print("")