From 87db631598a87003014513560bcc68161a7ca216 Mon Sep 17 00:00:00 2001 From: Jason Rudy Date: Thu, 13 Jun 2013 10:15:04 -0700 Subject: [PATCH 01/19] Made changes to pipeline to allow more general parameter passing --- .gitignore | 2 ++ sklearn/pipeline.py | 63 ++++++++++++++++++++++++++++----------------- 2 files changed, 41 insertions(+), 24 deletions(-) diff --git a/.gitignore b/.gitignore index c255dfe6fdf01..fead6bde33ce0 100644 --- a/.gitignore +++ b/.gitignore @@ -44,3 +44,5 @@ benchmarks/bench_covertype_data/ *.prefs .pydevproject + +.project diff --git a/sklearn/pipeline.py b/sklearn/pipeline.py index c01de183bff38..6d142f70c6e91 100644 --- a/sklearn/pipeline.py +++ b/sklearn/pipeline.py @@ -108,12 +108,20 @@ def get_params(self, deep=True): return out # Estimator interface - - def _pre_transform(self, X, y=None, **fit_params): - fit_params_steps = dict((step, {}) for step, _ in self.steps) - for pname, pval in six.iteritems(fit_params): + + def _extract_params(self, **params): + params_steps = dict((step, {}) for step, _ in self.steps) + for pname, pval in six.iteritems(params): step, param = pname.split('__', 1) - fit_params_steps[step][param] = pval + params_steps[step][param] = pval + return params_steps + + def _pre_transform(self, X, y=None, **fit_params): +# fit_params_steps = dict((step, {}) for step, _ in self.steps) +# for pname, pval in six.iteritems(fit_params): +# step, param = pname.split('__', 1) +# fit_params_steps[step][param] = pval + fit_params_steps = self._extract_params(**fit_params) Xt = X for name, transform in self.steps[:-1]: if hasattr(transform, "fit_transform"): @@ -141,64 +149,71 @@ def fit_transform(self, X, y=None, **fit_params): else: return self.steps[-1][-1].fit(Xt, y, **fit_params).transform(Xt) - def predict(self, X): + def predict(self, X, **params): """Applies transforms to the data, and the predict method of the final estimator. Valid only if the final estimator implements predict.""" + params = self._extract_params(**params) Xt = X for name, transform in self.steps[:-1]: - Xt = transform.transform(Xt) - return self.steps[-1][-1].predict(Xt) + Xt = transform.transform(Xt, **params[name]) + return self.steps[-1][-1].predict(Xt, **params[self.steps[-1][0]]) - def predict_proba(self, X): + def predict_proba(self, X, **params): """Applies transforms to the data, and the predict_proba method of the final estimator. Valid only if the final estimator implements predict_proba.""" + params = self._extract_params(**params) Xt = X for name, transform in self.steps[:-1]: - Xt = transform.transform(Xt) - return self.steps[-1][-1].predict_proba(Xt) + Xt = transform.transform(Xt, **params[name]) + return self.steps[-1][-1].predict_proba(Xt, **params[self.steps[-1][0]]) - def decision_function(self, X): + def decision_function(self, X, **params): """Applies transforms to the data, and the decision_function method of the final estimator. Valid only if the final estimator implements decision_function.""" + params = self._extract_params(**params) Xt = X for name, transform in self.steps[:-1]: - Xt = transform.transform(Xt) - return self.steps[-1][-1].decision_function(Xt) + Xt = transform.transform(Xt, **params[name]) + return self.steps[-1][-1].decision_function(Xt, **params[self.steps[-1][0]]) - def predict_log_proba(self, X): + def predict_log_proba(self, X, **params): + params = self._extract_params(**params) Xt = X for name, transform in self.steps[:-1]: - Xt = transform.transform(Xt) - return self.steps[-1][-1].predict_log_proba(Xt) + Xt = transform.transform(Xt, **params[name]) + return self.steps[-1][-1].predict_log_proba(Xt, **params[self.steps[-1][0]]) - def transform(self, X): + def transform(self, X, **params): """Applies transforms to the data, and the transform method of the final estimator. Valid only if the final estimator implements transform.""" + params = self._extract_params(**params) Xt = X for name, transform in self.steps: - Xt = transform.transform(Xt) + Xt = transform.transform(Xt, **params[name]) return Xt - def inverse_transform(self, X): + def inverse_transform(self, X, **params): + params = self._extract_params(**params) if X.ndim == 1: X = X[None, :] Xt = X for name, step in self.steps[::-1]: - Xt = step.inverse_transform(Xt) + Xt = step.inverse_transform(Xt, **params[name]) return Xt - def score(self, X, y=None): + def score(self, X, y=None, **params): """Applies transforms to the data, and the score method of the final estimator. Valid only if the final estimator implements score.""" + params = self._extract_params(**params) Xt = X for name, transform in self.steps[:-1]: - Xt = transform.transform(Xt) - return self.steps[-1][-1].score(Xt, y) + Xt = transform.transform(Xt, **params[name]) + return self.steps[-1][-1].score(Xt, y, **params[self.steps[-1][0]]) @property def _pairwise(self): From c5b716a9fd4beb8b042cfcf9330d7e7334850738 Mon Sep 17 00:00:00 2001 From: Jason Rudy Date: Sun, 30 Jun 2013 16:01:36 -0700 Subject: [PATCH 02/19] Revert "Made changes to pipeline to allow more general parameter passing" This reverts commit 87db631598a87003014513560bcc68161a7ca216. --- .gitignore | 2 -- sklearn/pipeline.py | 63 +++++++++++++++++---------------------------- 2 files changed, 24 insertions(+), 41 deletions(-) diff --git a/.gitignore b/.gitignore index fead6bde33ce0..c255dfe6fdf01 100644 --- a/.gitignore +++ b/.gitignore @@ -44,5 +44,3 @@ benchmarks/bench_covertype_data/ *.prefs .pydevproject - -.project diff --git a/sklearn/pipeline.py b/sklearn/pipeline.py index 6d142f70c6e91..c01de183bff38 100644 --- a/sklearn/pipeline.py +++ b/sklearn/pipeline.py @@ -108,20 +108,12 @@ def get_params(self, deep=True): return out # Estimator interface - - def _extract_params(self, **params): - params_steps = dict((step, {}) for step, _ in self.steps) - for pname, pval in six.iteritems(params): - step, param = pname.split('__', 1) - params_steps[step][param] = pval - return params_steps - + def _pre_transform(self, X, y=None, **fit_params): -# fit_params_steps = dict((step, {}) for step, _ in self.steps) -# for pname, pval in six.iteritems(fit_params): -# step, param = pname.split('__', 1) -# fit_params_steps[step][param] = pval - fit_params_steps = self._extract_params(**fit_params) + fit_params_steps = dict((step, {}) for step, _ in self.steps) + for pname, pval in six.iteritems(fit_params): + step, param = pname.split('__', 1) + fit_params_steps[step][param] = pval Xt = X for name, transform in self.steps[:-1]: if hasattr(transform, "fit_transform"): @@ -149,71 +141,64 @@ def fit_transform(self, X, y=None, **fit_params): else: return self.steps[-1][-1].fit(Xt, y, **fit_params).transform(Xt) - def predict(self, X, **params): + def predict(self, X): """Applies transforms to the data, and the predict method of the final estimator. Valid only if the final estimator implements predict.""" - params = self._extract_params(**params) Xt = X for name, transform in self.steps[:-1]: - Xt = transform.transform(Xt, **params[name]) - return self.steps[-1][-1].predict(Xt, **params[self.steps[-1][0]]) + Xt = transform.transform(Xt) + return self.steps[-1][-1].predict(Xt) - def predict_proba(self, X, **params): + def predict_proba(self, X): """Applies transforms to the data, and the predict_proba method of the final estimator. Valid only if the final estimator implements predict_proba.""" - params = self._extract_params(**params) Xt = X for name, transform in self.steps[:-1]: - Xt = transform.transform(Xt, **params[name]) - return self.steps[-1][-1].predict_proba(Xt, **params[self.steps[-1][0]]) + Xt = transform.transform(Xt) + return self.steps[-1][-1].predict_proba(Xt) - def decision_function(self, X, **params): + def decision_function(self, X): """Applies transforms to the data, and the decision_function method of the final estimator. Valid only if the final estimator implements decision_function.""" - params = self._extract_params(**params) Xt = X for name, transform in self.steps[:-1]: - Xt = transform.transform(Xt, **params[name]) - return self.steps[-1][-1].decision_function(Xt, **params[self.steps[-1][0]]) + Xt = transform.transform(Xt) + return self.steps[-1][-1].decision_function(Xt) - def predict_log_proba(self, X, **params): - params = self._extract_params(**params) + def predict_log_proba(self, X): Xt = X for name, transform in self.steps[:-1]: - Xt = transform.transform(Xt, **params[name]) - return self.steps[-1][-1].predict_log_proba(Xt, **params[self.steps[-1][0]]) + Xt = transform.transform(Xt) + return self.steps[-1][-1].predict_log_proba(Xt) - def transform(self, X, **params): + def transform(self, X): """Applies transforms to the data, and the transform method of the final estimator. Valid only if the final estimator implements transform.""" - params = self._extract_params(**params) Xt = X for name, transform in self.steps: - Xt = transform.transform(Xt, **params[name]) + Xt = transform.transform(Xt) return Xt - def inverse_transform(self, X, **params): - params = self._extract_params(**params) + def inverse_transform(self, X): if X.ndim == 1: X = X[None, :] Xt = X for name, step in self.steps[::-1]: - Xt = step.inverse_transform(Xt, **params[name]) + Xt = step.inverse_transform(Xt) return Xt - def score(self, X, y=None, **params): + def score(self, X, y=None): """Applies transforms to the data, and the score method of the final estimator. Valid only if the final estimator implements score.""" - params = self._extract_params(**params) Xt = X for name, transform in self.steps[:-1]: - Xt = transform.transform(Xt, **params[name]) - return self.steps[-1][-1].score(Xt, y, **params[self.steps[-1][0]]) + Xt = transform.transform(Xt) + return self.steps[-1][-1].score(Xt, y) @property def _pairwise(self): From 883775b8d1e216844cf7efd3d66ff61d54684da3 Mon Sep 17 00:00:00 2001 From: Jason Rudy Date: Sun, 21 Jul 2013 20:44:28 -0700 Subject: [PATCH 03/19] Added earth. Not passing all tests yet. --- .gitignore | 3 + examples/earth/classifier_comp.py | 125 + examples/earth/pyearth_vs_earth.py | 146 + examples/earth/sine_wave.py | 27 + examples/earth/v_function.py | 27 + sklearn/earth/__init__.py | 8 + sklearn/earth/_basis.c | 21508 ++++++++++++++++++++++ sklearn/earth/_basis.pxd | 127 + sklearn/earth/_basis.pyx | 582 + sklearn/earth/_forward.c | 14004 ++++++++++++++ sklearn/earth/_forward.pxd | 80 + sklearn/earth/_forward.pyx | 577 + sklearn/earth/_forward.pyxdep | 3 + sklearn/earth/_pruning.c | 8905 +++++++++ sklearn/earth/_pruning.pxd | 23 + sklearn/earth/_pruning.pyx | 108 + sklearn/earth/_record.c | 13919 ++++++++++++++ sklearn/earth/_record.pxd | 67 + sklearn/earth/_record.pyx | 260 + sklearn/earth/_util.c | 8030 ++++++++ sklearn/earth/_util.pxd | 19 + sklearn/earth/_util.pyx | 78 + sklearn/earth/earth.py | 651 + sklearn/earth/setup.py | 27 + sklearn/earth/tests/__init__.py | 0 sklearn/earth/tests/earth_regress.txt | 51 + sklearn/earth/tests/forward_regress.txt | 27 + sklearn/earth/tests/test_basis.py | 117 + sklearn/earth/tests/test_data.csv | 101 + sklearn/earth/tests/test_earth.py | 144 + sklearn/earth/tests/test_forward.py | 55 + sklearn/earth/tests/test_pruning.py | 13 + sklearn/earth/tests/test_record.py | 68 + sklearn/earth/tests/test_util.py | 13 + sklearn/earth/tests/testing_utils.py | 41 + sklearn/setup.py | 2 + 36 files changed, 69936 insertions(+) create mode 100644 examples/earth/classifier_comp.py create mode 100644 examples/earth/pyearth_vs_earth.py create mode 100644 examples/earth/sine_wave.py create mode 100644 examples/earth/v_function.py create mode 100644 sklearn/earth/__init__.py create mode 100644 sklearn/earth/_basis.c create mode 100644 sklearn/earth/_basis.pxd create mode 100644 sklearn/earth/_basis.pyx create mode 100644 sklearn/earth/_forward.c create mode 100644 sklearn/earth/_forward.pxd create mode 100644 sklearn/earth/_forward.pyx create mode 100644 sklearn/earth/_forward.pyxdep create mode 100644 sklearn/earth/_pruning.c create mode 100644 sklearn/earth/_pruning.pxd create mode 100644 sklearn/earth/_pruning.pyx create mode 100644 sklearn/earth/_record.c create mode 100644 sklearn/earth/_record.pxd create mode 100644 sklearn/earth/_record.pyx create mode 100644 sklearn/earth/_util.c create mode 100644 sklearn/earth/_util.pxd create mode 100644 sklearn/earth/_util.pyx create mode 100644 sklearn/earth/earth.py create mode 100644 sklearn/earth/setup.py create mode 100644 sklearn/earth/tests/__init__.py create mode 100644 sklearn/earth/tests/earth_regress.txt create mode 100644 sklearn/earth/tests/forward_regress.txt create mode 100644 sklearn/earth/tests/test_basis.py create mode 100644 sklearn/earth/tests/test_data.csv create mode 100644 sklearn/earth/tests/test_earth.py create mode 100644 sklearn/earth/tests/test_forward.py create mode 100644 sklearn/earth/tests/test_pruning.py create mode 100644 sklearn/earth/tests/test_record.py create mode 100644 sklearn/earth/tests/test_util.py create mode 100644 sklearn/earth/tests/testing_utils.py diff --git a/.gitignore b/.gitignore index 3da3203624641..b919bdfe113cd 100644 --- a/.gitignore +++ b/.gitignore @@ -46,3 +46,6 @@ benchmarks/bench_covertype_data/ *.prefs .pydevproject + +build/* +.project diff --git a/examples/earth/classifier_comp.py b/examples/earth/classifier_comp.py new file mode 100644 index 0000000000000..3a2701e3c80f4 --- /dev/null +++ b/examples/earth/classifier_comp.py @@ -0,0 +1,125 @@ +''' +This script recreates the scikit-learn classifier comparison example found at http://scikit-learn.org/dev/auto_examples/plot_classifier_comparison.html. +It has been modified to include an Earth based classifier. +''' + +# Code source: Gael Varoqueux +# Andreas Mueller +# Modified for Documentation merge by Jaques Grobler +# License: BSD 3 clause +# Modified to include pyearth by Jason Rudy + +import numpy as np +import pylab as pl +from matplotlib.colors import ListedColormap +from sklearn.cross_validation import train_test_split +from sklearn.preprocessing import StandardScaler +from sklearn.datasets import make_moons, make_circles, make_classification +from sklearn.neighbors import KNeighborsClassifier +from sklearn.svm import SVC +from sklearn.tree import DecisionTreeClassifier +from sklearn.ensemble import RandomForestClassifier +from sklearn.naive_bayes import GaussianNB +from sklearn.lda import LDA +from sklearn.qda import QDA + +h = .02 # step size in the mesh + +from sklearn.earth import Earth +from sklearn.linear_model.logistic import LogisticRegression +from sklearn.metrics import accuracy_score +from sklearn.pipeline import Pipeline + +np.random.seed(1) + +#Combine Earth with LogisticRegression in a pipeline to do classification +earth_classifier = Pipeline([('earth',Earth(max_degree=3,penalty=1.5)), + ('logistic',LogisticRegression())]) + +names = ["Nearest Neighbors", "Linear SVM", "RBF SVM", "Decision Tree", + "Random Forest", "Naive Bayes", "LDA", "QDA", "Earth"] +classifiers = [ + KNeighborsClassifier(3), + SVC(kernel="linear", C=0.025), + SVC(gamma=2, C=1), + DecisionTreeClassifier(max_depth=5), + RandomForestClassifier(max_depth=5, n_estimators=10, max_features=1), + GaussianNB(), + LDA(), + QDA(), + earth_classifier] + +X, y = make_classification(n_features=2, n_redundant=0, n_informative=2, + random_state=1, n_clusters_per_class=1) +rng = np.random.RandomState(2) +X += 2 * rng.uniform(size=X.shape) +linearly_separable = (X, y) + +datasets = [make_moons(noise=0.3, random_state=0), + make_circles(noise=0.2, factor=0.5, random_state=1), + linearly_separable + ] + +figure = pl.figure(figsize=(27, 9)) +i = 1 +# iterate over datasets +for ds in datasets: + # preprocess dataset, split into training and test part + X, y = ds + X = StandardScaler().fit_transform(X) + X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=.4) + + x_min, x_max = X[:, 0].min() - .5, X[:, 0].max() + .5 + y_min, y_max = X[:, 1].min() - .5, X[:, 1].max() + .5 + xx, yy = np.meshgrid(np.arange(x_min, x_max, h), + np.arange(y_min, y_max, h)) + + # just plot the dataset first + cm = pl.cm.RdBu + cm_bright = ListedColormap(['#FF0000', '#0000FF']) + ax = pl.subplot(len(datasets), len(classifiers) + 1, i) + # Plot the training points + ax.scatter(X_train[:, 0], X_train[:, 1], c=y_train, cmap=cm_bright) + # and testing points + ax.scatter(X_test[:, 0], X_test[:, 1], c=y_test, cmap=cm_bright, alpha=0.6) + ax.set_xlim(xx.min(), xx.max()) + ax.set_ylim(yy.min(), yy.max()) + ax.set_xticks(()) + ax.set_yticks(()) + i += 1 + + # iterate over classifiers + for name, clf in zip(names, classifiers): + ax = pl.subplot(len(datasets), len(classifiers) + 1, i) + clf.fit(X_train, y_train) + score = clf.score(X_test, y_test) + + # Plot the decision boundary. For that, we will assign a color to each + # point in the mesh [x_min, m_max]x[y_min, y_max]. + try: + Z = clf.predict_proba(np.c_[xx.ravel(), yy.ravel()])[:, 1] + except NotImplementedError: + Z = clf.decision_function(np.c_[xx.ravel(), yy.ravel()]) + + # Put the result into a color plot + Z = Z.reshape(xx.shape) + ax.contourf(xx, yy, Z, cmap=cm, alpha=.8) + + # Plot also the training points + ax.scatter(X_train[:, 0], X_train[:, 1], c=y_train, cmap=cm_bright) + # and testing points + ax.scatter(X_test[:, 0], X_test[:, 1], c=y_test, cmap=cm_bright, + alpha=0.6) + + ax.set_xlim(xx.min(), xx.max()) + ax.set_ylim(yy.min(), yy.max()) + ax.set_xticks(()) + ax.set_yticks(()) + ax.set_title(name) + ax.text(xx.max() - .3, yy.min() + .3, ('%.2f' % score).lstrip('0'), + size=15, horizontalalignment='right') + i += 1 + +figure.subplots_adjust(left=.02, right=.98) +pl.savefig('classifier_comp.pdf',transparent=True) +pl.show() \ No newline at end of file diff --git a/examples/earth/pyearth_vs_earth.py b/examples/earth/pyearth_vs_earth.py new file mode 100644 index 0000000000000..c1e2fb36fe247 --- /dev/null +++ b/examples/earth/pyearth_vs_earth.py @@ -0,0 +1,146 @@ +''' +This script randomly generates earth-style models, then randomly generates data from those models and +fits earth models to those data using both the python and R implementations. It records the sample size, +m, the number of input dimensions, n, the number of forward pass iterations, the runtime, and the r^2 +statistic for each fit and writes the result to a CSV file. +''' + +import numpy +import pandas.rpy.common as com +import rpy2.robjects as robjects +import time +import pandas +from sklearn.earth import Earth + +class DataGenerator(object): + def __init__(self): + pass + def generate(self, m): + pass + + +class NoiseGenerator(DataGenerator): + def __init__(self, n): + self.n = n + + def generate(self, m): + X = numpy.random.normal(size=(m,self.n)) + y = numpy.random.normal(size=m) + return X, y + +class LinearGenerator(DataGenerator): + def __init__(self, n): + self.n = n + + def generate(self, m): + X = numpy.random.normal(size=(m,self.n)) + beta = numpy.random.normal(size=self.n) + y = numpy.dot(X,beta) + numpy.random.normal(m) + return X, y + +class VFunctionGenerator(DataGenerator): + def __init__(self, n): + self.n = n + + def generate(self, m): + X = numpy.random.normal(size=(m,self.n)) + var = numpy.random.randint(self.n) + y = 10*abs(X[:,var]) + numpy.random.normal(m) + return X, y + +class UFunctionGenerator(DataGenerator): + def __init__(self, n): + self.n = n + + def generate(self, m): + X = numpy.random.normal(size=(m,self.n)) + var = numpy.random.randint(self.n) + y = 10*(X[:,var]**2) + numpy.random.normal(m) + return X, y + +class RandomComplexityGenerator(DataGenerator): + def __init__(self, n, max_terms=10, max_degree=2): + self.n = n + self.max_terms = max_terms + self.max_degree = max_degree + + + def generate(self, m): + X = numpy.random.normal(size=(m,self.n)) + num_terms = numpy.random.randint(2,self.max_terms) #Including the intercept + coef = 10*numpy.random.normal(size=num_terms) + B = numpy.ones(shape=(m,num_terms)) + B[:,0] += coef[0] + for i in range(1,num_terms): + degree = numpy.random.randint(1,self.max_degree) + for bf in range(degree): + knot = numpy.random.normal() + dir = 1 - 2*numpy.random.binomial(1,.5) + var = numpy.random.randint(0,self.n) + B[:,i] *= (dir*(X[:,var] - knot)) * (dir*(X[:,var] - knot) > 0) + y = numpy.dot(B,coef) + numpy.random.normal(size=m) + return X, y + + +def run_earth(X, y, **kwargs): + '''Run with the R package earth. Return prediction value, training time, and number of forward pass iterations.''' + r = robjects.r + m,n = X.shape + data = pandas.DataFrame(X) + data['y'] = y + r_data = com.convert_to_r_dataframe(data) + r('library(earth)') + r_func = ''' + run <- function(data, degree=1, fast.k=0, penalty=3.0){ + time = system.time(model <- earth(y~.,data=data,degree=degree,penalty=penalty))[3] + forward_terms = dim(summary(model)$prune.terms)[1] + y_pred = predict(model,data) + return(list(y_pred, time, forward_terms, model)) + } + ''' + r(r_func) + run = r('run') + r_list = run(**{'data':r_data,'degree':kwargs['max_degree'],'fast.k':0,'penalty':kwargs['penalty']}) + y_pred = numpy.array(r_list[0]).reshape(m) + time = r_list[1][0] + forward_terms = r_list[2][0] + return y_pred, time, (forward_terms - 1) / 2 + +def run_pyearth(X, y, **kwargs): + '''Run with pyearth. Return prediction value, training time, and number of forward pass iterations.''' + model = Earth(**kwargs) + t0 = time.time() + model.fit(X,y) + t1 = time.time() + y_pred = model.predict(X) + forward_iterations = len(model.forward_trace()) - 1 + return y_pred, t1-t0, forward_iterations + +def compare(generator_class, sample_sizes, dimensions, repetitions, **kwargs): + '''Return a data table that includes m, n, pyearth or earth, training time, and number of forward pass iterations.''' + header = ['m','n','pyearth','earth','time','forward_iterations','rsq'] + data = [] + for n in dimensions: + generator = generator_class(n=n) + for m in sample_sizes: + for rep in range(repetitions): + print n, m, rep + X, y = generator.generate(m=m) + y_pred_r, time_r, iter_r = run_earth(X,y,**kwargs) + rsq_r = 1 - (numpy.sum((y-y_pred_r)**2))/(numpy.sum((y-numpy.mean(y))**2)) + data.append([m,n,0,1,time_r,iter_r,rsq_r]) + y_pred_py, time_py, iter_py = run_pyearth(X,y,**kwargs) + rsq_py = 1 - (numpy.sum((y-y_pred_py)**2))/(numpy.sum((y-numpy.mean(y))**2)) + data.append([m,n,1,0,time_py,iter_py,rsq_py]) + return pandas.DataFrame(data,columns=header) + +if __name__ == '__main__': + sample_sizes = [100, 200, 300, 500] + dimensions = [10, 20, 30] + rep = 5 + numpy.random.seed(1) + data = compare(RandomComplexityGenerator,sample_sizes,dimensions,rep,max_degree=2,penalty=3.0) + print data + data.to_csv('comparison.csv') + + \ No newline at end of file diff --git a/examples/earth/sine_wave.py b/examples/earth/sine_wave.py new file mode 100644 index 0000000000000..0b0e52a748684 --- /dev/null +++ b/examples/earth/sine_wave.py @@ -0,0 +1,27 @@ + +import numpy +from sklearn.earth import Earth +from matplotlib import pyplot + +#Create some fake data +numpy.random.seed(2) +m = 10000 +n = 10 +X = 80*numpy.random.uniform(size=(m,n)) - 40 +y = 100*numpy.abs(numpy.sin((X[:,6])/10) - 4.0) + 10*numpy.random.normal(size=m) + +#Fit an Earth model +model = Earth(max_degree = 3,minspan_alpha=.5) +model.fit(X,y) + +#Print the model +print model.trace() +print model.summary() + +#Plot the model +y_hat = model.predict(X) +pyplot.figure() +pyplot.plot(X[:,6],y,'r.') +pyplot.plot(X[:,6],y_hat,'b.') +pyplot.show() + diff --git a/examples/earth/v_function.py b/examples/earth/v_function.py new file mode 100644 index 0000000000000..eaf74712b3b02 --- /dev/null +++ b/examples/earth/v_function.py @@ -0,0 +1,27 @@ + +import numpy +from sklearn.earth import Earth +from matplotlib import pyplot + +#Create some fake data +numpy.random.seed(2) +m = 1000 +n = 10 +X = 80*numpy.random.uniform(size=(m,n)) - 40 +y = numpy.abs(X[:,6] - 4.0) + 1*numpy.random.normal(size=m) + +#Fit an Earth model +model = Earth(max_degree = 1) +model.fit(X,y) + +#Print the model +print model.trace() +print model.summary() + +#Plot the model +y_hat = model.predict(X) +pyplot.figure() +pyplot.plot(X[:,6],y,'r.') +pyplot.plot(X[:,6],y_hat,'b.') +pyplot.show() + diff --git a/sklearn/earth/__init__.py b/sklearn/earth/__init__.py new file mode 100644 index 0000000000000..7b7657d5a554f --- /dev/null +++ b/sklearn/earth/__init__.py @@ -0,0 +1,8 @@ +""" +The :mod:`sklearn.earth` module contains the the Earth class for multivariate +adaptive regression splines. +""" + +from .earth import Earth + +__all__ = ['Earth'] \ No newline at end of file diff --git a/sklearn/earth/_basis.c b/sklearn/earth/_basis.c new file mode 100644 index 0000000000000..3f607997078e4 --- /dev/null +++ b/sklearn/earth/_basis.c @@ -0,0 +1,21508 @@ +/* Generated by Cython 0.19 on Sat Jul 20 23:46:45 2013 */ + +#define PY_SSIZE_T_CLEAN +#ifndef CYTHON_USE_PYLONG_INTERNALS +#ifdef PYLONG_BITS_IN_DIGIT +#define CYTHON_USE_PYLONG_INTERNALS 0 +#else +#include "pyconfig.h" +#ifdef PYLONG_BITS_IN_DIGIT +#define CYTHON_USE_PYLONG_INTERNALS 1 +#else +#define CYTHON_USE_PYLONG_INTERNALS 0 +#endif +#endif +#endif +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x02040000 + #error Cython requires Python 2.4+. +#else +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#ifdef PYPY_VERSION +#define CYTHON_COMPILING_IN_PYPY 1 +#define CYTHON_COMPILING_IN_CPYTHON 0 +#else +#define CYTHON_COMPILING_IN_PYPY 0 +#define CYTHON_COMPILING_IN_CPYTHON 1 +#endif +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define CYTHON_FORMAT_SSIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \ + (PyErr_Format(PyExc_TypeError, \ + "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ + (PyObject*)0)) + #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) + #define __PYX_BUILD_PY_SSIZE_T "i" +#else + #define __PYX_BUILD_PY_SSIZE_T "n" + #define CYTHON_FORMAT_SSIZE_T "z" + #define __Pyx_PyIndex_Check PyIndex_Check +#endif +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) + #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) + typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); + typedef void (*releasebufferproc)(PyObject *, Py_buffer *); +#endif +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#endif +#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 + #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") +#endif +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif +#if PY_VERSION_HEX < 0x02060000 + #define Py_TPFLAGS_HAVE_VERSION_TAG 0 +#endif +#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) + #define CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) +#else + #define CYTHON_PEP393_ENABLED 0 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) + #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#endif +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject + #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check + #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel +#endif +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) + #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) +#else + #define __Pyx_PyBaseString_Check(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || \ + PyString_Check(obj) || PyUnicode_Check(obj)) + #define __Pyx_PyBaseString_CheckExact(obj) (Py_TYPE(obj) == &PyBaseString_Type) +#endif +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) +#endif +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif +#ifdef NAN +#define __PYX_NAN() ((float) NAN) +#else +static CYTHON_INLINE float __PYX_NAN() { + /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and + a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is + a quiet NaN. */ + float value; + memset(&value, 0xFF, sizeof(value)); + return value; +} +#endif + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES +#endif +#include +#define __PYX_HAVE___basis +#define __PYX_HAVE_API___basis +#include "string.h" +#include "stdio.h" +#include "stdlib.h" +#include "numpy/arrayobject.h" +#include "numpy/ufuncobject.h" +#include "math.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif +typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding; + const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + +#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 +#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0 +#define __PYX_DEFAULT_STRING_ENCODING "" +#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString +#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); +static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); +#define __Pyx_PyBytes_FromString PyBytes_FromString +#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*); +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString + #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +#else + #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString + #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize +#endif +#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_FromUString(s) __Pyx_PyObject_FromString((char*)s) +#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s) +#define __Pyx_PyStr_FromUString(s) __Pyx_PyStr_FromString((char*)s) +#define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((char*)s) +#if PY_MAJOR_VERSION < 3 +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) +{ + const Py_UNICODE *u_end = u; + while (*u_end++) ; + return u_end - u - 1; +} +#else +#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen +#endif +#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) +#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode +#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); +#if CYTHON_COMPILING_IN_CPYTHON +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) +#else +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) +#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII +static int __Pyx_sys_getdefaultencoding_not_ascii; +static int __Pyx_init_sys_getdefaultencoding_params() { + PyObject* sys = NULL; + PyObject* default_encoding = NULL; + PyObject* ascii_chars_u = NULL; + PyObject* ascii_chars_b = NULL; + sys = PyImport_ImportModule("sys"); + if (sys == NULL) goto bad; + default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); + if (default_encoding == NULL) goto bad; + if (strcmp(PyBytes_AsString(default_encoding), "ascii") == 0) { + __Pyx_sys_getdefaultencoding_not_ascii = 0; + } else { + const char* default_encoding_c = PyBytes_AS_STRING(default_encoding); + char ascii_chars[128]; + int c; + for (c = 0; c < 128; c++) { + ascii_chars[c] = c; + } + __Pyx_sys_getdefaultencoding_not_ascii = 1; + ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); + if (ascii_chars_u == NULL) goto bad; + ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); + if (ascii_chars_b == NULL || strncmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { + PyErr_Format( + PyExc_ValueError, + "This module compiled with c_string_encoding=ascii, but default encoding '%s' is not a superset of ascii.", + default_encoding_c); + goto bad; + } + } + Py_XDECREF(sys); + Py_XDECREF(default_encoding); + Py_XDECREF(ascii_chars_u); + Py_XDECREF(ascii_chars_b); + return 0; +bad: + Py_XDECREF(sys); + Py_XDECREF(default_encoding); + Py_XDECREF(ascii_chars_u); + Py_XDECREF(ascii_chars_b); + return -1; +} +#endif +#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 +#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) +#else +#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) +#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT +static char* __PYX_DEFAULT_STRING_ENCODING; +static int __Pyx_init_sys_getdefaultencoding_params() { + PyObject* sys = NULL; + PyObject* default_encoding = NULL; + char* default_encoding_c; + sys = PyImport_ImportModule("sys"); + if (sys == NULL) goto bad; + default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); + if (default_encoding == NULL) goto bad; + default_encoding_c = PyBytes_AS_STRING(default_encoding); + __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); + strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); + Py_DECREF(sys); + Py_DECREF(default_encoding); + return 0; +bad: + Py_XDECREF(sys); + Py_XDECREF(default_encoding); + return -1; +} +#endif +#endif + + +#ifdef __GNUC__ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_d; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + +#if !defined(CYTHON_CCOMPLEX) + #if defined(__cplusplus) + #define CYTHON_CCOMPLEX 1 + #elif defined(_Complex_I) + #define CYTHON_CCOMPLEX 1 + #else + #define CYTHON_CCOMPLEX 0 + #endif +#endif +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #include + #else + #include + #endif +#endif +#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) + #undef _Complex_I + #define _Complex_I 1.0fj +#endif + + +static const char *__pyx_f[] = { + "_basis.pyx", + "numpy.pxd", + "type.pxd", +}; +#define IS_UNSIGNED(type) (((type) -1) > 0) +struct __Pyx_StructField_; +#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) +typedef struct { + const char* name; /* for error messages only */ + struct __Pyx_StructField_* fields; + size_t size; /* sizeof(type) */ + size_t arraysize[8]; /* length of array in each dimension */ + int ndim; + char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject, c_H_ar */ + char is_unsigned; + int flags; +} __Pyx_TypeInfo; +typedef struct __Pyx_StructField_ { + __Pyx_TypeInfo* type; + const char* name; + size_t offset; +} __Pyx_StructField; +typedef struct { + __Pyx_StructField* field; + size_t parent_offset; +} __Pyx_BufFmt_StackElem; +typedef struct { + __Pyx_StructField root; + __Pyx_BufFmt_StackElem* head; + size_t fmt_offset; + size_t new_count, enc_count; + size_t struct_alignment; + int is_complex; + char enc_type; + char new_packmode; + char enc_packmode; + char is_valid_array; +} __Pyx_BufFmt_Context; + + +/* "numpy.pxd":723 + * # in Cython to enable them only on the right systems. + * + * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + */ +typedef npy_int8 __pyx_t_5numpy_int8_t; + +/* "numpy.pxd":724 + * + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t + */ +typedef npy_int16 __pyx_t_5numpy_int16_t; + +/* "numpy.pxd":725 + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< + * ctypedef npy_int64 int64_t + * #ctypedef npy_int96 int96_t + */ +typedef npy_int32 __pyx_t_5numpy_int32_t; + +/* "numpy.pxd":726 + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< + * #ctypedef npy_int96 int96_t + * #ctypedef npy_int128 int128_t + */ +typedef npy_int64 __pyx_t_5numpy_int64_t; + +/* "numpy.pxd":730 + * #ctypedef npy_int128 int128_t + * + * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + */ +typedef npy_uint8 __pyx_t_5numpy_uint8_t; + +/* "numpy.pxd":731 + * + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t + */ +typedef npy_uint16 __pyx_t_5numpy_uint16_t; + +/* "numpy.pxd":732 + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< + * ctypedef npy_uint64 uint64_t + * #ctypedef npy_uint96 uint96_t + */ +typedef npy_uint32 __pyx_t_5numpy_uint32_t; + +/* "numpy.pxd":733 + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< + * #ctypedef npy_uint96 uint96_t + * #ctypedef npy_uint128 uint128_t + */ +typedef npy_uint64 __pyx_t_5numpy_uint64_t; + +/* "numpy.pxd":737 + * #ctypedef npy_uint128 uint128_t + * + * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< + * ctypedef npy_float64 float64_t + * #ctypedef npy_float80 float80_t + */ +typedef npy_float32 __pyx_t_5numpy_float32_t; + +/* "numpy.pxd":738 + * + * ctypedef npy_float32 float32_t + * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< + * #ctypedef npy_float80 float80_t + * #ctypedef npy_float128 float128_t + */ +typedef npy_float64 __pyx_t_5numpy_float64_t; + +/* "numpy.pxd":747 + * # The int types are mapped a bit surprising -- + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t + */ +typedef npy_long __pyx_t_5numpy_int_t; + +/* "numpy.pxd":748 + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong longlong_t + * + */ +typedef npy_longlong __pyx_t_5numpy_long_t; + +/* "numpy.pxd":749 + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_ulong uint_t + */ +typedef npy_longlong __pyx_t_5numpy_longlong_t; + +/* "numpy.pxd":751 + * ctypedef npy_longlong longlong_t + * + * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t + */ +typedef npy_ulong __pyx_t_5numpy_uint_t; + +/* "numpy.pxd":752 + * + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulonglong_t + * + */ +typedef npy_ulonglong __pyx_t_5numpy_ulong_t; + +/* "numpy.pxd":753 + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_intp intp_t + */ +typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; + +/* "numpy.pxd":755 + * ctypedef npy_ulonglong ulonglong_t + * + * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< + * ctypedef npy_uintp uintp_t + * + */ +typedef npy_intp __pyx_t_5numpy_intp_t; + +/* "numpy.pxd":756 + * + * ctypedef npy_intp intp_t + * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< + * + * ctypedef npy_double float_t + */ +typedef npy_uintp __pyx_t_5numpy_uintp_t; + +/* "numpy.pxd":758 + * ctypedef npy_uintp uintp_t + * + * ctypedef npy_double float_t # <<<<<<<<<<<<<< + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t + */ +typedef npy_double __pyx_t_5numpy_float_t; + +/* "numpy.pxd":759 + * + * ctypedef npy_double float_t + * ctypedef npy_double double_t # <<<<<<<<<<<<<< + * ctypedef npy_longdouble longdouble_t + * + */ +typedef npy_double __pyx_t_5numpy_double_t; + +/* "numpy.pxd":760 + * ctypedef npy_double float_t + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cfloat cfloat_t + */ +typedef npy_longdouble __pyx_t_5numpy_longdouble_t; + +/* "_util.pxd":2 + * cimport numpy as cnp + * ctypedef cnp.float64_t FLOAT_t # <<<<<<<<<<<<<< + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t + */ +typedef __pyx_t_5numpy_float64_t __pyx_t_5_util_FLOAT_t; + +/* "_util.pxd":3 + * cimport numpy as cnp + * ctypedef cnp.float64_t FLOAT_t + * ctypedef cnp.intp_t INT_t # <<<<<<<<<<<<<< + * ctypedef cnp.ulong_t INDEX_t + * ctypedef cnp.uint8_t BOOL_t + */ +typedef __pyx_t_5numpy_intp_t __pyx_t_5_util_INT_t; + +/* "_util.pxd":4 + * ctypedef cnp.float64_t FLOAT_t + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t # <<<<<<<<<<<<<< + * ctypedef cnp.uint8_t BOOL_t + * + */ +typedef __pyx_t_5numpy_ulong_t __pyx_t_5_util_INDEX_t; + +/* "_util.pxd":5 + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t + * ctypedef cnp.uint8_t BOOL_t # <<<<<<<<<<<<<< + * + * cdef FLOAT_t log2(FLOAT_t x) + */ +typedef __pyx_t_5numpy_uint8_t __pyx_t_5_util_BOOL_t; + +/* "_basis.pxd":2 + * cimport numpy as cnp + * ctypedef cnp.float64_t FLOAT_t # <<<<<<<<<<<<<< + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t + */ +typedef __pyx_t_5numpy_float64_t __pyx_t_6_basis_FLOAT_t; + +/* "_basis.pxd":3 + * cimport numpy as cnp + * ctypedef cnp.float64_t FLOAT_t + * ctypedef cnp.intp_t INT_t # <<<<<<<<<<<<<< + * ctypedef cnp.ulong_t INDEX_t + * ctypedef cnp.uint8_t BOOL_t + */ +typedef __pyx_t_5numpy_intp_t __pyx_t_6_basis_INT_t; + +/* "_basis.pxd":4 + * ctypedef cnp.float64_t FLOAT_t + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t # <<<<<<<<<<<<<< + * ctypedef cnp.uint8_t BOOL_t + * + */ +typedef __pyx_t_5numpy_ulong_t __pyx_t_6_basis_INDEX_t; + +/* "_basis.pxd":5 + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t + * ctypedef cnp.uint8_t BOOL_t # <<<<<<<<<<<<<< + * + * cdef class BasisFunction: + */ +typedef __pyx_t_5numpy_uint8_t __pyx_t_6_basis_BOOL_t; +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< float > __pyx_t_float_complex; + #else + typedef float _Complex __pyx_t_float_complex; + #endif +#else + typedef struct { float real, imag; } __pyx_t_float_complex; +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< double > __pyx_t_double_complex; + #else + typedef double _Complex __pyx_t_double_complex; + #endif +#else + typedef struct { double real, imag; } __pyx_t_double_complex; +#endif + + +/*--- Type declarations ---*/ +struct __pyx_obj_6_basis_Basis; +struct __pyx_obj_6_basis___pyx_scope_struct__piter; +struct __pyx_obj_6_basis_BasisFunction; +struct __pyx_obj_6_basis_PicklePlaceHolderBasisFunction; +struct __pyx_obj_6_basis_LinearBasisFunction; +struct __pyx_obj_6_basis_HingeBasisFunction; +struct __pyx_obj_6_basis_ConstantBasisFunction; + +/* "numpy.pxd":762 + * ctypedef npy_longdouble longdouble_t + * + * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t + */ +typedef npy_cfloat __pyx_t_5numpy_cfloat_t; + +/* "numpy.pxd":763 + * + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< + * ctypedef npy_clongdouble clongdouble_t + * + */ +typedef npy_cdouble __pyx_t_5numpy_cdouble_t; + +/* "numpy.pxd":764 + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cdouble complex_t + */ +typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; + +/* "numpy.pxd":766 + * ctypedef npy_clongdouble clongdouble_t + * + * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew1(a): + */ +typedef npy_cdouble __pyx_t_5numpy_complex_t; +struct __pyx_opt_args_6_basis_13BasisFunction_apply; +struct __pyx_opt_args_6_basis_21ConstantBasisFunction_apply; +struct __pyx_opt_args_6_basis_18HingeBasisFunction_apply; +struct __pyx_opt_args_6_basis_19LinearBasisFunction_apply; + +/* "_basis.pxd":45 + * cpdef INDEX_t degree(BasisFunction self) + * + * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) # <<<<<<<<<<<<<< + * + * cpdef cnp.ndarray[INT_t, ndim=1] valid_knots(BasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] values, cnp.ndarray[FLOAT_t,ndim=1] variable, int variable_idx, INDEX_t check_every, int endspan, int minspan, FLOAT_t minspan_alpha, INDEX_t n, cnp.ndarray[INT_t,ndim=1] workspace) + */ +struct __pyx_opt_args_6_basis_13BasisFunction_apply { + int __pyx_n; + int recurse; +}; + +/* "_basis.pxd":62 + * cpdef BasisFunction get_parent(self) + * + * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) # <<<<<<<<<<<<<< + * + * + */ +struct __pyx_opt_args_6_basis_21ConstantBasisFunction_apply { + int __pyx_n; + int recurse; +}; + +/* "_basis.pxd":86 + * cpdef INDEX_t get_knot_idx(self) + * + * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) # <<<<<<<<<<<<<< + * + * cdef class LinearBasisFunction(BasisFunction): + */ +struct __pyx_opt_args_6_basis_18HingeBasisFunction_apply { + int __pyx_n; + int recurse; +}; + +/* "_basis.pxd":98 + * cpdef INDEX_t get_variable(self) + * + * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) # <<<<<<<<<<<<<< + * + * + */ +struct __pyx_opt_args_6_basis_19LinearBasisFunction_apply { + int __pyx_n; + int recurse; +}; + +/* "_basis.pxd":102 + * + * + * cdef class Basis: # <<<<<<<<<<<<<< + * '''A wrapper that provides functionality related to a set of BasisFunctions with a + * common ConstantBasisFunction ancestor. Retains the order in which BasisFunctions are + */ +struct __pyx_obj_6_basis_Basis { + PyObject_HEAD + struct __pyx_vtabstruct_6_basis_Basis *__pyx_vtab; + PyObject *order; +}; + + +/* "_basis.pyx":507 + * return self.__class__ is other.__class__ and self._getstate() == other._getstate() + * + * def piter(Basis self): # <<<<<<<<<<<<<< + * for bf in self.order: + * if not bf.is_pruned(): + */ +struct __pyx_obj_6_basis___pyx_scope_struct__piter { + PyObject_HEAD + PyObject *__pyx_v_bf; + struct __pyx_obj_6_basis_Basis *__pyx_v_self; + PyObject *__pyx_t_0; + Py_ssize_t __pyx_t_1; +}; + + +/* "_basis.pxd":7 + * ctypedef cnp.uint8_t BOOL_t + * + * cdef class BasisFunction: # <<<<<<<<<<<<<< + * '''Abstract. Subclasses must implement the apply, translate, scale, and __init__ methods.''' + * + */ +struct __pyx_obj_6_basis_BasisFunction { + PyObject_HEAD + struct __pyx_vtabstruct_6_basis_BasisFunction *__pyx_vtab; + struct __pyx_obj_6_basis_BasisFunction *parent; + PyObject *child_map; + PyObject *children; + int pruned; + int prunable; + int splittable; +}; + + +/* "_basis.pyx":281 + * return result + * + * cdef class PicklePlaceHolderBasisFunction(BasisFunction): # <<<<<<<<<<<<<< + * '''This is a place holder for unpickling the basis function tree.''' + * + */ +struct __pyx_obj_6_basis_PicklePlaceHolderBasisFunction { + struct __pyx_obj_6_basis_BasisFunction __pyx_base; +}; + + +/* "_basis.pxd":88 + * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) + * + * cdef class LinearBasisFunction(BasisFunction): # <<<<<<<<<<<<<< + * cdef INDEX_t variable + * cdef str label + */ +struct __pyx_obj_6_basis_LinearBasisFunction { + struct __pyx_obj_6_basis_BasisFunction __pyx_base; + __pyx_t_6_basis_INDEX_t variable; + PyObject *label; +}; + + +/* "_basis.pxd":65 + * + * + * cdef class HingeBasisFunction(BasisFunction): # <<<<<<<<<<<<<< + * cdef FLOAT_t knot + * cdef INDEX_t knot_idx + */ +struct __pyx_obj_6_basis_HingeBasisFunction { + struct __pyx_obj_6_basis_BasisFunction __pyx_base; + __pyx_t_6_basis_FLOAT_t knot; + __pyx_t_6_basis_INDEX_t knot_idx; + __pyx_t_6_basis_INDEX_t variable; + int reverse; + PyObject *label; +}; + + +/* "_basis.pxd":50 + * + * + * cdef class ConstantBasisFunction(BasisFunction): # <<<<<<<<<<<<<< + * + * cpdef INDEX_t degree(ConstantBasisFunction self) + */ +struct __pyx_obj_6_basis_ConstantBasisFunction { + struct __pyx_obj_6_basis_BasisFunction __pyx_base; +}; + + + +/* "_basis.pyx":13 + * import numpy as np + * + * cdef class BasisFunction: # <<<<<<<<<<<<<< + * + * def __cinit__(BasisFunction self): + */ + +struct __pyx_vtabstruct_6_basis_BasisFunction { + int (*has_knot)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + int (*is_prunable)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + int (*is_pruned)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + int (*is_splittable)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + int (*make_splittable)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + int (*make_unsplittable)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*get_children)(struct __pyx_obj_6_basis_BasisFunction *); + PyObject *(*_set_parent)(struct __pyx_obj_6_basis_BasisFunction *, struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*_add_child)(struct __pyx_obj_6_basis_BasisFunction *, struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + struct __pyx_obj_6_basis_BasisFunction *(*get_parent)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*prune)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*unprune)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*knots)(struct __pyx_obj_6_basis_BasisFunction *, __pyx_t_6_basis_INDEX_t, int __pyx_skip_dispatch); + __pyx_t_6_basis_INDEX_t (*degree)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*apply)(struct __pyx_obj_6_basis_BasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_6_basis_13BasisFunction_apply *__pyx_optional_args); + PyArrayObject *(*valid_knots)(struct __pyx_obj_6_basis_BasisFunction *, PyArrayObject *, PyArrayObject *, int, __pyx_t_6_basis_INDEX_t, int, int, __pyx_t_6_basis_FLOAT_t, __pyx_t_6_basis_INDEX_t, PyArrayObject *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_6_basis_BasisFunction *__pyx_vtabptr_6_basis_BasisFunction; + + +/* "_basis.pyx":281 + * return result + * + * cdef class PicklePlaceHolderBasisFunction(BasisFunction): # <<<<<<<<<<<<<< + * '''This is a place holder for unpickling the basis function tree.''' + * + */ + +struct __pyx_vtabstruct_6_basis_PicklePlaceHolderBasisFunction { + struct __pyx_vtabstruct_6_basis_BasisFunction __pyx_base; +}; +static struct __pyx_vtabstruct_6_basis_PicklePlaceHolderBasisFunction *__pyx_vtabptr_6_basis_PicklePlaceHolderBasisFunction; + + +/* "_basis.pyx":427 + * b[i] *= tmp + * + * cdef class LinearBasisFunction(BasisFunction): # <<<<<<<<<<<<<< + * def __init__(self, BasisFunction parent, INDEX_t variable, label=None): #@DuplicatedSignature + * self.variable = variable + */ + +struct __pyx_vtabstruct_6_basis_LinearBasisFunction { + struct __pyx_vtabstruct_6_basis_BasisFunction __pyx_base; + PyObject *(*translate)(struct __pyx_obj_6_basis_LinearBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch); + __pyx_t_6_basis_FLOAT_t (*scale)(struct __pyx_obj_6_basis_LinearBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); + __pyx_t_6_basis_INDEX_t (*get_variable)(struct __pyx_obj_6_basis_LinearBasisFunction *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_6_basis_LinearBasisFunction *__pyx_vtabptr_6_basis_LinearBasisFunction; + + +/* "_basis.pyx":286 + * pickle_place_holder = PicklePlaceHolderBasisFunction() + * + * cdef class ConstantBasisFunction(BasisFunction): # <<<<<<<<<<<<<< + * def __init__(self): #@DuplicatedSignature + * self.prunable = False + */ + +struct __pyx_vtabstruct_6_basis_ConstantBasisFunction { + struct __pyx_vtabstruct_6_basis_BasisFunction __pyx_base; + PyObject *(*translate)(struct __pyx_obj_6_basis_ConstantBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch); + __pyx_t_6_basis_FLOAT_t (*scale)(struct __pyx_obj_6_basis_ConstantBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_6_basis_ConstantBasisFunction *__pyx_vtabptr_6_basis_ConstantBasisFunction; + + +/* "_basis.pyx":479 + * b[i] *= X[i,self.variable] + * + * cdef class Basis: # <<<<<<<<<<<<<< + * '''A container that provides functionality related to a set of BasisFunctions with a + * common ConstantBasisFunction ancestor. Retains the order in which BasisFunctions are + */ + +struct __pyx_vtabstruct_6_basis_Basis { + PyObject *(*translate)(struct __pyx_obj_6_basis_Basis *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); + PyObject *(*scale)(struct __pyx_obj_6_basis_Basis *, PyArrayObject *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); + struct __pyx_obj_6_basis_BasisFunction *(*get_root)(struct __pyx_obj_6_basis_Basis *, int __pyx_skip_dispatch); + PyObject *(*append)(struct __pyx_obj_6_basis_Basis *, struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + __pyx_t_6_basis_INDEX_t (*plen)(struct __pyx_obj_6_basis_Basis *, int __pyx_skip_dispatch); + struct __pyx_obj_6_basis_BasisFunction *(*get)(struct __pyx_obj_6_basis_Basis *, __pyx_t_6_basis_INDEX_t, int __pyx_skip_dispatch); + PyObject *(*transform)(struct __pyx_obj_6_basis_Basis *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); + PyObject *(*weighted_transform)(struct __pyx_obj_6_basis_Basis *, PyArrayObject *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_6_basis_Basis *__pyx_vtabptr_6_basis_Basis; + + +/* "_basis.pyx":330 + * return '(Intercept)' + * + * cdef class HingeBasisFunction(BasisFunction): # <<<<<<<<<<<<<< + * + * def __init__(self, BasisFunction parent, FLOAT_t knot, INDEX_t knot_idx, INDEX_t variable, bint reverse, label=None): #@DuplicatedSignature + */ + +struct __pyx_vtabstruct_6_basis_HingeBasisFunction { + struct __pyx_vtabstruct_6_basis_BasisFunction __pyx_base; + PyObject *(*translate)(struct __pyx_obj_6_basis_HingeBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch); + __pyx_t_6_basis_FLOAT_t (*scale)(struct __pyx_obj_6_basis_HingeBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); + __pyx_t_6_basis_INDEX_t (*get_variable)(struct __pyx_obj_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); + __pyx_t_6_basis_FLOAT_t (*get_knot)(struct __pyx_obj_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); + int (*get_reverse)(struct __pyx_obj_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); + __pyx_t_6_basis_INDEX_t (*get_knot_idx)(struct __pyx_obj_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_6_basis_HingeBasisFunction *__pyx_vtabptr_6_basis_HingeBasisFunction; +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; +#ifdef WITH_THREAD + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + if (acquire_gil) { \ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + PyGILState_Release(__pyx_gilstate_save); \ + } else { \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) +#endif + #define __Pyx_RefNannyFinishContext() \ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name, acquire_gil) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif /* CYTHON_REFNANNY */ +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) + +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_getattr)) + return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); +#endif + return PyObject_GetAttr(obj, attr_name); +} +#else +#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#endif + +static PyObject *__Pyx_GetBuiltinName(PyObject *name); /*proto*/ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static CYTHON_INLINE int __Pyx_CheckKeywordStrings(PyObject *kwdict, const char* function_name, int kw_allowed); /*proto*/ + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ + +static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); + +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact); /*proto*/ + +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { + Py_INCREF(x); + PyList_SET_ITEM(list, len, x); + Py_SIZE(list) = len+1; + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) +#endif + +static CYTHON_INLINE int __Pyx_PyDict_Contains(PyObject* item, PyObject* dict, int eq) { + int result = PyDict_Contains(dict, item); + return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); +} + +static PyObject* __Pyx_PyObject_CallMethodTuple(PyObject* obj, PyObject* method_name, PyObject* args) { + PyObject *method, *result = NULL; + if (unlikely(!args)) return NULL; + method = __Pyx_PyObject_GetAttrStr(obj, method_name); + if (unlikely(!method)) goto bad; + result = PyObject_Call(method, args, NULL); + Py_DECREF(method); +bad: + Py_DECREF(args); + return result; +} +#define __Pyx_PyObject_CallMethod3(obj, name, arg1, arg2, arg3) \ + __Pyx_PyObject_CallMethodTuple(obj, name, PyTuple_Pack(3, arg1, arg2, arg3)) +#define __Pyx_PyObject_CallMethod2(obj, name, arg1, arg2) \ + __Pyx_PyObject_CallMethodTuple(obj, name, PyTuple_Pack(2, arg1, arg2)) +#define __Pyx_PyObject_CallMethod1(obj, name, arg1) \ + __Pyx_PyObject_CallMethodTuple(obj, name, PyTuple_Pack(1, arg1)) +#define __Pyx_PyObject_CallMethod0(obj, name) \ + __Pyx_PyObject_CallMethodTuple(obj, name, (Py_INCREF(__pyx_empty_tuple), __pyx_empty_tuple)) + +static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x); /*proto*/ + +#define __Pyx_GetItemInt(o, i, size, to_py_func, is_list, wraparound, boundscheck) \ + (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Fast(o, i, is_list, wraparound, boundscheck) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) +#define __Pyx_GetItemInt_List(o, i, size, to_py_func, is_list, wraparound, boundscheck) \ + (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_List_Fast(o, i, wraparound, boundscheck) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck); +#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func, is_list, wraparound, boundscheck) \ + (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Tuple_Fast(o, i, wraparound, boundscheck) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck); +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, + int is_list, int wraparound, int boundscheck); + +#define __Pyx_SetItemInt(o, i, v, size, to_py_func, is_list, wraparound, boundscheck) \ + (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_SetItemInt_Fast(o, i, v, is_list, wraparound, boundscheck) : \ + __Pyx_SetItemInt_Generic(o, to_py_func(i), v)) +static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v); +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, + int is_list, int wraparound, int boundscheck); + +static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, + __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); +static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ + const char* function_name); /*proto*/ + +#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) +static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /*proto*/ + +static void __Pyx_RaiseBufferFallbackError(void); /*proto*/ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ + +#define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1) +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); + +static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ + +#include + +typedef struct { + Py_ssize_t shape, strides, suboffsets; +} __Pyx_Buf_DimInfo; +typedef struct { + size_t refcount; + Py_buffer pybuffer; +} __Pyx_Buffer; +typedef struct { + __Pyx_Buffer *rcbuffer; + char *data; + __Pyx_Buf_DimInfo diminfo[8]; +} __Pyx_LocalBuf_ND; + +#if PY_MAJOR_VERSION < 3 + static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); + static void __Pyx_ReleaseBuffer(Py_buffer *view); +#else + #define __Pyx_GetBuffer PyObject_GetBuffer + #define __Pyx_ReleaseBuffer PyBuffer_Release +#endif + + +static Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0}; +static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1}; + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/ + +static CYTHON_INLINE npy_ulonglong __Pyx_PyInt_from_py_npy_ulonglong(PyObject *); + +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_ulonglong(npy_ulonglong); + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #define __Pyx_CREAL(z) ((z).real()) + #define __Pyx_CIMAG(z) ((z).imag()) + #else + #define __Pyx_CREAL(z) (__real__(z)) + #define __Pyx_CIMAG(z) (__imag__(z)) + #endif +#else + #define __Pyx_CREAL(z) ((z).real) + #define __Pyx_CIMAG(z) ((z).imag) +#endif +#if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX + #define __Pyx_SET_CREAL(z,x) ((z).real(x)) + #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) +#else + #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) + #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) +#endif + +static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); + +#if CYTHON_CCOMPLEX + #define __Pyx_c_eqf(a, b) ((a)==(b)) + #define __Pyx_c_sumf(a, b) ((a)+(b)) + #define __Pyx_c_difff(a, b) ((a)-(b)) + #define __Pyx_c_prodf(a, b) ((a)*(b)) + #define __Pyx_c_quotf(a, b) ((a)/(b)) + #define __Pyx_c_negf(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zerof(z) ((z)==(float)0) + #define __Pyx_c_conjf(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_absf(z) (::std::abs(z)) + #define __Pyx_c_powf(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zerof(z) ((z)==0) + #define __Pyx_c_conjf(z) (conjf(z)) + #if 1 + #define __Pyx_c_absf(z) (cabsf(z)) + #define __Pyx_c_powf(a, b) (cpowf(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex); + #endif +#endif + +static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); + +#if CYTHON_CCOMPLEX + #define __Pyx_c_eq(a, b) ((a)==(b)) + #define __Pyx_c_sum(a, b) ((a)+(b)) + #define __Pyx_c_diff(a, b) ((a)-(b)) + #define __Pyx_c_prod(a, b) ((a)*(b)) + #define __Pyx_c_quot(a, b) ((a)/(b)) + #define __Pyx_c_neg(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero(z) ((z)==(double)0) + #define __Pyx_c_conj(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs(z) (::std::abs(z)) + #define __Pyx_c_pow(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero(z) ((z)==0) + #define __Pyx_c_conj(z) (conj(z)) + #if 1 + #define __Pyx_c_abs(z) (cabs(z)) + #define __Pyx_c_pow(a, b) (cpow(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex); + #endif +#endif + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static void __Pyx_WriteUnraisable(const char *name, int clineno, + int lineno, const char *filename); /*proto*/ + +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +#define __Pyx_Generator_USED +#include +#include +typedef PyObject *(*__pyx_generator_body_t)(PyObject *, PyObject *); +typedef struct { + PyObject_HEAD + __pyx_generator_body_t body; + PyObject *closure; + PyObject *exc_type; + PyObject *exc_value; + PyObject *exc_traceback; + PyObject *gi_weakreflist; + PyObject *classobj; + PyObject *yieldfrom; + int resume_label; + char is_running; // using T_BOOL for property below requires char value +} __pyx_GeneratorObject; +static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body, + PyObject *closure); +static int __pyx_Generator_init(void); +static int __Pyx_Generator_clear(PyObject* self); +#if 1 || PY_VERSION_HEX < 0x030300B0 +static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue); +#else +#define __Pyx_PyGen_FetchStopIterationValue(pvalue) PyGen_FetchStopIterationValue(pvalue) +#endif + +static int __Pyx_check_binary_version(void); + +static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ + +#if !defined(__Pyx_PyIdentifier_FromString) +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) +#else + #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) +#endif +#endif + +static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ + +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ + +static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig); /*proto*/ + +typedef struct { + int code_line; + PyCodeObject* code_object; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); + +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + + +/* Module declarations from 'cpython.buffer' */ + +/* Module declarations from 'cpython.ref' */ + +/* Module declarations from 'libc.string' */ + +/* Module declarations from 'libc.stdio' */ + +/* Module declarations from 'cpython.object' */ + +/* Module declarations from '__builtin__' */ + +/* Module declarations from 'cpython.type' */ +static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; + +/* Module declarations from 'libc.stdlib' */ + +/* Module declarations from 'numpy' */ + +/* Module declarations from 'numpy' */ +static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; +static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; +static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; +static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; +static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ + +/* Module declarations from '_util' */ +static __pyx_t_5_util_FLOAT_t (*__pyx_f_5_util_log2)(__pyx_t_5_util_FLOAT_t); /*proto*/ +static PyObject *(*__pyx_f_5_util_apply_weights_2d)(PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); /*proto*/ + +/* Module declarations from 'libc.math' */ + +/* Module declarations from '_basis' */ +static PyTypeObject *__pyx_ptype_6_basis_BasisFunction = 0; +static PyTypeObject *__pyx_ptype_6_basis_ConstantBasisFunction = 0; +static PyTypeObject *__pyx_ptype_6_basis_HingeBasisFunction = 0; +static PyTypeObject *__pyx_ptype_6_basis_LinearBasisFunction = 0; +static PyTypeObject *__pyx_ptype_6_basis_Basis = 0; +static PyTypeObject *__pyx_ptype_6_basis_PicklePlaceHolderBasisFunction = 0; +static PyTypeObject *__pyx_ptype_6_basis___pyx_scope_struct__piter = 0; +static __pyx_t_6_basis_FLOAT_t __pyx_v_6_basis_ZERO_TOL; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t = { "FLOAT_t", NULL, sizeof(__pyx_t_6_basis_FLOAT_t), { 0 }, 0, 'R', 0, 0 }; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_6_basis_INT_t = { "INT_t", NULL, sizeof(__pyx_t_6_basis_INT_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_6_basis_INT_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_6_basis_INT_t), 0 }; +#define __Pyx_MODULE_NAME "_basis" +int __pyx_module_is_main__basis = 0; + +/* Implementation of '_basis' */ +static PyObject *__pyx_builtin_NotImplemented; +static PyObject *__pyx_builtin_range; +static PyObject *__pyx_builtin_NotImplementedError; +static PyObject *__pyx_builtin_super; +static PyObject *__pyx_builtin_ValueError; +static PyObject *__pyx_builtin_RuntimeError; +static int __pyx_pf_6_basis_13BasisFunction___cinit__(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6_basis_13BasisFunction_2__reduce__(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6_basis_13BasisFunction_4_get_root(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6_basis_13BasisFunction_6_getstate(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6_basis_13BasisFunction_8_get_parent_state(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6_basis_13BasisFunction_10_set_parent_state(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, PyObject *__pyx_v_state); /* proto */ +static PyObject *__pyx_pf_6_basis_13BasisFunction_12__setstate__(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, PyObject *__pyx_v_state); /* proto */ +static PyObject *__pyx_pf_6_basis_13BasisFunction_14_eq(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, PyObject *__pyx_v_other); /* proto */ +static PyObject *__pyx_pf_6_basis_13BasisFunction_16__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_method); /* proto */ +static PyObject *__pyx_pf_6_basis_13BasisFunction_18has_knot(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6_basis_13BasisFunction_20is_prunable(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6_basis_13BasisFunction_22is_pruned(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6_basis_13BasisFunction_24is_splittable(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6_basis_13BasisFunction_26make_splittable(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6_basis_13BasisFunction_28make_unsplittable(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6_basis_13BasisFunction_30_set_parent(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, struct __pyx_obj_6_basis_BasisFunction *__pyx_v_parent); /* proto */ +static PyObject *__pyx_pf_6_basis_13BasisFunction_32_add_child(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, struct __pyx_obj_6_basis_BasisFunction *__pyx_v_child); /* proto */ +static PyObject *__pyx_pf_6_basis_13BasisFunction_34get_parent(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6_basis_13BasisFunction_36prune(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6_basis_13BasisFunction_38unprune(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6_basis_13BasisFunction_40knots(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, __pyx_t_6_basis_INDEX_t __pyx_v_variable); /* proto */ +static PyObject *__pyx_pf_6_basis_13BasisFunction_42degree(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6_basis_13BasisFunction_44apply(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_b, int __pyx_v_recurse); /* proto */ +static PyObject *__pyx_pf_6_basis_13BasisFunction_46valid_knots(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_variable, int __pyx_v_variable_idx, __pyx_t_6_basis_INDEX_t __pyx_v_check_every, int __pyx_v_endspan, int __pyx_v_minspan, __pyx_t_6_basis_FLOAT_t __pyx_v_minspan_alpha, __pyx_t_6_basis_INDEX_t __pyx_v_n, PyArrayObject *__pyx_v_workspace); /* proto */ +static int __pyx_pf_6_basis_21ConstantBasisFunction___init__(struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_2_get_root(struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_4_get_parent_state(CYTHON_UNUSED struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_6_set_parent_state(CYTHON_UNUSED struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_state); /* proto */ +static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_8degree(struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_10translate(struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_ConstantBasisFunctionself, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts, int __pyx_v_recurse); /* proto */ +static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_12scale(struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_ConstantBasisFunctionself, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts); /* proto */ +static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_14_set_parent(struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self, struct __pyx_obj_6_basis_BasisFunction *__pyx_v_parent); /* proto */ +static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_16get_parent(struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_18apply(struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_b, int __pyx_v_recurse); /* proto */ +static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_20__str__(CYTHON_UNUSED struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self); /* proto */ +static int __pyx_pf_6_basis_18HingeBasisFunction___init__(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self, struct __pyx_obj_6_basis_BasisFunction *__pyx_v_parent, __pyx_t_6_basis_FLOAT_t __pyx_v_knot, __pyx_t_6_basis_INDEX_t __pyx_v_knot_idx, __pyx_t_6_basis_INDEX_t __pyx_v_variable, int __pyx_v_reverse, PyObject *__pyx_v_label); /* proto */ +static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_2__reduce__(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_4_getstate(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_6__setstate__(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self, PyObject *__pyx_v_state); /* proto */ +static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_8has_knot(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_10translate(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts, int __pyx_v_recurse); /* proto */ +static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_12scale(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts); /* proto */ +static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_14__str__(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_16get_variable(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_18get_knot(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_20get_reverse(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_22get_knot_idx(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_24apply(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_b, int __pyx_v_recurse); /* proto */ +static int __pyx_pf_6_basis_19LinearBasisFunction___init__(struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_self, struct __pyx_obj_6_basis_BasisFunction *__pyx_v_parent, __pyx_t_6_basis_INDEX_t __pyx_v_variable, PyObject *__pyx_v_label); /* proto */ +static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_2__reduce__(struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_4_getstate(struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_6__setstate__(struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_self, PyObject *__pyx_v_state); /* proto */ +static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_8translate(struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_LinearBasisFunctionself, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts, int __pyx_v_recurse); /* proto */ +static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_10scale(struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts); /* proto */ +static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_12__str__(struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_14get_variable(struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_16apply(struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_b, int __pyx_v_recurse); /* proto */ +static int __pyx_pf_6_basis_5Basis___init__(struct __pyx_obj_6_basis_Basis *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6_basis_5Basis_2__reduce__(struct __pyx_obj_6_basis_Basis *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6_basis_5Basis_4_getstate(struct __pyx_obj_6_basis_Basis *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6_basis_5Basis_6__setstate__(struct __pyx_obj_6_basis_Basis *__pyx_v_self, PyObject *__pyx_v_state); /* proto */ +static PyObject *__pyx_pf_6_basis_5Basis_8__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_method); /* proto */ +static PyObject *__pyx_pf_6_basis_5Basis_10_eq(struct __pyx_obj_6_basis_Basis *__pyx_v_self, PyObject *__pyx_v_other); /* proto */ +static PyObject *__pyx_pf_6_basis_5Basis_12piter(struct __pyx_obj_6_basis_Basis *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6_basis_5Basis_15__str__(struct __pyx_obj_6_basis_Basis *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6_basis_5Basis_17translate(struct __pyx_obj_6_basis_Basis *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts); /* proto */ +static PyObject *__pyx_pf_6_basis_5Basis_19scale(struct __pyx_obj_6_basis_Basis *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts, PyArrayObject *__pyx_v_beta); /* proto */ +static PyObject *__pyx_pf_6_basis_5Basis_21get_root(struct __pyx_obj_6_basis_Basis *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6_basis_5Basis_23append(struct __pyx_obj_6_basis_Basis *__pyx_v_self, struct __pyx_obj_6_basis_BasisFunction *__pyx_v_basis_function); /* proto */ +static PyObject *__pyx_pf_6_basis_5Basis_25__iter__(struct __pyx_obj_6_basis_Basis *__pyx_v_self); /* proto */ +static Py_ssize_t __pyx_pf_6_basis_5Basis_27__len__(struct __pyx_obj_6_basis_Basis *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6_basis_5Basis_29get(struct __pyx_obj_6_basis_Basis *__pyx_v_self, __pyx_t_6_basis_INDEX_t __pyx_v_i); /* proto */ +static PyObject *__pyx_pf_6_basis_5Basis_31__getitem__(struct __pyx_obj_6_basis_Basis *__pyx_v_self, __pyx_t_6_basis_INDEX_t __pyx_v_i); /* proto */ +static PyObject *__pyx_pf_6_basis_5Basis_33plen(struct __pyx_obj_6_basis_Basis *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_6_basis_5Basis_35transform(struct __pyx_obj_6_basis_Basis *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_B); /* proto */ +static PyObject *__pyx_pf_6_basis_5Basis_37weighted_transform(struct __pyx_obj_6_basis_Basis *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_B, PyArrayObject *__pyx_v_weights); /* proto */ +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ +static PyObject *__pyx_tp_new_6_basis_BasisFunction(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_6_basis_ConstantBasisFunction(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_6_basis_HingeBasisFunction(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_6_basis_LinearBasisFunction(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_6_basis_Basis(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_6_basis_PicklePlaceHolderBasisFunction(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_6_basis___pyx_scope_struct__piter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static char __pyx_k_1[] = "(Intercept)"; +static char __pyx_k_2[] = ""; +static char __pyx_k_3[] = "h(%s-%G)"; +static char __pyx_k_4[] = "h(%s+%G)"; +static char __pyx_k_5[] = "h(%G-%s)"; +static char __pyx_k_6[] = "*%s"; +static char __pyx_k_7[] = "*"; +static char __pyx_k_8[] = "\n"; +static char __pyx_k_10[] = "ndarray is not C contiguous"; +static char __pyx_k_12[] = "ndarray is not Fortran contiguous"; +static char __pyx_k_14[] = "Non-native byte order not supported"; +static char __pyx_k_16[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_17[] = "Format string allocated too short, see comment in numpy.pxd"; +static char __pyx_k_20[] = "Format string allocated too short."; +static char __pyx_k__B[] = "B"; +static char __pyx_k__H[] = "H"; +static char __pyx_k__I[] = "I"; +static char __pyx_k__L[] = "L"; +static char __pyx_k__O[] = "O"; +static char __pyx_k__Q[] = "Q"; +static char __pyx_k__X[] = "X"; +static char __pyx_k__b[] = "b"; +static char __pyx_k__d[] = "d"; +static char __pyx_k__f[] = "f"; +static char __pyx_k__g[] = "g"; +static char __pyx_k__h[] = "h"; +static char __pyx_k__i[] = "i"; +static char __pyx_k__l[] = "l"; +static char __pyx_k__n[] = "n"; +static char __pyx_k__q[] = "q"; +static char __pyx_k__x[] = "x"; +static char __pyx_k__Zd[] = "Zd"; +static char __pyx_k__Zf[] = "Zf"; +static char __pyx_k__Zg[] = "Zg"; +static char __pyx_k__np[] = "np"; +static char __pyx_k___eq[] = "_eq"; +static char __pyx_k__get[] = "get"; +static char __pyx_k__args[] = "args"; +static char __pyx_k__beta[] = "beta"; +static char __pyx_k__knot[] = "knot"; +static char __pyx_k__plen[] = "plen"; +static char __pyx_k__root[] = "root"; +static char __pyx_k__send[] = "send"; +static char __pyx_k__apply[] = "apply"; +static char __pyx_k__close[] = "close"; +static char __pyx_k__dtype[] = "dtype"; +static char __pyx_k__empty[] = "empty"; +static char __pyx_k__knots[] = "knots"; +static char __pyx_k__label[] = "label"; +static char __pyx_k__numpy[] = "numpy"; +static char __pyx_k__order[] = "order"; +static char __pyx_k__prune[] = "prune"; +static char __pyx_k__range[] = "range"; +static char __pyx_k__scale[] = "scale"; +static char __pyx_k__shape[] = "shape"; +static char __pyx_k__super[] = "super"; +static char __pyx_k__throw[] = "throw"; +static char __pyx_k__append[] = "append"; +static char __pyx_k__degree[] = "degree"; +static char __pyx_k__parent[] = "parent"; +static char __pyx_k__pruned[] = "pruned"; +static char __pyx_k__slopes[] = "slopes"; +static char __pyx_k__update[] = "update"; +static char __pyx_k__values[] = "values"; +static char __pyx_k____len__[] = "__len__"; +static char __pyx_k__endspan[] = "endspan"; +static char __pyx_k__minspan[] = "minspan"; +static char __pyx_k__recurse[] = "recurse"; +static char __pyx_k__reverse[] = "reverse"; +static char __pyx_k__unprune[] = "unprune"; +static char __pyx_k__weights[] = "weights"; +static char __pyx_k____iter__[] = "__iter__"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__children[] = "children"; +static char __pyx_k__get_knot[] = "get_knot"; +static char __pyx_k__get_root[] = "get_root"; +static char __pyx_k__has_knot[] = "has_knot"; +static char __pyx_k__knot_idx[] = "knot_idx"; +static char __pyx_k__prunable[] = "prunable"; +static char __pyx_k__variable[] = "variable"; +static char __pyx_k____class__[] = "__class__"; +static char __pyx_k___get_root[] = "_get_root"; +static char __pyx_k___getstate[] = "_getstate"; +static char __pyx_k__child_map[] = "child_map"; +static char __pyx_k__is_pruned[] = "is_pruned"; +static char __pyx_k__transform[] = "transform"; +static char __pyx_k__translate[] = "translate"; +static char __pyx_k__workspace[] = "workspace"; +static char __pyx_k__ValueError[] = "ValueError"; +static char __pyx_k____import__[] = "__import__"; +static char __pyx_k___add_child[] = "_add_child"; +static char __pyx_k__get_parent[] = "get_parent"; +static char __pyx_k__intercepts[] = "intercepts"; +static char __pyx_k__splittable[] = "splittable"; +static char __pyx_k___set_parent[] = "_set_parent"; +static char __pyx_k__check_every[] = "check_every"; +static char __pyx_k__get_reverse[] = "get_reverse"; +static char __pyx_k__is_prunable[] = "is_prunable"; +static char __pyx_k__valid_knots[] = "valid_knots"; +static char __pyx_k__RuntimeError[] = "RuntimeError"; +static char __pyx_k____setstate__[] = "__setstate__"; +static char __pyx_k__get_knot_idx[] = "get_knot_idx"; +static char __pyx_k__get_variable[] = "get_variable"; +static char __pyx_k__variable_idx[] = "variable_idx"; +static char __pyx_k__is_splittable[] = "is_splittable"; +static char __pyx_k__minspan_alpha[] = "minspan_alpha"; +static char __pyx_k__NotImplemented[] = "NotImplemented"; +static char __pyx_k____pyx_getbuffer[] = "__pyx_getbuffer"; +static char __pyx_k__make_splittable[] = "make_splittable"; +static char __pyx_k___get_parent_state[] = "_get_parent_state"; +static char __pyx_k___set_parent_state[] = "_set_parent_state"; +static char __pyx_k__make_unsplittable[] = "make_unsplittable"; +static char __pyx_k__weighted_transform[] = "weighted_transform"; +static char __pyx_k__NotImplementedError[] = "NotImplementedError"; +static char __pyx_k____pyx_releasebuffer[] = "__pyx_releasebuffer"; +static char __pyx_k__pickle_place_holder[] = "pickle_place_holder"; +static PyObject *__pyx_kp_s_1; +static PyObject *__pyx_kp_u_10; +static PyObject *__pyx_kp_u_12; +static PyObject *__pyx_kp_u_14; +static PyObject *__pyx_kp_u_16; +static PyObject *__pyx_kp_u_17; +static PyObject *__pyx_kp_s_2; +static PyObject *__pyx_kp_u_20; +static PyObject *__pyx_kp_s_3; +static PyObject *__pyx_kp_s_4; +static PyObject *__pyx_kp_s_5; +static PyObject *__pyx_kp_s_6; +static PyObject *__pyx_kp_s_7; +static PyObject *__pyx_kp_s_8; +static PyObject *__pyx_n_s__B; +static PyObject *__pyx_n_s__NotImplemented; +static PyObject *__pyx_n_s__NotImplementedError; +static PyObject *__pyx_n_s__RuntimeError; +static PyObject *__pyx_n_s__ValueError; +static PyObject *__pyx_n_s__X; +static PyObject *__pyx_n_s____class__; +static PyObject *__pyx_n_s____import__; +static PyObject *__pyx_n_s____iter__; +static PyObject *__pyx_n_s____len__; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____pyx_getbuffer; +static PyObject *__pyx_n_s____pyx_releasebuffer; +static PyObject *__pyx_n_s____setstate__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s___add_child; +static PyObject *__pyx_n_s___eq; +static PyObject *__pyx_n_s___get_parent_state; +static PyObject *__pyx_n_s___get_root; +static PyObject *__pyx_n_s___getstate; +static PyObject *__pyx_n_s___set_parent; +static PyObject *__pyx_n_s___set_parent_state; +static PyObject *__pyx_n_s__append; +static PyObject *__pyx_n_s__apply; +static PyObject *__pyx_n_s__args; +static PyObject *__pyx_n_s__b; +static PyObject *__pyx_n_s__beta; +static PyObject *__pyx_n_s__check_every; +static PyObject *__pyx_n_s__child_map; +static PyObject *__pyx_n_s__children; +static PyObject *__pyx_n_s__close; +static PyObject *__pyx_n_s__degree; +static PyObject *__pyx_n_s__dtype; +static PyObject *__pyx_n_s__empty; +static PyObject *__pyx_n_s__endspan; +static PyObject *__pyx_n_s__get; +static PyObject *__pyx_n_s__get_knot; +static PyObject *__pyx_n_s__get_knot_idx; +static PyObject *__pyx_n_s__get_parent; +static PyObject *__pyx_n_s__get_reverse; +static PyObject *__pyx_n_s__get_root; +static PyObject *__pyx_n_s__get_variable; +static PyObject *__pyx_n_s__has_knot; +static PyObject *__pyx_n_s__intercepts; +static PyObject *__pyx_n_s__is_prunable; +static PyObject *__pyx_n_s__is_pruned; +static PyObject *__pyx_n_s__is_splittable; +static PyObject *__pyx_n_s__knot; +static PyObject *__pyx_n_s__knot_idx; +static PyObject *__pyx_n_s__knots; +static PyObject *__pyx_n_s__label; +static PyObject *__pyx_n_s__make_splittable; +static PyObject *__pyx_n_s__make_unsplittable; +static PyObject *__pyx_n_s__minspan; +static PyObject *__pyx_n_s__minspan_alpha; +static PyObject *__pyx_n_s__n; +static PyObject *__pyx_n_s__np; +static PyObject *__pyx_n_s__numpy; +static PyObject *__pyx_n_s__order; +static PyObject *__pyx_n_s__parent; +static PyObject *__pyx_n_s__pickle_place_holder; +static PyObject *__pyx_n_s__plen; +static PyObject *__pyx_n_s__prunable; +static PyObject *__pyx_n_s__prune; +static PyObject *__pyx_n_s__pruned; +static PyObject *__pyx_n_s__range; +static PyObject *__pyx_n_s__recurse; +static PyObject *__pyx_n_s__reverse; +static PyObject *__pyx_n_s__root; +static PyObject *__pyx_n_s__scale; +static PyObject *__pyx_n_s__send; +static PyObject *__pyx_n_s__shape; +static PyObject *__pyx_n_s__slopes; +static PyObject *__pyx_n_s__splittable; +static PyObject *__pyx_n_s__super; +static PyObject *__pyx_n_s__throw; +static PyObject *__pyx_n_s__transform; +static PyObject *__pyx_n_s__translate; +static PyObject *__pyx_n_s__unprune; +static PyObject *__pyx_n_s__update; +static PyObject *__pyx_n_s__valid_knots; +static PyObject *__pyx_n_s__values; +static PyObject *__pyx_n_s__variable; +static PyObject *__pyx_n_s__variable_idx; +static PyObject *__pyx_n_s__weighted_transform; +static PyObject *__pyx_n_s__weights; +static PyObject *__pyx_n_s__workspace; +static PyObject *__pyx_n_s__x; +static PyObject *__pyx_int_1; +static PyObject *__pyx_int_2; +static PyObject *__pyx_int_3; +static PyObject *__pyx_int_15; +static PyObject *__pyx_k_slice_9; +static PyObject *__pyx_k_tuple_11; +static PyObject *__pyx_k_tuple_13; +static PyObject *__pyx_k_tuple_15; +static PyObject *__pyx_k_tuple_18; +static PyObject *__pyx_k_tuple_19; +static PyObject *__pyx_k_tuple_21; + +/* Python wrapper */ +static int __pyx_pw_6_basis_13BasisFunction_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_6_basis_13BasisFunction_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); + if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { + __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; + __pyx_r = __pyx_pf_6_basis_13BasisFunction___cinit__(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":15 + * cdef class BasisFunction: + * + * def __cinit__(BasisFunction self): # <<<<<<<<<<<<<< + * self.pruned = False + * self.children = [] + */ + +static int __pyx_pf_6_basis_13BasisFunction___cinit__(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__cinit__", 0); + + /* "_basis.pyx":16 + * + * def __cinit__(BasisFunction self): + * self.pruned = False # <<<<<<<<<<<<<< + * self.children = [] + * self.prunable = True + */ + __pyx_v_self->pruned = 0; + + /* "_basis.pyx":17 + * def __cinit__(BasisFunction self): + * self.pruned = False + * self.children = [] # <<<<<<<<<<<<<< + * self.prunable = True + * self.child_map = {} + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_v_self->children); + __Pyx_DECREF(((PyObject *)__pyx_v_self->children)); + __pyx_v_self->children = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "_basis.pyx":18 + * self.pruned = False + * self.children = [] + * self.prunable = True # <<<<<<<<<<<<<< + * self.child_map = {} + * self.splittable = True + */ + __pyx_v_self->prunable = 1; + + /* "_basis.pyx":19 + * self.children = [] + * self.prunable = True + * self.child_map = {} # <<<<<<<<<<<<<< + * self.splittable = True + * + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_v_self->child_map); + __Pyx_DECREF(((PyObject *)__pyx_v_self->child_map)); + __pyx_v_self->child_map = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "_basis.pyx":20 + * self.prunable = True + * self.child_map = {} + * self.splittable = True # <<<<<<<<<<<<<< + * + * def __reduce__(self): + */ + __pyx_v_self->splittable = 1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_basis.BasisFunction.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_13BasisFunction_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6_basis_13BasisFunction_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_13BasisFunction_2__reduce__(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":22 + * self.splittable = True + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * return (self.__class__, (), self._getstate()) + * + */ + +static PyObject *__pyx_pf_6_basis_13BasisFunction_2__reduce__(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce__", 0); + + /* "_basis.pyx":23 + * + * def __reduce__(self): + * return (self.__class__, (), self._getstate()) # <<<<<<<<<<<<<< + * + * def _get_root(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_empty_tuple)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_empty_tuple)); + __Pyx_GIVEREF(((PyObject *)__pyx_empty_tuple)); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("_basis.BasisFunction.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_13BasisFunction_5_get_root(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6_basis_13BasisFunction_5_get_root(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_get_root (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_13BasisFunction_4_get_root(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":25 + * return (self.__class__, (), self._getstate()) + * + * def _get_root(self): # <<<<<<<<<<<<<< + * return self.parent._get_root() + * + */ + +static PyObject *__pyx_pf_6_basis_13BasisFunction_4_get_root(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_get_root", 0); + + /* "_basis.pyx":26 + * + * def _get_root(self): + * return self.parent._get_root() # <<<<<<<<<<<<<< + * + * def _getstate(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->parent), __pyx_n_s___get_root); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("_basis.BasisFunction._get_root", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_13BasisFunction_7_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6_basis_13BasisFunction_7_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_getstate (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_13BasisFunction_6_getstate(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":28 + * return self.parent._get_root() + * + * def _getstate(self): # <<<<<<<<<<<<<< + * result = {'pruned': self.pruned, + * 'children': self.children, + */ + +static PyObject *__pyx_pf_6_basis_13BasisFunction_6_getstate(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self) { + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_getstate", 0); + + /* "_basis.pyx":29 + * + * def _getstate(self): + * result = {'pruned': self.pruned, # <<<<<<<<<<<<<< + * 'children': self.children, + * 'prunable': self.prunable, + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->pruned); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__pruned), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "_basis.pyx":30 + * def _getstate(self): + * result = {'pruned': self.pruned, + * 'children': self.children, # <<<<<<<<<<<<<< + * 'prunable': self.prunable, + * 'child_map': self.child_map, + */ + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__children), ((PyObject *)__pyx_v_self->children)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "_basis.pyx":31 + * result = {'pruned': self.pruned, + * 'children': self.children, + * 'prunable': self.prunable, # <<<<<<<<<<<<<< + * 'child_map': self.child_map, + * 'splittable': self.splittable} + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->prunable); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__prunable), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "_basis.pyx":32 + * 'children': self.children, + * 'prunable': self.prunable, + * 'child_map': self.child_map, # <<<<<<<<<<<<<< + * 'splittable': self.splittable} + * result.update(self._get_parent_state()) + */ + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__child_map), ((PyObject *)__pyx_v_self->child_map)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "_basis.pyx":33 + * 'prunable': self.prunable, + * 'child_map': self.child_map, + * 'splittable': self.splittable} # <<<<<<<<<<<<<< + * result.update(self._get_parent_state()) + * return result + */ + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->splittable); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__splittable), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_result = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "_basis.pyx":34 + * 'child_map': self.child_map, + * 'splittable': self.splittable} + * result.update(self._get_parent_state()) # <<<<<<<<<<<<<< + * return result + * + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_result), __pyx_n_s__update); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___get_parent_state); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "_basis.pyx":35 + * 'splittable': self.splittable} + * result.update(self._get_parent_state()) + * return result # <<<<<<<<<<<<<< + * + * def _get_parent_state(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_result)); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("_basis.BasisFunction._getstate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_13BasisFunction_9_get_parent_state(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6_basis_13BasisFunction_9_get_parent_state(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_get_parent_state (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_13BasisFunction_8_get_parent_state(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":37 + * return result + * + * def _get_parent_state(self): # <<<<<<<<<<<<<< + * return {'parent': self.parent} + * + */ + +static PyObject *__pyx_pf_6_basis_13BasisFunction_8_get_parent_state(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_get_parent_state", 0); + + /* "_basis.pyx":38 + * + * def _get_parent_state(self): + * return {'parent': self.parent} # <<<<<<<<<<<<<< + * + * def _set_parent_state(self, state): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__parent), ((PyObject *)__pyx_v_self->parent)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_basis.BasisFunction._get_parent_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_13BasisFunction_11_set_parent_state(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ +static PyObject *__pyx_pw_6_basis_13BasisFunction_11_set_parent_state(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_set_parent_state (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_13BasisFunction_10_set_parent_state(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self), ((PyObject *)__pyx_v_state)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":40 + * return {'parent': self.parent} + * + * def _set_parent_state(self, state): # <<<<<<<<<<<<<< + * self.parent = state['parent'] + * + */ + +static PyObject *__pyx_pf_6_basis_13BasisFunction_10_set_parent_state(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, PyObject *__pyx_v_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_set_parent_state", 0); + + /* "_basis.pyx":41 + * + * def _set_parent_state(self, state): + * self.parent = state['parent'] # <<<<<<<<<<<<<< + * + * def __setstate__(self, state): + */ + __pyx_t_1 = PyObject_GetItem(__pyx_v_state, ((PyObject *)__pyx_n_s__parent)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->parent); + __Pyx_DECREF(((PyObject *)__pyx_v_self->parent)); + __pyx_v_self->parent = ((struct __pyx_obj_6_basis_BasisFunction *)__pyx_t_1); + __pyx_t_1 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_basis.BasisFunction._set_parent_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_13BasisFunction_13__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ +static PyObject *__pyx_pw_6_basis_13BasisFunction_13__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_13BasisFunction_12__setstate__(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self), ((PyObject *)__pyx_v_state)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":43 + * self.parent = state['parent'] + * + * def __setstate__(self, state): # <<<<<<<<<<<<<< + * self.pruned = state['pruned'] + * self.children = state['children'] + */ + +static PyObject *__pyx_pf_6_basis_13BasisFunction_12__setstate__(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, PyObject *__pyx_v_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate__", 0); + + /* "_basis.pyx":44 + * + * def __setstate__(self, state): + * self.pruned = state['pruned'] # <<<<<<<<<<<<<< + * self.children = state['children'] + * self.prunable = state['prunable'] + */ + __pyx_t_1 = PyObject_GetItem(__pyx_v_state, ((PyObject *)__pyx_n_s__pruned)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->pruned = __pyx_t_2; + + /* "_basis.pyx":45 + * def __setstate__(self, state): + * self.pruned = state['pruned'] + * self.children = state['children'] # <<<<<<<<<<<<<< + * self.prunable = state['prunable'] + * self.child_map = state['child_map'] + */ + __pyx_t_1 = PyObject_GetItem(__pyx_v_state, ((PyObject *)__pyx_n_s__children)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->children); + __Pyx_DECREF(((PyObject *)__pyx_v_self->children)); + __pyx_v_self->children = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "_basis.pyx":46 + * self.pruned = state['pruned'] + * self.children = state['children'] + * self.prunable = state['prunable'] # <<<<<<<<<<<<<< + * self.child_map = state['child_map'] + * self.splittable = state['splittable'] + */ + __pyx_t_1 = PyObject_GetItem(__pyx_v_state, ((PyObject *)__pyx_n_s__prunable)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->prunable = __pyx_t_2; + + /* "_basis.pyx":47 + * self.children = state['children'] + * self.prunable = state['prunable'] + * self.child_map = state['child_map'] # <<<<<<<<<<<<<< + * self.splittable = state['splittable'] + * self._set_parent_state(state) + */ + __pyx_t_1 = PyObject_GetItem(__pyx_v_state, ((PyObject *)__pyx_n_s__child_map)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(PyDict_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected dict, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->child_map); + __Pyx_DECREF(((PyObject *)__pyx_v_self->child_map)); + __pyx_v_self->child_map = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "_basis.pyx":48 + * self.prunable = state['prunable'] + * self.child_map = state['child_map'] + * self.splittable = state['splittable'] # <<<<<<<<<<<<<< + * self._set_parent_state(state) + * + */ + __pyx_t_1 = PyObject_GetItem(__pyx_v_state, ((PyObject *)__pyx_n_s__splittable)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->splittable = __pyx_t_2; + + /* "_basis.pyx":49 + * self.child_map = state['child_map'] + * self.splittable = state['splittable'] + * self._set_parent_state(state) # <<<<<<<<<<<<<< + * + * def _eq(self, other): + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___set_parent_state); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_state); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("_basis.BasisFunction.__setstate__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_13BasisFunction_15_eq(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static PyObject *__pyx_pw_6_basis_13BasisFunction_15_eq(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_eq (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_13BasisFunction_14_eq(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self), ((PyObject *)__pyx_v_other)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":51 + * self._set_parent_state(state) + * + * def _eq(self, other): # <<<<<<<<<<<<<< + * if self.__class__ is not other.__class__: + * return False + */ + +static PyObject *__pyx_pf_6_basis_13BasisFunction_14_eq(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, PyObject *__pyx_v_other) { + PyObject *__pyx_v_self_state = NULL; + PyObject *__pyx_v_other_state = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_eq", 0); + + /* "_basis.pyx":52 + * + * def _eq(self, other): + * if self.__class__ is not other.__class__: # <<<<<<<<<<<<<< + * return False + * self_state = self._getstate() + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = (__pyx_t_1 != __pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_3) { + + /* "_basis.pyx":53 + * def _eq(self, other): + * if self.__class__ is not other.__class__: + * return False # <<<<<<<<<<<<<< + * self_state = self._getstate() + * other_state = other._getstate() + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "_basis.pyx":54 + * if self.__class__ is not other.__class__: + * return False + * self_state = self._getstate() # <<<<<<<<<<<<<< + * other_state = other._getstate() + * del self_state['children'] + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_self_state = __pyx_t_1; + __pyx_t_1 = 0; + + /* "_basis.pyx":55 + * return False + * self_state = self._getstate() + * other_state = other._getstate() # <<<<<<<<<<<<<< + * del self_state['children'] + * del self_state['child_map'] + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_other_state = __pyx_t_2; + __pyx_t_2 = 0; + + /* "_basis.pyx":56 + * self_state = self._getstate() + * other_state = other._getstate() + * del self_state['children'] # <<<<<<<<<<<<<< + * del self_state['child_map'] + * del other_state['children'] + */ + if (unlikely(!__pyx_v_self_state)) { __Pyx_RaiseUnboundLocalError("self_state"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (PyObject_DelItem(__pyx_v_self_state, ((PyObject *)__pyx_n_s__children)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "_basis.pyx":57 + * other_state = other._getstate() + * del self_state['children'] + * del self_state['child_map'] # <<<<<<<<<<<<<< + * del other_state['children'] + * del other_state['child_map'] + */ + if (unlikely(!__pyx_v_self_state)) { __Pyx_RaiseUnboundLocalError("self_state"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (PyObject_DelItem(__pyx_v_self_state, ((PyObject *)__pyx_n_s__child_map)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "_basis.pyx":58 + * del self_state['children'] + * del self_state['child_map'] + * del other_state['children'] # <<<<<<<<<<<<<< + * del other_state['child_map'] + * return self_state == other_state + */ + if (unlikely(!__pyx_v_other_state)) { __Pyx_RaiseUnboundLocalError("other_state"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (PyObject_DelItem(__pyx_v_other_state, ((PyObject *)__pyx_n_s__children)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "_basis.pyx":59 + * del self_state['child_map'] + * del other_state['children'] + * del other_state['child_map'] # <<<<<<<<<<<<<< + * return self_state == other_state + * + */ + if (unlikely(!__pyx_v_other_state)) { __Pyx_RaiseUnboundLocalError("other_state"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + if (PyObject_DelItem(__pyx_v_other_state, ((PyObject *)__pyx_n_s__child_map)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "_basis.pyx":60 + * del other_state['children'] + * del other_state['child_map'] + * return self_state == other_state # <<<<<<<<<<<<<< + * + * def __richcmp__(self, other, method): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyObject_RichCompare(__pyx_v_self_state, __pyx_v_other_state, Py_EQ); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("_basis.BasisFunction._eq", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_self_state); + __Pyx_XDECREF(__pyx_v_other_state); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_13BasisFunction_17__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_arg_method); /*proto*/ +static PyObject *__pyx_pw_6_basis_13BasisFunction_17__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_arg_method) { + PyObject *__pyx_v_method = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0); + __pyx_v_method = PyInt_FromLong(__pyx_arg_method); if (unlikely(!__pyx_v_method)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_v_method); + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("_basis.BasisFunction.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6_basis_13BasisFunction_16__richcmp__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other), ((PyObject *)__pyx_v_method)); + __Pyx_XDECREF(__pyx_v_method); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":62 + * return self_state == other_state + * + * def __richcmp__(self, other, method): # <<<<<<<<<<<<<< + * if method == 2: + * return self._eq(other) + */ + +static PyObject *__pyx_pf_6_basis_13BasisFunction_16__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_method) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__richcmp__", 0); + + /* "_basis.pyx":63 + * + * def __richcmp__(self, other, method): + * if method == 2: # <<<<<<<<<<<<<< + * return self._eq(other) + * elif method == 3: + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_method, __pyx_int_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "_basis.pyx":64 + * def __richcmp__(self, other, method): + * if method == 2: + * return self._eq(other) # <<<<<<<<<<<<<< + * elif method == 3: + * return not self._eq(other) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s___eq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_other); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_other); + __Pyx_GIVEREF(__pyx_v_other); + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + goto __pyx_L3; + } + + /* "_basis.pyx":65 + * if method == 2: + * return self._eq(other) + * elif method == 3: # <<<<<<<<<<<<<< + * return not self._eq(other) + * else: + */ + __pyx_t_4 = PyObject_RichCompare(__pyx_v_method, __pyx_int_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_2) { + + /* "_basis.pyx":66 + * return self._eq(other) + * elif method == 3: + * return not self._eq(other) # <<<<<<<<<<<<<< + * else: + * return NotImplemented + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s___eq); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_other); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_other); + __Pyx_GIVEREF(__pyx_v_other); + __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyBool_FromLong((!__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "_basis.pyx":68 + * return not self._eq(other) + * else: + * return NotImplemented # <<<<<<<<<<<<<< + * + * cpdef bint has_knot(BasisFunction self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_builtin_NotImplemented); + __pyx_r = __pyx_builtin_NotImplemented; + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("_basis.BasisFunction.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":70 + * return NotImplemented + * + * cpdef bint has_knot(BasisFunction self): # <<<<<<<<<<<<<< + * return False + * + */ + +static PyObject *__pyx_pw_6_basis_13BasisFunction_19has_knot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static int __pyx_f_6_basis_13BasisFunction_has_knot(CYTHON_UNUSED struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("has_knot", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__has_knot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_13BasisFunction_19has_knot)) { + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_basis.pyx":71 + * + * cpdef bint has_knot(BasisFunction self): + * return False # <<<<<<<<<<<<<< + * + * cpdef bint is_prunable(BasisFunction self): + */ + __pyx_r = 0; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_WriteUnraisable("_basis.BasisFunction.has_knot", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_13BasisFunction_19has_knot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6_basis_13BasisFunction_19has_knot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("has_knot (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_13BasisFunction_18has_knot(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":70 + * return NotImplemented + * + * cpdef bint has_knot(BasisFunction self): # <<<<<<<<<<<<<< + * return False + * + */ + +static PyObject *__pyx_pf_6_basis_13BasisFunction_18has_knot(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("has_knot", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->has_knot(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_basis.BasisFunction.has_knot", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":73 + * return False + * + * cpdef bint is_prunable(BasisFunction self): # <<<<<<<<<<<<<< + * return self.prunable + * + */ + +static PyObject *__pyx_pw_6_basis_13BasisFunction_21is_prunable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static int __pyx_f_6_basis_13BasisFunction_is_prunable(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_prunable", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__is_prunable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_13BasisFunction_21is_prunable)) { + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_basis.pyx":74 + * + * cpdef bint is_prunable(BasisFunction self): + * return self.prunable # <<<<<<<<<<<<<< + * + * cpdef bint is_pruned(BasisFunction self): + */ + __pyx_r = __pyx_v_self->prunable; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_WriteUnraisable("_basis.BasisFunction.is_prunable", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_13BasisFunction_21is_prunable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6_basis_13BasisFunction_21is_prunable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("is_prunable (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_13BasisFunction_20is_prunable(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":73 + * return False + * + * cpdef bint is_prunable(BasisFunction self): # <<<<<<<<<<<<<< + * return self.prunable + * + */ + +static PyObject *__pyx_pf_6_basis_13BasisFunction_20is_prunable(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_prunable", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->is_prunable(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_basis.BasisFunction.is_prunable", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":76 + * return self.prunable + * + * cpdef bint is_pruned(BasisFunction self): # <<<<<<<<<<<<<< + * return self.pruned + * + */ + +static PyObject *__pyx_pw_6_basis_13BasisFunction_23is_pruned(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static int __pyx_f_6_basis_13BasisFunction_is_pruned(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_pruned", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__is_pruned); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_13BasisFunction_23is_pruned)) { + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_basis.pyx":77 + * + * cpdef bint is_pruned(BasisFunction self): + * return self.pruned # <<<<<<<<<<<<<< + * + * cpdef bint is_splittable(BasisFunction self): + */ + __pyx_r = __pyx_v_self->pruned; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_WriteUnraisable("_basis.BasisFunction.is_pruned", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_13BasisFunction_23is_pruned(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6_basis_13BasisFunction_23is_pruned(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("is_pruned (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_13BasisFunction_22is_pruned(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":76 + * return self.prunable + * + * cpdef bint is_pruned(BasisFunction self): # <<<<<<<<<<<<<< + * return self.pruned + * + */ + +static PyObject *__pyx_pf_6_basis_13BasisFunction_22is_pruned(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_pruned", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->is_pruned(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_basis.BasisFunction.is_pruned", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":79 + * return self.pruned + * + * cpdef bint is_splittable(BasisFunction self): # <<<<<<<<<<<<<< + * return self.splittable + * + */ + +static PyObject *__pyx_pw_6_basis_13BasisFunction_25is_splittable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static int __pyx_f_6_basis_13BasisFunction_is_splittable(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_splittable", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__is_splittable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_13BasisFunction_25is_splittable)) { + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_basis.pyx":80 + * + * cpdef bint is_splittable(BasisFunction self): + * return self.splittable # <<<<<<<<<<<<<< + * + * cpdef bint make_splittable(BasisFunction self): + */ + __pyx_r = __pyx_v_self->splittable; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_WriteUnraisable("_basis.BasisFunction.is_splittable", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_13BasisFunction_25is_splittable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6_basis_13BasisFunction_25is_splittable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("is_splittable (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_13BasisFunction_24is_splittable(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":79 + * return self.pruned + * + * cpdef bint is_splittable(BasisFunction self): # <<<<<<<<<<<<<< + * return self.splittable + * + */ + +static PyObject *__pyx_pf_6_basis_13BasisFunction_24is_splittable(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("is_splittable", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->is_splittable(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_basis.BasisFunction.is_splittable", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":82 + * return self.splittable + * + * cpdef bint make_splittable(BasisFunction self): # <<<<<<<<<<<<<< + * self.splittable = True + * + */ + +static PyObject *__pyx_pw_6_basis_13BasisFunction_27make_splittable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static int __pyx_f_6_basis_13BasisFunction_make_splittable(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("make_splittable", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__make_splittable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_13BasisFunction_27make_splittable)) { + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_basis.pyx":83 + * + * cpdef bint make_splittable(BasisFunction self): + * self.splittable = True # <<<<<<<<<<<<<< + * + * cpdef bint make_unsplittable(BasisFunction self): + */ + __pyx_v_self->splittable = 1; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_WriteUnraisable("_basis.BasisFunction.make_splittable", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_13BasisFunction_27make_splittable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6_basis_13BasisFunction_27make_splittable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("make_splittable (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_13BasisFunction_26make_splittable(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":82 + * return self.splittable + * + * cpdef bint make_splittable(BasisFunction self): # <<<<<<<<<<<<<< + * self.splittable = True + * + */ + +static PyObject *__pyx_pf_6_basis_13BasisFunction_26make_splittable(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("make_splittable", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->make_splittable(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_basis.BasisFunction.make_splittable", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":85 + * self.splittable = True + * + * cpdef bint make_unsplittable(BasisFunction self): # <<<<<<<<<<<<<< + * self.splittable = False + * + */ + +static PyObject *__pyx_pw_6_basis_13BasisFunction_29make_unsplittable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static int __pyx_f_6_basis_13BasisFunction_make_unsplittable(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("make_unsplittable", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__make_unsplittable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_13BasisFunction_29make_unsplittable)) { + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_basis.pyx":86 + * + * cpdef bint make_unsplittable(BasisFunction self): + * self.splittable = False # <<<<<<<<<<<<<< + * + * cdef list get_children(BasisFunction self): + */ + __pyx_v_self->splittable = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_WriteUnraisable("_basis.BasisFunction.make_unsplittable", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_13BasisFunction_29make_unsplittable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6_basis_13BasisFunction_29make_unsplittable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("make_unsplittable (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_13BasisFunction_28make_unsplittable(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":85 + * self.splittable = True + * + * cpdef bint make_unsplittable(BasisFunction self): # <<<<<<<<<<<<<< + * self.splittable = False + * + */ + +static PyObject *__pyx_pf_6_basis_13BasisFunction_28make_unsplittable(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("make_unsplittable", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->make_unsplittable(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_basis.BasisFunction.make_unsplittable", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":88 + * self.splittable = False + * + * cdef list get_children(BasisFunction self): # <<<<<<<<<<<<<< + * return self.children + * + */ + +static PyObject *__pyx_f_6_basis_13BasisFunction_get_children(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_children", 0); + + /* "_basis.pyx":89 + * + * cdef list get_children(BasisFunction self): + * return self.children # <<<<<<<<<<<<<< + * + * cpdef _set_parent(self,BasisFunction parent): + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)__pyx_v_self->children)); + __pyx_r = __pyx_v_self->children; + goto __pyx_L0; + + __pyx_r = ((PyObject*)Py_None); __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":91 + * return self.children + * + * cpdef _set_parent(self,BasisFunction parent): # <<<<<<<<<<<<<< + * '''Calls _add_child.''' + * self.parent = parent + */ + +static PyObject *__pyx_pw_6_basis_13BasisFunction_31_set_parent(PyObject *__pyx_v_self, PyObject *__pyx_v_parent); /*proto*/ +static PyObject *__pyx_f_6_basis_13BasisFunction__set_parent(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, struct __pyx_obj_6_basis_BasisFunction *__pyx_v_parent, int __pyx_skip_dispatch) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_set_parent", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___set_parent); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_13BasisFunction_31_set_parent)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_v_parent)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_parent)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_parent)); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_basis.pyx":93 + * cpdef _set_parent(self,BasisFunction parent): + * '''Calls _add_child.''' + * self.parent = parent # <<<<<<<<<<<<<< + * self.parent._add_child(self) + * + */ + __Pyx_INCREF(((PyObject *)__pyx_v_parent)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_parent)); + __Pyx_GOTREF(__pyx_v_self->parent); + __Pyx_DECREF(((PyObject *)__pyx_v_self->parent)); + __pyx_v_self->parent = __pyx_v_parent; + + /* "_basis.pyx":94 + * '''Calls _add_child.''' + * self.parent = parent + * self.parent._add_child(self) # <<<<<<<<<<<<<< + * + * cpdef _add_child(self,BasisFunction child): + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_self->parent->__pyx_vtab)->_add_child(__pyx_v_self->parent, __pyx_v_self, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("_basis.BasisFunction._set_parent", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_13BasisFunction_31_set_parent(PyObject *__pyx_v_self, PyObject *__pyx_v_parent); /*proto*/ +static char __pyx_doc_6_basis_13BasisFunction_30_set_parent[] = "Calls _add_child."; +static PyObject *__pyx_pw_6_basis_13BasisFunction_31_set_parent(PyObject *__pyx_v_self, PyObject *__pyx_v_parent) { + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_set_parent (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parent), __pyx_ptype_6_basis_BasisFunction, 1, "parent", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_6_basis_13BasisFunction_30_set_parent(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self), ((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_parent)); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":91 + * return self.children + * + * cpdef _set_parent(self,BasisFunction parent): # <<<<<<<<<<<<<< + * '''Calls _add_child.''' + * self.parent = parent + */ + +static PyObject *__pyx_pf_6_basis_13BasisFunction_30_set_parent(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, struct __pyx_obj_6_basis_BasisFunction *__pyx_v_parent) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_set_parent", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->_set_parent(__pyx_v_self, __pyx_v_parent, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_basis.BasisFunction._set_parent", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":96 + * self.parent._add_child(self) + * + * cpdef _add_child(self,BasisFunction child): # <<<<<<<<<<<<<< + * '''Called by _set_parent.''' + * cdef INDEX_t n = len(self.children) + */ + +static PyObject *__pyx_pw_6_basis_13BasisFunction_33_add_child(PyObject *__pyx_v_self, PyObject *__pyx_v_child); /*proto*/ +static PyObject *__pyx_f_6_basis_13BasisFunction__add_child(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, struct __pyx_obj_6_basis_BasisFunction *__pyx_v_child, int __pyx_skip_dispatch) { + __pyx_t_6_basis_INDEX_t __pyx_v_n; + int __pyx_v_var; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_add_child", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___add_child); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_13BasisFunction_33_add_child)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_v_child)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_child)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_child)); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_basis.pyx":98 + * cpdef _add_child(self,BasisFunction child): + * '''Called by _set_parent.''' + * cdef INDEX_t n = len(self.children) # <<<<<<<<<<<<<< + * self.children.append(child) + * cdef int var = child.get_variable() + */ + __pyx_t_1 = ((PyObject *)__pyx_v_self->children); + __Pyx_INCREF(__pyx_t_1); + if (unlikely(__pyx_t_1 == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_4 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_n = __pyx_t_4; + + /* "_basis.pyx":99 + * '''Called by _set_parent.''' + * cdef INDEX_t n = len(self.children) + * self.children.append(child) # <<<<<<<<<<<<<< + * cdef int var = child.get_variable() + * if var in self.child_map: + */ + if (unlikely(((PyObject *)__pyx_v_self->children) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_self->children, ((PyObject *)__pyx_v_child)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "_basis.pyx":100 + * cdef INDEX_t n = len(self.children) + * self.children.append(child) + * cdef int var = child.get_variable() # <<<<<<<<<<<<<< + * if var in self.child_map: + * self.child_map[var].append(n) + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_child), __pyx_n_s__get_variable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_var = __pyx_t_6; + + /* "_basis.pyx":101 + * self.children.append(child) + * cdef int var = child.get_variable() + * if var in self.child_map: # <<<<<<<<<<<<<< + * self.child_map[var].append(n) + * else: + */ + __pyx_t_3 = PyInt_FromLong(__pyx_v_var); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (unlikely(((PyObject *)__pyx_v_self->child_map) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_7 = (__Pyx_PyDict_Contains(__pyx_t_3, ((PyObject *)__pyx_v_self->child_map), Py_EQ)); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + + /* "_basis.pyx":102 + * cdef int var = child.get_variable() + * if var in self.child_map: + * self.child_map[var].append(n) # <<<<<<<<<<<<<< + * else: + * self.child_map[var] = [n] + */ + if (unlikely(((PyObject *)__pyx_v_self->child_map) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->child_map), __pyx_v_var, sizeof(int), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_Append(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L3; + } + /*else*/ { + + /* "_basis.pyx":104 + * self.child_map[var].append(n) + * else: + * self.child_map[var] = [n] # <<<<<<<<<<<<<< + * + * cpdef BasisFunction get_parent(self): + */ + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_n); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyList_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + if (unlikely(((PyObject *)__pyx_v_self->child_map) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_self->child_map), __pyx_v_var, ((PyObject *)__pyx_t_1), sizeof(int), PyInt_FromLong, 0, 0, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("_basis.BasisFunction._add_child", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_13BasisFunction_33_add_child(PyObject *__pyx_v_self, PyObject *__pyx_v_child); /*proto*/ +static char __pyx_doc_6_basis_13BasisFunction_32_add_child[] = "Called by _set_parent."; +static PyObject *__pyx_pw_6_basis_13BasisFunction_33_add_child(PyObject *__pyx_v_self, PyObject *__pyx_v_child) { + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_add_child (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_child), __pyx_ptype_6_basis_BasisFunction, 1, "child", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_6_basis_13BasisFunction_32_add_child(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self), ((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_child)); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":96 + * self.parent._add_child(self) + * + * cpdef _add_child(self,BasisFunction child): # <<<<<<<<<<<<<< + * '''Called by _set_parent.''' + * cdef INDEX_t n = len(self.children) + */ + +static PyObject *__pyx_pf_6_basis_13BasisFunction_32_add_child(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, struct __pyx_obj_6_basis_BasisFunction *__pyx_v_child) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_add_child", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->_add_child(__pyx_v_self, __pyx_v_child, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_basis.BasisFunction._add_child", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":106 + * self.child_map[var] = [n] + * + * cpdef BasisFunction get_parent(self): # <<<<<<<<<<<<<< + * return self.parent + * + */ + +static PyObject *__pyx_pw_6_basis_13BasisFunction_35get_parent(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static struct __pyx_obj_6_basis_BasisFunction *__pyx_f_6_basis_13BasisFunction_get_parent(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { + struct __pyx_obj_6_basis_BasisFunction *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_parent", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_parent); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_13BasisFunction_35get_parent)) { + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((struct __pyx_obj_6_basis_BasisFunction *)__pyx_t_2); + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_basis.pyx":107 + * + * cpdef BasisFunction get_parent(self): + * return self.parent # <<<<<<<<<<<<<< + * + * cpdef prune(self): + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)__pyx_v_self->parent)); + __pyx_r = __pyx_v_self->parent; + goto __pyx_L0; + + __pyx_r = ((struct __pyx_obj_6_basis_BasisFunction *)Py_None); __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("_basis.BasisFunction.get_parent", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_13BasisFunction_35get_parent(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6_basis_13BasisFunction_35get_parent(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_parent (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_13BasisFunction_34get_parent(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":106 + * self.child_map[var] = [n] + * + * cpdef BasisFunction get_parent(self): # <<<<<<<<<<<<<< + * return self.parent + * + */ + +static PyObject *__pyx_pf_6_basis_13BasisFunction_34get_parent(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_parent", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->get_parent(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_basis.BasisFunction.get_parent", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":109 + * return self.parent + * + * cpdef prune(self): # <<<<<<<<<<<<<< + * self.pruned = True + * + */ + +static PyObject *__pyx_pw_6_basis_13BasisFunction_37prune(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_f_6_basis_13BasisFunction_prune(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("prune", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__prune); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_13BasisFunction_37prune)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_basis.pyx":110 + * + * cpdef prune(self): + * self.pruned = True # <<<<<<<<<<<<<< + * + * cpdef unprune(self): + */ + __pyx_v_self->pruned = 1; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("_basis.BasisFunction.prune", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_13BasisFunction_37prune(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6_basis_13BasisFunction_37prune(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("prune (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_13BasisFunction_36prune(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":109 + * return self.parent + * + * cpdef prune(self): # <<<<<<<<<<<<<< + * self.pruned = True + * + */ + +static PyObject *__pyx_pf_6_basis_13BasisFunction_36prune(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("prune", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->prune(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_basis.BasisFunction.prune", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":112 + * self.pruned = True + * + * cpdef unprune(self): # <<<<<<<<<<<<<< + * self.pruned = False + * + */ + +static PyObject *__pyx_pw_6_basis_13BasisFunction_39unprune(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_f_6_basis_13BasisFunction_unprune(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("unprune", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__unprune); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_13BasisFunction_39unprune)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_basis.pyx":113 + * + * cpdef unprune(self): + * self.pruned = False # <<<<<<<<<<<<<< + * + * cpdef knots(BasisFunction self, INDEX_t variable): + */ + __pyx_v_self->pruned = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("_basis.BasisFunction.unprune", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_13BasisFunction_39unprune(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6_basis_13BasisFunction_39unprune(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("unprune (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_13BasisFunction_38unprune(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":112 + * self.pruned = True + * + * cpdef unprune(self): # <<<<<<<<<<<<<< + * self.pruned = False + * + */ + +static PyObject *__pyx_pf_6_basis_13BasisFunction_38unprune(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("unprune", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->unprune(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_basis.BasisFunction.unprune", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":115 + * self.pruned = False + * + * cpdef knots(BasisFunction self, INDEX_t variable): # <<<<<<<<<<<<<< + * + * cdef list children + */ + +static PyObject *__pyx_pw_6_basis_13BasisFunction_41knots(PyObject *__pyx_v_self, PyObject *__pyx_arg_variable); /*proto*/ +static PyObject *__pyx_f_6_basis_13BasisFunction_knots(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, __pyx_t_6_basis_INDEX_t __pyx_v_variable, int __pyx_skip_dispatch) { + PyObject *__pyx_v_children = 0; + struct __pyx_obj_6_basis_BasisFunction *__pyx_v_child = 0; + __pyx_t_6_basis_INDEX_t __pyx_v_n; + __pyx_t_6_basis_INDEX_t __pyx_v_i; + PyObject *__pyx_v_result = 0; + int __pyx_v_idx; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + Py_ssize_t __pyx_t_5; + __pyx_t_6_basis_INDEX_t __pyx_t_6; + __pyx_t_6_basis_INDEX_t __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("knots", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__knots); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_13BasisFunction_41knots)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_basis.pyx":119 + * cdef list children + * cdef BasisFunction child + * if variable in self.child_map: # <<<<<<<<<<<<<< + * children = self.child_map[variable] + * else: + */ + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (unlikely(((PyObject *)__pyx_v_self->child_map) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_4 = (__Pyx_PyDict_Contains(__pyx_t_1, ((PyObject *)__pyx_v_self->child_map), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_4) { + + /* "_basis.pyx":120 + * cdef BasisFunction child + * if variable in self.child_map: + * children = self.child_map[variable] # <<<<<<<<<<<<<< + * else: + * return [] + */ + if (unlikely(((PyObject *)__pyx_v_self->child_map) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->child_map), __pyx_v_variable, sizeof(__pyx_t_6_basis_INDEX_t)+1, __Pyx_PyInt_to_py_npy_ulonglong, 0, 0, 0); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_children = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L3; + } + /*else*/ { + + /* "_basis.pyx":122 + * children = self.child_map[variable] + * else: + * return [] # <<<<<<<<<<<<<< + * cdef INDEX_t n = len(children) + * cdef INDEX_t i + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + } + __pyx_L3:; + + /* "_basis.pyx":123 + * else: + * return [] + * cdef INDEX_t n = len(children) # <<<<<<<<<<<<<< + * cdef INDEX_t i + * cdef list result = [] + */ + if (unlikely(((PyObject *)__pyx_v_children) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_5 = PyList_GET_SIZE(((PyObject *)__pyx_v_children)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_n = __pyx_t_5; + + /* "_basis.pyx":125 + * cdef INDEX_t n = len(children) + * cdef INDEX_t i + * cdef list result = [] # <<<<<<<<<<<<<< + * cdef int idx + * for i in range(n): + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_result = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "_basis.pyx":127 + * cdef list result = [] + * cdef int idx + * for i in range(n): # <<<<<<<<<<<<<< + * idx = children[i] + * child = self.get_children()[idx] + */ + __pyx_t_6 = __pyx_v_n; + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { + __pyx_v_i = __pyx_t_7; + + /* "_basis.pyx":128 + * cdef int idx + * for i in range(n): + * idx = children[i] # <<<<<<<<<<<<<< + * child = self.get_children()[idx] + * if child.has_knot(): + */ + if (unlikely(((PyObject *)__pyx_v_children) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_8 = __Pyx_PyInt_AsInt(PyList_GET_ITEM(__pyx_v_children, __pyx_v_i)); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_idx = __pyx_t_8; + + /* "_basis.pyx":129 + * for i in range(n): + * idx = children[i] + * child = self.get_children()[idx] # <<<<<<<<<<<<<< + * if child.has_knot(): + * result.append(child.get_knot_idx()) + */ + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->get_children(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (unlikely(__pyx_t_1 == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + if (!(likely(((PyList_GET_ITEM(__pyx_t_1, __pyx_v_idx)) == Py_None) || likely(__Pyx_TypeTest(PyList_GET_ITEM(__pyx_t_1, __pyx_v_idx), __pyx_ptype_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_v_idx); + __Pyx_INCREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_XDECREF(((PyObject *)__pyx_v_child)); + __pyx_v_child = ((struct __pyx_obj_6_basis_BasisFunction *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "_basis.pyx":130 + * idx = children[i] + * child = self.get_children()[idx] + * if child.has_knot(): # <<<<<<<<<<<<<< + * result.append(child.get_knot_idx()) + * return result + */ + __pyx_t_4 = ((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_child->__pyx_vtab)->has_knot(__pyx_v_child, 0); + if (__pyx_t_4) { + + /* "_basis.pyx":131 + * child = self.get_children()[idx] + * if child.has_knot(): + * result.append(child.get_knot_idx()) # <<<<<<<<<<<<<< + * return result + * + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_child), __pyx_n_s__get_knot_idx); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_1); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L6; + } + __pyx_L6:; + } + + /* "_basis.pyx":132 + * if child.has_knot(): + * result.append(child.get_knot_idx()) + * return result # <<<<<<<<<<<<<< + * + * cpdef INDEX_t degree(BasisFunction self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_result)); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("_basis.BasisFunction.knots", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_children); + __Pyx_XDECREF((PyObject *)__pyx_v_child); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_13BasisFunction_41knots(PyObject *__pyx_v_self, PyObject *__pyx_arg_variable); /*proto*/ +static PyObject *__pyx_pw_6_basis_13BasisFunction_41knots(PyObject *__pyx_v_self, PyObject *__pyx_arg_variable) { + __pyx_t_6_basis_INDEX_t __pyx_v_variable; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("knots (wrapper)", 0); + assert(__pyx_arg_variable); { + __pyx_v_variable = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_arg_variable); if (unlikely((__pyx_v_variable == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("_basis.BasisFunction.knots", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6_basis_13BasisFunction_40knots(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self), ((__pyx_t_6_basis_INDEX_t)__pyx_v_variable)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":115 + * self.pruned = False + * + * cpdef knots(BasisFunction self, INDEX_t variable): # <<<<<<<<<<<<<< + * + * cdef list children + */ + +static PyObject *__pyx_pf_6_basis_13BasisFunction_40knots(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, __pyx_t_6_basis_INDEX_t __pyx_v_variable) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("knots", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->knots(__pyx_v_self, __pyx_v_variable, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_basis.BasisFunction.knots", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":134 + * return result + * + * cpdef INDEX_t degree(BasisFunction self): # <<<<<<<<<<<<<< + * return self.parent.degree() + 1 + * + */ + +static PyObject *__pyx_pw_6_basis_13BasisFunction_43degree(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static __pyx_t_6_basis_INDEX_t __pyx_f_6_basis_13BasisFunction_degree(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { + __pyx_t_6_basis_INDEX_t __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __pyx_t_6_basis_INDEX_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("degree", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__degree); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_13BasisFunction_43degree)) { + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_basis.pyx":135 + * + * cpdef INDEX_t degree(BasisFunction self): + * return self.parent.degree() + 1 # <<<<<<<<<<<<<< + * + * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = True): + */ + __pyx_r = (((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_self->parent->__pyx_vtab)->degree(__pyx_v_self->parent, 0) + 1); + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_WriteUnraisable("_basis.BasisFunction.degree", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_13BasisFunction_43degree(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6_basis_13BasisFunction_43degree(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("degree (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_13BasisFunction_42degree(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":134 + * return result + * + * cpdef INDEX_t degree(BasisFunction self): # <<<<<<<<<<<<<< + * return self.parent.degree() + 1 + * + */ + +static PyObject *__pyx_pf_6_basis_13BasisFunction_42degree(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("degree", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->degree(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_basis.BasisFunction.degree", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":137 + * return self.parent.degree() + 1 + * + * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = True): # <<<<<<<<<<<<<< + * ''' + * X - Data matrix + */ + +static PyObject *__pyx_pw_6_basis_13BasisFunction_45apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_6_basis_13BasisFunction_apply(CYTHON_UNUSED struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, CYTHON_UNUSED PyArrayObject *__pyx_v_X, CYTHON_UNUSED PyArrayObject *__pyx_v_b, int __pyx_skip_dispatch, struct __pyx_opt_args_6_basis_13BasisFunction_apply *__pyx_optional_args) { + int __pyx_v_recurse = ((int)1); + __Pyx_LocalBuf_ND __pyx_pybuffernd_X; + __Pyx_Buffer __pyx_pybuffer_X; + __Pyx_LocalBuf_ND __pyx_pybuffernd_b; + __Pyx_Buffer __pyx_pybuffer_b; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("apply", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_recurse = __pyx_optional_args->recurse; + } + } + __pyx_pybuffer_X.pybuffer.buf = NULL; + __pyx_pybuffer_X.refcount = 0; + __pyx_pybuffernd_X.data = NULL; + __pyx_pybuffernd_X.rcbuffer = &__pyx_pybuffer_X; + __pyx_pybuffer_b.pybuffer.buf = NULL; + __pyx_pybuffer_b.refcount = 0; + __pyx_pybuffernd_b.data = NULL; + __pyx_pybuffernd_b.rcbuffer = &__pyx_pybuffer_b; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)__pyx_v_b, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_b.diminfo[0].strides = __pyx_pybuffernd_b.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_b.diminfo[0].shape = __pyx_pybuffernd_b.rcbuffer->pybuffer.shape[0]; + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__apply); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_13BasisFunction_45apply)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_recurse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_X)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_X)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_X)); + __Pyx_INCREF(((PyObject *)__pyx_v_b)); + PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_b)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_b)); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_basis.pyx":145 + * ''' + * + * cpdef cnp.ndarray[INT_t, ndim=1] valid_knots(BasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] values, cnp.ndarray[FLOAT_t,ndim=1] variable, int variable_idx, INDEX_t check_every, int endspan, int minspan, FLOAT_t minspan_alpha, INDEX_t n, cnp.ndarray[INT_t,ndim=1] workspace): # <<<<<<<<<<<<<< + * ''' + * values - The unsorted values of self in the data set + */ + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_b.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("_basis.BasisFunction.apply", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_b.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_13BasisFunction_45apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6_basis_13BasisFunction_44apply[] = "\n X - Data matrix\n b - parent vector\n recurse - If False, assume b already contains the result of the parent function. Otherwise, recurse to compute\n parent function.\n "; +static PyObject *__pyx_pw_6_basis_13BasisFunction_45apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_X = 0; + PyArrayObject *__pyx_v_b = 0; + int __pyx_v_recurse; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("apply (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__b,&__pyx_n_s__recurse,0}; + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__b)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("apply", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__recurse); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_X = ((PyArrayObject *)values[0]); + __pyx_v_b = ((PyArrayObject *)values[1]); + if (values[2]) { + __pyx_v_recurse = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_recurse == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + + /* "_basis.pyx":137 + * return self.parent.degree() + 1 + * + * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = True): # <<<<<<<<<<<<<< + * ''' + * X - Data matrix + */ + __pyx_v_recurse = ((int)1); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("apply", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("_basis.BasisFunction.apply", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_5numpy_ndarray, 1, "b", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_6_basis_13BasisFunction_44apply(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self), __pyx_v_X, __pyx_v_b, __pyx_v_recurse); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6_basis_13BasisFunction_44apply(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_b, int __pyx_v_recurse) { + __Pyx_LocalBuf_ND __pyx_pybuffernd_X; + __Pyx_Buffer __pyx_pybuffer_X; + __Pyx_LocalBuf_ND __pyx_pybuffernd_b; + __Pyx_Buffer __pyx_pybuffer_b; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + struct __pyx_opt_args_6_basis_13BasisFunction_apply __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("apply", 0); + __pyx_pybuffer_X.pybuffer.buf = NULL; + __pyx_pybuffer_X.refcount = 0; + __pyx_pybuffernd_X.data = NULL; + __pyx_pybuffernd_X.rcbuffer = &__pyx_pybuffer_X; + __pyx_pybuffer_b.pybuffer.buf = NULL; + __pyx_pybuffer_b.refcount = 0; + __pyx_pybuffernd_b.data = NULL; + __pyx_pybuffernd_b.rcbuffer = &__pyx_pybuffer_b; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)__pyx_v_b, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_b.diminfo[0].strides = __pyx_pybuffernd_b.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_b.diminfo[0].shape = __pyx_pybuffernd_b.rcbuffer->pybuffer.shape[0]; + __Pyx_XDECREF(__pyx_r); + __pyx_t_2.__pyx_n = 1; + __pyx_t_2.recurse = __pyx_v_recurse; + __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->apply(__pyx_v_self, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_b), 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_b.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("_basis.BasisFunction.apply", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_b.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":145 + * ''' + * + * cpdef cnp.ndarray[INT_t, ndim=1] valid_knots(BasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] values, cnp.ndarray[FLOAT_t,ndim=1] variable, int variable_idx, INDEX_t check_every, int endspan, int minspan, FLOAT_t minspan_alpha, INDEX_t n, cnp.ndarray[INT_t,ndim=1] workspace): # <<<<<<<<<<<<<< + * ''' + * values - The unsorted values of self in the data set + */ + +static PyObject *__pyx_pw_6_basis_13BasisFunction_47valid_knots(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_variable, int __pyx_v_variable_idx, __pyx_t_6_basis_INDEX_t __pyx_v_check_every, int __pyx_v_endspan, int __pyx_v_minspan, __pyx_t_6_basis_FLOAT_t __pyx_v_minspan_alpha, __pyx_t_6_basis_INDEX_t __pyx_v_n, PyArrayObject *__pyx_v_workspace, int __pyx_skip_dispatch) { + __pyx_t_6_basis_INDEX_t __pyx_v_i; + __pyx_t_6_basis_INDEX_t __pyx_v_j; + __pyx_t_6_basis_INDEX_t __pyx_v_k; + __pyx_t_6_basis_INDEX_t __pyx_v_m; + __pyx_t_6_basis_INT_t __pyx_v_int_tmp; + __pyx_t_6_basis_INDEX_t __pyx_v_count; + int __pyx_v_minspan_; + PyArrayObject *__pyx_v_result = 0; + __pyx_t_6_basis_INDEX_t __pyx_v_num_used; + __pyx_t_6_basis_INDEX_t __pyx_v_prev; + int __pyx_v_idx; + int __pyx_v_last_idx; + __pyx_t_6_basis_FLOAT_t __pyx_v_first_var_value; + __pyx_t_6_basis_FLOAT_t __pyx_v_last_var_value; + PyObject *__pyx_v_used_knots = 0; + __Pyx_LocalBuf_ND __pyx_pybuffernd_result; + __Pyx_Buffer __pyx_pybuffer_result; + __Pyx_LocalBuf_ND __pyx_pybuffernd_values; + __Pyx_Buffer __pyx_pybuffer_values; + __Pyx_LocalBuf_ND __pyx_pybuffernd_variable; + __Pyx_Buffer __pyx_pybuffer_variable; + __Pyx_LocalBuf_ND __pyx_pybuffernd_workspace; + __Pyx_Buffer __pyx_pybuffer_workspace; + PyArrayObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7 = NULL; + PyObject *__pyx_t_8 = NULL; + __pyx_t_6_basis_INDEX_t __pyx_t_9; + __pyx_t_6_basis_INDEX_t __pyx_t_10; + int __pyx_t_11; + __pyx_t_6_basis_INDEX_t __pyx_t_12; + __pyx_t_6_basis_INDEX_t __pyx_t_13; + __pyx_t_6_basis_INDEX_t __pyx_t_14; + int __pyx_t_15; + __pyx_t_6_basis_INDEX_t __pyx_t_16; + __pyx_t_6_basis_INDEX_t __pyx_t_17; + __pyx_t_6_basis_INDEX_t __pyx_t_18; + __pyx_t_6_basis_INDEX_t __pyx_t_19; + __pyx_t_6_basis_INDEX_t __pyx_t_20; + Py_ssize_t __pyx_t_21; + int __pyx_t_22; + int __pyx_t_23; + int __pyx_t_24; + __pyx_t_6_basis_INDEX_t __pyx_t_25; + __pyx_t_6_basis_INT_t __pyx_t_26; + __pyx_t_6_basis_INDEX_t __pyx_t_27; + __pyx_t_6_basis_INDEX_t __pyx_t_28; + __pyx_t_6_basis_INDEX_t __pyx_t_29; + __pyx_t_6_basis_INDEX_t __pyx_t_30; + __pyx_t_6_basis_INDEX_t __pyx_t_31; + __pyx_t_6_basis_INDEX_t __pyx_t_32; + __pyx_t_6_basis_INDEX_t __pyx_t_33; + __pyx_t_6_basis_INDEX_t __pyx_t_34; + __pyx_t_6_basis_INDEX_t __pyx_t_35; + __pyx_t_6_basis_INDEX_t __pyx_t_36; + __pyx_t_6_basis_INDEX_t __pyx_t_37; + __pyx_t_6_basis_INDEX_t __pyx_t_38; + __pyx_t_6_basis_INDEX_t __pyx_t_39; + __pyx_t_6_basis_INDEX_t __pyx_t_40; + __pyx_t_6_basis_INDEX_t __pyx_t_41; + PyArrayObject *__pyx_t_42 = NULL; + int __pyx_t_43; + PyObject *__pyx_t_44 = NULL; + PyObject *__pyx_t_45 = NULL; + PyObject *__pyx_t_46 = NULL; + __pyx_t_6_basis_INDEX_t __pyx_t_47; + __pyx_t_6_basis_INDEX_t __pyx_t_48; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("valid_knots", 0); + __pyx_pybuffer_result.pybuffer.buf = NULL; + __pyx_pybuffer_result.refcount = 0; + __pyx_pybuffernd_result.data = NULL; + __pyx_pybuffernd_result.rcbuffer = &__pyx_pybuffer_result; + __pyx_pybuffer_values.pybuffer.buf = NULL; + __pyx_pybuffer_values.refcount = 0; + __pyx_pybuffernd_values.data = NULL; + __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values; + __pyx_pybuffer_variable.pybuffer.buf = NULL; + __pyx_pybuffer_variable.refcount = 0; + __pyx_pybuffernd_variable.data = NULL; + __pyx_pybuffernd_variable.rcbuffer = &__pyx_pybuffer_variable; + __pyx_pybuffer_workspace.pybuffer.buf = NULL; + __pyx_pybuffer_workspace.refcount = 0; + __pyx_pybuffernd_workspace.data = NULL; + __pyx_pybuffernd_workspace.rcbuffer = &__pyx_pybuffer_workspace; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_variable.rcbuffer->pybuffer, (PyObject*)__pyx_v_variable, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_variable.diminfo[0].strides = __pyx_pybuffernd_variable.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_variable.diminfo[0].shape = __pyx_pybuffernd_variable.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_workspace.rcbuffer->pybuffer, (PyObject*)__pyx_v_workspace, &__Pyx_TypeInfo_nn___pyx_t_6_basis_INT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_workspace.diminfo[0].strides = __pyx_pybuffernd_workspace.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_workspace.diminfo[0].shape = __pyx_pybuffernd_workspace.rcbuffer->pybuffer.shape[0]; + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__valid_knots); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_13BasisFunction_47valid_knots)) { + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_2 = PyInt_FromLong(__pyx_v_variable_idx); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_check_every); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyInt_FromLong(__pyx_v_endspan); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyInt_FromLong(__pyx_v_minspan); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyFloat_FromDouble(__pyx_v_minspan_alpha); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_n); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = PyTuple_New(9); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_INCREF(((PyObject *)__pyx_v_values)); + PyTuple_SET_ITEM(__pyx_t_8, 0, ((PyObject *)__pyx_v_values)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_values)); + __Pyx_INCREF(((PyObject *)__pyx_v_variable)); + PyTuple_SET_ITEM(__pyx_t_8, 1, ((PyObject *)__pyx_v_variable)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_variable)); + PyTuple_SET_ITEM(__pyx_t_8, 2, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_8, 3, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_8, 4, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_8, 5, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_8, 6, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_8, 7, __pyx_t_7); + __Pyx_GIVEREF(__pyx_t_7); + __Pyx_INCREF(((PyObject *)__pyx_v_workspace)); + PyTuple_SET_ITEM(__pyx_t_8, 8, ((PyObject *)__pyx_v_workspace)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_workspace)); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_6 = 0; + __pyx_t_7 = 0; + __pyx_t_7 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_8), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((PyArrayObject *)__pyx_t_7); + __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_basis.pyx":155 + * cdef INDEX_t j + * cdef INDEX_t k + * cdef INDEX_t m = values.shape[0] # <<<<<<<<<<<<<< + * cdef FLOAT_t float_tmp + * cdef INT_t int_tmp + */ + __pyx_v_m = (__pyx_v_values->dimensions[0]); + + /* "_basis.pyx":166 + * cdef int idx + * cdef int last_idx + * cdef FLOAT_t first_var_value = variable[m-1] # <<<<<<<<<<<<<< + * cdef FLOAT_t last_var_value = variable[m-1] + * + */ + __pyx_t_9 = (__pyx_v_m - 1); + __pyx_v_first_var_value = (*__Pyx_BufPtrStrided1d(__pyx_t_6_basis_FLOAT_t *, __pyx_pybuffernd_variable.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_variable.diminfo[0].strides)); + + /* "_basis.pyx":167 + * cdef int last_idx + * cdef FLOAT_t first_var_value = variable[m-1] + * cdef FLOAT_t last_var_value = variable[m-1] # <<<<<<<<<<<<<< + * + * #Calculate the used knots + */ + __pyx_t_10 = (__pyx_v_m - 1); + __pyx_v_last_var_value = (*__Pyx_BufPtrStrided1d(__pyx_t_6_basis_FLOAT_t *, __pyx_pybuffernd_variable.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_variable.diminfo[0].strides)); + + /* "_basis.pyx":170 + * + * #Calculate the used knots + * cdef list used_knots = self.knots(variable_idx) # <<<<<<<<<<<<<< + * used_knots.sort() + * + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->knots(__pyx_v_self, __pyx_v_variable_idx, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_used_knots = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "_basis.pyx":171 + * #Calculate the used knots + * cdef list used_knots = self.knots(variable_idx) + * used_knots.sort() # <<<<<<<<<<<<<< + * + * #Initialize workspace to 1 where value is nonzero + */ + if (unlikely(((PyObject *)__pyx_v_used_knots) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "sort"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_11 = PyList_Sort(((PyObject *)__pyx_v_used_knots)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "_basis.pyx":177 + * #where value is nonzero and last_var_value to the + * #minimum variable where value is nonzero + * count = 0 # <<<<<<<<<<<<<< + * for i in range(m): + * if abs(values[i]) > ZERO_TOL: + */ + __pyx_v_count = 0; + + /* "_basis.pyx":178 + * #minimum variable where value is nonzero + * count = 0 + * for i in range(m): # <<<<<<<<<<<<<< + * if abs(values[i]) > ZERO_TOL: + * workspace[i] = 1 + */ + __pyx_t_12 = __pyx_v_m; + for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { + __pyx_v_i = __pyx_t_13; + + /* "_basis.pyx":179 + * count = 0 + * for i in range(m): + * if abs(values[i]) > ZERO_TOL: # <<<<<<<<<<<<<< + * workspace[i] = 1 + * count += 1 + */ + __pyx_t_14 = __pyx_v_i; + __pyx_t_15 = (fabs((*__Pyx_BufPtrStrided1d(__pyx_t_6_basis_FLOAT_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_values.diminfo[0].strides))) > __pyx_v_6_basis_ZERO_TOL); + if (__pyx_t_15) { + + /* "_basis.pyx":180 + * for i in range(m): + * if abs(values[i]) > ZERO_TOL: + * workspace[i] = 1 # <<<<<<<<<<<<<< + * count += 1 + * if variable[i] >= first_var_value: + */ + __pyx_t_16 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_workspace.diminfo[0].strides) = 1; + + /* "_basis.pyx":181 + * if abs(values[i]) > ZERO_TOL: + * workspace[i] = 1 + * count += 1 # <<<<<<<<<<<<<< + * if variable[i] >= first_var_value: + * first_var_value = variable[i] + */ + __pyx_v_count = (__pyx_v_count + 1); + + /* "_basis.pyx":182 + * workspace[i] = 1 + * count += 1 + * if variable[i] >= first_var_value: # <<<<<<<<<<<<<< + * first_var_value = variable[i] + * last_var_value = variable[i] + */ + __pyx_t_17 = __pyx_v_i; + __pyx_t_15 = ((*__Pyx_BufPtrStrided1d(__pyx_t_6_basis_FLOAT_t *, __pyx_pybuffernd_variable.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_variable.diminfo[0].strides)) >= __pyx_v_first_var_value); + if (__pyx_t_15) { + + /* "_basis.pyx":183 + * count += 1 + * if variable[i] >= first_var_value: + * first_var_value = variable[i] # <<<<<<<<<<<<<< + * last_var_value = variable[i] + * else: + */ + __pyx_t_18 = __pyx_v_i; + __pyx_v_first_var_value = (*__Pyx_BufPtrStrided1d(__pyx_t_6_basis_FLOAT_t *, __pyx_pybuffernd_variable.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_variable.diminfo[0].strides)); + goto __pyx_L6; + } + __pyx_L6:; + + /* "_basis.pyx":184 + * if variable[i] >= first_var_value: + * first_var_value = variable[i] + * last_var_value = variable[i] # <<<<<<<<<<<<<< + * else: + * workspace[i] = 0 + */ + __pyx_t_19 = __pyx_v_i; + __pyx_v_last_var_value = (*__Pyx_BufPtrStrided1d(__pyx_t_6_basis_FLOAT_t *, __pyx_pybuffernd_variable.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_variable.diminfo[0].strides)); + goto __pyx_L5; + } + /*else*/ { + + /* "_basis.pyx":186 + * last_var_value = variable[i] + * else: + * workspace[i] = 0 # <<<<<<<<<<<<<< + * + * #Calculate minspan + */ + __pyx_t_20 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_workspace.diminfo[0].strides) = 0; + } + __pyx_L5:; + } + + /* "_basis.pyx":189 + * + * #Calculate minspan + * if minspan < 0: # <<<<<<<<<<<<<< + * minspan_ = (-log2(-(1.0/(n*count))*log(1.0-minspan_alpha)) / 2.5) + * else: + */ + __pyx_t_15 = (__pyx_v_minspan < 0); + if (__pyx_t_15) { + + /* "_basis.pyx":190 + * #Calculate minspan + * if minspan < 0: + * minspan_ = (-log2(-(1.0/(n*count))*log(1.0-minspan_alpha)) / 2.5) # <<<<<<<<<<<<<< + * else: + * minspan_ = minspan + */ + __pyx_v_minspan_ = ((int)((-__pyx_f_5_util_log2(((-(1.0 / (__pyx_v_n * __pyx_v_count))) * log((1.0 - __pyx_v_minspan_alpha))))) / 2.5)); + goto __pyx_L7; + } + /*else*/ { + + /* "_basis.pyx":192 + * minspan_ = (-log2(-(1.0/(n*count))*log(1.0-minspan_alpha)) / 2.5) + * else: + * minspan_ = minspan # <<<<<<<<<<<<<< + * + * #Take out the used points and apply minspan + */ + __pyx_v_minspan_ = __pyx_v_minspan; + } + __pyx_L7:; + + /* "_basis.pyx":195 + * + * #Take out the used points and apply minspan + * num_used = len(used_knots) # <<<<<<<<<<<<<< + * prev = 0 + * last_idx = -1 + */ + if (unlikely(((PyObject *)__pyx_v_used_knots) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_21 = PyList_GET_SIZE(((PyObject *)__pyx_v_used_knots)); if (unlikely(__pyx_t_21 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_num_used = __pyx_t_21; + + /* "_basis.pyx":196 + * #Take out the used points and apply minspan + * num_used = len(used_knots) + * prev = 0 # <<<<<<<<<<<<<< + * last_idx = -1 + * for i in range(num_used): + */ + __pyx_v_prev = 0; + + /* "_basis.pyx":197 + * num_used = len(used_knots) + * prev = 0 + * last_idx = -1 # <<<<<<<<<<<<<< + * for i in range(num_used): + * idx = used_knots[i] + */ + __pyx_v_last_idx = -1; + + /* "_basis.pyx":198 + * prev = 0 + * last_idx = -1 + * for i in range(num_used): # <<<<<<<<<<<<<< + * idx = used_knots[i] + * if last_idx == idx: + */ + __pyx_t_12 = __pyx_v_num_used; + for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { + __pyx_v_i = __pyx_t_13; + + /* "_basis.pyx":199 + * last_idx = -1 + * for i in range(num_used): + * idx = used_knots[i] # <<<<<<<<<<<<<< + * if last_idx == idx: + * continue + */ + if (unlikely(((PyObject *)__pyx_v_used_knots) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_22 = __Pyx_PyInt_AsInt(PyList_GET_ITEM(__pyx_v_used_knots, __pyx_v_i)); if (unlikely((__pyx_t_22 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_idx = __pyx_t_22; + + /* "_basis.pyx":200 + * for i in range(num_used): + * idx = used_knots[i] + * if last_idx == idx: # <<<<<<<<<<<<<< + * continue + * workspace[idx] = 0 + */ + __pyx_t_15 = (__pyx_v_last_idx == __pyx_v_idx); + if (__pyx_t_15) { + + /* "_basis.pyx":201 + * idx = used_knots[i] + * if last_idx == idx: + * continue # <<<<<<<<<<<<<< + * workspace[idx] = 0 + * j = idx + */ + goto __pyx_L8_continue; + goto __pyx_L10; + } + __pyx_L10:; + + /* "_basis.pyx":202 + * if last_idx == idx: + * continue + * workspace[idx] = 0 # <<<<<<<<<<<<<< + * j = idx + * k = 0 + */ + __pyx_t_22 = __pyx_v_idx; + *__Pyx_BufPtrStrided1d(__pyx_t_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_workspace.diminfo[0].strides) = 0; + + /* "_basis.pyx":203 + * continue + * workspace[idx] = 0 + * j = idx # <<<<<<<<<<<<<< + * k = 0 + * while j > prev + 1 and k < minspan_: + */ + __pyx_v_j = __pyx_v_idx; + + /* "_basis.pyx":204 + * workspace[idx] = 0 + * j = idx + * k = 0 # <<<<<<<<<<<<<< + * while j > prev + 1 and k < minspan_: + * if workspace[j-1]: + */ + __pyx_v_k = 0; + + /* "_basis.pyx":205 + * j = idx + * k = 0 + * while j > prev + 1 and k < minspan_: # <<<<<<<<<<<<<< + * if workspace[j-1]: + * workspace[j-1] = False + */ + while (1) { + __pyx_t_15 = (__pyx_v_j > (__pyx_v_prev + 1)); + if (__pyx_t_15) { + __pyx_t_23 = (__pyx_v_k < __pyx_v_minspan_); + __pyx_t_24 = __pyx_t_23; + } else { + __pyx_t_24 = __pyx_t_15; + } + if (!__pyx_t_24) break; + + /* "_basis.pyx":206 + * k = 0 + * while j > prev + 1 and k < minspan_: + * if workspace[j-1]: # <<<<<<<<<<<<<< + * workspace[j-1] = False + * k += 1 + */ + __pyx_t_25 = (__pyx_v_j - 1); + __pyx_t_26 = (*__Pyx_BufPtrStrided1d(__pyx_t_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_workspace.diminfo[0].strides)); + if (__pyx_t_26) { + + /* "_basis.pyx":207 + * while j > prev + 1 and k < minspan_: + * if workspace[j-1]: + * workspace[j-1] = False # <<<<<<<<<<<<<< + * k += 1 + * j -= 1 + */ + __pyx_t_27 = (__pyx_v_j - 1); + *__Pyx_BufPtrStrided1d(__pyx_t_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_workspace.diminfo[0].strides) = 0; + + /* "_basis.pyx":208 + * if workspace[j-1]: + * workspace[j-1] = False + * k += 1 # <<<<<<<<<<<<<< + * j -= 1 + * j = idx + 1 + */ + __pyx_v_k = (__pyx_v_k + 1); + goto __pyx_L13; + } + __pyx_L13:; + + /* "_basis.pyx":209 + * workspace[j-1] = False + * k += 1 + * j -= 1 # <<<<<<<<<<<<<< + * j = idx + 1 + * k = 0 + */ + __pyx_v_j = (__pyx_v_j - 1); + } + + /* "_basis.pyx":210 + * k += 1 + * j -= 1 + * j = idx + 1 # <<<<<<<<<<<<<< + * k = 0 + * while j < m and k < minspan_: + */ + __pyx_v_j = (__pyx_v_idx + 1); + + /* "_basis.pyx":211 + * j -= 1 + * j = idx + 1 + * k = 0 # <<<<<<<<<<<<<< + * while j < m and k < minspan_: + * if workspace[j]: + */ + __pyx_v_k = 0; + + /* "_basis.pyx":212 + * j = idx + 1 + * k = 0 + * while j < m and k < minspan_: # <<<<<<<<<<<<<< + * if workspace[j]: + * workspace[j] = False + */ + while (1) { + __pyx_t_24 = (__pyx_v_j < __pyx_v_m); + if (__pyx_t_24) { + __pyx_t_15 = (__pyx_v_k < __pyx_v_minspan_); + __pyx_t_23 = __pyx_t_15; + } else { + __pyx_t_23 = __pyx_t_24; + } + if (!__pyx_t_23) break; + + /* "_basis.pyx":213 + * k = 0 + * while j < m and k < minspan_: + * if workspace[j]: # <<<<<<<<<<<<<< + * workspace[j] = False + * k += 1 + */ + __pyx_t_28 = __pyx_v_j; + __pyx_t_26 = (*__Pyx_BufPtrStrided1d(__pyx_t_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_workspace.diminfo[0].strides)); + if (__pyx_t_26) { + + /* "_basis.pyx":214 + * while j < m and k < minspan_: + * if workspace[j]: + * workspace[j] = False # <<<<<<<<<<<<<< + * k += 1 + * j += 1 + */ + __pyx_t_29 = __pyx_v_j; + *__Pyx_BufPtrStrided1d(__pyx_t_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_workspace.diminfo[0].strides) = 0; + + /* "_basis.pyx":215 + * if workspace[j]: + * workspace[j] = False + * k += 1 # <<<<<<<<<<<<<< + * j += 1 + * prev = idx + */ + __pyx_v_k = (__pyx_v_k + 1); + goto __pyx_L16; + } + __pyx_L16:; + + /* "_basis.pyx":216 + * workspace[j] = False + * k += 1 + * j += 1 # <<<<<<<<<<<<<< + * prev = idx + * last_idx = idx + */ + __pyx_v_j = (__pyx_v_j + 1); + } + + /* "_basis.pyx":217 + * k += 1 + * j += 1 + * prev = idx # <<<<<<<<<<<<<< + * last_idx = idx + * + */ + __pyx_v_prev = __pyx_v_idx; + + /* "_basis.pyx":218 + * j += 1 + * prev = idx + * last_idx = idx # <<<<<<<<<<<<<< + * + * #Apply endspan + */ + __pyx_v_last_idx = __pyx_v_idx; + __pyx_L8_continue:; + } + + /* "_basis.pyx":221 + * + * #Apply endspan + * i = 0 # <<<<<<<<<<<<<< + * j = 0 + * while i < endspan: + */ + __pyx_v_i = 0; + + /* "_basis.pyx":222 + * #Apply endspan + * i = 0 + * j = 0 # <<<<<<<<<<<<<< + * while i < endspan: + * if workspace[j]: + */ + __pyx_v_j = 0; + + /* "_basis.pyx":223 + * i = 0 + * j = 0 + * while i < endspan: # <<<<<<<<<<<<<< + * if workspace[j]: + * workspace[j] = 0 + */ + while (1) { + __pyx_t_23 = (__pyx_v_i < __pyx_v_endspan); + if (!__pyx_t_23) break; + + /* "_basis.pyx":224 + * j = 0 + * while i < endspan: + * if workspace[j]: # <<<<<<<<<<<<<< + * workspace[j] = 0 + * i += 1 + */ + __pyx_t_12 = __pyx_v_j; + __pyx_t_26 = (*__Pyx_BufPtrStrided1d(__pyx_t_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_workspace.diminfo[0].strides)); + if (__pyx_t_26) { + + /* "_basis.pyx":225 + * while i < endspan: + * if workspace[j]: + * workspace[j] = 0 # <<<<<<<<<<<<<< + * i += 1 + * j += 1 + */ + __pyx_t_13 = __pyx_v_j; + *__Pyx_BufPtrStrided1d(__pyx_t_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_workspace.diminfo[0].strides) = 0; + + /* "_basis.pyx":226 + * if workspace[j]: + * workspace[j] = 0 + * i += 1 # <<<<<<<<<<<<<< + * j += 1 + * if j == m: + */ + __pyx_v_i = (__pyx_v_i + 1); + goto __pyx_L19; + } + __pyx_L19:; + + /* "_basis.pyx":227 + * workspace[j] = 0 + * i += 1 + * j += 1 # <<<<<<<<<<<<<< + * if j == m: + * break + */ + __pyx_v_j = (__pyx_v_j + 1); + + /* "_basis.pyx":228 + * i += 1 + * j += 1 + * if j == m: # <<<<<<<<<<<<<< + * break + * i = 0 + */ + __pyx_t_23 = (__pyx_v_j == __pyx_v_m); + if (__pyx_t_23) { + + /* "_basis.pyx":229 + * j += 1 + * if j == m: + * break # <<<<<<<<<<<<<< + * i = 0 + * j = m - 1 + */ + goto __pyx_L18_break; + goto __pyx_L20; + } + __pyx_L20:; + } + __pyx_L18_break:; + + /* "_basis.pyx":230 + * if j == m: + * break + * i = 0 # <<<<<<<<<<<<<< + * j = m - 1 + * while i < endspan: + */ + __pyx_v_i = 0; + + /* "_basis.pyx":231 + * break + * i = 0 + * j = m - 1 # <<<<<<<<<<<<<< + * while i < endspan: + * if workspace[j]: + */ + __pyx_v_j = (__pyx_v_m - 1); + + /* "_basis.pyx":232 + * i = 0 + * j = m - 1 + * while i < endspan: # <<<<<<<<<<<<<< + * if workspace[j]: + * workspace[j] = 0 + */ + while (1) { + __pyx_t_23 = (__pyx_v_i < __pyx_v_endspan); + if (!__pyx_t_23) break; + + /* "_basis.pyx":233 + * j = m - 1 + * while i < endspan: + * if workspace[j]: # <<<<<<<<<<<<<< + * workspace[j] = 0 + * i += 1 + */ + __pyx_t_30 = __pyx_v_j; + __pyx_t_26 = (*__Pyx_BufPtrStrided1d(__pyx_t_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_workspace.diminfo[0].strides)); + if (__pyx_t_26) { + + /* "_basis.pyx":234 + * while i < endspan: + * if workspace[j]: + * workspace[j] = 0 # <<<<<<<<<<<<<< + * i += 1 + * if j == 0: + */ + __pyx_t_31 = __pyx_v_j; + *__Pyx_BufPtrStrided1d(__pyx_t_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_workspace.diminfo[0].strides) = 0; + + /* "_basis.pyx":235 + * if workspace[j]: + * workspace[j] = 0 + * i += 1 # <<<<<<<<<<<<<< + * if j == 0: + * break + */ + __pyx_v_i = (__pyx_v_i + 1); + goto __pyx_L23; + } + __pyx_L23:; + + /* "_basis.pyx":236 + * workspace[j] = 0 + * i += 1 + * if j == 0: # <<<<<<<<<<<<<< + * break + * j -= 1 + */ + __pyx_t_23 = (__pyx_v_j == 0); + if (__pyx_t_23) { + + /* "_basis.pyx":237 + * i += 1 + * if j == 0: + * break # <<<<<<<<<<<<<< + * j -= 1 + * + */ + goto __pyx_L22_break; + goto __pyx_L24; + } + __pyx_L24:; + + /* "_basis.pyx":238 + * if j == 0: + * break + * j -= 1 # <<<<<<<<<<<<<< + * + * #Implement check_every + */ + __pyx_v_j = (__pyx_v_j - 1); + } + __pyx_L22_break:; + + /* "_basis.pyx":241 + * + * #Implement check_every + * int_tmp = 0 # <<<<<<<<<<<<<< + * count = 0 + * for i in range(m): + */ + __pyx_v_int_tmp = 0; + + /* "_basis.pyx":242 + * #Implement check_every + * int_tmp = 0 + * count = 0 # <<<<<<<<<<<<<< + * for i in range(m): + * if workspace[i]: + */ + __pyx_v_count = 0; + + /* "_basis.pyx":243 + * int_tmp = 0 + * count = 0 + * for i in range(m): # <<<<<<<<<<<<<< + * if workspace[i]: + * if (int_tmp % check_every) != 0: + */ + __pyx_t_32 = __pyx_v_m; + for (__pyx_t_33 = 0; __pyx_t_33 < __pyx_t_32; __pyx_t_33+=1) { + __pyx_v_i = __pyx_t_33; + + /* "_basis.pyx":244 + * count = 0 + * for i in range(m): + * if workspace[i]: # <<<<<<<<<<<<<< + * if (int_tmp % check_every) != 0: + * workspace[i] = 0 + */ + __pyx_t_34 = __pyx_v_i; + __pyx_t_26 = (*__Pyx_BufPtrStrided1d(__pyx_t_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_workspace.diminfo[0].strides)); + if (__pyx_t_26) { + + /* "_basis.pyx":245 + * for i in range(m): + * if workspace[i]: + * if (int_tmp % check_every) != 0: # <<<<<<<<<<<<<< + * workspace[i] = 0 + * else: + */ + __pyx_t_23 = ((__pyx_v_int_tmp % __pyx_v_check_every) != 0); + if (__pyx_t_23) { + + /* "_basis.pyx":246 + * if workspace[i]: + * if (int_tmp % check_every) != 0: + * workspace[i] = 0 # <<<<<<<<<<<<<< + * else: + * count += 1 + */ + __pyx_t_35 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_workspace.diminfo[0].strides) = 0; + goto __pyx_L28; + } + /*else*/ { + + /* "_basis.pyx":248 + * workspace[i] = 0 + * else: + * count += 1 # <<<<<<<<<<<<<< + * int_tmp += 1 + * else: + */ + __pyx_v_count = (__pyx_v_count + 1); + } + __pyx_L28:; + + /* "_basis.pyx":249 + * else: + * count += 1 + * int_tmp += 1 # <<<<<<<<<<<<<< + * else: + * int_tmp = 0 + */ + __pyx_v_int_tmp = (__pyx_v_int_tmp + 1); + goto __pyx_L27; + } + /*else*/ { + + /* "_basis.pyx":251 + * int_tmp += 1 + * else: + * int_tmp = 0 # <<<<<<<<<<<<<< + * + * #Make sure the greatest value is not a candidate (this can happen if the first endspan+1 values are the same) + */ + __pyx_v_int_tmp = 0; + } + __pyx_L27:; + } + + /* "_basis.pyx":254 + * + * #Make sure the greatest value is not a candidate (this can happen if the first endspan+1 values are the same) + * for i in range(m): # <<<<<<<<<<<<<< + * if workspace[i]: + * if variable[i] == first_var_value: + */ + __pyx_t_32 = __pyx_v_m; + for (__pyx_t_33 = 0; __pyx_t_33 < __pyx_t_32; __pyx_t_33+=1) { + __pyx_v_i = __pyx_t_33; + + /* "_basis.pyx":255 + * #Make sure the greatest value is not a candidate (this can happen if the first endspan+1 values are the same) + * for i in range(m): + * if workspace[i]: # <<<<<<<<<<<<<< + * if variable[i] == first_var_value: + * workspace[i] = 0 + */ + __pyx_t_36 = __pyx_v_i; + __pyx_t_26 = (*__Pyx_BufPtrStrided1d(__pyx_t_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_workspace.diminfo[0].strides)); + if (__pyx_t_26) { + + /* "_basis.pyx":256 + * for i in range(m): + * if workspace[i]: + * if variable[i] == first_var_value: # <<<<<<<<<<<<<< + * workspace[i] = 0 + * count -= 1 + */ + __pyx_t_37 = __pyx_v_i; + __pyx_t_23 = ((*__Pyx_BufPtrStrided1d(__pyx_t_6_basis_FLOAT_t *, __pyx_pybuffernd_variable.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_variable.diminfo[0].strides)) == __pyx_v_first_var_value); + if (__pyx_t_23) { + + /* "_basis.pyx":257 + * if workspace[i]: + * if variable[i] == first_var_value: + * workspace[i] = 0 # <<<<<<<<<<<<<< + * count -= 1 + * else: + */ + __pyx_t_38 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_workspace.diminfo[0].strides) = 0; + + /* "_basis.pyx":258 + * if variable[i] == first_var_value: + * workspace[i] = 0 + * count -= 1 # <<<<<<<<<<<<<< + * else: + * break + */ + __pyx_v_count = (__pyx_v_count - 1); + goto __pyx_L32; + } + /*else*/ { + + /* "_basis.pyx":260 + * count -= 1 + * else: + * break # <<<<<<<<<<<<<< + * + * #Also make sure the least value is not a candidate + */ + goto __pyx_L30_break; + } + __pyx_L32:; + goto __pyx_L31; + } + __pyx_L31:; + } + __pyx_L30_break:; + + /* "_basis.pyx":263 + * + * #Also make sure the least value is not a candidate + * for i in range(m): # <<<<<<<<<<<<<< + * if workspace[m-i-1]: + * if variable[m-i-1] == last_var_value: + */ + __pyx_t_32 = __pyx_v_m; + for (__pyx_t_33 = 0; __pyx_t_33 < __pyx_t_32; __pyx_t_33+=1) { + __pyx_v_i = __pyx_t_33; + + /* "_basis.pyx":264 + * #Also make sure the least value is not a candidate + * for i in range(m): + * if workspace[m-i-1]: # <<<<<<<<<<<<<< + * if variable[m-i-1] == last_var_value: + * workspace[m-i-1] = 0 + */ + __pyx_t_39 = ((__pyx_v_m - __pyx_v_i) - 1); + __pyx_t_26 = (*__Pyx_BufPtrStrided1d(__pyx_t_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_workspace.diminfo[0].strides)); + if (__pyx_t_26) { + + /* "_basis.pyx":265 + * for i in range(m): + * if workspace[m-i-1]: + * if variable[m-i-1] == last_var_value: # <<<<<<<<<<<<<< + * workspace[m-i-1] = 0 + * count -= 1 + */ + __pyx_t_40 = ((__pyx_v_m - __pyx_v_i) - 1); + __pyx_t_23 = ((*__Pyx_BufPtrStrided1d(__pyx_t_6_basis_FLOAT_t *, __pyx_pybuffernd_variable.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_variable.diminfo[0].strides)) == __pyx_v_last_var_value); + if (__pyx_t_23) { + + /* "_basis.pyx":266 + * if workspace[m-i-1]: + * if variable[m-i-1] == last_var_value: + * workspace[m-i-1] = 0 # <<<<<<<<<<<<<< + * count -= 1 + * else: + */ + __pyx_t_41 = ((__pyx_v_m - __pyx_v_i) - 1); + *__Pyx_BufPtrStrided1d(__pyx_t_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_workspace.diminfo[0].strides) = 0; + + /* "_basis.pyx":267 + * if variable[m-i-1] == last_var_value: + * workspace[m-i-1] = 0 + * count -= 1 # <<<<<<<<<<<<<< + * else: + * break + */ + __pyx_v_count = (__pyx_v_count - 1); + goto __pyx_L36; + } + /*else*/ { + + /* "_basis.pyx":269 + * count -= 1 + * else: + * break # <<<<<<<<<<<<<< + * + * #Create result array and return + */ + goto __pyx_L34_break; + } + __pyx_L36:; + goto __pyx_L35; + } + __pyx_L35:; + } + __pyx_L34_break:; + + /* "_basis.pyx":272 + * + * #Create result array and return + * result = np.empty(shape=count,dtype=int) # <<<<<<<<<<<<<< + * j = 0 + * for i in range(m): + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_8 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_count); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__shape), __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)(&PyInt_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_42 = ((PyArrayObject *)__pyx_t_8); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer); + __pyx_t_43 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_42, &__Pyx_TypeInfo_nn___pyx_t_6_basis_INT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); + if (unlikely(__pyx_t_43 < 0)) { + PyErr_Fetch(&__pyx_t_44, &__pyx_t_45, &__pyx_t_46); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn___pyx_t_6_basis_INT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_44); Py_XDECREF(__pyx_t_45); Py_XDECREF(__pyx_t_46); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_44, __pyx_t_45, __pyx_t_46); + } + } + __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0]; + if (unlikely(__pyx_t_43 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_42 = 0; + __pyx_v_result = ((PyArrayObject *)__pyx_t_8); + __pyx_t_8 = 0; + + /* "_basis.pyx":273 + * #Create result array and return + * result = np.empty(shape=count,dtype=int) + * j = 0 # <<<<<<<<<<<<<< + * for i in range(m): + * if workspace[i]: + */ + __pyx_v_j = 0; + + /* "_basis.pyx":274 + * result = np.empty(shape=count,dtype=int) + * j = 0 + * for i in range(m): # <<<<<<<<<<<<<< + * if workspace[i]: + * result[j] = i + */ + __pyx_t_32 = __pyx_v_m; + for (__pyx_t_33 = 0; __pyx_t_33 < __pyx_t_32; __pyx_t_33+=1) { + __pyx_v_i = __pyx_t_33; + + /* "_basis.pyx":275 + * j = 0 + * for i in range(m): + * if workspace[i]: # <<<<<<<<<<<<<< + * result[j] = i + * j += 1 + */ + __pyx_t_47 = __pyx_v_i; + __pyx_t_26 = (*__Pyx_BufPtrStrided1d(__pyx_t_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_workspace.diminfo[0].strides)); + if (__pyx_t_26) { + + /* "_basis.pyx":276 + * for i in range(m): + * if workspace[i]: + * result[j] = i # <<<<<<<<<<<<<< + * j += 1 + * + */ + __pyx_t_48 = __pyx_v_j; + *__Pyx_BufPtrStrided1d(__pyx_t_6_basis_INT_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_result.diminfo[0].strides) = __pyx_v_i; + + /* "_basis.pyx":277 + * if workspace[i]: + * result[j] = i + * j += 1 # <<<<<<<<<<<<<< + * + * return result + */ + __pyx_v_j = (__pyx_v_j + 1); + goto __pyx_L39; + } + __pyx_L39:; + } + + /* "_basis.pyx":279 + * j += 1 + * + * return result # <<<<<<<<<<<<<< + * + * cdef class PicklePlaceHolderBasisFunction(BasisFunction): + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)__pyx_v_result)); + __pyx_r = ((PyArrayObject *)__pyx_v_result); + goto __pyx_L0; + + __pyx_r = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_8); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_variable.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_workspace.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("_basis.BasisFunction.valid_knots", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_variable.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_workspace.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_result); + __Pyx_XDECREF(__pyx_v_used_knots); + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_13BasisFunction_47valid_knots(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6_basis_13BasisFunction_46valid_knots[] = "\n values - The unsorted values of self in the data set\n variable - The sorted values of variable in the data set\n variable_idx - The index of the variable in the data set\n workspace - An m-vector (where m is the number of samples) used internally\n "; +static PyObject *__pyx_pw_6_basis_13BasisFunction_47valid_knots(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_values = 0; + PyArrayObject *__pyx_v_variable = 0; + int __pyx_v_variable_idx; + __pyx_t_6_basis_INDEX_t __pyx_v_check_every; + int __pyx_v_endspan; + int __pyx_v_minspan; + __pyx_t_6_basis_FLOAT_t __pyx_v_minspan_alpha; + __pyx_t_6_basis_INDEX_t __pyx_v_n; + PyArrayObject *__pyx_v_workspace = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("valid_knots (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__values,&__pyx_n_s__variable,&__pyx_n_s__variable_idx,&__pyx_n_s__check_every,&__pyx_n_s__endspan,&__pyx_n_s__minspan,&__pyx_n_s__minspan_alpha,&__pyx_n_s__n,&__pyx_n_s__workspace,0}; + PyObject* values[9] = {0,0,0,0,0,0,0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 9: values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + case 8: values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + case 7: values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__variable)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("valid_knots", 1, 9, 9, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__variable_idx)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("valid_knots", 1, 9, 9, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__check_every)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("valid_knots", 1, 9, 9, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__endspan)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("valid_knots", 1, 9, 9, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 5: + if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__minspan)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("valid_knots", 1, 9, 9, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 6: + if (likely((values[6] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__minspan_alpha)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("valid_knots", 1, 9, 9, 6); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 7: + if (likely((values[7] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("valid_knots", 1, 9, 9, 7); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 8: + if (likely((values[8] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__workspace)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("valid_knots", 1, 9, 9, 8); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "valid_knots") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 9) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + values[6] = PyTuple_GET_ITEM(__pyx_args, 6); + values[7] = PyTuple_GET_ITEM(__pyx_args, 7); + values[8] = PyTuple_GET_ITEM(__pyx_args, 8); + } + __pyx_v_values = ((PyArrayObject *)values[0]); + __pyx_v_variable = ((PyArrayObject *)values[1]); + __pyx_v_variable_idx = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_variable_idx == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_check_every = __Pyx_PyInt_from_py_npy_ulonglong(values[3]); if (unlikely((__pyx_v_check_every == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_endspan = __Pyx_PyInt_AsInt(values[4]); if (unlikely((__pyx_v_endspan == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_minspan = __Pyx_PyInt_AsInt(values[5]); if (unlikely((__pyx_v_minspan == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_minspan_alpha = __pyx_PyFloat_AsDouble(values[6]); if (unlikely((__pyx_v_minspan_alpha == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_n = __Pyx_PyInt_from_py_npy_ulonglong(values[7]); if (unlikely((__pyx_v_n == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_workspace = ((PyArrayObject *)values[8]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("valid_knots", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("_basis.BasisFunction.valid_knots", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_variable), __pyx_ptype_5numpy_ndarray, 1, "variable", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_workspace), __pyx_ptype_5numpy_ndarray, 1, "workspace", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_6_basis_13BasisFunction_46valid_knots(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self), __pyx_v_values, __pyx_v_variable, __pyx_v_variable_idx, __pyx_v_check_every, __pyx_v_endspan, __pyx_v_minspan, __pyx_v_minspan_alpha, __pyx_v_n, __pyx_v_workspace); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":145 + * ''' + * + * cpdef cnp.ndarray[INT_t, ndim=1] valid_knots(BasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] values, cnp.ndarray[FLOAT_t,ndim=1] variable, int variable_idx, INDEX_t check_every, int endspan, int minspan, FLOAT_t minspan_alpha, INDEX_t n, cnp.ndarray[INT_t,ndim=1] workspace): # <<<<<<<<<<<<<< + * ''' + * values - The unsorted values of self in the data set + */ + +static PyObject *__pyx_pf_6_basis_13BasisFunction_46valid_knots(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_variable, int __pyx_v_variable_idx, __pyx_t_6_basis_INDEX_t __pyx_v_check_every, int __pyx_v_endspan, int __pyx_v_minspan, __pyx_t_6_basis_FLOAT_t __pyx_v_minspan_alpha, __pyx_t_6_basis_INDEX_t __pyx_v_n, PyArrayObject *__pyx_v_workspace) { + __Pyx_LocalBuf_ND __pyx_pybuffernd_values; + __Pyx_Buffer __pyx_pybuffer_values; + __Pyx_LocalBuf_ND __pyx_pybuffernd_variable; + __Pyx_Buffer __pyx_pybuffer_variable; + __Pyx_LocalBuf_ND __pyx_pybuffernd_workspace; + __Pyx_Buffer __pyx_pybuffer_workspace; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("valid_knots", 0); + __pyx_pybuffer_values.pybuffer.buf = NULL; + __pyx_pybuffer_values.refcount = 0; + __pyx_pybuffernd_values.data = NULL; + __pyx_pybuffernd_values.rcbuffer = &__pyx_pybuffer_values; + __pyx_pybuffer_variable.pybuffer.buf = NULL; + __pyx_pybuffer_variable.refcount = 0; + __pyx_pybuffernd_variable.data = NULL; + __pyx_pybuffernd_variable.rcbuffer = &__pyx_pybuffer_variable; + __pyx_pybuffer_workspace.pybuffer.buf = NULL; + __pyx_pybuffer_workspace.refcount = 0; + __pyx_pybuffernd_workspace.data = NULL; + __pyx_pybuffernd_workspace.rcbuffer = &__pyx_pybuffer_workspace; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_variable.rcbuffer->pybuffer, (PyObject*)__pyx_v_variable, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_variable.diminfo[0].strides = __pyx_pybuffernd_variable.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_variable.diminfo[0].shape = __pyx_pybuffernd_variable.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_workspace.rcbuffer->pybuffer, (PyObject*)__pyx_v_workspace, &__Pyx_TypeInfo_nn___pyx_t_6_basis_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_workspace.diminfo[0].strides = __pyx_pybuffernd_workspace.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_workspace.diminfo[0].shape = __pyx_pybuffernd_workspace.rcbuffer->pybuffer.shape[0]; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->valid_knots(__pyx_v_self, ((PyArrayObject *)__pyx_v_values), ((PyArrayObject *)__pyx_v_variable), __pyx_v_variable_idx, __pyx_v_check_every, __pyx_v_endspan, __pyx_v_minspan, __pyx_v_minspan_alpha, __pyx_v_n, ((PyArrayObject *)__pyx_v_workspace), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_variable.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_workspace.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("_basis.BasisFunction.valid_knots", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_values.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_variable.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_workspace.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6_basis_21ConstantBasisFunction_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_6_basis_21ConstantBasisFunction_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; + __pyx_r = __pyx_pf_6_basis_21ConstantBasisFunction___init__(((struct __pyx_obj_6_basis_ConstantBasisFunction *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":287 + * + * cdef class ConstantBasisFunction(BasisFunction): + * def __init__(self): #@DuplicatedSignature # <<<<<<<<<<<<<< + * self.prunable = False + * + */ + +static int __pyx_pf_6_basis_21ConstantBasisFunction___init__(struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__", 0); + + /* "_basis.pyx":288 + * cdef class ConstantBasisFunction(BasisFunction): + * def __init__(self): #@DuplicatedSignature + * self.prunable = False # <<<<<<<<<<<<<< + * + * def _get_root(self): + */ + __pyx_v_self->__pyx_base.prunable = 0; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_3_get_root(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_3_get_root(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_get_root (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_21ConstantBasisFunction_2_get_root(((struct __pyx_obj_6_basis_ConstantBasisFunction *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":290 + * self.prunable = False + * + * def _get_root(self): # <<<<<<<<<<<<<< + * return self + * + */ + +static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_2_get_root(struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_get_root", 0); + + /* "_basis.pyx":291 + * + * def _get_root(self): + * return self # <<<<<<<<<<<<<< + * + * def _get_parent_state(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __pyx_r = ((PyObject *)__pyx_v_self); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_5_get_parent_state(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_5_get_parent_state(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_get_parent_state (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_21ConstantBasisFunction_4_get_parent_state(((struct __pyx_obj_6_basis_ConstantBasisFunction *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":293 + * return self + * + * def _get_parent_state(self): # <<<<<<<<<<<<<< + * return {} + * + */ + +static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_4_get_parent_state(CYTHON_UNUSED struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_get_parent_state", 0); + + /* "_basis.pyx":294 + * + * def _get_parent_state(self): + * return {} # <<<<<<<<<<<<<< + * + * def _set_parent_state(self, state): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_basis.ConstantBasisFunction._get_parent_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_7_set_parent_state(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ +static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_7_set_parent_state(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_set_parent_state (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_21ConstantBasisFunction_6_set_parent_state(((struct __pyx_obj_6_basis_ConstantBasisFunction *)__pyx_v_self), ((PyObject *)__pyx_v_state)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":296 + * return {} + * + * def _set_parent_state(self, state): # <<<<<<<<<<<<<< + * pass + * + */ + +static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_6_set_parent_state(CYTHON_UNUSED struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_set_parent_state", 0); + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":299 + * pass + * + * cpdef INDEX_t degree(ConstantBasisFunction self): # <<<<<<<<<<<<<< + * return 0 + * + */ + +static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_9degree(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static __pyx_t_6_basis_INDEX_t __pyx_f_6_basis_21ConstantBasisFunction_degree(CYTHON_UNUSED struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { + __pyx_t_6_basis_INDEX_t __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __pyx_t_6_basis_INDEX_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("degree", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__degree); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_21ConstantBasisFunction_9degree)) { + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_basis.pyx":300 + * + * cpdef INDEX_t degree(ConstantBasisFunction self): + * return 0 # <<<<<<<<<<<<<< + * + * cpdef translate(ConstantBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse): + */ + __pyx_r = 0; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_WriteUnraisable("_basis.ConstantBasisFunction.degree", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_9degree(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_9degree(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("degree (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_21ConstantBasisFunction_8degree(((struct __pyx_obj_6_basis_ConstantBasisFunction *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":299 + * pass + * + * cpdef INDEX_t degree(ConstantBasisFunction self): # <<<<<<<<<<<<<< + * return 0 + * + */ + +static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_8degree(struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("degree", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_6_basis_ConstantBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.degree(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_basis.ConstantBasisFunction.degree", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":302 + * return 0 + * + * cpdef translate(ConstantBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse): # <<<<<<<<<<<<<< + * pass + * + */ + +static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_11translate(PyObject *__pyx_v_ConstantBasisFunctionself, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_6_basis_21ConstantBasisFunction_translate(CYTHON_UNUSED struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_ConstantBasisFunctionself, CYTHON_UNUSED PyArrayObject *__pyx_v_slopes, CYTHON_UNUSED PyArrayObject *__pyx_v_intercepts, CYTHON_UNUSED int __pyx_v_recurse, int __pyx_skip_dispatch) { + __Pyx_LocalBuf_ND __pyx_pybuffernd_intercepts; + __Pyx_Buffer __pyx_pybuffer_intercepts; + __Pyx_LocalBuf_ND __pyx_pybuffernd_slopes; + __Pyx_Buffer __pyx_pybuffer_slopes; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("translate", 0); + __pyx_pybuffer_slopes.pybuffer.buf = NULL; + __pyx_pybuffer_slopes.refcount = 0; + __pyx_pybuffernd_slopes.data = NULL; + __pyx_pybuffernd_slopes.rcbuffer = &__pyx_pybuffer_slopes; + __pyx_pybuffer_intercepts.pybuffer.buf = NULL; + __pyx_pybuffer_intercepts.refcount = 0; + __pyx_pybuffernd_intercepts.data = NULL; + __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_ConstantBasisFunctionself))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_ConstantBasisFunctionself), __pyx_n_s__translate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_21ConstantBasisFunction_11translate)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_recurse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_slopes)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_slopes)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_slopes)); + __Pyx_INCREF(((PyObject *)__pyx_v_intercepts)); + PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_intercepts)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_intercepts)); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_basis.pyx":303 + * + * cpdef translate(ConstantBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse): + * pass # <<<<<<<<<<<<<< + * + * cpdef FLOAT_t scale(ConstantBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): + */ + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("_basis.ConstantBasisFunction.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_11translate(PyObject *__pyx_v_ConstantBasisFunctionself, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_11translate(PyObject *__pyx_v_ConstantBasisFunctionself, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_slopes = 0; + PyArrayObject *__pyx_v_intercepts = 0; + int __pyx_v_recurse; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("translate (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__slopes,&__pyx_n_s__intercepts,&__pyx_n_s__recurse,0}; + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__slopes)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__intercepts)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("translate", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__recurse)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("translate", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "translate") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_slopes = ((PyArrayObject *)values[0]); + __pyx_v_intercepts = ((PyArrayObject *)values[1]); + __pyx_v_recurse = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_recurse == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("translate", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("_basis.ConstantBasisFunction.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_slopes), __pyx_ptype_5numpy_ndarray, 1, "slopes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercepts), __pyx_ptype_5numpy_ndarray, 1, "intercepts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_6_basis_21ConstantBasisFunction_10translate(((struct __pyx_obj_6_basis_ConstantBasisFunction *)__pyx_v_ConstantBasisFunctionself), __pyx_v_slopes, __pyx_v_intercepts, __pyx_v_recurse); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":302 + * return 0 + * + * cpdef translate(ConstantBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse): # <<<<<<<<<<<<<< + * pass + * + */ + +static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_10translate(struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_ConstantBasisFunctionself, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts, int __pyx_v_recurse) { + __Pyx_LocalBuf_ND __pyx_pybuffernd_intercepts; + __Pyx_Buffer __pyx_pybuffer_intercepts; + __Pyx_LocalBuf_ND __pyx_pybuffernd_slopes; + __Pyx_Buffer __pyx_pybuffer_slopes; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("translate", 0); + __pyx_pybuffer_slopes.pybuffer.buf = NULL; + __pyx_pybuffer_slopes.refcount = 0; + __pyx_pybuffernd_slopes.data = NULL; + __pyx_pybuffernd_slopes.rcbuffer = &__pyx_pybuffer_slopes; + __pyx_pybuffer_intercepts.pybuffer.buf = NULL; + __pyx_pybuffer_intercepts.refcount = 0; + __pyx_pybuffernd_intercepts.data = NULL; + __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_ConstantBasisFunction *)__pyx_v_ConstantBasisFunctionself->__pyx_base.__pyx_vtab)->translate(__pyx_v_ConstantBasisFunctionself, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), __pyx_v_recurse, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("_basis.ConstantBasisFunction.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":305 + * pass + * + * cpdef FLOAT_t scale(ConstantBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): # <<<<<<<<<<<<<< + * return 1.0 + * + */ + +static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_13scale(PyObject *__pyx_v_ConstantBasisFunctionself, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static __pyx_t_6_basis_FLOAT_t __pyx_f_6_basis_21ConstantBasisFunction_scale(CYTHON_UNUSED struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_ConstantBasisFunctionself, CYTHON_UNUSED PyArrayObject *__pyx_v_slopes, CYTHON_UNUSED PyArrayObject *__pyx_v_intercepts, int __pyx_skip_dispatch) { + __Pyx_LocalBuf_ND __pyx_pybuffernd_intercepts; + __Pyx_Buffer __pyx_pybuffer_intercepts; + __Pyx_LocalBuf_ND __pyx_pybuffernd_slopes; + __Pyx_Buffer __pyx_pybuffer_slopes; + __pyx_t_6_basis_FLOAT_t __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __pyx_t_6_basis_FLOAT_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("scale", 0); + __pyx_pybuffer_slopes.pybuffer.buf = NULL; + __pyx_pybuffer_slopes.refcount = 0; + __pyx_pybuffernd_slopes.data = NULL; + __pyx_pybuffernd_slopes.rcbuffer = &__pyx_pybuffer_slopes; + __pyx_pybuffer_intercepts.pybuffer.buf = NULL; + __pyx_pybuffer_intercepts.refcount = 0; + __pyx_pybuffernd_intercepts.data = NULL; + __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_ConstantBasisFunctionself))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_ConstantBasisFunctionself), __pyx_n_s__scale); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_21ConstantBasisFunction_13scale)) { + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_v_slopes)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_slopes)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_slopes)); + __Pyx_INCREF(((PyObject *)__pyx_v_intercepts)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_intercepts)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_intercepts)); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_4; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_basis.pyx":306 + * + * cpdef FLOAT_t scale(ConstantBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): + * return 1.0 # <<<<<<<<<<<<<< + * + * cpdef _set_parent(self,BasisFunction parent): + */ + __pyx_r = ((__pyx_t_6_basis_FLOAT_t)1.0); + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_WriteUnraisable("_basis.ConstantBasisFunction.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_13scale(PyObject *__pyx_v_ConstantBasisFunctionself, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_13scale(PyObject *__pyx_v_ConstantBasisFunctionself, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_slopes = 0; + PyArrayObject *__pyx_v_intercepts = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("scale (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__slopes,&__pyx_n_s__intercepts,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__slopes)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__intercepts)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("scale", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scale") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_slopes = ((PyArrayObject *)values[0]); + __pyx_v_intercepts = ((PyArrayObject *)values[1]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("scale", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("_basis.ConstantBasisFunction.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_slopes), __pyx_ptype_5numpy_ndarray, 1, "slopes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercepts), __pyx_ptype_5numpy_ndarray, 1, "intercepts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_6_basis_21ConstantBasisFunction_12scale(((struct __pyx_obj_6_basis_ConstantBasisFunction *)__pyx_v_ConstantBasisFunctionself), __pyx_v_slopes, __pyx_v_intercepts); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":305 + * pass + * + * cpdef FLOAT_t scale(ConstantBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): # <<<<<<<<<<<<<< + * return 1.0 + * + */ + +static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_12scale(struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_ConstantBasisFunctionself, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts) { + __Pyx_LocalBuf_ND __pyx_pybuffernd_intercepts; + __Pyx_Buffer __pyx_pybuffer_intercepts; + __Pyx_LocalBuf_ND __pyx_pybuffernd_slopes; + __Pyx_Buffer __pyx_pybuffer_slopes; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("scale", 0); + __pyx_pybuffer_slopes.pybuffer.buf = NULL; + __pyx_pybuffer_slopes.refcount = 0; + __pyx_pybuffernd_slopes.data = NULL; + __pyx_pybuffernd_slopes.rcbuffer = &__pyx_pybuffer_slopes; + __pyx_pybuffer_intercepts.pybuffer.buf = NULL; + __pyx_pybuffer_intercepts.refcount = 0; + __pyx_pybuffernd_intercepts.data = NULL; + __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_6_basis_ConstantBasisFunction *)__pyx_v_ConstantBasisFunctionself->__pyx_base.__pyx_vtab)->scale(__pyx_v_ConstantBasisFunctionself, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("_basis.ConstantBasisFunction.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":308 + * return 1.0 + * + * cpdef _set_parent(self,BasisFunction parent): # <<<<<<<<<<<<<< + * raise NotImplementedError + * + */ + +static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_15_set_parent(PyObject *__pyx_v_self, PyObject *__pyx_v_parent); /*proto*/ +static PyObject *__pyx_f_6_basis_21ConstantBasisFunction__set_parent(CYTHON_UNUSED struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self, CYTHON_UNUSED struct __pyx_obj_6_basis_BasisFunction *__pyx_v_parent, int __pyx_skip_dispatch) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_set_parent", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___set_parent); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_21ConstantBasisFunction_15_set_parent)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_v_parent)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_parent)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_parent)); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_basis.pyx":309 + * + * cpdef _set_parent(self,BasisFunction parent): + * raise NotImplementedError # <<<<<<<<<<<<<< + * + * cpdef BasisFunction get_parent(self): + */ + __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("_basis.ConstantBasisFunction._set_parent", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_15_set_parent(PyObject *__pyx_v_self, PyObject *__pyx_v_parent); /*proto*/ +static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_15_set_parent(PyObject *__pyx_v_self, PyObject *__pyx_v_parent) { + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_set_parent (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parent), __pyx_ptype_6_basis_BasisFunction, 1, "parent", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_6_basis_21ConstantBasisFunction_14_set_parent(((struct __pyx_obj_6_basis_ConstantBasisFunction *)__pyx_v_self), ((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_parent)); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":308 + * return 1.0 + * + * cpdef _set_parent(self,BasisFunction parent): # <<<<<<<<<<<<<< + * raise NotImplementedError + * + */ + +static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_14_set_parent(struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self, struct __pyx_obj_6_basis_BasisFunction *__pyx_v_parent) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_set_parent", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_ConstantBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._set_parent(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self), __pyx_v_parent, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_basis.ConstantBasisFunction._set_parent", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":311 + * raise NotImplementedError + * + * cpdef BasisFunction get_parent(self): # <<<<<<<<<<<<<< + * raise NotImplementedError + * + */ + +static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_17get_parent(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static struct __pyx_obj_6_basis_BasisFunction *__pyx_f_6_basis_21ConstantBasisFunction_get_parent(CYTHON_UNUSED struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { + struct __pyx_obj_6_basis_BasisFunction *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_parent", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_parent); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_21ConstantBasisFunction_17get_parent)) { + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((struct __pyx_obj_6_basis_BasisFunction *)__pyx_t_2); + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_basis.pyx":312 + * + * cpdef BasisFunction get_parent(self): + * raise NotImplementedError # <<<<<<<<<<<<<< + * + * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = False): + */ + __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + __pyx_r = ((struct __pyx_obj_6_basis_BasisFunction *)Py_None); __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("_basis.ConstantBasisFunction.get_parent", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_17get_parent(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_17get_parent(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_parent (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_21ConstantBasisFunction_16get_parent(((struct __pyx_obj_6_basis_ConstantBasisFunction *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":311 + * raise NotImplementedError + * + * cpdef BasisFunction get_parent(self): # <<<<<<<<<<<<<< + * raise NotImplementedError + * + */ + +static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_16get_parent(struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_parent", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_6_basis_ConstantBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_parent(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_basis.ConstantBasisFunction.get_parent", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":314 + * raise NotImplementedError + * + * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = False): # <<<<<<<<<<<<<< + * ''' + * X - Data matrix + */ + +static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_19apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_6_basis_21ConstantBasisFunction_apply(CYTHON_UNUSED struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self, CYTHON_UNUSED PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_b, int __pyx_skip_dispatch, struct __pyx_opt_args_6_basis_21ConstantBasisFunction_apply *__pyx_optional_args) { + int __pyx_v_recurse = ((int)0); + __pyx_t_6_basis_INDEX_t __pyx_v_i; + __pyx_t_6_basis_INDEX_t __pyx_v_m; + __Pyx_LocalBuf_ND __pyx_pybuffernd_X; + __Pyx_Buffer __pyx_pybuffer_X; + __Pyx_LocalBuf_ND __pyx_pybuffernd_b; + __Pyx_Buffer __pyx_pybuffer_b; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + __pyx_t_6_basis_INDEX_t __pyx_t_5; + __pyx_t_6_basis_INDEX_t __pyx_t_6; + __pyx_t_6_basis_INDEX_t __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("apply", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_recurse = __pyx_optional_args->recurse; + } + } + __pyx_pybuffer_X.pybuffer.buf = NULL; + __pyx_pybuffer_X.refcount = 0; + __pyx_pybuffernd_X.data = NULL; + __pyx_pybuffernd_X.rcbuffer = &__pyx_pybuffer_X; + __pyx_pybuffer_b.pybuffer.buf = NULL; + __pyx_pybuffer_b.refcount = 0; + __pyx_pybuffernd_b.data = NULL; + __pyx_pybuffernd_b.rcbuffer = &__pyx_pybuffer_b; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)__pyx_v_b, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_b.diminfo[0].strides = __pyx_pybuffernd_b.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_b.diminfo[0].shape = __pyx_pybuffernd_b.rcbuffer->pybuffer.shape[0]; + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__apply); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_21ConstantBasisFunction_19apply)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_recurse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_X)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_X)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_X)); + __Pyx_INCREF(((PyObject *)__pyx_v_b)); + PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_b)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_b)); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_basis.pyx":323 + * ''' + * cdef INDEX_t i #@DuplicatedSignature + * cdef INDEX_t m = len(b) # <<<<<<<<<<<<<< + * for i in range(m): + * b[i] = 1.0 + */ + __pyx_t_4 = PyObject_Length(((PyObject *)__pyx_v_b)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_m = __pyx_t_4; + + /* "_basis.pyx":324 + * cdef INDEX_t i #@DuplicatedSignature + * cdef INDEX_t m = len(b) + * for i in range(m): # <<<<<<<<<<<<<< + * b[i] = 1.0 + * + */ + __pyx_t_5 = __pyx_v_m; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "_basis.pyx":325 + * cdef INDEX_t m = len(b) + * for i in range(m): + * b[i] = 1.0 # <<<<<<<<<<<<<< + * + * def __str__(self): + */ + __pyx_t_7 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_6_basis_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_b.diminfo[0].strides) = ((__pyx_t_6_basis_FLOAT_t)1.0); + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_b.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("_basis.ConstantBasisFunction.apply", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_b.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_19apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6_basis_21ConstantBasisFunction_18apply[] = "\n X - Data matrix\n b - parent vector\n recurse - The ConstantBasisFunction is the parent of all BasisFunctions and never has a parent. \n Therefore the recurse argument is ignored. This spares child BasisFunctions from \n having to know whether their parents have parents.\n "; +static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_19apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_X = 0; + PyArrayObject *__pyx_v_b = 0; + int __pyx_v_recurse; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("apply (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__b,&__pyx_n_s__recurse,0}; + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__b)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("apply", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__recurse); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_X = ((PyArrayObject *)values[0]); + __pyx_v_b = ((PyArrayObject *)values[1]); + if (values[2]) { + __pyx_v_recurse = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_recurse == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + + /* "_basis.pyx":314 + * raise NotImplementedError + * + * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = False): # <<<<<<<<<<<<<< + * ''' + * X - Data matrix + */ + __pyx_v_recurse = ((int)0); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("apply", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("_basis.ConstantBasisFunction.apply", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_5numpy_ndarray, 1, "b", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_6_basis_21ConstantBasisFunction_18apply(((struct __pyx_obj_6_basis_ConstantBasisFunction *)__pyx_v_self), __pyx_v_X, __pyx_v_b, __pyx_v_recurse); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_18apply(struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_b, int __pyx_v_recurse) { + __Pyx_LocalBuf_ND __pyx_pybuffernd_X; + __Pyx_Buffer __pyx_pybuffer_X; + __Pyx_LocalBuf_ND __pyx_pybuffernd_b; + __Pyx_Buffer __pyx_pybuffer_b; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + struct __pyx_opt_args_6_basis_13BasisFunction_apply __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("apply", 0); + __pyx_pybuffer_X.pybuffer.buf = NULL; + __pyx_pybuffer_X.refcount = 0; + __pyx_pybuffernd_X.data = NULL; + __pyx_pybuffernd_X.rcbuffer = &__pyx_pybuffer_X; + __pyx_pybuffer_b.pybuffer.buf = NULL; + __pyx_pybuffer_b.refcount = 0; + __pyx_pybuffernd_b.data = NULL; + __pyx_pybuffernd_b.rcbuffer = &__pyx_pybuffer_b; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)__pyx_v_b, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_b.diminfo[0].strides = __pyx_pybuffernd_b.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_b.diminfo[0].shape = __pyx_pybuffernd_b.rcbuffer->pybuffer.shape[0]; + __Pyx_XDECREF(__pyx_r); + __pyx_t_2.__pyx_n = 1; + __pyx_t_2.recurse = __pyx_v_recurse; + __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_ConstantBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.apply(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self), ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_b), 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_b.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("_basis.ConstantBasisFunction.apply", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_b.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_21__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_21__str__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_21ConstantBasisFunction_20__str__(((struct __pyx_obj_6_basis_ConstantBasisFunction *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":327 + * b[i] = 1.0 + * + * def __str__(self): # <<<<<<<<<<<<<< + * return '(Intercept)' + * + */ + +static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_20__str__(CYTHON_UNUSED struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__", 0); + + /* "_basis.pyx":328 + * + * def __str__(self): + * return '(Intercept)' # <<<<<<<<<<<<<< + * + * cdef class HingeBasisFunction(BasisFunction): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); + __pyx_r = ((PyObject *)__pyx_kp_s_1); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6_basis_18HingeBasisFunction_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_6_basis_18HingeBasisFunction_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_6_basis_BasisFunction *__pyx_v_parent = 0; + __pyx_t_6_basis_FLOAT_t __pyx_v_knot; + __pyx_t_6_basis_INDEX_t __pyx_v_knot_idx; + __pyx_t_6_basis_INDEX_t __pyx_v_variable; + int __pyx_v_reverse; + PyObject *__pyx_v_label = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__parent,&__pyx_n_s__knot,&__pyx_n_s__knot_idx,&__pyx_n_s__variable,&__pyx_n_s__reverse,&__pyx_n_s__label,0}; + PyObject* values[6] = {0,0,0,0,0,0}; + + /* "_basis.pyx":332 + * cdef class HingeBasisFunction(BasisFunction): + * + * def __init__(self, BasisFunction parent, FLOAT_t knot, INDEX_t knot_idx, INDEX_t variable, bint reverse, label=None): #@DuplicatedSignature # <<<<<<<<<<<<<< + * self.knot = knot + * self.knot_idx = knot_idx + */ + values[5] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parent)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__knot)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__knot_idx)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__variable)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reverse)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 5: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__label); + if (value) { values[5] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_parent = ((struct __pyx_obj_6_basis_BasisFunction *)values[0]); + __pyx_v_knot = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_knot == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_knot_idx = __Pyx_PyInt_from_py_npy_ulonglong(values[2]); if (unlikely((__pyx_v_knot_idx == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_variable = __Pyx_PyInt_from_py_npy_ulonglong(values[3]); if (unlikely((__pyx_v_variable == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_reverse = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_reverse == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_label = values[5]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("_basis.HingeBasisFunction.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parent), __pyx_ptype_6_basis_BasisFunction, 1, "parent", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_6_basis_18HingeBasisFunction___init__(((struct __pyx_obj_6_basis_HingeBasisFunction *)__pyx_v_self), __pyx_v_parent, __pyx_v_knot, __pyx_v_knot_idx, __pyx_v_variable, __pyx_v_reverse, __pyx_v_label); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6_basis_18HingeBasisFunction___init__(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self, struct __pyx_obj_6_basis_BasisFunction *__pyx_v_parent, __pyx_t_6_basis_FLOAT_t __pyx_v_knot, __pyx_t_6_basis_INDEX_t __pyx_v_knot_idx, __pyx_t_6_basis_INDEX_t __pyx_v_variable, int __pyx_v_reverse, PyObject *__pyx_v_label) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "_basis.pyx":333 + * + * def __init__(self, BasisFunction parent, FLOAT_t knot, INDEX_t knot_idx, INDEX_t variable, bint reverse, label=None): #@DuplicatedSignature + * self.knot = knot # <<<<<<<<<<<<<< + * self.knot_idx = knot_idx + * self.variable = variable + */ + __pyx_v_self->knot = __pyx_v_knot; + + /* "_basis.pyx":334 + * def __init__(self, BasisFunction parent, FLOAT_t knot, INDEX_t knot_idx, INDEX_t variable, bint reverse, label=None): #@DuplicatedSignature + * self.knot = knot + * self.knot_idx = knot_idx # <<<<<<<<<<<<<< + * self.variable = variable + * self.reverse = reverse + */ + __pyx_v_self->knot_idx = __pyx_v_knot_idx; + + /* "_basis.pyx":335 + * self.knot = knot + * self.knot_idx = knot_idx + * self.variable = variable # <<<<<<<<<<<<<< + * self.reverse = reverse + * self.label = label if label is not None else 'x'+str(variable) + */ + __pyx_v_self->variable = __pyx_v_variable; + + /* "_basis.pyx":336 + * self.knot_idx = knot_idx + * self.variable = variable + * self.reverse = reverse # <<<<<<<<<<<<<< + * self.label = label if label is not None else 'x'+str(variable) + * self._set_parent(parent) + */ + __pyx_v_self->reverse = __pyx_v_reverse; + + /* "_basis.pyx":337 + * self.variable = variable + * self.reverse = reverse + * self.label = label if label is not None else 'x'+str(variable) # <<<<<<<<<<<<<< + * self._set_parent(parent) + * + */ + __pyx_t_2 = (__pyx_v_label != Py_None); + if (__pyx_t_2) { + __Pyx_INCREF(__pyx_v_label); + __pyx_t_1 = __pyx_v_label; + } else { + __pyx_t_3 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_n_s__x), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_1 = __pyx_t_4; + __pyx_t_4 = 0; + } + if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->label); + __Pyx_DECREF(((PyObject *)__pyx_v_self->label)); + __pyx_v_self->label = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "_basis.pyx":338 + * self.reverse = reverse + * self.label = label if label is not None else 'x'+str(variable) + * self._set_parent(parent) # <<<<<<<<<<<<<< + * + * def __reduce__(self): + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._set_parent(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self), __pyx_v_parent, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("_basis.HingeBasisFunction.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_18HingeBasisFunction_2__reduce__(((struct __pyx_obj_6_basis_HingeBasisFunction *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":340 + * self._set_parent(parent) + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * return (self.__class__, (pickle_place_holder, 1.0, 1, 1, True, ''), self._getstate()) + * + */ + +static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_2__reduce__(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce__", 0); + + /* "_basis.pyx":341 + * + * def __reduce__(self): + * return (self.__class__, (pickle_place_holder, 1.0, 1, 1, True, ''), self._getstate()) # <<<<<<<<<<<<<< + * + * def _getstate(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__pickle_place_holder); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_5, 4, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_2)); + PyTuple_SET_ITEM(__pyx_t_5, 5, ((PyObject *)__pyx_kp_s_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2)); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_1 = 0; + __pyx_t_5 = 0; + __pyx_t_3 = 0; + __pyx_r = ((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("_basis.HingeBasisFunction.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_getstate (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_18HingeBasisFunction_4_getstate(((struct __pyx_obj_6_basis_HingeBasisFunction *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":343 + * return (self.__class__, (pickle_place_holder, 1.0, 1, 1, True, ''), self._getstate()) + * + * def _getstate(self): # <<<<<<<<<<<<<< + * result = super(HingeBasisFunction, self)._getstate() + * result.update({'knot': self.knot, + */ + +static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_4_getstate(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self) { + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_getstate", 0); + + /* "_basis.pyx":344 + * + * def _getstate(self): + * result = super(HingeBasisFunction, self)._getstate() # <<<<<<<<<<<<<< + * result.update({'knot': self.knot, + * 'knot_idx': self.knot_idx, + */ + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_6_basis_HingeBasisFunction))); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_6_basis_HingeBasisFunction))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_6_basis_HingeBasisFunction))); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + __pyx_t_2 = PyObject_Call(__pyx_builtin_super, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_result = __pyx_t_2; + __pyx_t_2 = 0; + + /* "_basis.pyx":345 + * def _getstate(self): + * result = super(HingeBasisFunction, self)._getstate() + * result.update({'knot': self.knot, # <<<<<<<<<<<<<< + * 'knot_idx': self.knot_idx, + * 'variable': self.variable, + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_n_s__update); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->knot); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__knot), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "_basis.pyx":346 + * result = super(HingeBasisFunction, self)._getstate() + * result.update({'knot': self.knot, + * 'knot_idx': self.knot_idx, # <<<<<<<<<<<<<< + * 'variable': self.variable, + * 'reverse': self.reverse, + */ + __pyx_t_3 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->knot_idx); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__knot_idx), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "_basis.pyx":347 + * result.update({'knot': self.knot, + * 'knot_idx': self.knot_idx, + * 'variable': self.variable, # <<<<<<<<<<<<<< + * 'reverse': self.reverse, + * 'label': self.label}) + */ + __pyx_t_3 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->variable); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__variable), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "_basis.pyx":348 + * 'knot_idx': self.knot_idx, + * 'variable': self.variable, + * 'reverse': self.reverse, # <<<<<<<<<<<<<< + * 'label': self.label}) + * return result + */ + __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_self->reverse); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__reverse), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "_basis.pyx":349 + * 'variable': self.variable, + * 'reverse': self.reverse, + * 'label': self.label}) # <<<<<<<<<<<<<< + * return result + * + */ + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__label), ((PyObject *)__pyx_v_self->label)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "_basis.pyx":350 + * 'reverse': self.reverse, + * 'label': self.label}) + * return result # <<<<<<<<<<<<<< + * + * def __setstate__(self, state): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("_basis.HingeBasisFunction._getstate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ +static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_18HingeBasisFunction_6__setstate__(((struct __pyx_obj_6_basis_HingeBasisFunction *)__pyx_v_self), ((PyObject *)__pyx_v_state)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":352 + * return result + * + * def __setstate__(self, state): # <<<<<<<<<<<<<< + * self.knot = state['knot'] + * self.knot_idx = state['knot_idx'] + */ + +static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_6__setstate__(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self, PyObject *__pyx_v_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __pyx_t_6_basis_FLOAT_t __pyx_t_2; + __pyx_t_6_basis_INDEX_t __pyx_t_3; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate__", 0); + + /* "_basis.pyx":353 + * + * def __setstate__(self, state): + * self.knot = state['knot'] # <<<<<<<<<<<<<< + * self.knot_idx = state['knot_idx'] + * self.variable = state['variable'] + */ + __pyx_t_1 = PyObject_GetItem(__pyx_v_state, ((PyObject *)__pyx_n_s__knot)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->knot = __pyx_t_2; + + /* "_basis.pyx":354 + * def __setstate__(self, state): + * self.knot = state['knot'] + * self.knot_idx = state['knot_idx'] # <<<<<<<<<<<<<< + * self.variable = state['variable'] + * self.reverse = state['reverse'] + */ + __pyx_t_1 = PyObject_GetItem(__pyx_v_state, ((PyObject *)__pyx_n_s__knot_idx)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->knot_idx = __pyx_t_3; + + /* "_basis.pyx":355 + * self.knot = state['knot'] + * self.knot_idx = state['knot_idx'] + * self.variable = state['variable'] # <<<<<<<<<<<<<< + * self.reverse = state['reverse'] + * self.label = state['label'] + */ + __pyx_t_1 = PyObject_GetItem(__pyx_v_state, ((PyObject *)__pyx_n_s__variable)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->variable = __pyx_t_3; + + /* "_basis.pyx":356 + * self.knot_idx = state['knot_idx'] + * self.variable = state['variable'] + * self.reverse = state['reverse'] # <<<<<<<<<<<<<< + * self.label = state['label'] + * super(HingeBasisFunction, self).__setstate__(state) + */ + __pyx_t_1 = PyObject_GetItem(__pyx_v_state, ((PyObject *)__pyx_n_s__reverse)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->reverse = __pyx_t_4; + + /* "_basis.pyx":357 + * self.variable = state['variable'] + * self.reverse = state['reverse'] + * self.label = state['label'] # <<<<<<<<<<<<<< + * super(HingeBasisFunction, self).__setstate__(state) + * + */ + __pyx_t_1 = PyObject_GetItem(__pyx_v_state, ((PyObject *)__pyx_n_s__label)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->label); + __Pyx_DECREF(((PyObject *)__pyx_v_self->label)); + __pyx_v_self->label = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "_basis.pyx":358 + * self.reverse = state['reverse'] + * self.label = state['label'] + * super(HingeBasisFunction, self).__setstate__(state) # <<<<<<<<<<<<<< + * + * cpdef bint has_knot(HingeBasisFunction self): + */ + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_6_basis_HingeBasisFunction))); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_6_basis_HingeBasisFunction))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_6_basis_HingeBasisFunction))); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + __pyx_t_5 = PyObject_Call(__pyx_builtin_super, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s____setstate__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_v_state); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("_basis.HingeBasisFunction.__setstate__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":360 + * super(HingeBasisFunction, self).__setstate__(state) + * + * cpdef bint has_knot(HingeBasisFunction self): # <<<<<<<<<<<<<< + * return True + * + */ + +static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_9has_knot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static int __pyx_f_6_basis_18HingeBasisFunction_has_knot(CYTHON_UNUSED struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("has_knot", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__has_knot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_18HingeBasisFunction_9has_knot)) { + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_basis.pyx":361 + * + * cpdef bint has_knot(HingeBasisFunction self): + * return True # <<<<<<<<<<<<<< + * + * cpdef translate(HingeBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse): + */ + __pyx_r = 1; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_WriteUnraisable("_basis.HingeBasisFunction.has_knot", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_9has_knot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_9has_knot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("has_knot (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_18HingeBasisFunction_8has_knot(((struct __pyx_obj_6_basis_HingeBasisFunction *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":360 + * super(HingeBasisFunction, self).__setstate__(state) + * + * cpdef bint has_knot(HingeBasisFunction self): # <<<<<<<<<<<<<< + * return True + * + */ + +static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_8has_knot(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("has_knot", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_vtabstruct_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.has_knot(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_basis.HingeBasisFunction.has_knot", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":363 + * return True + * + * cpdef translate(HingeBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse): # <<<<<<<<<<<<<< + * self.knot = slopes[self.variable]*self.knot + intercepts[self.variable] + * if slopes[self.variable] < 0: + */ + +static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_11translate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_6_basis_18HingeBasisFunction_translate(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts, int __pyx_v_recurse, int __pyx_skip_dispatch) { + __Pyx_LocalBuf_ND __pyx_pybuffernd_intercepts; + __Pyx_Buffer __pyx_pybuffer_intercepts; + __Pyx_LocalBuf_ND __pyx_pybuffernd_slopes; + __Pyx_Buffer __pyx_pybuffer_slopes; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __pyx_t_6_basis_INDEX_t __pyx_t_4; + __pyx_t_6_basis_INDEX_t __pyx_t_5; + __pyx_t_6_basis_INDEX_t __pyx_t_6; + int __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("translate", 0); + __pyx_pybuffer_slopes.pybuffer.buf = NULL; + __pyx_pybuffer_slopes.refcount = 0; + __pyx_pybuffernd_slopes.data = NULL; + __pyx_pybuffernd_slopes.rcbuffer = &__pyx_pybuffer_slopes; + __pyx_pybuffer_intercepts.pybuffer.buf = NULL; + __pyx_pybuffer_intercepts.refcount = 0; + __pyx_pybuffernd_intercepts.data = NULL; + __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__translate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_18HingeBasisFunction_11translate)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_recurse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_slopes)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_slopes)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_slopes)); + __Pyx_INCREF(((PyObject *)__pyx_v_intercepts)); + PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_intercepts)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_intercepts)); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_basis.pyx":364 + * + * cpdef translate(HingeBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse): + * self.knot = slopes[self.variable]*self.knot + intercepts[self.variable] # <<<<<<<<<<<<<< + * if slopes[self.variable] < 0: + * self.reverse = not self.reverse + */ + __pyx_t_4 = __pyx_v_self->variable; + __pyx_t_5 = __pyx_v_self->variable; + __pyx_v_self->knot = (((*__Pyx_BufPtrStrided1d(__pyx_t_6_basis_FLOAT_t *, __pyx_pybuffernd_slopes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_slopes.diminfo[0].strides)) * __pyx_v_self->knot) + (*__Pyx_BufPtrStrided1d(__pyx_t_6_basis_FLOAT_t *, __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_intercepts.diminfo[0].strides))); + + /* "_basis.pyx":365 + * cpdef translate(HingeBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse): + * self.knot = slopes[self.variable]*self.knot + intercepts[self.variable] + * if slopes[self.variable] < 0: # <<<<<<<<<<<<<< + * self.reverse = not self.reverse + * if recurse: + */ + __pyx_t_6 = __pyx_v_self->variable; + __pyx_t_7 = ((*__Pyx_BufPtrStrided1d(__pyx_t_6_basis_FLOAT_t *, __pyx_pybuffernd_slopes.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_slopes.diminfo[0].strides)) < 0.0); + if (__pyx_t_7) { + + /* "_basis.pyx":366 + * self.knot = slopes[self.variable]*self.knot + intercepts[self.variable] + * if slopes[self.variable] < 0: + * self.reverse = not self.reverse # <<<<<<<<<<<<<< + * if recurse: + * self.parent.translate(slopes,intercepts) + */ + __pyx_v_self->reverse = (!__pyx_v_self->reverse); + goto __pyx_L3; + } + __pyx_L3:; + + /* "_basis.pyx":367 + * if slopes[self.variable] < 0: + * self.reverse = not self.reverse + * if recurse: # <<<<<<<<<<<<<< + * self.parent.translate(slopes,intercepts) + * + */ + if (__pyx_v_recurse) { + + /* "_basis.pyx":368 + * self.reverse = not self.reverse + * if recurse: + * self.parent.translate(slopes,intercepts) # <<<<<<<<<<<<<< + * + * cpdef FLOAT_t scale(HingeBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx_base.parent), __pyx_n_s__translate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_v_slopes)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_slopes)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_slopes)); + __Pyx_INCREF(((PyObject *)__pyx_v_intercepts)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_intercepts)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_intercepts)); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + goto __pyx_L4; + } + __pyx_L4:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("_basis.HingeBasisFunction.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_11translate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_11translate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_slopes = 0; + PyArrayObject *__pyx_v_intercepts = 0; + int __pyx_v_recurse; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("translate (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__slopes,&__pyx_n_s__intercepts,&__pyx_n_s__recurse,0}; + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__slopes)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__intercepts)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("translate", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__recurse)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("translate", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "translate") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_slopes = ((PyArrayObject *)values[0]); + __pyx_v_intercepts = ((PyArrayObject *)values[1]); + __pyx_v_recurse = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_recurse == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("translate", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("_basis.HingeBasisFunction.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_slopes), __pyx_ptype_5numpy_ndarray, 1, "slopes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercepts), __pyx_ptype_5numpy_ndarray, 1, "intercepts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_6_basis_18HingeBasisFunction_10translate(((struct __pyx_obj_6_basis_HingeBasisFunction *)__pyx_v_self), __pyx_v_slopes, __pyx_v_intercepts, __pyx_v_recurse); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":363 + * return True + * + * cpdef translate(HingeBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse): # <<<<<<<<<<<<<< + * self.knot = slopes[self.variable]*self.knot + intercepts[self.variable] + * if slopes[self.variable] < 0: + */ + +static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_10translate(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts, int __pyx_v_recurse) { + __Pyx_LocalBuf_ND __pyx_pybuffernd_intercepts; + __Pyx_Buffer __pyx_pybuffer_intercepts; + __Pyx_LocalBuf_ND __pyx_pybuffernd_slopes; + __Pyx_Buffer __pyx_pybuffer_slopes; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("translate", 0); + __pyx_pybuffer_slopes.pybuffer.buf = NULL; + __pyx_pybuffer_slopes.refcount = 0; + __pyx_pybuffernd_slopes.data = NULL; + __pyx_pybuffernd_slopes.rcbuffer = &__pyx_pybuffer_slopes; + __pyx_pybuffer_intercepts.pybuffer.buf = NULL; + __pyx_pybuffer_intercepts.refcount = 0; + __pyx_pybuffernd_intercepts.data = NULL; + __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->translate(__pyx_v_self, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), __pyx_v_recurse, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("_basis.HingeBasisFunction.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":370 + * self.parent.translate(slopes,intercepts) + * + * cpdef FLOAT_t scale(HingeBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): # <<<<<<<<<<<<<< + * result = self.parent.scale(slopes,intercepts) + * result /= slopes[self.variable] + */ + +static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_13scale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static __pyx_t_6_basis_FLOAT_t __pyx_f_6_basis_18HingeBasisFunction_scale(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts, int __pyx_skip_dispatch) { + PyObject *__pyx_v_result = NULL; + __Pyx_LocalBuf_ND __pyx_pybuffernd_intercepts; + __Pyx_Buffer __pyx_pybuffer_intercepts; + __Pyx_LocalBuf_ND __pyx_pybuffernd_slopes; + __Pyx_Buffer __pyx_pybuffer_slopes; + __pyx_t_6_basis_FLOAT_t __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __pyx_t_6_basis_FLOAT_t __pyx_t_4; + __pyx_t_6_basis_INDEX_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("scale", 0); + __pyx_pybuffer_slopes.pybuffer.buf = NULL; + __pyx_pybuffer_slopes.refcount = 0; + __pyx_pybuffernd_slopes.data = NULL; + __pyx_pybuffernd_slopes.rcbuffer = &__pyx_pybuffer_slopes; + __pyx_pybuffer_intercepts.pybuffer.buf = NULL; + __pyx_pybuffer_intercepts.refcount = 0; + __pyx_pybuffernd_intercepts.data = NULL; + __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__scale); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_18HingeBasisFunction_13scale)) { + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_v_slopes)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_slopes)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_slopes)); + __Pyx_INCREF(((PyObject *)__pyx_v_intercepts)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_intercepts)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_intercepts)); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_4; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_basis.pyx":371 + * + * cpdef FLOAT_t scale(HingeBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): + * result = self.parent.scale(slopes,intercepts) # <<<<<<<<<<<<<< + * result /= slopes[self.variable] + * return result + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx_base.parent), __pyx_n_s__scale); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_slopes)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_slopes)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_slopes)); + __Pyx_INCREF(((PyObject *)__pyx_v_intercepts)); + PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_intercepts)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_intercepts)); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_v_result = __pyx_t_2; + __pyx_t_2 = 0; + + /* "_basis.pyx":372 + * cpdef FLOAT_t scale(HingeBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): + * result = self.parent.scale(slopes,intercepts) + * result /= slopes[self.variable] # <<<<<<<<<<<<<< + * return result + * + */ + __pyx_t_5 = __pyx_v_self->variable; + __pyx_t_2 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_6_basis_FLOAT_t *, __pyx_pybuffernd_slopes.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_slopes.diminfo[0].strides))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyNumber_InPlaceDivide(__pyx_v_result, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_3; + __pyx_t_3 = 0; + + /* "_basis.pyx":373 + * result = self.parent.scale(slopes,intercepts) + * result /= slopes[self.variable] + * return result # <<<<<<<<<<<<<< + * + * def __str__(self): + */ + __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_result); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_t_4; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_WriteUnraisable("_basis.HingeBasisFunction.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_13scale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_13scale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_slopes = 0; + PyArrayObject *__pyx_v_intercepts = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("scale (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__slopes,&__pyx_n_s__intercepts,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__slopes)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__intercepts)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("scale", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scale") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_slopes = ((PyArrayObject *)values[0]); + __pyx_v_intercepts = ((PyArrayObject *)values[1]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("scale", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("_basis.HingeBasisFunction.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_slopes), __pyx_ptype_5numpy_ndarray, 1, "slopes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercepts), __pyx_ptype_5numpy_ndarray, 1, "intercepts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_6_basis_18HingeBasisFunction_12scale(((struct __pyx_obj_6_basis_HingeBasisFunction *)__pyx_v_self), __pyx_v_slopes, __pyx_v_intercepts); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":370 + * self.parent.translate(slopes,intercepts) + * + * cpdef FLOAT_t scale(HingeBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): # <<<<<<<<<<<<<< + * result = self.parent.scale(slopes,intercepts) + * result /= slopes[self.variable] + */ + +static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_12scale(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts) { + __Pyx_LocalBuf_ND __pyx_pybuffernd_intercepts; + __Pyx_Buffer __pyx_pybuffer_intercepts; + __Pyx_LocalBuf_ND __pyx_pybuffernd_slopes; + __Pyx_Buffer __pyx_pybuffer_slopes; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("scale", 0); + __pyx_pybuffer_slopes.pybuffer.buf = NULL; + __pyx_pybuffer_slopes.refcount = 0; + __pyx_pybuffernd_slopes.data = NULL; + __pyx_pybuffernd_slopes.rcbuffer = &__pyx_pybuffer_slopes; + __pyx_pybuffer_intercepts.pybuffer.buf = NULL; + __pyx_pybuffer_intercepts.refcount = 0; + __pyx_pybuffernd_intercepts.data = NULL; + __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->scale(__pyx_v_self, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("_basis.HingeBasisFunction.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_15__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_15__str__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_18HingeBasisFunction_14__str__(((struct __pyx_obj_6_basis_HingeBasisFunction *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":375 + * return result + * + * def __str__(self): # <<<<<<<<<<<<<< + * result = '' + * if self.variable is not None: + */ + +static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_14__str__(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self) { + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_v_parent = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__str__", 0); + + /* "_basis.pyx":376 + * + * def __str__(self): + * result = '' # <<<<<<<<<<<<<< + * if self.variable is not None: + * if not self.reverse: + */ + __Pyx_INCREF(((PyObject *)__pyx_kp_s_2)); + __pyx_v_result = ((PyObject *)__pyx_kp_s_2); + + /* "_basis.pyx":377 + * def __str__(self): + * result = '' + * if self.variable is not None: # <<<<<<<<<<<<<< + * if not self.reverse: + * if self.knot >= 0: + */ + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->variable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = (__pyx_t_1 != Py_None); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "_basis.pyx":378 + * result = '' + * if self.variable is not None: + * if not self.reverse: # <<<<<<<<<<<<<< + * if self.knot >= 0: + * result = 'h(%s-%G)' % (self.label,self.knot) + */ + __pyx_t_2 = (!__pyx_v_self->reverse); + if (__pyx_t_2) { + + /* "_basis.pyx":379 + * if self.variable is not None: + * if not self.reverse: + * if self.knot >= 0: # <<<<<<<<<<<<<< + * result = 'h(%s-%G)' % (self.label,self.knot) + * else: + */ + __pyx_t_2 = (__pyx_v_self->knot >= 0.0); + if (__pyx_t_2) { + + /* "_basis.pyx":380 + * if not self.reverse: + * if self.knot >= 0: + * result = 'h(%s-%G)' % (self.label,self.knot) # <<<<<<<<<<<<<< + * else: + * result = 'h(%s+%G)' % (self.label,-self.knot) + */ + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->knot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_self->label)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self->label)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->label)); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_3), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L5; + } + /*else*/ { + + /* "_basis.pyx":382 + * result = 'h(%s-%G)' % (self.label,self.knot) + * else: + * result = 'h(%s+%G)' % (self.label,-self.knot) # <<<<<<<<<<<<<< + * else: + * result = 'h(%G-%s)' % (self.knot,self.label) + */ + __pyx_t_1 = PyFloat_FromDouble((-__pyx_v_self->knot)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_self->label)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self->label)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->label)); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_4), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + } + __pyx_L5:; + goto __pyx_L4; + } + /*else*/ { + + /* "_basis.pyx":384 + * result = 'h(%s+%G)' % (self.label,-self.knot) + * else: + * result = 'h(%G-%s)' % (self.knot,self.label) # <<<<<<<<<<<<<< + * parent = str(self.parent) if not self.parent.__class__ is ConstantBasisFunction else '' + * if parent != '': + */ + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->knot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_v_self->label)); + PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_self->label)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->label)); + __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + } + __pyx_L4:; + goto __pyx_L3; + } + __pyx_L3:; + + /* "_basis.pyx":385 + * else: + * result = 'h(%G-%s)' % (self.knot,self.label) + * parent = str(self.parent) if not self.parent.__class__ is ConstantBasisFunction else '' # <<<<<<<<<<<<<< + * if parent != '': + * result += '*%s' % (str(self.parent),) + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx_base.parent), __pyx_n_s____class__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = (__pyx_t_3 == ((PyObject *)((PyObject*)__pyx_ptype_6_basis_ConstantBasisFunction))); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if ((!__pyx_t_2)) { + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.parent)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self->__pyx_base.parent)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.parent)); + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_1 = __pyx_t_4; + __pyx_t_4 = 0; + } else { + __Pyx_INCREF(((PyObject *)__pyx_kp_s_2)); + __pyx_t_1 = ((PyObject *)__pyx_kp_s_2); + } + __pyx_v_parent = __pyx_t_1; + __pyx_t_1 = 0; + + /* "_basis.pyx":386 + * result = 'h(%G-%s)' % (self.knot,self.label) + * parent = str(self.parent) if not self.parent.__class__ is ConstantBasisFunction else '' + * if parent != '': # <<<<<<<<<<<<<< + * result += '*%s' % (str(self.parent),) + * return result + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_parent, ((PyObject *)__pyx_kp_s_2), Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "_basis.pyx":387 + * parent = str(self.parent) if not self.parent.__class__ is ConstantBasisFunction else '' + * if parent != '': + * result += '*%s' % (str(self.parent),) # <<<<<<<<<<<<<< + * return result + * + */ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.parent)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self->__pyx_base.parent)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.parent)); + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_6), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "_basis.pyx":388 + * if parent != '': + * result += '*%s' % (str(self.parent),) + * return result # <<<<<<<<<<<<<< + * + * cpdef INDEX_t get_variable(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("_basis.HingeBasisFunction.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_parent); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":390 + * return result + * + * cpdef INDEX_t get_variable(self): # <<<<<<<<<<<<<< + * return self.variable + * + */ + +static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_17get_variable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static __pyx_t_6_basis_INDEX_t __pyx_f_6_basis_18HingeBasisFunction_get_variable(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { + __pyx_t_6_basis_INDEX_t __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __pyx_t_6_basis_INDEX_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_variable", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_variable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_18HingeBasisFunction_17get_variable)) { + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_basis.pyx":391 + * + * cpdef INDEX_t get_variable(self): + * return self.variable # <<<<<<<<<<<<<< + * + * cpdef FLOAT_t get_knot(self): + */ + __pyx_r = __pyx_v_self->variable; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_WriteUnraisable("_basis.HingeBasisFunction.get_variable", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_17get_variable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_17get_variable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_variable (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_18HingeBasisFunction_16get_variable(((struct __pyx_obj_6_basis_HingeBasisFunction *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":390 + * return result + * + * cpdef INDEX_t get_variable(self): # <<<<<<<<<<<<<< + * return self.variable + * + */ + +static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_16get_variable(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_variable", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_variable(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_basis.HingeBasisFunction.get_variable", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":393 + * return self.variable + * + * cpdef FLOAT_t get_knot(self): # <<<<<<<<<<<<<< + * return self.knot + * + */ + +static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_19get_knot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static __pyx_t_6_basis_FLOAT_t __pyx_f_6_basis_18HingeBasisFunction_get_knot(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { + __pyx_t_6_basis_FLOAT_t __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __pyx_t_6_basis_FLOAT_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_knot", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_knot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_18HingeBasisFunction_19get_knot)) { + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_basis.pyx":394 + * + * cpdef FLOAT_t get_knot(self): + * return self.knot # <<<<<<<<<<<<<< + * + * cpdef bint get_reverse(self): + */ + __pyx_r = __pyx_v_self->knot; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_WriteUnraisable("_basis.HingeBasisFunction.get_knot", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_19get_knot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_19get_knot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_knot (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_18HingeBasisFunction_18get_knot(((struct __pyx_obj_6_basis_HingeBasisFunction *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":393 + * return self.variable + * + * cpdef FLOAT_t get_knot(self): # <<<<<<<<<<<<<< + * return self.knot + * + */ + +static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_18get_knot(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_knot", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_knot(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_basis.HingeBasisFunction.get_knot", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":396 + * return self.knot + * + * cpdef bint get_reverse(self): # <<<<<<<<<<<<<< + * return self.reverse + * + */ + +static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_21get_reverse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static int __pyx_f_6_basis_18HingeBasisFunction_get_reverse(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_reverse", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_reverse); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_18HingeBasisFunction_21get_reverse)) { + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_basis.pyx":397 + * + * cpdef bint get_reverse(self): + * return self.reverse # <<<<<<<<<<<<<< + * + * cpdef INDEX_t get_knot_idx(self): + */ + __pyx_r = __pyx_v_self->reverse; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_WriteUnraisable("_basis.HingeBasisFunction.get_reverse", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_21get_reverse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_21get_reverse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_reverse (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_18HingeBasisFunction_20get_reverse(((struct __pyx_obj_6_basis_HingeBasisFunction *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":396 + * return self.knot + * + * cpdef bint get_reverse(self): # <<<<<<<<<<<<<< + * return self.reverse + * + */ + +static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_20get_reverse(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_reverse", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_vtabstruct_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_reverse(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_basis.HingeBasisFunction.get_reverse", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":399 + * return self.reverse + * + * cpdef INDEX_t get_knot_idx(self): # <<<<<<<<<<<<<< + * return self.knot_idx + * + */ + +static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_23get_knot_idx(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static __pyx_t_6_basis_INDEX_t __pyx_f_6_basis_18HingeBasisFunction_get_knot_idx(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { + __pyx_t_6_basis_INDEX_t __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __pyx_t_6_basis_INDEX_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_knot_idx", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_knot_idx); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_18HingeBasisFunction_23get_knot_idx)) { + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_basis.pyx":400 + * + * cpdef INDEX_t get_knot_idx(self): + * return self.knot_idx # <<<<<<<<<<<<<< + * + * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = True): + */ + __pyx_r = __pyx_v_self->knot_idx; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_WriteUnraisable("_basis.HingeBasisFunction.get_knot_idx", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_23get_knot_idx(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_23get_knot_idx(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_knot_idx (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_18HingeBasisFunction_22get_knot_idx(((struct __pyx_obj_6_basis_HingeBasisFunction *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":399 + * return self.reverse + * + * cpdef INDEX_t get_knot_idx(self): # <<<<<<<<<<<<<< + * return self.knot_idx + * + */ + +static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_22get_knot_idx(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_knot_idx", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_knot_idx(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_basis.HingeBasisFunction.get_knot_idx", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":402 + * return self.knot_idx + * + * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = True): # <<<<<<<<<<<<<< + * ''' + * X - Data matrix + */ + +static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_25apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_6_basis_18HingeBasisFunction_apply(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_b, int __pyx_skip_dispatch, struct __pyx_opt_args_6_basis_18HingeBasisFunction_apply *__pyx_optional_args) { + int __pyx_v_recurse = ((int)1); + __pyx_t_6_basis_INDEX_t __pyx_v_i; + __pyx_t_6_basis_INDEX_t __pyx_v_m; + __pyx_t_6_basis_FLOAT_t __pyx_v_tmp; + __Pyx_LocalBuf_ND __pyx_pybuffernd_X; + __Pyx_Buffer __pyx_pybuffer_X; + __Pyx_LocalBuf_ND __pyx_pybuffernd_b; + __Pyx_Buffer __pyx_pybuffer_b; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + struct __pyx_opt_args_6_basis_13BasisFunction_apply __pyx_t_4; + Py_ssize_t __pyx_t_5; + __pyx_t_6_basis_INDEX_t __pyx_t_6; + __pyx_t_6_basis_INDEX_t __pyx_t_7; + __pyx_t_6_basis_INDEX_t __pyx_t_8; + __pyx_t_6_basis_INDEX_t __pyx_t_9; + int __pyx_t_10; + __pyx_t_6_basis_INDEX_t __pyx_t_11; + __pyx_t_6_basis_INDEX_t __pyx_t_12; + __pyx_t_6_basis_INDEX_t __pyx_t_13; + __pyx_t_6_basis_INDEX_t __pyx_t_14; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("apply", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_recurse = __pyx_optional_args->recurse; + } + } + __pyx_pybuffer_X.pybuffer.buf = NULL; + __pyx_pybuffer_X.refcount = 0; + __pyx_pybuffernd_X.data = NULL; + __pyx_pybuffernd_X.rcbuffer = &__pyx_pybuffer_X; + __pyx_pybuffer_b.pybuffer.buf = NULL; + __pyx_pybuffer_b.refcount = 0; + __pyx_pybuffernd_b.data = NULL; + __pyx_pybuffernd_b.rcbuffer = &__pyx_pybuffer_b; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)__pyx_v_b, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_b.diminfo[0].strides = __pyx_pybuffernd_b.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_b.diminfo[0].shape = __pyx_pybuffernd_b.rcbuffer->pybuffer.shape[0]; + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__apply); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_18HingeBasisFunction_25apply)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_recurse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_X)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_X)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_X)); + __Pyx_INCREF(((PyObject *)__pyx_v_b)); + PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_b)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_b)); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_basis.pyx":409 + * parent function. + * ''' + * if recurse: # <<<<<<<<<<<<<< + * self.parent.apply(X,b,recurse=True) + * cdef INDEX_t i #@DuplicatedSignature + */ + if (__pyx_v_recurse) { + + /* "_basis.pyx":410 + * ''' + * if recurse: + * self.parent.apply(X,b,recurse=True) # <<<<<<<<<<<<<< + * cdef INDEX_t i #@DuplicatedSignature + * cdef INDEX_t m = len(b) #@DuplicatedSignature + */ + __pyx_t_4.__pyx_n = 1; + __pyx_t_4.recurse = 1; + __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_self->__pyx_base.parent->__pyx_vtab)->apply(__pyx_v_self->__pyx_base.parent, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_b), 0, &__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "_basis.pyx":412 + * self.parent.apply(X,b,recurse=True) + * cdef INDEX_t i #@DuplicatedSignature + * cdef INDEX_t m = len(b) #@DuplicatedSignature # <<<<<<<<<<<<<< + * cdef FLOAT_t tmp + * if self.reverse: + */ + __pyx_t_5 = PyObject_Length(((PyObject *)__pyx_v_b)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_m = __pyx_t_5; + + /* "_basis.pyx":414 + * cdef INDEX_t m = len(b) #@DuplicatedSignature + * cdef FLOAT_t tmp + * if self.reverse: # <<<<<<<<<<<<<< + * for i in range(m): + * tmp = self.knot - X[i,self.variable] + */ + if (__pyx_v_self->reverse) { + + /* "_basis.pyx":415 + * cdef FLOAT_t tmp + * if self.reverse: + * for i in range(m): # <<<<<<<<<<<<<< + * tmp = self.knot - X[i,self.variable] + * if tmp < 0: + */ + __pyx_t_6 = __pyx_v_m; + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { + __pyx_v_i = __pyx_t_7; + + /* "_basis.pyx":416 + * if self.reverse: + * for i in range(m): + * tmp = self.knot - X[i,self.variable] # <<<<<<<<<<<<<< + * if tmp < 0: + * tmp = 0.0 + */ + __pyx_t_8 = __pyx_v_i; + __pyx_t_9 = __pyx_v_self->variable; + __pyx_v_tmp = (__pyx_v_self->knot - (*__Pyx_BufPtrStrided2d(__pyx_t_6_basis_FLOAT_t *, __pyx_pybuffernd_X.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_X.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_X.diminfo[1].strides))); + + /* "_basis.pyx":417 + * for i in range(m): + * tmp = self.knot - X[i,self.variable] + * if tmp < 0: # <<<<<<<<<<<<<< + * tmp = 0.0 + * b[i] *= tmp + */ + __pyx_t_10 = (__pyx_v_tmp < 0.0); + if (__pyx_t_10) { + + /* "_basis.pyx":418 + * tmp = self.knot - X[i,self.variable] + * if tmp < 0: + * tmp = 0.0 # <<<<<<<<<<<<<< + * b[i] *= tmp + * else: + */ + __pyx_v_tmp = ((__pyx_t_6_basis_FLOAT_t)0.0); + goto __pyx_L7; + } + __pyx_L7:; + + /* "_basis.pyx":419 + * if tmp < 0: + * tmp = 0.0 + * b[i] *= tmp # <<<<<<<<<<<<<< + * else: + * for i in range(m): + */ + __pyx_t_11 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_6_basis_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_b.diminfo[0].strides) *= __pyx_v_tmp; + } + goto __pyx_L4; + } + /*else*/ { + + /* "_basis.pyx":421 + * b[i] *= tmp + * else: + * for i in range(m): # <<<<<<<<<<<<<< + * tmp = X[i,self.variable] - self.knot + * if tmp < 0: + */ + __pyx_t_6 = __pyx_v_m; + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { + __pyx_v_i = __pyx_t_7; + + /* "_basis.pyx":422 + * else: + * for i in range(m): + * tmp = X[i,self.variable] - self.knot # <<<<<<<<<<<<<< + * if tmp < 0: + * tmp = 0.0 + */ + __pyx_t_12 = __pyx_v_i; + __pyx_t_13 = __pyx_v_self->variable; + __pyx_v_tmp = ((*__Pyx_BufPtrStrided2d(__pyx_t_6_basis_FLOAT_t *, __pyx_pybuffernd_X.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_X.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_X.diminfo[1].strides)) - __pyx_v_self->knot); + + /* "_basis.pyx":423 + * for i in range(m): + * tmp = X[i,self.variable] - self.knot + * if tmp < 0: # <<<<<<<<<<<<<< + * tmp = 0.0 + * b[i] *= tmp + */ + __pyx_t_10 = (__pyx_v_tmp < 0.0); + if (__pyx_t_10) { + + /* "_basis.pyx":424 + * tmp = X[i,self.variable] - self.knot + * if tmp < 0: + * tmp = 0.0 # <<<<<<<<<<<<<< + * b[i] *= tmp + * + */ + __pyx_v_tmp = ((__pyx_t_6_basis_FLOAT_t)0.0); + goto __pyx_L10; + } + __pyx_L10:; + + /* "_basis.pyx":425 + * if tmp < 0: + * tmp = 0.0 + * b[i] *= tmp # <<<<<<<<<<<<<< + * + * cdef class LinearBasisFunction(BasisFunction): + */ + __pyx_t_14 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_6_basis_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_b.diminfo[0].strides) *= __pyx_v_tmp; + } + } + __pyx_L4:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_b.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("_basis.HingeBasisFunction.apply", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_b.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_25apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6_basis_18HingeBasisFunction_24apply[] = "\n X - Data matrix\n b - parent vector\n recurse - If False, assume b already contains the result of the parent function. Otherwise, recurse to compute\n parent function.\n "; +static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_25apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_X = 0; + PyArrayObject *__pyx_v_b = 0; + int __pyx_v_recurse; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("apply (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__b,&__pyx_n_s__recurse,0}; + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__b)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("apply", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__recurse); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_X = ((PyArrayObject *)values[0]); + __pyx_v_b = ((PyArrayObject *)values[1]); + if (values[2]) { + __pyx_v_recurse = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_recurse == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + + /* "_basis.pyx":402 + * return self.knot_idx + * + * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = True): # <<<<<<<<<<<<<< + * ''' + * X - Data matrix + */ + __pyx_v_recurse = ((int)1); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("apply", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("_basis.HingeBasisFunction.apply", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_5numpy_ndarray, 1, "b", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_6_basis_18HingeBasisFunction_24apply(((struct __pyx_obj_6_basis_HingeBasisFunction *)__pyx_v_self), __pyx_v_X, __pyx_v_b, __pyx_v_recurse); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_24apply(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_b, int __pyx_v_recurse) { + __Pyx_LocalBuf_ND __pyx_pybuffernd_X; + __Pyx_Buffer __pyx_pybuffer_X; + __Pyx_LocalBuf_ND __pyx_pybuffernd_b; + __Pyx_Buffer __pyx_pybuffer_b; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + struct __pyx_opt_args_6_basis_13BasisFunction_apply __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("apply", 0); + __pyx_pybuffer_X.pybuffer.buf = NULL; + __pyx_pybuffer_X.refcount = 0; + __pyx_pybuffernd_X.data = NULL; + __pyx_pybuffernd_X.rcbuffer = &__pyx_pybuffer_X; + __pyx_pybuffer_b.pybuffer.buf = NULL; + __pyx_pybuffer_b.refcount = 0; + __pyx_pybuffernd_b.data = NULL; + __pyx_pybuffernd_b.rcbuffer = &__pyx_pybuffer_b; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)__pyx_v_b, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_b.diminfo[0].strides = __pyx_pybuffernd_b.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_b.diminfo[0].shape = __pyx_pybuffernd_b.rcbuffer->pybuffer.shape[0]; + __Pyx_XDECREF(__pyx_r); + __pyx_t_2.__pyx_n = 1; + __pyx_t_2.recurse = __pyx_v_recurse; + __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.apply(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self), ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_b), 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_b.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("_basis.HingeBasisFunction.apply", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_b.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6_basis_19LinearBasisFunction_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_6_basis_19LinearBasisFunction_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_6_basis_BasisFunction *__pyx_v_parent = 0; + __pyx_t_6_basis_INDEX_t __pyx_v_variable; + PyObject *__pyx_v_label = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__parent,&__pyx_n_s__variable,&__pyx_n_s__label,0}; + PyObject* values[3] = {0,0,0}; + + /* "_basis.pyx":428 + * + * cdef class LinearBasisFunction(BasisFunction): + * def __init__(self, BasisFunction parent, INDEX_t variable, label=None): #@DuplicatedSignature # <<<<<<<<<<<<<< + * self.variable = variable + * self.label = label if label is not None else 'x'+str(variable) + */ + values[2] = ((PyObject *)Py_None); + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parent)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__variable)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__label); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_parent = ((struct __pyx_obj_6_basis_BasisFunction *)values[0]); + __pyx_v_variable = __Pyx_PyInt_from_py_npy_ulonglong(values[1]); if (unlikely((__pyx_v_variable == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_label = values[2]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("_basis.LinearBasisFunction.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parent), __pyx_ptype_6_basis_BasisFunction, 1, "parent", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_6_basis_19LinearBasisFunction___init__(((struct __pyx_obj_6_basis_LinearBasisFunction *)__pyx_v_self), __pyx_v_parent, __pyx_v_variable, __pyx_v_label); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static int __pyx_pf_6_basis_19LinearBasisFunction___init__(struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_self, struct __pyx_obj_6_basis_BasisFunction *__pyx_v_parent, __pyx_t_6_basis_INDEX_t __pyx_v_variable, PyObject *__pyx_v_label) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "_basis.pyx":429 + * cdef class LinearBasisFunction(BasisFunction): + * def __init__(self, BasisFunction parent, INDEX_t variable, label=None): #@DuplicatedSignature + * self.variable = variable # <<<<<<<<<<<<<< + * self.label = label if label is not None else 'x'+str(variable) + * self._set_parent(parent) + */ + __pyx_v_self->variable = __pyx_v_variable; + + /* "_basis.pyx":430 + * def __init__(self, BasisFunction parent, INDEX_t variable, label=None): #@DuplicatedSignature + * self.variable = variable + * self.label = label if label is not None else 'x'+str(variable) # <<<<<<<<<<<<<< + * self._set_parent(parent) + * + */ + __pyx_t_2 = (__pyx_v_label != Py_None); + if (__pyx_t_2) { + __Pyx_INCREF(__pyx_v_label); + __pyx_t_1 = __pyx_v_label; + } else { + __pyx_t_3 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_n_s__x), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_1 = __pyx_t_4; + __pyx_t_4 = 0; + } + if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->label); + __Pyx_DECREF(((PyObject *)__pyx_v_self->label)); + __pyx_v_self->label = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "_basis.pyx":431 + * self.variable = variable + * self.label = label if label is not None else 'x'+str(variable) + * self._set_parent(parent) # <<<<<<<<<<<<<< + * + * def __reduce__(self): + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_LinearBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._set_parent(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self), __pyx_v_parent, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("_basis.LinearBasisFunction.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_19LinearBasisFunction_2__reduce__(((struct __pyx_obj_6_basis_LinearBasisFunction *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":433 + * self._set_parent(parent) + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * return (self.__class__, (pickle_place_holder, 1, ''), self._getstate()) + * + */ + +static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_2__reduce__(struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce__", 0); + + /* "_basis.pyx":434 + * + * def __reduce__(self): + * return (self.__class__, (pickle_place_holder, 1, ''), self._getstate()) # <<<<<<<<<<<<<< + * + * def _getstate(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__pickle_place_holder); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_2)); + PyTuple_SET_ITEM(__pyx_t_3, 2, ((PyObject *)__pyx_kp_s_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2)); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("_basis.LinearBasisFunction.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_getstate (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_19LinearBasisFunction_4_getstate(((struct __pyx_obj_6_basis_LinearBasisFunction *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":436 + * return (self.__class__, (pickle_place_holder, 1, ''), self._getstate()) + * + * def _getstate(self): # <<<<<<<<<<<<<< + * result = super(LinearBasisFunction, self)._getstate() + * result.update({'variable': self.variable, + */ + +static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_4_getstate(struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_self) { + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_getstate", 0); + + /* "_basis.pyx":437 + * + * def _getstate(self): + * result = super(LinearBasisFunction, self)._getstate() # <<<<<<<<<<<<<< + * result.update({'variable': self.variable, + * 'label': self.label}) + */ + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_6_basis_LinearBasisFunction))); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_6_basis_LinearBasisFunction))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_6_basis_LinearBasisFunction))); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + __pyx_t_2 = PyObject_Call(__pyx_builtin_super, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_result = __pyx_t_2; + __pyx_t_2 = 0; + + /* "_basis.pyx":438 + * def _getstate(self): + * result = super(LinearBasisFunction, self)._getstate() + * result.update({'variable': self.variable, # <<<<<<<<<<<<<< + * 'label': self.label}) + * return result + */ + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_n_s__update); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_3 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->variable); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__variable), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "_basis.pyx":439 + * result = super(LinearBasisFunction, self)._getstate() + * result.update({'variable': self.variable, + * 'label': self.label}) # <<<<<<<<<<<<<< + * return result + * + */ + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__label), ((PyObject *)__pyx_v_self->label)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "_basis.pyx":440 + * result.update({'variable': self.variable, + * 'label': self.label}) + * return result # <<<<<<<<<<<<<< + * + * def __setstate__(self, state): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("_basis.LinearBasisFunction._getstate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ +static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_19LinearBasisFunction_6__setstate__(((struct __pyx_obj_6_basis_LinearBasisFunction *)__pyx_v_self), ((PyObject *)__pyx_v_state)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":442 + * return result + * + * def __setstate__(self, state): # <<<<<<<<<<<<<< + * self.variable = state['variable'] + * self.label = state['label'] + */ + +static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_6__setstate__(struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_self, PyObject *__pyx_v_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __pyx_t_6_basis_INDEX_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate__", 0); + + /* "_basis.pyx":443 + * + * def __setstate__(self, state): + * self.variable = state['variable'] # <<<<<<<<<<<<<< + * self.label = state['label'] + * super(LinearBasisFunction, self).__setstate__(state) + */ + __pyx_t_1 = PyObject_GetItem(__pyx_v_state, ((PyObject *)__pyx_n_s__variable)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->variable = __pyx_t_2; + + /* "_basis.pyx":444 + * def __setstate__(self, state): + * self.variable = state['variable'] + * self.label = state['label'] # <<<<<<<<<<<<<< + * super(LinearBasisFunction, self).__setstate__(state) + * + */ + __pyx_t_1 = PyObject_GetItem(__pyx_v_state, ((PyObject *)__pyx_n_s__label)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->label); + __Pyx_DECREF(((PyObject *)__pyx_v_self->label)); + __pyx_v_self->label = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "_basis.pyx":445 + * self.variable = state['variable'] + * self.label = state['label'] + * super(LinearBasisFunction, self).__setstate__(state) # <<<<<<<<<<<<<< + * + * cpdef translate(LinearBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse): + */ + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_6_basis_LinearBasisFunction))); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_6_basis_LinearBasisFunction))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_6_basis_LinearBasisFunction))); + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + __pyx_t_3 = PyObject_Call(__pyx_builtin_super, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s____setstate__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_state); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_state); + __Pyx_GIVEREF(__pyx_v_state); + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("_basis.LinearBasisFunction.__setstate__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":447 + * super(LinearBasisFunction, self).__setstate__(state) + * + * cpdef translate(LinearBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse): # <<<<<<<<<<<<<< + * pass + * + */ + +static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_9translate(PyObject *__pyx_v_LinearBasisFunctionself, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_6_basis_19LinearBasisFunction_translate(CYTHON_UNUSED struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_LinearBasisFunctionself, CYTHON_UNUSED PyArrayObject *__pyx_v_slopes, CYTHON_UNUSED PyArrayObject *__pyx_v_intercepts, CYTHON_UNUSED int __pyx_v_recurse, int __pyx_skip_dispatch) { + __Pyx_LocalBuf_ND __pyx_pybuffernd_intercepts; + __Pyx_Buffer __pyx_pybuffer_intercepts; + __Pyx_LocalBuf_ND __pyx_pybuffernd_slopes; + __Pyx_Buffer __pyx_pybuffer_slopes; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("translate", 0); + __pyx_pybuffer_slopes.pybuffer.buf = NULL; + __pyx_pybuffer_slopes.refcount = 0; + __pyx_pybuffernd_slopes.data = NULL; + __pyx_pybuffernd_slopes.rcbuffer = &__pyx_pybuffer_slopes; + __pyx_pybuffer_intercepts.pybuffer.buf = NULL; + __pyx_pybuffer_intercepts.refcount = 0; + __pyx_pybuffernd_intercepts.data = NULL; + __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_LinearBasisFunctionself))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_LinearBasisFunctionself), __pyx_n_s__translate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_19LinearBasisFunction_9translate)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_recurse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_slopes)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_slopes)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_slopes)); + __Pyx_INCREF(((PyObject *)__pyx_v_intercepts)); + PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_intercepts)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_intercepts)); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_basis.pyx":448 + * + * cpdef translate(LinearBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse): + * pass # <<<<<<<<<<<<<< + * + * cpdef FLOAT_t scale(LinearBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): + */ + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("_basis.LinearBasisFunction.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_9translate(PyObject *__pyx_v_LinearBasisFunctionself, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_9translate(PyObject *__pyx_v_LinearBasisFunctionself, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_slopes = 0; + PyArrayObject *__pyx_v_intercepts = 0; + int __pyx_v_recurse; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("translate (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__slopes,&__pyx_n_s__intercepts,&__pyx_n_s__recurse,0}; + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__slopes)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__intercepts)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("translate", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__recurse)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("translate", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "translate") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_slopes = ((PyArrayObject *)values[0]); + __pyx_v_intercepts = ((PyArrayObject *)values[1]); + __pyx_v_recurse = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_recurse == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("translate", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("_basis.LinearBasisFunction.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_slopes), __pyx_ptype_5numpy_ndarray, 1, "slopes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercepts), __pyx_ptype_5numpy_ndarray, 1, "intercepts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_6_basis_19LinearBasisFunction_8translate(((struct __pyx_obj_6_basis_LinearBasisFunction *)__pyx_v_LinearBasisFunctionself), __pyx_v_slopes, __pyx_v_intercepts, __pyx_v_recurse); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":447 + * super(LinearBasisFunction, self).__setstate__(state) + * + * cpdef translate(LinearBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse): # <<<<<<<<<<<<<< + * pass + * + */ + +static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_8translate(struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_LinearBasisFunctionself, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts, int __pyx_v_recurse) { + __Pyx_LocalBuf_ND __pyx_pybuffernd_intercepts; + __Pyx_Buffer __pyx_pybuffer_intercepts; + __Pyx_LocalBuf_ND __pyx_pybuffernd_slopes; + __Pyx_Buffer __pyx_pybuffer_slopes; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("translate", 0); + __pyx_pybuffer_slopes.pybuffer.buf = NULL; + __pyx_pybuffer_slopes.refcount = 0; + __pyx_pybuffernd_slopes.data = NULL; + __pyx_pybuffernd_slopes.rcbuffer = &__pyx_pybuffer_slopes; + __pyx_pybuffer_intercepts.pybuffer.buf = NULL; + __pyx_pybuffer_intercepts.refcount = 0; + __pyx_pybuffernd_intercepts.data = NULL; + __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_LinearBasisFunction *)__pyx_v_LinearBasisFunctionself->__pyx_base.__pyx_vtab)->translate(__pyx_v_LinearBasisFunctionself, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), __pyx_v_recurse, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("_basis.LinearBasisFunction.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":450 + * pass + * + * cpdef FLOAT_t scale(LinearBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): # <<<<<<<<<<<<<< + * result = self.parent.scale(slopes,intercepts) + * result /= slopes[self.variable] + */ + +static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_11scale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static __pyx_t_6_basis_FLOAT_t __pyx_f_6_basis_19LinearBasisFunction_scale(struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts, int __pyx_skip_dispatch) { + PyObject *__pyx_v_result = NULL; + __Pyx_LocalBuf_ND __pyx_pybuffernd_intercepts; + __Pyx_Buffer __pyx_pybuffer_intercepts; + __Pyx_LocalBuf_ND __pyx_pybuffernd_slopes; + __Pyx_Buffer __pyx_pybuffer_slopes; + __pyx_t_6_basis_FLOAT_t __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __pyx_t_6_basis_FLOAT_t __pyx_t_4; + __pyx_t_6_basis_INDEX_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("scale", 0); + __pyx_pybuffer_slopes.pybuffer.buf = NULL; + __pyx_pybuffer_slopes.refcount = 0; + __pyx_pybuffernd_slopes.data = NULL; + __pyx_pybuffernd_slopes.rcbuffer = &__pyx_pybuffer_slopes; + __pyx_pybuffer_intercepts.pybuffer.buf = NULL; + __pyx_pybuffer_intercepts.refcount = 0; + __pyx_pybuffernd_intercepts.data = NULL; + __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__scale); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_19LinearBasisFunction_11scale)) { + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_v_slopes)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_slopes)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_slopes)); + __Pyx_INCREF(((PyObject *)__pyx_v_intercepts)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_intercepts)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_intercepts)); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_4; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_basis.pyx":451 + * + * cpdef FLOAT_t scale(LinearBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): + * result = self.parent.scale(slopes,intercepts) # <<<<<<<<<<<<<< + * result /= slopes[self.variable] + * return result + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx_base.parent), __pyx_n_s__scale); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_slopes)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_slopes)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_slopes)); + __Pyx_INCREF(((PyObject *)__pyx_v_intercepts)); + PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_intercepts)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_intercepts)); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_v_result = __pyx_t_2; + __pyx_t_2 = 0; + + /* "_basis.pyx":452 + * cpdef FLOAT_t scale(LinearBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): + * result = self.parent.scale(slopes,intercepts) + * result /= slopes[self.variable] # <<<<<<<<<<<<<< + * return result + * + */ + __pyx_t_5 = __pyx_v_self->variable; + __pyx_t_2 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_6_basis_FLOAT_t *, __pyx_pybuffernd_slopes.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_slopes.diminfo[0].strides))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyNumber_InPlaceDivide(__pyx_v_result, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_3; + __pyx_t_3 = 0; + + /* "_basis.pyx":453 + * result = self.parent.scale(slopes,intercepts) + * result /= slopes[self.variable] + * return result # <<<<<<<<<<<<<< + * + * def __str__(LinearBasisFunction self): + */ + __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_result); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_t_4; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_WriteUnraisable("_basis.LinearBasisFunction.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_11scale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_11scale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_slopes = 0; + PyArrayObject *__pyx_v_intercepts = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("scale (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__slopes,&__pyx_n_s__intercepts,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__slopes)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__intercepts)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("scale", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scale") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_slopes = ((PyArrayObject *)values[0]); + __pyx_v_intercepts = ((PyArrayObject *)values[1]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("scale", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("_basis.LinearBasisFunction.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_slopes), __pyx_ptype_5numpy_ndarray, 1, "slopes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercepts), __pyx_ptype_5numpy_ndarray, 1, "intercepts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_6_basis_19LinearBasisFunction_10scale(((struct __pyx_obj_6_basis_LinearBasisFunction *)__pyx_v_self), __pyx_v_slopes, __pyx_v_intercepts); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":450 + * pass + * + * cpdef FLOAT_t scale(LinearBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): # <<<<<<<<<<<<<< + * result = self.parent.scale(slopes,intercepts) + * result /= slopes[self.variable] + */ + +static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_10scale(struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts) { + __Pyx_LocalBuf_ND __pyx_pybuffernd_intercepts; + __Pyx_Buffer __pyx_pybuffer_intercepts; + __Pyx_LocalBuf_ND __pyx_pybuffernd_slopes; + __Pyx_Buffer __pyx_pybuffer_slopes; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("scale", 0); + __pyx_pybuffer_slopes.pybuffer.buf = NULL; + __pyx_pybuffer_slopes.refcount = 0; + __pyx_pybuffernd_slopes.data = NULL; + __pyx_pybuffernd_slopes.rcbuffer = &__pyx_pybuffer_slopes; + __pyx_pybuffer_intercepts.pybuffer.buf = NULL; + __pyx_pybuffer_intercepts.refcount = 0; + __pyx_pybuffernd_intercepts.data = NULL; + __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_6_basis_LinearBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->scale(__pyx_v_self, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("_basis.LinearBasisFunction.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_13__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_13__str__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_19LinearBasisFunction_12__str__(((struct __pyx_obj_6_basis_LinearBasisFunction *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":455 + * return result + * + * def __str__(LinearBasisFunction self): # <<<<<<<<<<<<<< + * result = self.label + * if not self.parent.__class__ is ConstantBasisFunction: + */ + +static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_12__str__(struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_self) { + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_v_parent = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__str__", 0); + + /* "_basis.pyx":456 + * + * def __str__(LinearBasisFunction self): + * result = self.label # <<<<<<<<<<<<<< + * if not self.parent.__class__ is ConstantBasisFunction: + * parent = str(self.parent) + */ + __pyx_t_1 = ((PyObject *)__pyx_v_self->label); + __Pyx_INCREF(__pyx_t_1); + __pyx_v_result = __pyx_t_1; + __pyx_t_1 = 0; + + /* "_basis.pyx":457 + * def __str__(LinearBasisFunction self): + * result = self.label + * if not self.parent.__class__ is ConstantBasisFunction: # <<<<<<<<<<<<<< + * parent = str(self.parent) + * result += '*'+parent + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx_base.parent), __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = (__pyx_t_1 == ((PyObject *)((PyObject*)__pyx_ptype_6_basis_ConstantBasisFunction))); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = (!__pyx_t_2); + if (__pyx_t_3) { + + /* "_basis.pyx":458 + * result = self.label + * if not self.parent.__class__ is ConstantBasisFunction: + * parent = str(self.parent) # <<<<<<<<<<<<<< + * result += '*'+parent + * return result + */ + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.parent)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self->__pyx_base.parent)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.parent)); + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_v_parent = __pyx_t_4; + __pyx_t_4 = 0; + + /* "_basis.pyx":459 + * if not self.parent.__class__ is ConstantBasisFunction: + * parent = str(self.parent) + * result += '*'+parent # <<<<<<<<<<<<<< + * return result + * + */ + __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_kp_s_7), __pyx_v_parent); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_result, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "_basis.pyx":460 + * parent = str(self.parent) + * result += '*'+parent + * return result # <<<<<<<<<<<<<< + * + * cpdef INDEX_t get_variable(self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("_basis.LinearBasisFunction.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_parent); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":462 + * return result + * + * cpdef INDEX_t get_variable(self): # <<<<<<<<<<<<<< + * return self.variable + * + */ + +static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_15get_variable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static __pyx_t_6_basis_INDEX_t __pyx_f_6_basis_19LinearBasisFunction_get_variable(struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { + __pyx_t_6_basis_INDEX_t __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __pyx_t_6_basis_INDEX_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_variable", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_variable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_19LinearBasisFunction_15get_variable)) { + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_basis.pyx":463 + * + * cpdef INDEX_t get_variable(self): + * return self.variable # <<<<<<<<<<<<<< + * + * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = True): + */ + __pyx_r = __pyx_v_self->variable; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_WriteUnraisable("_basis.LinearBasisFunction.get_variable", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_15get_variable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_15get_variable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_variable (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_19LinearBasisFunction_14get_variable(((struct __pyx_obj_6_basis_LinearBasisFunction *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":462 + * return result + * + * cpdef INDEX_t get_variable(self): # <<<<<<<<<<<<<< + * return self.variable + * + */ + +static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_14get_variable(struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_variable", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_6_basis_LinearBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_variable(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_basis.LinearBasisFunction.get_variable", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":465 + * return self.variable + * + * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = True): # <<<<<<<<<<<<<< + * ''' + * X - Data matrix + */ + +static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_17apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_6_basis_19LinearBasisFunction_apply(struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_b, int __pyx_skip_dispatch, struct __pyx_opt_args_6_basis_19LinearBasisFunction_apply *__pyx_optional_args) { + int __pyx_v_recurse = ((int)1); + __pyx_t_6_basis_INDEX_t __pyx_v_i; + __pyx_t_6_basis_INDEX_t __pyx_v_m; + __Pyx_LocalBuf_ND __pyx_pybuffernd_X; + __Pyx_Buffer __pyx_pybuffer_X; + __Pyx_LocalBuf_ND __pyx_pybuffernd_b; + __Pyx_Buffer __pyx_pybuffer_b; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + struct __pyx_opt_args_6_basis_13BasisFunction_apply __pyx_t_4; + Py_ssize_t __pyx_t_5; + __pyx_t_6_basis_INDEX_t __pyx_t_6; + __pyx_t_6_basis_INDEX_t __pyx_t_7; + __pyx_t_6_basis_INDEX_t __pyx_t_8; + __pyx_t_6_basis_INDEX_t __pyx_t_9; + __pyx_t_6_basis_INDEX_t __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("apply", 0); + if (__pyx_optional_args) { + if (__pyx_optional_args->__pyx_n > 0) { + __pyx_v_recurse = __pyx_optional_args->recurse; + } + } + __pyx_pybuffer_X.pybuffer.buf = NULL; + __pyx_pybuffer_X.refcount = 0; + __pyx_pybuffernd_X.data = NULL; + __pyx_pybuffernd_X.rcbuffer = &__pyx_pybuffer_X; + __pyx_pybuffer_b.pybuffer.buf = NULL; + __pyx_pybuffer_b.refcount = 0; + __pyx_pybuffernd_b.data = NULL; + __pyx_pybuffernd_b.rcbuffer = &__pyx_pybuffer_b; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)__pyx_v_b, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_b.diminfo[0].strides = __pyx_pybuffernd_b.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_b.diminfo[0].shape = __pyx_pybuffernd_b.rcbuffer->pybuffer.shape[0]; + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__apply); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_19LinearBasisFunction_17apply)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_recurse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_X)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_X)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_X)); + __Pyx_INCREF(((PyObject *)__pyx_v_b)); + PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_b)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_b)); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_basis.pyx":472 + * parent function. + * ''' + * if recurse: # <<<<<<<<<<<<<< + * self.parent.apply(X,b,recurse=True) + * cdef INDEX_t i #@DuplicatedSignature + */ + if (__pyx_v_recurse) { + + /* "_basis.pyx":473 + * ''' + * if recurse: + * self.parent.apply(X,b,recurse=True) # <<<<<<<<<<<<<< + * cdef INDEX_t i #@DuplicatedSignature + * cdef INDEX_t m = len(b) #@DuplicatedSignature + */ + __pyx_t_4.__pyx_n = 1; + __pyx_t_4.recurse = 1; + __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_self->__pyx_base.parent->__pyx_vtab)->apply(__pyx_v_self->__pyx_base.parent, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_b), 0, &__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "_basis.pyx":475 + * self.parent.apply(X,b,recurse=True) + * cdef INDEX_t i #@DuplicatedSignature + * cdef INDEX_t m = len(b) #@DuplicatedSignature # <<<<<<<<<<<<<< + * for i in range(m): + * b[i] *= X[i,self.variable] + */ + __pyx_t_5 = PyObject_Length(((PyObject *)__pyx_v_b)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_m = __pyx_t_5; + + /* "_basis.pyx":476 + * cdef INDEX_t i #@DuplicatedSignature + * cdef INDEX_t m = len(b) #@DuplicatedSignature + * for i in range(m): # <<<<<<<<<<<<<< + * b[i] *= X[i,self.variable] + * + */ + __pyx_t_6 = __pyx_v_m; + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { + __pyx_v_i = __pyx_t_7; + + /* "_basis.pyx":477 + * cdef INDEX_t m = len(b) #@DuplicatedSignature + * for i in range(m): + * b[i] *= X[i,self.variable] # <<<<<<<<<<<<<< + * + * cdef class Basis: + */ + __pyx_t_8 = __pyx_v_i; + __pyx_t_9 = __pyx_v_self->variable; + __pyx_t_10 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_6_basis_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_b.diminfo[0].strides) *= (*__Pyx_BufPtrStrided2d(__pyx_t_6_basis_FLOAT_t *, __pyx_pybuffernd_X.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_X.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_X.diminfo[1].strides)); + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_b.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("_basis.LinearBasisFunction.apply", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_b.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_17apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_6_basis_19LinearBasisFunction_16apply[] = "\n X - Data matrix\n b - parent vector\n recurse - If False, assume b already contains the result of the parent function. Otherwise, recurse to compute\n parent function.\n "; +static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_17apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_X = 0; + PyArrayObject *__pyx_v_b = 0; + int __pyx_v_recurse; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("apply (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__b,&__pyx_n_s__recurse,0}; + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__b)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("apply", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (kw_args > 0) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__recurse); + if (value) { values[2] = value; kw_args--; } + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else { + switch (PyTuple_GET_SIZE(__pyx_args)) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + break; + default: goto __pyx_L5_argtuple_error; + } + } + __pyx_v_X = ((PyArrayObject *)values[0]); + __pyx_v_b = ((PyArrayObject *)values[1]); + if (values[2]) { + __pyx_v_recurse = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_recurse == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + + /* "_basis.pyx":465 + * return self.variable + * + * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = True): # <<<<<<<<<<<<<< + * ''' + * X - Data matrix + */ + __pyx_v_recurse = ((int)1); + } + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("apply", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("_basis.LinearBasisFunction.apply", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_5numpy_ndarray, 1, "b", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_6_basis_19LinearBasisFunction_16apply(((struct __pyx_obj_6_basis_LinearBasisFunction *)__pyx_v_self), __pyx_v_X, __pyx_v_b, __pyx_v_recurse); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_16apply(struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_b, int __pyx_v_recurse) { + __Pyx_LocalBuf_ND __pyx_pybuffernd_X; + __Pyx_Buffer __pyx_pybuffer_X; + __Pyx_LocalBuf_ND __pyx_pybuffernd_b; + __Pyx_Buffer __pyx_pybuffer_b; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + struct __pyx_opt_args_6_basis_13BasisFunction_apply __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("apply", 0); + __pyx_pybuffer_X.pybuffer.buf = NULL; + __pyx_pybuffer_X.refcount = 0; + __pyx_pybuffernd_X.data = NULL; + __pyx_pybuffernd_X.rcbuffer = &__pyx_pybuffer_X; + __pyx_pybuffer_b.pybuffer.buf = NULL; + __pyx_pybuffer_b.refcount = 0; + __pyx_pybuffernd_b.data = NULL; + __pyx_pybuffernd_b.rcbuffer = &__pyx_pybuffer_b; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)__pyx_v_b, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_b.diminfo[0].strides = __pyx_pybuffernd_b.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_b.diminfo[0].shape = __pyx_pybuffernd_b.rcbuffer->pybuffer.shape[0]; + __Pyx_XDECREF(__pyx_r); + __pyx_t_2.__pyx_n = 1; + __pyx_t_2.recurse = __pyx_v_recurse; + __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_LinearBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.apply(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self), ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_b), 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_b.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("_basis.LinearBasisFunction.apply", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_b.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_6_basis_5Basis_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_6_basis_5Basis_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} + if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; + __pyx_r = __pyx_pf_6_basis_5Basis___init__(((struct __pyx_obj_6_basis_Basis *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":484 + * added.''' + * + * def __init__(Basis self): #@DuplicatedSignature # <<<<<<<<<<<<<< + * self.order = [] + * + */ + +static int __pyx_pf_6_basis_5Basis___init__(struct __pyx_obj_6_basis_Basis *__pyx_v_self) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "_basis.pyx":485 + * + * def __init__(Basis self): #@DuplicatedSignature + * self.order = [] # <<<<<<<<<<<<<< + * + * def __reduce__(self): + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); + __Pyx_GOTREF(__pyx_v_self->order); + __Pyx_DECREF(((PyObject *)__pyx_v_self->order)); + __pyx_v_self->order = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_basis.Basis.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_5Basis_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6_basis_5Basis_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_5Basis_2__reduce__(((struct __pyx_obj_6_basis_Basis *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":487 + * self.order = [] + * + * def __reduce__(self): # <<<<<<<<<<<<<< + * return (self.__class__, (), self._getstate()) + * + */ + +static PyObject *__pyx_pf_6_basis_5Basis_2__reduce__(struct __pyx_obj_6_basis_Basis *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce__", 0); + + /* "_basis.pyx":488 + * + * def __reduce__(self): + * return (self.__class__, (), self._getstate()) # <<<<<<<<<<<<<< + * + * def _getstate(self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_empty_tuple)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_empty_tuple)); + __Pyx_GIVEREF(((PyObject *)__pyx_empty_tuple)); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_1 = 0; + __pyx_t_3 = 0; + __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("_basis.Basis.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_5Basis_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6_basis_5Basis_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_getstate (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_5Basis_4_getstate(((struct __pyx_obj_6_basis_Basis *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":490 + * return (self.__class__, (), self._getstate()) + * + * def _getstate(self): # <<<<<<<<<<<<<< + * return {'order': self.order} + * + */ + +static PyObject *__pyx_pf_6_basis_5Basis_4_getstate(struct __pyx_obj_6_basis_Basis *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_getstate", 0); + + /* "_basis.pyx":491 + * + * def _getstate(self): + * return {'order': self.order} # <<<<<<<<<<<<<< + * + * def __setstate__(self, state): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_v_self->order)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_basis.Basis._getstate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_5Basis_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ +static PyObject *__pyx_pw_6_basis_5Basis_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_5Basis_6__setstate__(((struct __pyx_obj_6_basis_Basis *)__pyx_v_self), ((PyObject *)__pyx_v_state)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":493 + * return {'order': self.order} + * + * def __setstate__(self, state): # <<<<<<<<<<<<<< + * self.order = state['order'] + * + */ + +static PyObject *__pyx_pf_6_basis_5Basis_6__setstate__(struct __pyx_obj_6_basis_Basis *__pyx_v_self, PyObject *__pyx_v_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate__", 0); + + /* "_basis.pyx":494 + * + * def __setstate__(self, state): + * self.order = state['order'] # <<<<<<<<<<<<<< + * + * def __richcmp__(self, other, method): + */ + __pyx_t_1 = PyObject_GetItem(__pyx_v_state, ((PyObject *)__pyx_n_s__order)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->order); + __Pyx_DECREF(((PyObject *)__pyx_v_self->order)); + __pyx_v_self->order = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_basis.Basis.__setstate__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_5Basis_9__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_arg_method); /*proto*/ +static PyObject *__pyx_pw_6_basis_5Basis_9__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_arg_method) { + PyObject *__pyx_v_method = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0); + __pyx_v_method = PyInt_FromLong(__pyx_arg_method); if (unlikely(!__pyx_v_method)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_v_method); + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("_basis.Basis.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6_basis_5Basis_8__richcmp__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other), ((PyObject *)__pyx_v_method)); + __Pyx_XDECREF(__pyx_v_method); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":496 + * self.order = state['order'] + * + * def __richcmp__(self, other, method): # <<<<<<<<<<<<<< + * if method == 2: + * return self._eq(other) + */ + +static PyObject *__pyx_pf_6_basis_5Basis_8__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_method) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__richcmp__", 0); + + /* "_basis.pyx":497 + * + * def __richcmp__(self, other, method): + * if method == 2: # <<<<<<<<<<<<<< + * return self._eq(other) + * elif method == 3: + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_method, __pyx_int_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "_basis.pyx":498 + * def __richcmp__(self, other, method): + * if method == 2: + * return self._eq(other) # <<<<<<<<<<<<<< + * elif method == 3: + * return not self._eq(other) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s___eq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_other); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_other); + __Pyx_GIVEREF(__pyx_v_other); + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + goto __pyx_L3; + } + + /* "_basis.pyx":499 + * if method == 2: + * return self._eq(other) + * elif method == 3: # <<<<<<<<<<<<<< + * return not self._eq(other) + * else: + */ + __pyx_t_4 = PyObject_RichCompare(__pyx_v_method, __pyx_int_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_2) { + + /* "_basis.pyx":500 + * return self._eq(other) + * elif method == 3: + * return not self._eq(other) # <<<<<<<<<<<<<< + * else: + * return NotImplemented + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s___eq); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_other); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_other); + __Pyx_GIVEREF(__pyx_v_other); + __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyBool_FromLong((!__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "_basis.pyx":502 + * return not self._eq(other) + * else: + * return NotImplemented # <<<<<<<<<<<<<< + * + * def _eq(self, other): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_builtin_NotImplemented); + __pyx_r = __pyx_builtin_NotImplemented; + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("_basis.Basis.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_5Basis_11_eq(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static PyObject *__pyx_pw_6_basis_5Basis_11_eq(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_eq (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_5Basis_10_eq(((struct __pyx_obj_6_basis_Basis *)__pyx_v_self), ((PyObject *)__pyx_v_other)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":504 + * return NotImplemented + * + * def _eq(self, other): # <<<<<<<<<<<<<< + * return self.__class__ is other.__class__ and self._getstate() == other._getstate() + * + */ + +static PyObject *__pyx_pf_6_basis_5Basis_10_eq(struct __pyx_obj_6_basis_Basis *__pyx_v_self, PyObject *__pyx_v_other) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_eq", 0); + + /* "_basis.pyx":505 + * + * def _eq(self, other): + * return self.__class__ is other.__class__ and self._getstate() == other._getstate() # <<<<<<<<<<<<<< + * + * def piter(Basis self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = (__pyx_t_1 == __pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_3) { + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __pyx_t_1; + __pyx_t_1 = 0; + } else { + __pyx_t_5 = __pyx_t_2; + __pyx_t_2 = 0; + } + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("_basis.Basis._eq", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static PyObject *__pyx_gb_6_basis_5Basis_14generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_5Basis_13piter(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6_basis_5Basis_13piter(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("piter (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_5Basis_12piter(((struct __pyx_obj_6_basis_Basis *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":507 + * return self.__class__ is other.__class__ and self._getstate() == other._getstate() + * + * def piter(Basis self): # <<<<<<<<<<<<<< + * for bf in self.order: + * if not bf.is_pruned(): + */ + +static PyObject *__pyx_pf_6_basis_5Basis_12piter(struct __pyx_obj_6_basis_Basis *__pyx_v_self) { + struct __pyx_obj_6_basis___pyx_scope_struct__piter *__pyx_cur_scope; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("piter", 0); + __pyx_cur_scope = (struct __pyx_obj_6_basis___pyx_scope_struct__piter *)__pyx_tp_new_6_basis___pyx_scope_struct__piter(__pyx_ptype_6_basis___pyx_scope_struct__piter, __pyx_empty_tuple, NULL); + if (unlikely(!__pyx_cur_scope)) { + __Pyx_RefNannyFinishContext(); + return NULL; + } + __Pyx_GOTREF(__pyx_cur_scope); + __pyx_cur_scope->__pyx_v_self = __pyx_v_self; + __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); + { + __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_6_basis_5Basis_14generator, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_cur_scope); + __Pyx_RefNannyFinishContext(); + return (PyObject *) gen; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("_basis.Basis.piter", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyObject *__pyx_gb_6_basis_5Basis_14generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +{ + struct __pyx_obj_6_basis___pyx_scope_struct__piter *__pyx_cur_scope = ((struct __pyx_obj_6_basis___pyx_scope_struct__piter *)__pyx_generator->closure); + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("None", 0); + switch (__pyx_generator->resume_label) { + case 0: goto __pyx_L3_first_run; + case 1: goto __pyx_L7_resume_from_yield; + default: /* CPython raises the right error here */ + __Pyx_RefNannyFinishContext(); + return NULL; + } + __pyx_L3_first_run:; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "_basis.pyx":508 + * + * def piter(Basis self): + * for bf in self.order: # <<<<<<<<<<<<<< + * if not bf.is_pruned(): + * yield bf + */ + if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_self->order) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = ((PyObject *)__pyx_cur_scope->__pyx_v_self->order); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; + for (;;) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_bf); + __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_bf); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_cur_scope->__pyx_v_bf = __pyx_t_3; + __pyx_t_3 = 0; + + /* "_basis.pyx":509 + * def piter(Basis self): + * for bf in self.order: + * if not bf.is_pruned(): # <<<<<<<<<<<<<< + * yield bf + * + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_bf, __pyx_n_s__is_pruned); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = (!__pyx_t_5); + if (__pyx_t_6) { + + /* "_basis.pyx":510 + * for bf in self.order: + * if not bf.is_pruned(): + * yield bf # <<<<<<<<<<<<<< + * + * def __str__(Basis self): + */ + __Pyx_INCREF(__pyx_cur_scope->__pyx_v_bf); + __pyx_r = __pyx_cur_scope->__pyx_v_bf; + __Pyx_XGIVEREF(__pyx_t_1); + __pyx_cur_scope->__pyx_t_0 = __pyx_t_1; + __pyx_cur_scope->__pyx_t_1 = __pyx_t_2; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + /* return from generator, yielding value */ + __pyx_generator->resume_label = 1; + return __pyx_r; + __pyx_L7_resume_from_yield:; + __pyx_t_1 = __pyx_cur_scope->__pyx_t_0; + __pyx_cur_scope->__pyx_t_0 = 0; + __Pyx_XGOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + PyErr_SetNone(PyExc_StopIteration); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("piter", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_L0:; + __Pyx_XDECREF(__pyx_r); + __pyx_generator->resume_label = -1; + __Pyx_Generator_clear((PyObject*)__pyx_generator); + __Pyx_RefNannyFinishContext(); + return NULL; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_5Basis_16__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6_basis_5Basis_16__str__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_5Basis_15__str__(((struct __pyx_obj_6_basis_Basis *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":512 + * yield bf + * + * def __str__(Basis self): # <<<<<<<<<<<<<< + * cdef INDEX_t i + * cdef INDEX_t n = len(self) + */ + +static PyObject *__pyx_pf_6_basis_5Basis_15__str__(struct __pyx_obj_6_basis_Basis *__pyx_v_self) { + __pyx_t_6_basis_INDEX_t __pyx_v_i; + __pyx_t_6_basis_INDEX_t __pyx_v_n; + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + __pyx_t_6_basis_INDEX_t __pyx_t_2; + __pyx_t_6_basis_INDEX_t __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__str__", 0); + + /* "_basis.pyx":514 + * def __str__(Basis self): + * cdef INDEX_t i + * cdef INDEX_t n = len(self) # <<<<<<<<<<<<<< + * result = '' + * for i in range(n): + */ + __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_n = __pyx_t_1; + + /* "_basis.pyx":515 + * cdef INDEX_t i + * cdef INDEX_t n = len(self) + * result = '' # <<<<<<<<<<<<<< + * for i in range(n): + * result += str(self[i]) + */ + __Pyx_INCREF(((PyObject *)__pyx_kp_s_2)); + __pyx_v_result = ((PyObject *)__pyx_kp_s_2); + + /* "_basis.pyx":516 + * cdef INDEX_t n = len(self) + * result = '' + * for i in range(n): # <<<<<<<<<<<<<< + * result += str(self[i]) + * result += '\n' + */ + __pyx_t_2 = __pyx_v_n; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; + + /* "_basis.pyx":517 + * result = '' + * for i in range(n): + * result += str(self[i]) # <<<<<<<<<<<<<< + * result += '\n' + * return result + */ + __pyx_t_4 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self), __pyx_v_i, sizeof(__pyx_t_6_basis_INDEX_t)+1, __Pyx_PyInt_to_py_npy_ulonglong, 0, 0, 0); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_result, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_5; + __pyx_t_5 = 0; + + /* "_basis.pyx":518 + * for i in range(n): + * result += str(self[i]) + * result += '\n' # <<<<<<<<<<<<<< + * return result + * + */ + __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_8)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_5; + __pyx_t_5 = 0; + } + + /* "_basis.pyx":519 + * result += str(self[i]) + * result += '\n' + * return result # <<<<<<<<<<<<<< + * + * cpdef translate(Basis self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("_basis.Basis.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":521 + * return result + * + * cpdef translate(Basis self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): # <<<<<<<<<<<<<< + * cdef INDEX_t n = len(self) + * cdef INDEX_t i #@DuplicatedSignature + */ + +static PyObject *__pyx_pw_6_basis_5Basis_18translate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_6_basis_5Basis_translate(struct __pyx_obj_6_basis_Basis *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts, int __pyx_skip_dispatch) { + __pyx_t_6_basis_INDEX_t __pyx_v_n; + __pyx_t_6_basis_INDEX_t __pyx_v_i; + __Pyx_LocalBuf_ND __pyx_pybuffernd_intercepts; + __Pyx_Buffer __pyx_pybuffer_intercepts; + __Pyx_LocalBuf_ND __pyx_pybuffernd_slopes; + __Pyx_Buffer __pyx_pybuffer_slopes; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + __pyx_t_6_basis_INDEX_t __pyx_t_5; + __pyx_t_6_basis_INDEX_t __pyx_t_6; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("translate", 0); + __pyx_pybuffer_slopes.pybuffer.buf = NULL; + __pyx_pybuffer_slopes.refcount = 0; + __pyx_pybuffernd_slopes.data = NULL; + __pyx_pybuffernd_slopes.rcbuffer = &__pyx_pybuffer_slopes; + __pyx_pybuffer_intercepts.pybuffer.buf = NULL; + __pyx_pybuffer_intercepts.refcount = 0; + __pyx_pybuffernd_intercepts.data = NULL; + __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__translate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_5Basis_18translate)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_v_slopes)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_slopes)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_slopes)); + __Pyx_INCREF(((PyObject *)__pyx_v_intercepts)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_intercepts)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_intercepts)); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_basis.pyx":522 + * + * cpdef translate(Basis self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): + * cdef INDEX_t n = len(self) # <<<<<<<<<<<<<< + * cdef INDEX_t i #@DuplicatedSignature + * for i in range(n): + */ + __pyx_t_4 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_n = __pyx_t_4; + + /* "_basis.pyx":524 + * cdef INDEX_t n = len(self) + * cdef INDEX_t i #@DuplicatedSignature + * for i in range(n): # <<<<<<<<<<<<<< + * self.order[i].translate(slopes,intercepts,False) + * + */ + __pyx_t_5 = __pyx_v_n; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "_basis.pyx":525 + * cdef INDEX_t i #@DuplicatedSignature + * for i in range(n): + * self.order[i].translate(slopes,intercepts,False) # <<<<<<<<<<<<<< + * + * cpdef scale(Basis self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, cnp.ndarray[FLOAT_t,ndim=1] beta): + */ + if (unlikely(((PyObject *)__pyx_v_self->order) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i), __pyx_n_s__translate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_v_slopes)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_slopes)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_slopes)); + __Pyx_INCREF(((PyObject *)__pyx_v_intercepts)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_intercepts)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_intercepts)); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("_basis.Basis.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_5Basis_18translate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6_basis_5Basis_18translate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_slopes = 0; + PyArrayObject *__pyx_v_intercepts = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("translate (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__slopes,&__pyx_n_s__intercepts,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__slopes)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__intercepts)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("translate", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "translate") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_slopes = ((PyArrayObject *)values[0]); + __pyx_v_intercepts = ((PyArrayObject *)values[1]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("translate", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("_basis.Basis.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_slopes), __pyx_ptype_5numpy_ndarray, 1, "slopes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercepts), __pyx_ptype_5numpy_ndarray, 1, "intercepts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_6_basis_5Basis_17translate(((struct __pyx_obj_6_basis_Basis *)__pyx_v_self), __pyx_v_slopes, __pyx_v_intercepts); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":521 + * return result + * + * cpdef translate(Basis self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): # <<<<<<<<<<<<<< + * cdef INDEX_t n = len(self) + * cdef INDEX_t i #@DuplicatedSignature + */ + +static PyObject *__pyx_pf_6_basis_5Basis_17translate(struct __pyx_obj_6_basis_Basis *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts) { + __Pyx_LocalBuf_ND __pyx_pybuffernd_intercepts; + __Pyx_Buffer __pyx_pybuffer_intercepts; + __Pyx_LocalBuf_ND __pyx_pybuffernd_slopes; + __Pyx_Buffer __pyx_pybuffer_slopes; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("translate", 0); + __pyx_pybuffer_slopes.pybuffer.buf = NULL; + __pyx_pybuffer_slopes.refcount = 0; + __pyx_pybuffernd_slopes.data = NULL; + __pyx_pybuffernd_slopes.rcbuffer = &__pyx_pybuffer_slopes; + __pyx_pybuffer_intercepts.pybuffer.buf = NULL; + __pyx_pybuffer_intercepts.refcount = 0; + __pyx_pybuffernd_intercepts.data = NULL; + __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->translate(__pyx_v_self, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("_basis.Basis.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":527 + * self.order[i].translate(slopes,intercepts,False) + * + * cpdef scale(Basis self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, cnp.ndarray[FLOAT_t,ndim=1] beta): # <<<<<<<<<<<<<< + * cdef INDEX_t n = len(self) #@DuplicatedSignature + * cdef INDEX_t i #@DuplicatedSignature + */ + +static PyObject *__pyx_pw_6_basis_5Basis_20scale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_6_basis_5Basis_scale(struct __pyx_obj_6_basis_Basis *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts, PyArrayObject *__pyx_v_beta, int __pyx_skip_dispatch) { + __pyx_t_6_basis_INDEX_t __pyx_v_n; + __pyx_t_6_basis_INDEX_t __pyx_v_i; + __pyx_t_6_basis_INDEX_t __pyx_v_j; + __Pyx_LocalBuf_ND __pyx_pybuffernd_beta; + __Pyx_Buffer __pyx_pybuffer_beta; + __Pyx_LocalBuf_ND __pyx_pybuffernd_intercepts; + __Pyx_Buffer __pyx_pybuffer_intercepts; + __Pyx_LocalBuf_ND __pyx_pybuffernd_slopes; + __Pyx_Buffer __pyx_pybuffer_slopes; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + __pyx_t_6_basis_INDEX_t __pyx_t_5; + __pyx_t_6_basis_INDEX_t __pyx_t_6; + int __pyx_t_7; + __pyx_t_6_basis_FLOAT_t __pyx_t_8; + __pyx_t_6_basis_INDEX_t __pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("scale", 0); + __pyx_pybuffer_slopes.pybuffer.buf = NULL; + __pyx_pybuffer_slopes.refcount = 0; + __pyx_pybuffernd_slopes.data = NULL; + __pyx_pybuffernd_slopes.rcbuffer = &__pyx_pybuffer_slopes; + __pyx_pybuffer_intercepts.pybuffer.buf = NULL; + __pyx_pybuffer_intercepts.refcount = 0; + __pyx_pybuffernd_intercepts.data = NULL; + __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; + __pyx_pybuffer_beta.pybuffer.buf = NULL; + __pyx_pybuffer_beta.refcount = 0; + __pyx_pybuffernd_beta.data = NULL; + __pyx_pybuffernd_beta.rcbuffer = &__pyx_pybuffer_beta; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_beta.rcbuffer->pybuffer, (PyObject*)__pyx_v_beta, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_beta.diminfo[0].strides = __pyx_pybuffernd_beta.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_beta.diminfo[0].shape = __pyx_pybuffernd_beta.rcbuffer->pybuffer.shape[0]; + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__scale); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_5Basis_20scale)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_v_slopes)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_slopes)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_slopes)); + __Pyx_INCREF(((PyObject *)__pyx_v_intercepts)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_intercepts)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_intercepts)); + __Pyx_INCREF(((PyObject *)__pyx_v_beta)); + PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_beta)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_beta)); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_basis.pyx":528 + * + * cpdef scale(Basis self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, cnp.ndarray[FLOAT_t,ndim=1] beta): + * cdef INDEX_t n = len(self) #@DuplicatedSignature # <<<<<<<<<<<<<< + * cdef INDEX_t i #@DuplicatedSignature + * cdef INDEX_t j = 0 + */ + __pyx_t_4 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_n = __pyx_t_4; + + /* "_basis.pyx":530 + * cdef INDEX_t n = len(self) #@DuplicatedSignature + * cdef INDEX_t i #@DuplicatedSignature + * cdef INDEX_t j = 0 # <<<<<<<<<<<<<< + * for i in range(n): + * if self.order[i].is_pruned(): + */ + __pyx_v_j = 0; + + /* "_basis.pyx":531 + * cdef INDEX_t i #@DuplicatedSignature + * cdef INDEX_t j = 0 + * for i in range(n): # <<<<<<<<<<<<<< + * if self.order[i].is_pruned(): + * continue + */ + __pyx_t_5 = __pyx_v_n; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "_basis.pyx":532 + * cdef INDEX_t j = 0 + * for i in range(n): + * if self.order[i].is_pruned(): # <<<<<<<<<<<<<< + * continue + * beta[j] *= self.order[i].scale(slopes,intercepts) + */ + if (unlikely(((PyObject *)__pyx_v_self->order) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i), __pyx_n_s__is_pruned); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + + /* "_basis.pyx":533 + * for i in range(n): + * if self.order[i].is_pruned(): + * continue # <<<<<<<<<<<<<< + * beta[j] *= self.order[i].scale(slopes,intercepts) + * j += 1 + */ + goto __pyx_L3_continue; + goto __pyx_L5; + } + __pyx_L5:; + + /* "_basis.pyx":534 + * if self.order[i].is_pruned(): + * continue + * beta[j] *= self.order[i].scale(slopes,intercepts) # <<<<<<<<<<<<<< + * j += 1 + * + */ + if (unlikely(((PyObject *)__pyx_v_self->order) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i), __pyx_n_s__scale); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_v_slopes)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_slopes)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_slopes)); + __Pyx_INCREF(((PyObject *)__pyx_v_intercepts)); + PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_intercepts)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_intercepts)); + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_8 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_9 = __pyx_v_j; + *__Pyx_BufPtrStrided1d(__pyx_t_6_basis_FLOAT_t *, __pyx_pybuffernd_beta.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_beta.diminfo[0].strides) *= __pyx_t_8; + + /* "_basis.pyx":535 + * continue + * beta[j] *= self.order[i].scale(slopes,intercepts) + * j += 1 # <<<<<<<<<<<<<< + * + * cpdef BasisFunction get_root(Basis self): + */ + __pyx_v_j = (__pyx_v_j + 1); + __pyx_L3_continue:; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_beta.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("_basis.Basis.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_beta.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_5Basis_20scale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6_basis_5Basis_20scale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_slopes = 0; + PyArrayObject *__pyx_v_intercepts = 0; + PyArrayObject *__pyx_v_beta = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("scale (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__slopes,&__pyx_n_s__intercepts,&__pyx_n_s__beta,0}; + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__slopes)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__intercepts)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("scale", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__beta)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("scale", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scale") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_slopes = ((PyArrayObject *)values[0]); + __pyx_v_intercepts = ((PyArrayObject *)values[1]); + __pyx_v_beta = ((PyArrayObject *)values[2]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("scale", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("_basis.Basis.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_slopes), __pyx_ptype_5numpy_ndarray, 1, "slopes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercepts), __pyx_ptype_5numpy_ndarray, 1, "intercepts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_beta), __pyx_ptype_5numpy_ndarray, 1, "beta", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_6_basis_5Basis_19scale(((struct __pyx_obj_6_basis_Basis *)__pyx_v_self), __pyx_v_slopes, __pyx_v_intercepts, __pyx_v_beta); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":527 + * self.order[i].translate(slopes,intercepts,False) + * + * cpdef scale(Basis self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, cnp.ndarray[FLOAT_t,ndim=1] beta): # <<<<<<<<<<<<<< + * cdef INDEX_t n = len(self) #@DuplicatedSignature + * cdef INDEX_t i #@DuplicatedSignature + */ + +static PyObject *__pyx_pf_6_basis_5Basis_19scale(struct __pyx_obj_6_basis_Basis *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts, PyArrayObject *__pyx_v_beta) { + __Pyx_LocalBuf_ND __pyx_pybuffernd_beta; + __Pyx_Buffer __pyx_pybuffer_beta; + __Pyx_LocalBuf_ND __pyx_pybuffernd_intercepts; + __Pyx_Buffer __pyx_pybuffer_intercepts; + __Pyx_LocalBuf_ND __pyx_pybuffernd_slopes; + __Pyx_Buffer __pyx_pybuffer_slopes; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("scale", 0); + __pyx_pybuffer_slopes.pybuffer.buf = NULL; + __pyx_pybuffer_slopes.refcount = 0; + __pyx_pybuffernd_slopes.data = NULL; + __pyx_pybuffernd_slopes.rcbuffer = &__pyx_pybuffer_slopes; + __pyx_pybuffer_intercepts.pybuffer.buf = NULL; + __pyx_pybuffer_intercepts.refcount = 0; + __pyx_pybuffernd_intercepts.data = NULL; + __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; + __pyx_pybuffer_beta.pybuffer.buf = NULL; + __pyx_pybuffer_beta.refcount = 0; + __pyx_pybuffernd_beta.data = NULL; + __pyx_pybuffernd_beta.rcbuffer = &__pyx_pybuffer_beta; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_beta.rcbuffer->pybuffer, (PyObject*)__pyx_v_beta, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_beta.diminfo[0].strides = __pyx_pybuffernd_beta.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_beta.diminfo[0].shape = __pyx_pybuffernd_beta.rcbuffer->pybuffer.shape[0]; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->scale(__pyx_v_self, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), ((PyArrayObject *)__pyx_v_beta), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_beta.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("_basis.Basis.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_beta.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":537 + * j += 1 + * + * cpdef BasisFunction get_root(Basis self): # <<<<<<<<<<<<<< + * return self.root + * + */ + +static PyObject *__pyx_pw_6_basis_5Basis_22get_root(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static struct __pyx_obj_6_basis_BasisFunction *__pyx_f_6_basis_5Basis_get_root(struct __pyx_obj_6_basis_Basis *__pyx_v_self, int __pyx_skip_dispatch) { + struct __pyx_obj_6_basis_BasisFunction *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_root", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_root); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_5Basis_22get_root)) { + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((struct __pyx_obj_6_basis_BasisFunction *)__pyx_t_2); + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_basis.pyx":538 + * + * cpdef BasisFunction get_root(Basis self): + * return self.root # <<<<<<<<<<<<<< + * + * cpdef append(Basis self, BasisFunction basis_function): + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__root); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((struct __pyx_obj_6_basis_BasisFunction *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = ((struct __pyx_obj_6_basis_BasisFunction *)Py_None); __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("_basis.Basis.get_root", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_5Basis_22get_root(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6_basis_5Basis_22get_root(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_root (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_5Basis_21get_root(((struct __pyx_obj_6_basis_Basis *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":537 + * j += 1 + * + * cpdef BasisFunction get_root(Basis self): # <<<<<<<<<<<<<< + * return self.root + * + */ + +static PyObject *__pyx_pf_6_basis_5Basis_21get_root(struct __pyx_obj_6_basis_Basis *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_root", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->get_root(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_basis.Basis.get_root", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":540 + * return self.root + * + * cpdef append(Basis self, BasisFunction basis_function): # <<<<<<<<<<<<<< + * self.order.append(basis_function) + * + */ + +static PyObject *__pyx_pw_6_basis_5Basis_24append(PyObject *__pyx_v_self, PyObject *__pyx_v_basis_function); /*proto*/ +static PyObject *__pyx_f_6_basis_5Basis_append(struct __pyx_obj_6_basis_Basis *__pyx_v_self, struct __pyx_obj_6_basis_BasisFunction *__pyx_v_basis_function, int __pyx_skip_dispatch) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("append", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__append); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_5Basis_24append)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_v_basis_function)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_basis_function)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_basis_function)); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_basis.pyx":541 + * + * cpdef append(Basis self, BasisFunction basis_function): + * self.order.append(basis_function) # <<<<<<<<<<<<<< + * + * def __iter__(Basis self): + */ + if (unlikely(((PyObject *)__pyx_v_self->order) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_self->order, ((PyObject *)__pyx_v_basis_function)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("_basis.Basis.append", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_5Basis_24append(PyObject *__pyx_v_self, PyObject *__pyx_v_basis_function); /*proto*/ +static PyObject *__pyx_pw_6_basis_5Basis_24append(PyObject *__pyx_v_self, PyObject *__pyx_v_basis_function) { + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("append (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_basis_function), __pyx_ptype_6_basis_BasisFunction, 1, "basis_function", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_6_basis_5Basis_23append(((struct __pyx_obj_6_basis_Basis *)__pyx_v_self), ((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_basis_function)); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":540 + * return self.root + * + * cpdef append(Basis self, BasisFunction basis_function): # <<<<<<<<<<<<<< + * self.order.append(basis_function) + * + */ + +static PyObject *__pyx_pf_6_basis_5Basis_23append(struct __pyx_obj_6_basis_Basis *__pyx_v_self, struct __pyx_obj_6_basis_BasisFunction *__pyx_v_basis_function) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("append", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->append(__pyx_v_self, __pyx_v_basis_function, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_basis.Basis.append", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_5Basis_26__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_6_basis_5Basis_26__iter__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_5Basis_25__iter__(((struct __pyx_obj_6_basis_Basis *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":543 + * self.order.append(basis_function) + * + * def __iter__(Basis self): # <<<<<<<<<<<<<< + * return self.order.__iter__() + * + */ + +static PyObject *__pyx_pf_6_basis_5Basis_25__iter__(struct __pyx_obj_6_basis_Basis *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__iter__", 0); + + /* "_basis.pyx":544 + * + * def __iter__(Basis self): + * return self.order.__iter__() # <<<<<<<<<<<<<< + * + * def __len__(Basis self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->order), __pyx_n_s____iter__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("_basis.Basis.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static Py_ssize_t __pyx_pw_6_basis_5Basis_28__len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_pw_6_basis_5Basis_28__len__(PyObject *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_5Basis_27__len__(((struct __pyx_obj_6_basis_Basis *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":546 + * return self.order.__iter__() + * + * def __len__(Basis self): # <<<<<<<<<<<<<< + * return self.order.__len__() + * + */ + +static Py_ssize_t __pyx_pf_6_basis_5Basis_27__len__(struct __pyx_obj_6_basis_Basis *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__len__", 0); + + /* "_basis.pyx":547 + * + * def __len__(Basis self): + * return self.order.__len__() # <<<<<<<<<<<<<< + * + * cpdef BasisFunction get(Basis self, INDEX_t i): + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->order), __pyx_n_s____len__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_3 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("_basis.Basis.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":549 + * return self.order.__len__() + * + * cpdef BasisFunction get(Basis self, INDEX_t i): # <<<<<<<<<<<<<< + * return self.order[i] + * + */ + +static PyObject *__pyx_pw_6_basis_5Basis_30get(PyObject *__pyx_v_self, PyObject *__pyx_arg_i); /*proto*/ +static struct __pyx_obj_6_basis_BasisFunction *__pyx_f_6_basis_5Basis_get(struct __pyx_obj_6_basis_Basis *__pyx_v_self, __pyx_t_6_basis_INDEX_t __pyx_v_i, int __pyx_skip_dispatch) { + struct __pyx_obj_6_basis_BasisFunction *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_5Basis_30get)) { + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((struct __pyx_obj_6_basis_BasisFunction *)__pyx_t_2); + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_basis.pyx":550 + * + * cpdef BasisFunction get(Basis self, INDEX_t i): + * return self.order[i] # <<<<<<<<<<<<<< + * + * def __getitem__(Basis self, INDEX_t i): + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + if (unlikely(((PyObject *)__pyx_v_self->order) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + if (!(likely(((PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i)) == Py_None) || likely(__Pyx_TypeTest(PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i), __pyx_ptype_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i)); + __pyx_r = ((struct __pyx_obj_6_basis_BasisFunction *)PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i)); + goto __pyx_L0; + + __pyx_r = ((struct __pyx_obj_6_basis_BasisFunction *)Py_None); __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("_basis.Basis.get", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_5Basis_30get(PyObject *__pyx_v_self, PyObject *__pyx_arg_i); /*proto*/ +static PyObject *__pyx_pw_6_basis_5Basis_30get(PyObject *__pyx_v_self, PyObject *__pyx_arg_i) { + __pyx_t_6_basis_INDEX_t __pyx_v_i; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get (wrapper)", 0); + assert(__pyx_arg_i); { + __pyx_v_i = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_arg_i); if (unlikely((__pyx_v_i == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("_basis.Basis.get", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6_basis_5Basis_29get(((struct __pyx_obj_6_basis_Basis *)__pyx_v_self), ((__pyx_t_6_basis_INDEX_t)__pyx_v_i)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":549 + * return self.order.__len__() + * + * cpdef BasisFunction get(Basis self, INDEX_t i): # <<<<<<<<<<<<<< + * return self.order[i] + * + */ + +static PyObject *__pyx_pf_6_basis_5Basis_29get(struct __pyx_obj_6_basis_Basis *__pyx_v_self, __pyx_t_6_basis_INDEX_t __pyx_v_i) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->get(__pyx_v_self, __pyx_v_i, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_basis.Basis.get", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_5Basis_32__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_i); /*proto*/ +static PyObject *__pyx_pw_6_basis_5Basis_32__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_i) { + __pyx_t_6_basis_INDEX_t __pyx_v_i; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + assert(__pyx_arg_i); { + __pyx_v_i = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_arg_i); if (unlikely((__pyx_v_i == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("_basis.Basis.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_6_basis_5Basis_31__getitem__(((struct __pyx_obj_6_basis_Basis *)__pyx_v_self), ((__pyx_t_6_basis_INDEX_t)__pyx_v_i)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":552 + * return self.order[i] + * + * def __getitem__(Basis self, INDEX_t i): # <<<<<<<<<<<<<< + * return self.get(i) + * + */ + +static PyObject *__pyx_pf_6_basis_5Basis_31__getitem__(struct __pyx_obj_6_basis_Basis *__pyx_v_self, __pyx_t_6_basis_INDEX_t __pyx_v_i) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__", 0); + + /* "_basis.pyx":553 + * + * def __getitem__(Basis self, INDEX_t i): + * return self.get(i) # <<<<<<<<<<<<<< + * + * cpdef INDEX_t plen(Basis self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->get(__pyx_v_self, __pyx_v_i, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_basis.Basis.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":555 + * return self.get(i) + * + * cpdef INDEX_t plen(Basis self): # <<<<<<<<<<<<<< + * cdef INDEX_t length = 0 + * cdef INDEX_t i + */ + +static PyObject *__pyx_pw_6_basis_5Basis_34plen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static __pyx_t_6_basis_INDEX_t __pyx_f_6_basis_5Basis_plen(struct __pyx_obj_6_basis_Basis *__pyx_v_self, int __pyx_skip_dispatch) { + __pyx_t_6_basis_INDEX_t __pyx_v_length; + __pyx_t_6_basis_INDEX_t __pyx_v_i; + __pyx_t_6_basis_INDEX_t __pyx_v_n; + __pyx_t_6_basis_INDEX_t __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __pyx_t_6_basis_INDEX_t __pyx_t_3; + Py_ssize_t __pyx_t_4; + __pyx_t_6_basis_INDEX_t __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("plen", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__plen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_5Basis_34plen)) { + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_basis.pyx":556 + * + * cpdef INDEX_t plen(Basis self): + * cdef INDEX_t length = 0 # <<<<<<<<<<<<<< + * cdef INDEX_t i + * cdef INDEX_t n = len(self.order) + */ + __pyx_v_length = 0; + + /* "_basis.pyx":558 + * cdef INDEX_t length = 0 + * cdef INDEX_t i + * cdef INDEX_t n = len(self.order) # <<<<<<<<<<<<<< + * for i in range(n): + * if not self.order[i].is_pruned(): + */ + __pyx_t_1 = ((PyObject *)__pyx_v_self->order); + __Pyx_INCREF(__pyx_t_1); + if (unlikely(__pyx_t_1 == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_4 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_n = __pyx_t_4; + + /* "_basis.pyx":559 + * cdef INDEX_t i + * cdef INDEX_t n = len(self.order) + * for i in range(n): # <<<<<<<<<<<<<< + * if not self.order[i].is_pruned(): + * length += 1 + */ + __pyx_t_3 = __pyx_v_n; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_3; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "_basis.pyx":560 + * cdef INDEX_t n = len(self.order) + * for i in range(n): + * if not self.order[i].is_pruned(): # <<<<<<<<<<<<<< + * length += 1 + * return length + */ + if (unlikely(((PyObject *)__pyx_v_self->order) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i), __pyx_n_s__is_pruned); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_7 = (!__pyx_t_6); + if (__pyx_t_7) { + + /* "_basis.pyx":561 + * for i in range(n): + * if not self.order[i].is_pruned(): + * length += 1 # <<<<<<<<<<<<<< + * return length + * + */ + __pyx_v_length = (__pyx_v_length + 1); + goto __pyx_L5; + } + __pyx_L5:; + } + + /* "_basis.pyx":562 + * if not self.order[i].is_pruned(): + * length += 1 + * return length # <<<<<<<<<<<<<< + * + * cpdef transform(Basis self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=2] B): + */ + __pyx_r = __pyx_v_length; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_WriteUnraisable("_basis.Basis.plen", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_5Basis_34plen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_6_basis_5Basis_34plen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("plen (wrapper)", 0); + __pyx_r = __pyx_pf_6_basis_5Basis_33plen(((struct __pyx_obj_6_basis_Basis *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":555 + * return self.get(i) + * + * cpdef INDEX_t plen(Basis self): # <<<<<<<<<<<<<< + * cdef INDEX_t length = 0 + * cdef INDEX_t i + */ + +static PyObject *__pyx_pf_6_basis_5Basis_33plen(struct __pyx_obj_6_basis_Basis *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("plen", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->plen(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_basis.Basis.plen", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":564 + * return length + * + * cpdef transform(Basis self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=2] B): # <<<<<<<<<<<<<< + * cdef INDEX_t i #@DuplicatedSignature + * cdef INDEX_t n = self.__len__() + */ + +static PyObject *__pyx_pw_6_basis_5Basis_36transform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_6_basis_5Basis_transform(struct __pyx_obj_6_basis_Basis *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_B, int __pyx_skip_dispatch) { + __pyx_t_6_basis_INDEX_t __pyx_v_i; + __pyx_t_6_basis_INDEX_t __pyx_v_n; + struct __pyx_obj_6_basis_BasisFunction *__pyx_v_bf = 0; + __pyx_t_6_basis_INDEX_t __pyx_v_col; + __Pyx_LocalBuf_ND __pyx_pybuffernd_B; + __Pyx_Buffer __pyx_pybuffer_B; + __Pyx_LocalBuf_ND __pyx_pybuffernd_X; + __Pyx_Buffer __pyx_pybuffer_X; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __pyx_t_6_basis_INDEX_t __pyx_t_4; + __pyx_t_6_basis_INDEX_t __pyx_t_5; + int __pyx_t_6; + struct __pyx_opt_args_6_basis_13BasisFunction_apply __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("transform", 0); + __pyx_pybuffer_X.pybuffer.buf = NULL; + __pyx_pybuffer_X.refcount = 0; + __pyx_pybuffernd_X.data = NULL; + __pyx_pybuffernd_X.rcbuffer = &__pyx_pybuffer_X; + __pyx_pybuffer_B.pybuffer.buf = NULL; + __pyx_pybuffer_B.refcount = 0; + __pyx_pybuffernd_B.data = NULL; + __pyx_pybuffernd_B.rcbuffer = &__pyx_pybuffer_B; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_v_B, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_B.diminfo[0].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B.diminfo[0].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B.diminfo[1].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B.diminfo[1].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[1]; + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__transform); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_5Basis_36transform)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_v_X)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_X)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_X)); + __Pyx_INCREF(((PyObject *)__pyx_v_B)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_B)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_B)); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_basis.pyx":566 + * cpdef transform(Basis self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=2] B): + * cdef INDEX_t i #@DuplicatedSignature + * cdef INDEX_t n = self.__len__() # <<<<<<<<<<<<<< + * cdef BasisFunction bf + * cdef INDEX_t col = 0 + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____len__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_3); if (unlikely((__pyx_t_4 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_n = __pyx_t_4; + + /* "_basis.pyx":568 + * cdef INDEX_t n = self.__len__() + * cdef BasisFunction bf + * cdef INDEX_t col = 0 # <<<<<<<<<<<<<< + * for i in range(n): + * bf = self.order[i] + */ + __pyx_v_col = 0; + + /* "_basis.pyx":569 + * cdef BasisFunction bf + * cdef INDEX_t col = 0 + * for i in range(n): # <<<<<<<<<<<<<< + * bf = self.order[i] + * if bf.is_pruned(): + */ + __pyx_t_4 = __pyx_v_n; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; + + /* "_basis.pyx":570 + * cdef INDEX_t col = 0 + * for i in range(n): + * bf = self.order[i] # <<<<<<<<<<<<<< + * if bf.is_pruned(): + * continue + */ + if (unlikely(((PyObject *)__pyx_v_self->order) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + if (!(likely(((PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i)) == Py_None) || likely(__Pyx_TypeTest(PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i), __pyx_ptype_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i); + __Pyx_INCREF(__pyx_t_3); + __Pyx_XDECREF(((PyObject *)__pyx_v_bf)); + __pyx_v_bf = ((struct __pyx_obj_6_basis_BasisFunction *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "_basis.pyx":571 + * for i in range(n): + * bf = self.order[i] + * if bf.is_pruned(): # <<<<<<<<<<<<<< + * continue + * bf.apply(X,B[:,col],recurse=True) + */ + __pyx_t_6 = ((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_bf->__pyx_vtab)->is_pruned(__pyx_v_bf, 0); + if (__pyx_t_6) { + + /* "_basis.pyx":572 + * bf = self.order[i] + * if bf.is_pruned(): + * continue # <<<<<<<<<<<<<< + * bf.apply(X,B[:,col],recurse=True) + * col += 1 + */ + goto __pyx_L3_continue; + goto __pyx_L5; + } + __pyx_L5:; + + /* "_basis.pyx":573 + * if bf.is_pruned(): + * continue + * bf.apply(X,B[:,col],recurse=True) # <<<<<<<<<<<<<< + * col += 1 + * + */ + __pyx_t_3 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_col); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_k_slice_9); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_k_slice_9); + __Pyx_GIVEREF(__pyx_k_slice_9); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_1)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7.__pyx_n = 1; + __pyx_t_7.recurse = 1; + __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_bf->__pyx_vtab)->apply(__pyx_v_bf, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_t_3), 0, &__pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "_basis.pyx":574 + * continue + * bf.apply(X,B[:,col],recurse=True) + * col += 1 # <<<<<<<<<<<<<< + * + * cpdef weighted_transform(Basis self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=2] B, cnp.ndarray[FLOAT_t,ndim=1] weights): + */ + __pyx_v_col = (__pyx_v_col + 1); + __pyx_L3_continue:; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_B.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("_basis.Basis.transform", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_B.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_bf); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_5Basis_36transform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6_basis_5Basis_36transform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_X = 0; + PyArrayObject *__pyx_v_B = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("transform (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__B,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__B)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("transform", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "transform") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_X = ((PyArrayObject *)values[0]); + __pyx_v_B = ((PyArrayObject *)values[1]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("transform", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("_basis.Basis.transform", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_B), __pyx_ptype_5numpy_ndarray, 1, "B", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_6_basis_5Basis_35transform(((struct __pyx_obj_6_basis_Basis *)__pyx_v_self), __pyx_v_X, __pyx_v_B); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":564 + * return length + * + * cpdef transform(Basis self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=2] B): # <<<<<<<<<<<<<< + * cdef INDEX_t i #@DuplicatedSignature + * cdef INDEX_t n = self.__len__() + */ + +static PyObject *__pyx_pf_6_basis_5Basis_35transform(struct __pyx_obj_6_basis_Basis *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_B) { + __Pyx_LocalBuf_ND __pyx_pybuffernd_B; + __Pyx_Buffer __pyx_pybuffer_B; + __Pyx_LocalBuf_ND __pyx_pybuffernd_X; + __Pyx_Buffer __pyx_pybuffer_X; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("transform", 0); + __pyx_pybuffer_X.pybuffer.buf = NULL; + __pyx_pybuffer_X.refcount = 0; + __pyx_pybuffernd_X.data = NULL; + __pyx_pybuffernd_X.rcbuffer = &__pyx_pybuffer_X; + __pyx_pybuffer_B.pybuffer.buf = NULL; + __pyx_pybuffer_B.refcount = 0; + __pyx_pybuffernd_B.data = NULL; + __pyx_pybuffernd_B.rcbuffer = &__pyx_pybuffer_B; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_v_B, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_B.diminfo[0].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B.diminfo[0].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B.diminfo[1].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B.diminfo[1].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[1]; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->transform(__pyx_v_self, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_B), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_B.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("_basis.Basis.transform", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_B.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":576 + * col += 1 + * + * cpdef weighted_transform(Basis self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=2] B, cnp.ndarray[FLOAT_t,ndim=1] weights): # <<<<<<<<<<<<<< + * cdef INDEX_t i #@DuplicatedSignature + * cdef INDEX_t n = self.__len__() + */ + +static PyObject *__pyx_pw_6_basis_5Basis_38weighted_transform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_6_basis_5Basis_weighted_transform(struct __pyx_obj_6_basis_Basis *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_B, PyArrayObject *__pyx_v_weights, int __pyx_skip_dispatch) { + CYTHON_UNUSED __pyx_t_6_basis_INDEX_t __pyx_v_n; + __Pyx_LocalBuf_ND __pyx_pybuffernd_B; + __Pyx_Buffer __pyx_pybuffer_B; + __Pyx_LocalBuf_ND __pyx_pybuffernd_X; + __Pyx_Buffer __pyx_pybuffer_X; + __Pyx_LocalBuf_ND __pyx_pybuffernd_weights; + __Pyx_Buffer __pyx_pybuffer_weights; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __pyx_t_6_basis_INDEX_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("weighted_transform", 0); + __pyx_pybuffer_X.pybuffer.buf = NULL; + __pyx_pybuffer_X.refcount = 0; + __pyx_pybuffernd_X.data = NULL; + __pyx_pybuffernd_X.rcbuffer = &__pyx_pybuffer_X; + __pyx_pybuffer_B.pybuffer.buf = NULL; + __pyx_pybuffer_B.refcount = 0; + __pyx_pybuffernd_B.data = NULL; + __pyx_pybuffernd_B.rcbuffer = &__pyx_pybuffer_B; + __pyx_pybuffer_weights.pybuffer.buf = NULL; + __pyx_pybuffer_weights.refcount = 0; + __pyx_pybuffernd_weights.data = NULL; + __pyx_pybuffernd_weights.rcbuffer = &__pyx_pybuffer_weights; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_v_B, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_B.diminfo[0].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B.diminfo[0].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B.diminfo[1].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B.diminfo[1].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_weights.diminfo[0].strides = __pyx_pybuffernd_weights.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weights.diminfo[0].shape = __pyx_pybuffernd_weights.rcbuffer->pybuffer.shape[0]; + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__weighted_transform); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_5Basis_38weighted_transform)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_v_X)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_X)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_X)); + __Pyx_INCREF(((PyObject *)__pyx_v_B)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_B)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_B)); + __Pyx_INCREF(((PyObject *)__pyx_v_weights)); + PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_weights)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_weights)); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_basis.pyx":578 + * cpdef weighted_transform(Basis self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=2] B, cnp.ndarray[FLOAT_t,ndim=1] weights): + * cdef INDEX_t i #@DuplicatedSignature + * cdef INDEX_t n = self.__len__() # <<<<<<<<<<<<<< + * + * self.transform(X,B) + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____len__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_3); if (unlikely((__pyx_t_4 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_n = __pyx_t_4; + + /* "_basis.pyx":580 + * cdef INDEX_t n = self.__len__() + * + * self.transform(X,B) # <<<<<<<<<<<<<< + * apply_weights_2d(B,weights) + * + */ + __pyx_t_3 = ((struct __pyx_vtabstruct_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->transform(__pyx_v_self, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_B), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "_basis.pyx":581 + * + * self.transform(X,B) + * apply_weights_2d(B,weights) # <<<<<<<<<<<<<< + * + */ + __pyx_t_3 = __pyx_f_5_util_apply_weights_2d(((PyArrayObject *)__pyx_v_B), ((PyArrayObject *)__pyx_v_weights), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_B.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("_basis.Basis.weighted_transform", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_B.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_6_basis_5Basis_38weighted_transform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_6_basis_5Basis_38weighted_transform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_X = 0; + PyArrayObject *__pyx_v_B = 0; + PyArrayObject *__pyx_v_weights = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("weighted_transform (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__B,&__pyx_n_s__weights,0}; + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__B)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("weighted_transform", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weights)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("weighted_transform", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "weighted_transform") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_X = ((PyArrayObject *)values[0]); + __pyx_v_B = ((PyArrayObject *)values[1]); + __pyx_v_weights = ((PyArrayObject *)values[2]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("weighted_transform", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("_basis.Basis.weighted_transform", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_B), __pyx_ptype_5numpy_ndarray, 1, "B", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weights), __pyx_ptype_5numpy_ndarray, 1, "weights", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_6_basis_5Basis_37weighted_transform(((struct __pyx_obj_6_basis_Basis *)__pyx_v_self), __pyx_v_X, __pyx_v_B, __pyx_v_weights); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_basis.pyx":576 + * col += 1 + * + * cpdef weighted_transform(Basis self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=2] B, cnp.ndarray[FLOAT_t,ndim=1] weights): # <<<<<<<<<<<<<< + * cdef INDEX_t i #@DuplicatedSignature + * cdef INDEX_t n = self.__len__() + */ + +static PyObject *__pyx_pf_6_basis_5Basis_37weighted_transform(struct __pyx_obj_6_basis_Basis *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_B, PyArrayObject *__pyx_v_weights) { + __Pyx_LocalBuf_ND __pyx_pybuffernd_B; + __Pyx_Buffer __pyx_pybuffer_B; + __Pyx_LocalBuf_ND __pyx_pybuffernd_X; + __Pyx_Buffer __pyx_pybuffer_X; + __Pyx_LocalBuf_ND __pyx_pybuffernd_weights; + __Pyx_Buffer __pyx_pybuffer_weights; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("weighted_transform", 0); + __pyx_pybuffer_X.pybuffer.buf = NULL; + __pyx_pybuffer_X.refcount = 0; + __pyx_pybuffernd_X.data = NULL; + __pyx_pybuffernd_X.rcbuffer = &__pyx_pybuffer_X; + __pyx_pybuffer_B.pybuffer.buf = NULL; + __pyx_pybuffer_B.refcount = 0; + __pyx_pybuffernd_B.data = NULL; + __pyx_pybuffernd_B.rcbuffer = &__pyx_pybuffer_B; + __pyx_pybuffer_weights.pybuffer.buf = NULL; + __pyx_pybuffer_weights.refcount = 0; + __pyx_pybuffernd_weights.data = NULL; + __pyx_pybuffernd_weights.rcbuffer = &__pyx_pybuffer_weights; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_v_B, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_B.diminfo[0].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B.diminfo[0].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B.diminfo[1].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B.diminfo[1].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_weights.diminfo[0].strides = __pyx_pybuffernd_weights.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weights.diminfo[0].shape = __pyx_pybuffernd_weights.rcbuffer->pybuffer.shape[0]; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->weighted_transform(__pyx_v_self, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_B), ((PyArrayObject *)__pyx_v_weights), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_B.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("_basis.Basis.weighted_transform", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_B.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":194 + * # experimental exception made for __getbuffer__ and __releasebuffer__ + * # -- the details of this may change. + * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< + * # This implementation of getbuffer is geared towards Cython + * # requirements, and does not yet fullfill the PEP. + */ + +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_v_copy_shape; + int __pyx_v_i; + int __pyx_v_ndim; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; + int __pyx_v_t; + char *__pyx_v_f; + PyArray_Descr *__pyx_v_descr = 0; + int __pyx_v_offset; + int __pyx_v_hasfields; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + char *__pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getbuffer__", 0); + if (__pyx_v_info != NULL) { + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + } + + /* "numpy.pxd":200 + * # of flags + * + * if info == NULL: return # <<<<<<<<<<<<<< + * + * cdef int copy_shape, i, ndim + */ + __pyx_t_1 = (__pyx_v_info == NULL); + if (__pyx_t_1) { + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "numpy.pxd":203 + * + * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + */ + __pyx_v_endian_detector = 1; + + /* "numpy.pxd":204 + * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * + * ndim = PyArray_NDIM(self) + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "numpy.pxd":206 + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + */ + __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); + + /* "numpy.pxd":208 + * ndim = PyArray_NDIM(self) + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< + * copy_shape = 1 + * else: + */ + __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_1) { + + /* "numpy.pxd":209 + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * copy_shape = 1 # <<<<<<<<<<<<<< + * else: + * copy_shape = 0 + */ + __pyx_v_copy_shape = 1; + goto __pyx_L4; + } + /*else*/ { + + /* "numpy.pxd":211 + * copy_shape = 1 + * else: + * copy_shape = 0 # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + */ + __pyx_v_copy_shape = 0; + } + __pyx_L4:; + + /* "numpy.pxd":213 + * copy_shape = 0 + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") + */ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); + if (__pyx_t_1) { + + /* "numpy.pxd":214 + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not C contiguous") + * + */ + __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS)); + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + + /* "numpy.pxd":215 + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + */ + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "numpy.pxd":217 + * raise ValueError(u"ndarray is not C contiguous") + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") + */ + __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); + if (__pyx_t_3) { + + /* "numpy.pxd":218 + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not Fortran contiguous") + * + */ + __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS)); + __pyx_t_2 = __pyx_t_1; + } else { + __pyx_t_2 = __pyx_t_3; + } + if (__pyx_t_2) { + + /* "numpy.pxd":219 + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * + * info.buf = PyArray_DATA(self) + */ + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "numpy.pxd":221 + * raise ValueError(u"ndarray is not Fortran contiguous") + * + * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< + * info.ndim = ndim + * if copy_shape: + */ + __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); + + /* "numpy.pxd":222 + * + * info.buf = PyArray_DATA(self) + * info.ndim = ndim # <<<<<<<<<<<<<< + * if copy_shape: + * # Allocate new buffer for strides and shape info. + */ + __pyx_v_info->ndim = __pyx_v_ndim; + + /* "numpy.pxd":223 + * info.buf = PyArray_DATA(self) + * info.ndim = ndim + * if copy_shape: # <<<<<<<<<<<<<< + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. + */ + if (__pyx_v_copy_shape) { + + /* "numpy.pxd":226 + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< + * info.shape = info.strides + ndim + * for i in range(ndim): + */ + __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); + + /* "numpy.pxd":227 + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + * info.shape = info.strides + ndim # <<<<<<<<<<<<<< + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] + */ + __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); + + /* "numpy.pxd":228 + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + * info.shape = info.strides + ndim + * for i in range(ndim): # <<<<<<<<<<<<<< + * info.strides[i] = PyArray_STRIDES(self)[i] + * info.shape[i] = PyArray_DIMS(self)[i] + */ + __pyx_t_5 = __pyx_v_ndim; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "numpy.pxd":229 + * info.shape = info.strides + ndim + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< + * info.shape[i] = PyArray_DIMS(self)[i] + * else: + */ + (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); + + /* "numpy.pxd":230 + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] + * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< + * else: + * info.strides = PyArray_STRIDES(self) + */ + (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); + } + goto __pyx_L7; + } + /*else*/ { + + /* "numpy.pxd":232 + * info.shape[i] = PyArray_DIMS(self)[i] + * else: + * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL + */ + __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); + + /* "numpy.pxd":233 + * else: + * info.strides = PyArray_STRIDES(self) + * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) + */ + __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); + } + __pyx_L7:; + + /* "numpy.pxd":234 + * info.strides = PyArray_STRIDES(self) + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL # <<<<<<<<<<<<<< + * info.itemsize = PyArray_ITEMSIZE(self) + * info.readonly = not PyArray_ISWRITEABLE(self) + */ + __pyx_v_info->suboffsets = NULL; + + /* "numpy.pxd":235 + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< + * info.readonly = not PyArray_ISWRITEABLE(self) + * + */ + __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); + + /* "numpy.pxd":236 + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) + * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< + * + * cdef int t + */ + __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self)); + + /* "numpy.pxd":239 + * + * cdef int t + * cdef char* f = NULL # <<<<<<<<<<<<<< + * cdef dtype descr = self.descr + * cdef list stack + */ + __pyx_v_f = NULL; + + /* "numpy.pxd":240 + * cdef int t + * cdef char* f = NULL + * cdef dtype descr = self.descr # <<<<<<<<<<<<<< + * cdef list stack + * cdef int offset + */ + __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); + __Pyx_INCREF(__pyx_t_4); + __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "numpy.pxd":244 + * cdef int offset + * + * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< + * + * if not hasfields and not copy_shape: + */ + __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); + + /* "numpy.pxd":246 + * cdef bint hasfields = PyDataType_HASFIELDS(descr) + * + * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< + * # do not call releasebuffer + * info.obj = None + */ + __pyx_t_2 = (!__pyx_v_hasfields); + if (__pyx_t_2) { + __pyx_t_3 = (!__pyx_v_copy_shape); + __pyx_t_1 = __pyx_t_3; + } else { + __pyx_t_1 = __pyx_t_2; + } + if (__pyx_t_1) { + + /* "numpy.pxd":248 + * if not hasfields and not copy_shape: + * # do not call releasebuffer + * info.obj = None # <<<<<<<<<<<<<< + * else: + * # need to call releasebuffer + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = Py_None; + goto __pyx_L10; + } + /*else*/ { + + /* "numpy.pxd":251 + * else: + * # need to call releasebuffer + * info.obj = self # <<<<<<<<<<<<<< + * + * if not hasfields: + */ + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); + } + __pyx_L10:; + + /* "numpy.pxd":253 + * info.obj = self + * + * if not hasfields: # <<<<<<<<<<<<<< + * t = descr.type_num + * if ((descr.byteorder == c'>' and little_endian) or + */ + __pyx_t_1 = (!__pyx_v_hasfields); + if (__pyx_t_1) { + + /* "numpy.pxd":254 + * + * if not hasfields: + * t = descr.type_num # <<<<<<<<<<<<<< + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): + */ + __pyx_t_5 = __pyx_v_descr->type_num; + __pyx_v_t = __pyx_t_5; + + /* "numpy.pxd":255 + * if not hasfields: + * t = descr.type_num + * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + */ + __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); + if (__pyx_t_1) { + __pyx_t_2 = __pyx_v_little_endian; + } else { + __pyx_t_2 = __pyx_t_1; + } + if (!__pyx_t_2) { + + /* "numpy.pxd":256 + * t = descr.type_num + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" + */ + __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); + if (__pyx_t_1) { + __pyx_t_3 = (!__pyx_v_little_endian); + __pyx_t_7 = __pyx_t_3; + } else { + __pyx_t_7 = __pyx_t_1; + } + __pyx_t_1 = __pyx_t_7; + } else { + __pyx_t_1 = __pyx_t_2; + } + if (__pyx_t_1) { + + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_15), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; + } + __pyx_L12:; + + /* "numpy.pxd":274 + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" + * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + */ + switch (__pyx_v_t) { + + /* "numpy.pxd":258 + * (descr.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" + */ + case NPY_BYTE: + __pyx_v_f = __pyx_k__b; + break; + + /* "numpy.pxd":259 + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" + */ + case NPY_UBYTE: + __pyx_v_f = __pyx_k__B; + break; + + /* "numpy.pxd":260 + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" + */ + case NPY_SHORT: + __pyx_v_f = __pyx_k__h; + break; + + /* "numpy.pxd":261 + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" + */ + case NPY_USHORT: + __pyx_v_f = __pyx_k__H; + break; + + /* "numpy.pxd":262 + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" + */ + case NPY_INT: + __pyx_v_f = __pyx_k__i; + break; + + /* "numpy.pxd":263 + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" + */ + case NPY_UINT: + __pyx_v_f = __pyx_k__I; + break; + + /* "numpy.pxd":264 + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" + */ + case NPY_LONG: + __pyx_v_f = __pyx_k__l; + break; + + /* "numpy.pxd":265 + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" + */ + case NPY_ULONG: + __pyx_v_f = __pyx_k__L; + break; + + /* "numpy.pxd":266 + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" + */ + case NPY_LONGLONG: + __pyx_v_f = __pyx_k__q; + break; + + /* "numpy.pxd":267 + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" + */ + case NPY_ULONGLONG: + __pyx_v_f = __pyx_k__Q; + break; + + /* "numpy.pxd":268 + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" + */ + case NPY_FLOAT: + __pyx_v_f = __pyx_k__f; + break; + + /* "numpy.pxd":269 + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" + */ + case NPY_DOUBLE: + __pyx_v_f = __pyx_k__d; + break; + + /* "numpy.pxd":270 + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" + */ + case NPY_LONGDOUBLE: + __pyx_v_f = __pyx_k__g; + break; + + /* "numpy.pxd":271 + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" + */ + case NPY_CFLOAT: + __pyx_v_f = __pyx_k__Zf; + break; + + /* "numpy.pxd":272 + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< + * elif t == NPY_CLONGDOUBLE: f = "Zg" + * elif t == NPY_OBJECT: f = "O" + */ + case NPY_CDOUBLE: + __pyx_v_f = __pyx_k__Zd; + break; + + /* "numpy.pxd":273 + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< + * elif t == NPY_OBJECT: f = "O" + * else: + */ + case NPY_CLONGDOUBLE: + __pyx_v_f = __pyx_k__Zg; + break; + + /* "numpy.pxd":274 + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" + * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + */ + case NPY_OBJECT: + __pyx_v_f = __pyx_k__O; + break; + default: + + /* "numpy.pxd":276 + * elif t == NPY_OBJECT: f = "O" + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * info.format = f + * return + */ + __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_16), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + + /* "numpy.pxd":277 + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * info.format = f # <<<<<<<<<<<<<< + * return + * else: + */ + __pyx_v_info->format = __pyx_v_f; + + /* "numpy.pxd":278 + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * info.format = f + * return # <<<<<<<<<<<<<< + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L11; + } + /*else*/ { + + /* "numpy.pxd":280 + * return + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< + * info.format[0] = c'^' # Native data types, manual alignment + * offset = 0 + */ + __pyx_v_info->format = ((char *)malloc(255)); + + /* "numpy.pxd":281 + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) + * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * offset = 0 + * f = _util_dtypestring(descr, info.format + 1, + */ + (__pyx_v_info->format[0]) = '^'; + + /* "numpy.pxd":282 + * info.format = stdlib.malloc(_buffer_format_string_len) + * info.format[0] = c'^' # Native data types, manual alignment + * offset = 0 # <<<<<<<<<<<<<< + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + */ + __pyx_v_offset = 0; + + /* "numpy.pxd":285 + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + * &offset) # <<<<<<<<<<<<<< + * f[0] = c'\0' # Terminate format string + * + */ + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_9; + + /* "numpy.pxd":286 + * info.format + _buffer_format_string_len, + * &offset) + * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< + * + * def __releasebuffer__(ndarray self, Py_buffer* info): + */ + (__pyx_v_f[0]) = '\x00'; + } + __pyx_L11:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; + } + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(Py_None); + __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; + } + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_descr); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); + __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":288 + * f[0] = c'\0' # Terminate format string + * + * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + */ + +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("__releasebuffer__", 0); + + /* "numpy.pxd":289 + * + * def __releasebuffer__(ndarray self, Py_buffer* info): + * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + */ + __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self); + if (__pyx_t_1) { + + /* "numpy.pxd":290 + * def __releasebuffer__(ndarray self, Py_buffer* info): + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) # <<<<<<<<<<<<<< + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * stdlib.free(info.strides) + */ + free(__pyx_v_info->format); + goto __pyx_L3; + } + __pyx_L3:; + + /* "numpy.pxd":291 + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< + * stdlib.free(info.strides) + * # info.shape was stored after info.strides in the same block + */ + __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_1) { + + /* "numpy.pxd":292 + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * stdlib.free(info.strides) # <<<<<<<<<<<<<< + * # info.shape was stored after info.strides in the same block + * + */ + free(__pyx_v_info->strides); + goto __pyx_L4; + } + __pyx_L4:; + + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":768 + * ctypedef npy_cdouble complex_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); + + /* "numpy.pxd":769 + * + * cdef inline object PyArray_MultiIterNew1(a): + * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew2(a, b): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":771 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); + + /* "numpy.pxd":772 + * + * cdef inline object PyArray_MultiIterNew2(a, b): + * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":774 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); + + /* "numpy.pxd":775 + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":777 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); + + /* "numpy.pxd":778 + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":780 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); + + /* "numpy.pxd":781 + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":783 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< + * # Recursive utility function used in __getbuffer__ to get format + * # string. The new location in the format string is returned. + */ + +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { + PyArray_Descr *__pyx_v_child = 0; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; + PyObject *__pyx_v_fields = 0; + PyObject *__pyx_v_childname = NULL; + PyObject *__pyx_v_new_offset = NULL; + PyObject *__pyx_v_t = NULL; + char *__pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *(*__pyx_t_6)(PyObject *); + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + long __pyx_t_11; + char *__pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_util_dtypestring", 0); + + /* "numpy.pxd":790 + * cdef int delta_offset + * cdef tuple i + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * cdef tuple fields + */ + __pyx_v_endian_detector = 1; + + /* "numpy.pxd":791 + * cdef tuple i + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * cdef tuple fields + * + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "numpy.pxd":794 + * cdef tuple fields + * + * for childname in descr.names: # <<<<<<<<<<<<<< + * fields = descr.fields[childname] + * child, new_offset = fields + */ + if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; + for (;;) { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + __Pyx_XDECREF(__pyx_v_childname); + __pyx_v_childname = __pyx_t_3; + __pyx_t_3 = 0; + + /* "numpy.pxd":795 + * + * for childname in descr.names: + * fields = descr.fields[childname] # <<<<<<<<<<<<<< + * child, new_offset = fields + * + */ + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); + __pyx_v_fields = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + + /* "numpy.pxd":796 + * for childname in descr.names: + * fields = descr.fields[childname] + * child, new_offset = fields # <<<<<<<<<<<<<< + * + * if (end - f) - (new_offset - offset[0]) < 15: + */ + if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { + PyObject* sequence = ((PyObject *)__pyx_v_fields); + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + #else + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + #endif + } else if (1) { + __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else + { + Py_ssize_t index = -1; + __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_fields)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; + index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = NULL; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L6_unpacking_done; + __pyx_L5_unpacking_failed:; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L6_unpacking_done:; + } + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_child)); + __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); + __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_v_new_offset); + __pyx_v_new_offset = __pyx_t_4; + __pyx_t_4 = 0; + + /* "numpy.pxd":798 + * child, new_offset = fields + * + * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") + * + */ + __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + + /* "numpy.pxd":799 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == c'>' and little_endian) or + */ + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + /* "numpy.pxd":801 + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") + * + * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (child.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + */ + __pyx_t_7 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_7) { + __pyx_t_8 = __pyx_v_little_endian; + } else { + __pyx_t_8 = __pyx_t_7; + } + if (!__pyx_t_8) { + + /* "numpy.pxd":802 + * + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError(u"Non-native byte order not supported") + * # One could encode it in the format string and have Cython + */ + __pyx_t_7 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_7) { + __pyx_t_9 = (!__pyx_v_little_endian); + __pyx_t_10 = __pyx_t_9; + } else { + __pyx_t_10 = __pyx_t_7; + } + __pyx_t_7 = __pyx_t_10; + } else { + __pyx_t_7 = __pyx_t_8; + } + if (__pyx_t_7) { + + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_19), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + + /* "numpy.pxd":813 + * + * # Output padding bytes + * while offset[0] < new_offset: # <<<<<<<<<<<<<< + * f[0] = 120 # "x"; pad byte + * f += 1 + */ + while (1) { + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!__pyx_t_7) break; + + /* "numpy.pxd":814 + * # Output padding bytes + * while offset[0] < new_offset: + * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< + * f += 1 + * offset[0] += 1 + */ + (__pyx_v_f[0]) = 120; + + /* "numpy.pxd":815 + * while offset[0] < new_offset: + * f[0] = 120 # "x"; pad byte + * f += 1 # <<<<<<<<<<<<<< + * offset[0] += 1 + * + */ + __pyx_v_f = (__pyx_v_f + 1); + + /* "numpy.pxd":816 + * f[0] = 120 # "x"; pad byte + * f += 1 + * offset[0] += 1 # <<<<<<<<<<<<<< + * + * offset[0] += child.itemsize + */ + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1); + } + + /* "numpy.pxd":818 + * offset[0] += 1 + * + * offset[0] += child.itemsize # <<<<<<<<<<<<<< + * + * if not PyDataType_HASFIELDS(child): + */ + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize); + + /* "numpy.pxd":820 + * offset[0] += child.itemsize + * + * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< + * t = child.type_num + * if end - f < 5: + */ + __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_7) { + + /* "numpy.pxd":821 + * + * if not PyDataType_HASFIELDS(child): + * t = child.type_num # <<<<<<<<<<<<<< + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") + */ + __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_v_t); + __pyx_v_t = __pyx_t_3; + __pyx_t_3 = 0; + + /* "numpy.pxd":822 + * if not PyDataType_HASFIELDS(child): + * t = child.type_num + * if end - f < 5: # <<<<<<<<<<<<<< + * raise RuntimeError(u"Format string allocated too short.") + * + */ + __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_7) { + + /* "numpy.pxd":823 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings + */ + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_21), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; + } + __pyx_L12:; + + /* "numpy.pxd":826 + * + * # Until ticket #99 is fixed, use integers to avoid warnings + * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" + */ + __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 98; + goto __pyx_L13; + } + + /* "numpy.pxd":827 + * # Until ticket #99 is fixed, use integers to avoid warnings + * if t == NPY_BYTE: f[0] = 98 #"b" + * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" + */ + __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 66; + goto __pyx_L13; + } + + /* "numpy.pxd":828 + * if t == NPY_BYTE: f[0] = 98 #"b" + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" + */ + __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 104; + goto __pyx_L13; + } + + /* "numpy.pxd":829 + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" + */ + __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 72; + goto __pyx_L13; + } + + /* "numpy.pxd":830 + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" + */ + __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 105; + goto __pyx_L13; + } + + /* "numpy.pxd":831 + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" + */ + __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 73; + goto __pyx_L13; + } + + /* "numpy.pxd":832 + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + */ + __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 108; + goto __pyx_L13; + } + + /* "numpy.pxd":833 + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + */ + __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 76; + goto __pyx_L13; + } + + /* "numpy.pxd":834 + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" + */ + __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 113; + goto __pyx_L13; + } + + /* "numpy.pxd":835 + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + */ + __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 81; + goto __pyx_L13; + } + + /* "numpy.pxd":836 + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + */ + __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 102; + goto __pyx_L13; + } + + /* "numpy.pxd":837 + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + */ + __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 100; + goto __pyx_L13; + } + + /* "numpy.pxd":838 + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + */ + __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 103; + goto __pyx_L13; + } + + /* "numpy.pxd":839 + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + */ + __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 102; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; + } + + /* "numpy.pxd":840 + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + * elif t == NPY_OBJECT: f[0] = 79 #"O" + */ + __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 100; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; + } + + /* "numpy.pxd":841 + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: + */ + __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 103; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; + } + + /* "numpy.pxd":842 + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + */ + __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 79; + goto __pyx_L13; + } + /*else*/ { + + /* "numpy.pxd":844 + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * f += 1 + * else: + */ + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_16), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L13:; + + /* "numpy.pxd":845 + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * f += 1 # <<<<<<<<<<<<<< + * else: + * # Cython ignores struct boundary information ("T{...}"), + */ + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L11; + } + /*else*/ { + + /* "numpy.pxd":849 + * # Cython ignores struct boundary information ("T{...}"), + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< + * return f + * + */ + __pyx_t_12 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_12; + } + __pyx_L11:; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "numpy.pxd":850 + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) + * return f # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_f; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_child); + __Pyx_XDECREF(__pyx_v_fields); + __Pyx_XDECREF(__pyx_v_childname); + __Pyx_XDECREF(__pyx_v_new_offset); + __Pyx_XDECREF(__pyx_v_t); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":965 + * + * + * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< + * cdef PyObject* baseptr + * if base is None: + */ + +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { + PyObject *__pyx_v_baseptr; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("set_array_base", 0); + + /* "numpy.pxd":967 + * cdef inline void set_array_base(ndarray arr, object base): + * cdef PyObject* baseptr + * if base is None: # <<<<<<<<<<<<<< + * baseptr = NULL + * else: + */ + __pyx_t_1 = (__pyx_v_base == Py_None); + if (__pyx_t_1) { + + /* "numpy.pxd":968 + * cdef PyObject* baseptr + * if base is None: + * baseptr = NULL # <<<<<<<<<<<<<< + * else: + * Py_INCREF(base) # important to do this before decref below! + */ + __pyx_v_baseptr = NULL; + goto __pyx_L3; + } + /*else*/ { + + /* "numpy.pxd":970 + * baseptr = NULL + * else: + * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< + * baseptr = base + * Py_XDECREF(arr.base) + */ + Py_INCREF(__pyx_v_base); + + /* "numpy.pxd":971 + * else: + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base # <<<<<<<<<<<<<< + * Py_XDECREF(arr.base) + * arr.base = baseptr + */ + __pyx_v_baseptr = ((PyObject *)__pyx_v_base); + } + __pyx_L3:; + + /* "numpy.pxd":972 + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base + * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< + * arr.base = baseptr + * + */ + Py_XDECREF(__pyx_v_arr->base); + + /* "numpy.pxd":973 + * baseptr = base + * Py_XDECREF(arr.base) + * arr.base = baseptr # <<<<<<<<<<<<<< + * + * cdef inline object get_array_base(ndarray arr): + */ + __pyx_v_arr->base = __pyx_v_baseptr; + + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":975 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("get_array_base", 0); + + /* "numpy.pxd":976 + * + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: # <<<<<<<<<<<<<< + * return None + * else: + */ + __pyx_t_1 = (__pyx_v_arr->base == NULL); + if (__pyx_t_1) { + + /* "numpy.pxd":977 + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: + * return None # <<<<<<<<<<<<<< + * else: + * return arr.base + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "numpy.pxd":979 + * return None + * else: + * return arr.base # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); + __pyx_r = ((PyObject *)__pyx_v_arr->base); + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static struct __pyx_vtabstruct_6_basis_BasisFunction __pyx_vtable_6_basis_BasisFunction; + +static PyObject *__pyx_tp_new_6_basis_BasisFunction(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_6_basis_BasisFunction *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_6_basis_BasisFunction *)o); + p->__pyx_vtab = __pyx_vtabptr_6_basis_BasisFunction; + p->parent = ((struct __pyx_obj_6_basis_BasisFunction *)Py_None); Py_INCREF(Py_None); + p->child_map = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->children = ((PyObject*)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_pw_6_basis_13BasisFunction_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) { + Py_DECREF(o); o = 0; + } + return o; +} + +static void __pyx_tp_dealloc_6_basis_BasisFunction(PyObject *o) { + struct __pyx_obj_6_basis_BasisFunction *p = (struct __pyx_obj_6_basis_BasisFunction *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->parent); + Py_CLEAR(p->child_map); + Py_CLEAR(p->children); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_6_basis_BasisFunction(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_6_basis_BasisFunction *p = (struct __pyx_obj_6_basis_BasisFunction *)o; + if (p->parent) { + e = (*v)(((PyObject*)p->parent), a); if (e) return e; + } + if (p->child_map) { + e = (*v)(p->child_map, a); if (e) return e; + } + if (p->children) { + e = (*v)(p->children, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_6_basis_BasisFunction(PyObject *o) { + struct __pyx_obj_6_basis_BasisFunction *p = (struct __pyx_obj_6_basis_BasisFunction *)o; + PyObject* tmp; + tmp = ((PyObject*)p->parent); + p->parent = ((struct __pyx_obj_6_basis_BasisFunction *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->child_map); + p->child_map = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->children); + p->children = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_6_basis_BasisFunction[] = { + {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_3__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_get_root"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_5_get_root, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_getstate"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_7_getstate, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_get_parent_state"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_9_get_parent_state, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_set_parent_state"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_11_set_parent_state, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__setstate__"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_13__setstate__, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_eq"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_15_eq, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("has_knot"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_19has_knot, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("is_prunable"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_21is_prunable, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("is_pruned"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_23is_pruned, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("is_splittable"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_25is_splittable, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("make_splittable"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_27make_splittable, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("make_unsplittable"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_29make_unsplittable, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_set_parent"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_31_set_parent, METH_O, __Pyx_DOCSTR(__pyx_doc_6_basis_13BasisFunction_30_set_parent)}, + {__Pyx_NAMESTR("_add_child"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_33_add_child, METH_O, __Pyx_DOCSTR(__pyx_doc_6_basis_13BasisFunction_32_add_child)}, + {__Pyx_NAMESTR("get_parent"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_35get_parent, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("prune"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_37prune, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("unprune"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_39unprune, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("knots"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_41knots, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("degree"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_43degree, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("apply"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_45apply, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6_basis_13BasisFunction_44apply)}, + {__Pyx_NAMESTR("valid_knots"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_47valid_knots, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6_basis_13BasisFunction_46valid_knots)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_BasisFunction = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_BasisFunction = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_BasisFunction = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_BasisFunction = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_6_basis_BasisFunction = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("_basis.BasisFunction"), /*tp_name*/ + sizeof(struct __pyx_obj_6_basis_BasisFunction), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6_basis_BasisFunction, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_BasisFunction, /*tp_as_number*/ + &__pyx_tp_as_sequence_BasisFunction, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_BasisFunction, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_BasisFunction, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("Abstract. Subclasses must implement the apply, translate, scale, and __init__ methods."), /*tp_doc*/ + __pyx_tp_traverse_6_basis_BasisFunction, /*tp_traverse*/ + __pyx_tp_clear_6_basis_BasisFunction, /*tp_clear*/ + __pyx_pw_6_basis_13BasisFunction_17__richcmp__, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_6_basis_BasisFunction, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6_basis_BasisFunction, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_6_basis_ConstantBasisFunction __pyx_vtable_6_basis_ConstantBasisFunction; + +static PyObject *__pyx_tp_new_6_basis_ConstantBasisFunction(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_6_basis_ConstantBasisFunction *p; + PyObject *o = __pyx_tp_new_6_basis_BasisFunction(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_6_basis_ConstantBasisFunction *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6_basis_BasisFunction*)__pyx_vtabptr_6_basis_ConstantBasisFunction; + return o; +} + +static PyMethodDef __pyx_methods_6_basis_ConstantBasisFunction[] = { + {__Pyx_NAMESTR("_get_root"), (PyCFunction)__pyx_pw_6_basis_21ConstantBasisFunction_3_get_root, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_get_parent_state"), (PyCFunction)__pyx_pw_6_basis_21ConstantBasisFunction_5_get_parent_state, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_set_parent_state"), (PyCFunction)__pyx_pw_6_basis_21ConstantBasisFunction_7_set_parent_state, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("degree"), (PyCFunction)__pyx_pw_6_basis_21ConstantBasisFunction_9degree, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("translate"), (PyCFunction)__pyx_pw_6_basis_21ConstantBasisFunction_11translate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("scale"), (PyCFunction)__pyx_pw_6_basis_21ConstantBasisFunction_13scale, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_set_parent"), (PyCFunction)__pyx_pw_6_basis_21ConstantBasisFunction_15_set_parent, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_parent"), (PyCFunction)__pyx_pw_6_basis_21ConstantBasisFunction_17get_parent, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("apply"), (PyCFunction)__pyx_pw_6_basis_21ConstantBasisFunction_19apply, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6_basis_21ConstantBasisFunction_18apply)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_ConstantBasisFunction = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_ConstantBasisFunction = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_ConstantBasisFunction = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_ConstantBasisFunction = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_6_basis_ConstantBasisFunction = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("_basis.ConstantBasisFunction"), /*tp_name*/ + sizeof(struct __pyx_obj_6_basis_ConstantBasisFunction), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6_basis_BasisFunction, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_ConstantBasisFunction, /*tp_as_number*/ + &__pyx_tp_as_sequence_ConstantBasisFunction, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_ConstantBasisFunction, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + __pyx_pw_6_basis_21ConstantBasisFunction_21__str__, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_ConstantBasisFunction, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_6_basis_BasisFunction, /*tp_traverse*/ + __pyx_tp_clear_6_basis_BasisFunction, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_6_basis_ConstantBasisFunction, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_6_basis_21ConstantBasisFunction_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6_basis_ConstantBasisFunction, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_6_basis_HingeBasisFunction __pyx_vtable_6_basis_HingeBasisFunction; + +static PyObject *__pyx_tp_new_6_basis_HingeBasisFunction(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_6_basis_HingeBasisFunction *p; + PyObject *o = __pyx_tp_new_6_basis_BasisFunction(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_6_basis_HingeBasisFunction *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6_basis_BasisFunction*)__pyx_vtabptr_6_basis_HingeBasisFunction; + p->label = ((PyObject*)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_6_basis_HingeBasisFunction(PyObject *o) { + struct __pyx_obj_6_basis_HingeBasisFunction *p = (struct __pyx_obj_6_basis_HingeBasisFunction *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->label); + PyObject_GC_Track(o); + __pyx_tp_dealloc_6_basis_BasisFunction(o); +} + +static int __pyx_tp_traverse_6_basis_HingeBasisFunction(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_6_basis_HingeBasisFunction *p = (struct __pyx_obj_6_basis_HingeBasisFunction *)o; + e = __pyx_tp_traverse_6_basis_BasisFunction(o, v, a); if (e) return e; + if (p->label) { + e = (*v)(p->label, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_6_basis_HingeBasisFunction(PyObject *o) { + struct __pyx_obj_6_basis_HingeBasisFunction *p = (struct __pyx_obj_6_basis_HingeBasisFunction *)o; + PyObject* tmp; + __pyx_tp_clear_6_basis_BasisFunction(o); + tmp = ((PyObject*)p->label); + p->label = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_6_basis_HingeBasisFunction[] = { + {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_6_basis_18HingeBasisFunction_3__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_getstate"), (PyCFunction)__pyx_pw_6_basis_18HingeBasisFunction_5_getstate, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__setstate__"), (PyCFunction)__pyx_pw_6_basis_18HingeBasisFunction_7__setstate__, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("has_knot"), (PyCFunction)__pyx_pw_6_basis_18HingeBasisFunction_9has_knot, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("translate"), (PyCFunction)__pyx_pw_6_basis_18HingeBasisFunction_11translate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("scale"), (PyCFunction)__pyx_pw_6_basis_18HingeBasisFunction_13scale, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_variable"), (PyCFunction)__pyx_pw_6_basis_18HingeBasisFunction_17get_variable, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_knot"), (PyCFunction)__pyx_pw_6_basis_18HingeBasisFunction_19get_knot, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_reverse"), (PyCFunction)__pyx_pw_6_basis_18HingeBasisFunction_21get_reverse, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_knot_idx"), (PyCFunction)__pyx_pw_6_basis_18HingeBasisFunction_23get_knot_idx, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("apply"), (PyCFunction)__pyx_pw_6_basis_18HingeBasisFunction_25apply, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6_basis_18HingeBasisFunction_24apply)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_HingeBasisFunction = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_HingeBasisFunction = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_HingeBasisFunction = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_HingeBasisFunction = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_6_basis_HingeBasisFunction = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("_basis.HingeBasisFunction"), /*tp_name*/ + sizeof(struct __pyx_obj_6_basis_HingeBasisFunction), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6_basis_HingeBasisFunction, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_HingeBasisFunction, /*tp_as_number*/ + &__pyx_tp_as_sequence_HingeBasisFunction, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_HingeBasisFunction, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + __pyx_pw_6_basis_18HingeBasisFunction_15__str__, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_HingeBasisFunction, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_6_basis_HingeBasisFunction, /*tp_traverse*/ + __pyx_tp_clear_6_basis_HingeBasisFunction, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_6_basis_HingeBasisFunction, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_6_basis_18HingeBasisFunction_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6_basis_HingeBasisFunction, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_6_basis_LinearBasisFunction __pyx_vtable_6_basis_LinearBasisFunction; + +static PyObject *__pyx_tp_new_6_basis_LinearBasisFunction(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_6_basis_LinearBasisFunction *p; + PyObject *o = __pyx_tp_new_6_basis_BasisFunction(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_6_basis_LinearBasisFunction *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6_basis_BasisFunction*)__pyx_vtabptr_6_basis_LinearBasisFunction; + p->label = ((PyObject*)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_6_basis_LinearBasisFunction(PyObject *o) { + struct __pyx_obj_6_basis_LinearBasisFunction *p = (struct __pyx_obj_6_basis_LinearBasisFunction *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->label); + PyObject_GC_Track(o); + __pyx_tp_dealloc_6_basis_BasisFunction(o); +} + +static int __pyx_tp_traverse_6_basis_LinearBasisFunction(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_6_basis_LinearBasisFunction *p = (struct __pyx_obj_6_basis_LinearBasisFunction *)o; + e = __pyx_tp_traverse_6_basis_BasisFunction(o, v, a); if (e) return e; + if (p->label) { + e = (*v)(p->label, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_6_basis_LinearBasisFunction(PyObject *o) { + struct __pyx_obj_6_basis_LinearBasisFunction *p = (struct __pyx_obj_6_basis_LinearBasisFunction *)o; + PyObject* tmp; + __pyx_tp_clear_6_basis_BasisFunction(o); + tmp = ((PyObject*)p->label); + p->label = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_6_basis_LinearBasisFunction[] = { + {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_6_basis_19LinearBasisFunction_3__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_getstate"), (PyCFunction)__pyx_pw_6_basis_19LinearBasisFunction_5_getstate, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__setstate__"), (PyCFunction)__pyx_pw_6_basis_19LinearBasisFunction_7__setstate__, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("translate"), (PyCFunction)__pyx_pw_6_basis_19LinearBasisFunction_9translate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("scale"), (PyCFunction)__pyx_pw_6_basis_19LinearBasisFunction_11scale, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_variable"), (PyCFunction)__pyx_pw_6_basis_19LinearBasisFunction_15get_variable, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("apply"), (PyCFunction)__pyx_pw_6_basis_19LinearBasisFunction_17apply, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6_basis_19LinearBasisFunction_16apply)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_LinearBasisFunction = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_LinearBasisFunction = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_LinearBasisFunction = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_LinearBasisFunction = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_6_basis_LinearBasisFunction = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("_basis.LinearBasisFunction"), /*tp_name*/ + sizeof(struct __pyx_obj_6_basis_LinearBasisFunction), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6_basis_LinearBasisFunction, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_LinearBasisFunction, /*tp_as_number*/ + &__pyx_tp_as_sequence_LinearBasisFunction, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_LinearBasisFunction, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + __pyx_pw_6_basis_19LinearBasisFunction_13__str__, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_LinearBasisFunction, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_6_basis_LinearBasisFunction, /*tp_traverse*/ + __pyx_tp_clear_6_basis_LinearBasisFunction, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_6_basis_LinearBasisFunction, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_6_basis_19LinearBasisFunction_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6_basis_LinearBasisFunction, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_6_basis_Basis __pyx_vtable_6_basis_Basis; + +static PyObject *__pyx_tp_new_6_basis_Basis(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_6_basis_Basis *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_6_basis_Basis *)o); + p->__pyx_vtab = __pyx_vtabptr_6_basis_Basis; + p->order = ((PyObject*)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_6_basis_Basis(PyObject *o) { + struct __pyx_obj_6_basis_Basis *p = (struct __pyx_obj_6_basis_Basis *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->order); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_6_basis_Basis(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_6_basis_Basis *p = (struct __pyx_obj_6_basis_Basis *)o; + if (p->order) { + e = (*v)(p->order, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_6_basis_Basis(PyObject *o) { + struct __pyx_obj_6_basis_Basis *p = (struct __pyx_obj_6_basis_Basis *)o; + PyObject* tmp; + tmp = ((PyObject*)p->order); + p->order = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} +static PyObject *__pyx_sq_item_6_basis_Basis(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + Py_DECREF(x); + return r; +} + +static PyMethodDef __pyx_methods_6_basis_Basis[] = { + {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_6_basis_5Basis_3__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_getstate"), (PyCFunction)__pyx_pw_6_basis_5Basis_5_getstate, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__setstate__"), (PyCFunction)__pyx_pw_6_basis_5Basis_7__setstate__, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_eq"), (PyCFunction)__pyx_pw_6_basis_5Basis_11_eq, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("piter"), (PyCFunction)__pyx_pw_6_basis_5Basis_13piter, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("translate"), (PyCFunction)__pyx_pw_6_basis_5Basis_18translate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("scale"), (PyCFunction)__pyx_pw_6_basis_5Basis_20scale, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_root"), (PyCFunction)__pyx_pw_6_basis_5Basis_22get_root, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("append"), (PyCFunction)__pyx_pw_6_basis_5Basis_24append, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get"), (PyCFunction)__pyx_pw_6_basis_5Basis_30get, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("plen"), (PyCFunction)__pyx_pw_6_basis_5Basis_34plen, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("transform"), (PyCFunction)__pyx_pw_6_basis_5Basis_36transform, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("weighted_transform"), (PyCFunction)__pyx_pw_6_basis_5Basis_38weighted_transform, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_Basis = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_Basis = { + __pyx_pw_6_basis_5Basis_28__len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_6_basis_Basis, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_Basis = { + __pyx_pw_6_basis_5Basis_28__len__, /*mp_length*/ + __pyx_pw_6_basis_5Basis_32__getitem__, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_Basis = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_6_basis_Basis = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("_basis.Basis"), /*tp_name*/ + sizeof(struct __pyx_obj_6_basis_Basis), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6_basis_Basis, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_Basis, /*tp_as_number*/ + &__pyx_tp_as_sequence_Basis, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_Basis, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + __pyx_pw_6_basis_5Basis_16__str__, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_Basis, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("A container that provides functionality related to a set of BasisFunctions with a \n common ConstantBasisFunction ancestor. Retains the order in which BasisFunctions are \n added."), /*tp_doc*/ + __pyx_tp_traverse_6_basis_Basis, /*tp_traverse*/ + __pyx_tp_clear_6_basis_Basis, /*tp_clear*/ + __pyx_pw_6_basis_5Basis_9__richcmp__, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + __pyx_pw_6_basis_5Basis_26__iter__, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_6_basis_Basis, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_6_basis_5Basis_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6_basis_Basis, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_6_basis_PicklePlaceHolderBasisFunction __pyx_vtable_6_basis_PicklePlaceHolderBasisFunction; + +static PyObject *__pyx_tp_new_6_basis_PicklePlaceHolderBasisFunction(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_6_basis_PicklePlaceHolderBasisFunction *p; + PyObject *o = __pyx_tp_new_6_basis_BasisFunction(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_6_basis_PicklePlaceHolderBasisFunction *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6_basis_BasisFunction*)__pyx_vtabptr_6_basis_PicklePlaceHolderBasisFunction; + return o; +} + +static PyMethodDef __pyx_methods_6_basis_PicklePlaceHolderBasisFunction[] = { + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_PicklePlaceHolderBasisFunction = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_PicklePlaceHolderBasisFunction = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_PicklePlaceHolderBasisFunction = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_PicklePlaceHolderBasisFunction = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_6_basis_PicklePlaceHolderBasisFunction = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("_basis.PicklePlaceHolderBasisFunction"), /*tp_name*/ + sizeof(struct __pyx_obj_6_basis_PicklePlaceHolderBasisFunction), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6_basis_BasisFunction, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_PicklePlaceHolderBasisFunction, /*tp_as_number*/ + &__pyx_tp_as_sequence_PicklePlaceHolderBasisFunction, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_PicklePlaceHolderBasisFunction, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_PicklePlaceHolderBasisFunction, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("This is a place holder for unpickling the basis function tree."), /*tp_doc*/ + __pyx_tp_traverse_6_basis_BasisFunction, /*tp_traverse*/ + __pyx_tp_clear_6_basis_BasisFunction, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_6_basis_PicklePlaceHolderBasisFunction, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6_basis_PicklePlaceHolderBasisFunction, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static struct __pyx_obj_6_basis___pyx_scope_struct__piter *__pyx_freelist_6_basis___pyx_scope_struct__piter[8]; +static int __pyx_freecount_6_basis___pyx_scope_struct__piter = 0; + +static PyObject *__pyx_tp_new_6_basis___pyx_scope_struct__piter(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_6_basis___pyx_scope_struct__piter *p; + PyObject *o; + if (likely((__pyx_freecount_6_basis___pyx_scope_struct__piter > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6_basis___pyx_scope_struct__piter)))) { + o = (PyObject*)__pyx_freelist_6_basis___pyx_scope_struct__piter[--__pyx_freecount_6_basis___pyx_scope_struct__piter]; + memset(o, 0, sizeof(struct __pyx_obj_6_basis___pyx_scope_struct__piter)); + PyObject_INIT(o, t); + PyObject_GC_Track(o); + } else { + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + } + p = ((struct __pyx_obj_6_basis___pyx_scope_struct__piter *)o); + p->__pyx_v_bf = 0; + p->__pyx_v_self = 0; + p->__pyx_t_0 = 0; + return o; +} + +static void __pyx_tp_dealloc_6_basis___pyx_scope_struct__piter(PyObject *o) { + struct __pyx_obj_6_basis___pyx_scope_struct__piter *p = (struct __pyx_obj_6_basis___pyx_scope_struct__piter *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->__pyx_v_bf); + Py_CLEAR(p->__pyx_v_self); + Py_CLEAR(p->__pyx_t_0); + if ((__pyx_freecount_6_basis___pyx_scope_struct__piter < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6_basis___pyx_scope_struct__piter))) { + __pyx_freelist_6_basis___pyx_scope_struct__piter[__pyx_freecount_6_basis___pyx_scope_struct__piter++] = ((struct __pyx_obj_6_basis___pyx_scope_struct__piter *)o); + } else { + (*Py_TYPE(o)->tp_free)(o); + } +} + +static int __pyx_tp_traverse_6_basis___pyx_scope_struct__piter(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_6_basis___pyx_scope_struct__piter *p = (struct __pyx_obj_6_basis___pyx_scope_struct__piter *)o; + if (p->__pyx_v_bf) { + e = (*v)(p->__pyx_v_bf, a); if (e) return e; + } + if (p->__pyx_v_self) { + e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e; + } + if (p->__pyx_t_0) { + e = (*v)(p->__pyx_t_0, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_6_basis___pyx_scope_struct__piter(PyObject *o) { + struct __pyx_obj_6_basis___pyx_scope_struct__piter *p = (struct __pyx_obj_6_basis___pyx_scope_struct__piter *)o; + PyObject* tmp; + tmp = ((PyObject*)p->__pyx_v_bf); + p->__pyx_v_bf = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_self); + p->__pyx_v_self = ((struct __pyx_obj_6_basis_Basis *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_t_0); + p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_6_basis___pyx_scope_struct__piter[] = { + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct__piter = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct__piter = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct__piter = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct__piter = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_6_basis___pyx_scope_struct__piter = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("_basis.__pyx_scope_struct__piter"), /*tp_name*/ + sizeof(struct __pyx_obj_6_basis___pyx_scope_struct__piter), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_6_basis___pyx_scope_struct__piter, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number___pyx_scope_struct__piter, /*tp_as_number*/ + &__pyx_tp_as_sequence___pyx_scope_struct__piter, /*tp_as_sequence*/ + &__pyx_tp_as_mapping___pyx_scope_struct__piter, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer___pyx_scope_struct__piter, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_6_basis___pyx_scope_struct__piter, /*tp_traverse*/ + __pyx_tp_clear_6_basis___pyx_scope_struct__piter, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_6_basis___pyx_scope_struct__piter, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_6_basis___pyx_scope_struct__piter, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + #if PY_VERSION_HEX < 0x03020000 + { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, + #else + PyModuleDef_HEAD_INIT, + #endif + __Pyx_NAMESTR("_basis"), + 0, /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, + {&__pyx_kp_u_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 1, 0, 0}, + {&__pyx_kp_u_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 1, 0, 0}, + {&__pyx_kp_u_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 1, 0, 0}, + {&__pyx_kp_u_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 1, 0, 0}, + {&__pyx_kp_u_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 1, 0, 0}, + {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0}, + {&__pyx_kp_u_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 1, 0, 0}, + {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, + {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0}, + {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0}, + {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0}, + {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0}, + {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0}, + {&__pyx_n_s__B, __pyx_k__B, sizeof(__pyx_k__B), 0, 0, 1, 1}, + {&__pyx_n_s__NotImplemented, __pyx_k__NotImplemented, sizeof(__pyx_k__NotImplemented), 0, 0, 1, 1}, + {&__pyx_n_s__NotImplementedError, __pyx_k__NotImplementedError, sizeof(__pyx_k__NotImplementedError), 0, 0, 1, 1}, + {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, + {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, + {&__pyx_n_s__X, __pyx_k__X, sizeof(__pyx_k__X), 0, 0, 1, 1}, + {&__pyx_n_s____class__, __pyx_k____class__, sizeof(__pyx_k____class__), 0, 0, 1, 1}, + {&__pyx_n_s____import__, __pyx_k____import__, sizeof(__pyx_k____import__), 0, 0, 1, 1}, + {&__pyx_n_s____iter__, __pyx_k____iter__, sizeof(__pyx_k____iter__), 0, 0, 1, 1}, + {&__pyx_n_s____len__, __pyx_k____len__, sizeof(__pyx_k____len__), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____pyx_getbuffer, __pyx_k____pyx_getbuffer, sizeof(__pyx_k____pyx_getbuffer), 0, 0, 1, 1}, + {&__pyx_n_s____pyx_releasebuffer, __pyx_k____pyx_releasebuffer, sizeof(__pyx_k____pyx_releasebuffer), 0, 0, 1, 1}, + {&__pyx_n_s____setstate__, __pyx_k____setstate__, sizeof(__pyx_k____setstate__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s___add_child, __pyx_k___add_child, sizeof(__pyx_k___add_child), 0, 0, 1, 1}, + {&__pyx_n_s___eq, __pyx_k___eq, sizeof(__pyx_k___eq), 0, 0, 1, 1}, + {&__pyx_n_s___get_parent_state, __pyx_k___get_parent_state, sizeof(__pyx_k___get_parent_state), 0, 0, 1, 1}, + {&__pyx_n_s___get_root, __pyx_k___get_root, sizeof(__pyx_k___get_root), 0, 0, 1, 1}, + {&__pyx_n_s___getstate, __pyx_k___getstate, sizeof(__pyx_k___getstate), 0, 0, 1, 1}, + {&__pyx_n_s___set_parent, __pyx_k___set_parent, sizeof(__pyx_k___set_parent), 0, 0, 1, 1}, + {&__pyx_n_s___set_parent_state, __pyx_k___set_parent_state, sizeof(__pyx_k___set_parent_state), 0, 0, 1, 1}, + {&__pyx_n_s__append, __pyx_k__append, sizeof(__pyx_k__append), 0, 0, 1, 1}, + {&__pyx_n_s__apply, __pyx_k__apply, sizeof(__pyx_k__apply), 0, 0, 1, 1}, + {&__pyx_n_s__args, __pyx_k__args, sizeof(__pyx_k__args), 0, 0, 1, 1}, + {&__pyx_n_s__b, __pyx_k__b, sizeof(__pyx_k__b), 0, 0, 1, 1}, + {&__pyx_n_s__beta, __pyx_k__beta, sizeof(__pyx_k__beta), 0, 0, 1, 1}, + {&__pyx_n_s__check_every, __pyx_k__check_every, sizeof(__pyx_k__check_every), 0, 0, 1, 1}, + {&__pyx_n_s__child_map, __pyx_k__child_map, sizeof(__pyx_k__child_map), 0, 0, 1, 1}, + {&__pyx_n_s__children, __pyx_k__children, sizeof(__pyx_k__children), 0, 0, 1, 1}, + {&__pyx_n_s__close, __pyx_k__close, sizeof(__pyx_k__close), 0, 0, 1, 1}, + {&__pyx_n_s__degree, __pyx_k__degree, sizeof(__pyx_k__degree), 0, 0, 1, 1}, + {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, + {&__pyx_n_s__empty, __pyx_k__empty, sizeof(__pyx_k__empty), 0, 0, 1, 1}, + {&__pyx_n_s__endspan, __pyx_k__endspan, sizeof(__pyx_k__endspan), 0, 0, 1, 1}, + {&__pyx_n_s__get, __pyx_k__get, sizeof(__pyx_k__get), 0, 0, 1, 1}, + {&__pyx_n_s__get_knot, __pyx_k__get_knot, sizeof(__pyx_k__get_knot), 0, 0, 1, 1}, + {&__pyx_n_s__get_knot_idx, __pyx_k__get_knot_idx, sizeof(__pyx_k__get_knot_idx), 0, 0, 1, 1}, + {&__pyx_n_s__get_parent, __pyx_k__get_parent, sizeof(__pyx_k__get_parent), 0, 0, 1, 1}, + {&__pyx_n_s__get_reverse, __pyx_k__get_reverse, sizeof(__pyx_k__get_reverse), 0, 0, 1, 1}, + {&__pyx_n_s__get_root, __pyx_k__get_root, sizeof(__pyx_k__get_root), 0, 0, 1, 1}, + {&__pyx_n_s__get_variable, __pyx_k__get_variable, sizeof(__pyx_k__get_variable), 0, 0, 1, 1}, + {&__pyx_n_s__has_knot, __pyx_k__has_knot, sizeof(__pyx_k__has_knot), 0, 0, 1, 1}, + {&__pyx_n_s__intercepts, __pyx_k__intercepts, sizeof(__pyx_k__intercepts), 0, 0, 1, 1}, + {&__pyx_n_s__is_prunable, __pyx_k__is_prunable, sizeof(__pyx_k__is_prunable), 0, 0, 1, 1}, + {&__pyx_n_s__is_pruned, __pyx_k__is_pruned, sizeof(__pyx_k__is_pruned), 0, 0, 1, 1}, + {&__pyx_n_s__is_splittable, __pyx_k__is_splittable, sizeof(__pyx_k__is_splittable), 0, 0, 1, 1}, + {&__pyx_n_s__knot, __pyx_k__knot, sizeof(__pyx_k__knot), 0, 0, 1, 1}, + {&__pyx_n_s__knot_idx, __pyx_k__knot_idx, sizeof(__pyx_k__knot_idx), 0, 0, 1, 1}, + {&__pyx_n_s__knots, __pyx_k__knots, sizeof(__pyx_k__knots), 0, 0, 1, 1}, + {&__pyx_n_s__label, __pyx_k__label, sizeof(__pyx_k__label), 0, 0, 1, 1}, + {&__pyx_n_s__make_splittable, __pyx_k__make_splittable, sizeof(__pyx_k__make_splittable), 0, 0, 1, 1}, + {&__pyx_n_s__make_unsplittable, __pyx_k__make_unsplittable, sizeof(__pyx_k__make_unsplittable), 0, 0, 1, 1}, + {&__pyx_n_s__minspan, __pyx_k__minspan, sizeof(__pyx_k__minspan), 0, 0, 1, 1}, + {&__pyx_n_s__minspan_alpha, __pyx_k__minspan_alpha, sizeof(__pyx_k__minspan_alpha), 0, 0, 1, 1}, + {&__pyx_n_s__n, __pyx_k__n, sizeof(__pyx_k__n), 0, 0, 1, 1}, + {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, + {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, + {&__pyx_n_s__order, __pyx_k__order, sizeof(__pyx_k__order), 0, 0, 1, 1}, + {&__pyx_n_s__parent, __pyx_k__parent, sizeof(__pyx_k__parent), 0, 0, 1, 1}, + {&__pyx_n_s__pickle_place_holder, __pyx_k__pickle_place_holder, sizeof(__pyx_k__pickle_place_holder), 0, 0, 1, 1}, + {&__pyx_n_s__plen, __pyx_k__plen, sizeof(__pyx_k__plen), 0, 0, 1, 1}, + {&__pyx_n_s__prunable, __pyx_k__prunable, sizeof(__pyx_k__prunable), 0, 0, 1, 1}, + {&__pyx_n_s__prune, __pyx_k__prune, sizeof(__pyx_k__prune), 0, 0, 1, 1}, + {&__pyx_n_s__pruned, __pyx_k__pruned, sizeof(__pyx_k__pruned), 0, 0, 1, 1}, + {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, + {&__pyx_n_s__recurse, __pyx_k__recurse, sizeof(__pyx_k__recurse), 0, 0, 1, 1}, + {&__pyx_n_s__reverse, __pyx_k__reverse, sizeof(__pyx_k__reverse), 0, 0, 1, 1}, + {&__pyx_n_s__root, __pyx_k__root, sizeof(__pyx_k__root), 0, 0, 1, 1}, + {&__pyx_n_s__scale, __pyx_k__scale, sizeof(__pyx_k__scale), 0, 0, 1, 1}, + {&__pyx_n_s__send, __pyx_k__send, sizeof(__pyx_k__send), 0, 0, 1, 1}, + {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1}, + {&__pyx_n_s__slopes, __pyx_k__slopes, sizeof(__pyx_k__slopes), 0, 0, 1, 1}, + {&__pyx_n_s__splittable, __pyx_k__splittable, sizeof(__pyx_k__splittable), 0, 0, 1, 1}, + {&__pyx_n_s__super, __pyx_k__super, sizeof(__pyx_k__super), 0, 0, 1, 1}, + {&__pyx_n_s__throw, __pyx_k__throw, sizeof(__pyx_k__throw), 0, 0, 1, 1}, + {&__pyx_n_s__transform, __pyx_k__transform, sizeof(__pyx_k__transform), 0, 0, 1, 1}, + {&__pyx_n_s__translate, __pyx_k__translate, sizeof(__pyx_k__translate), 0, 0, 1, 1}, + {&__pyx_n_s__unprune, __pyx_k__unprune, sizeof(__pyx_k__unprune), 0, 0, 1, 1}, + {&__pyx_n_s__update, __pyx_k__update, sizeof(__pyx_k__update), 0, 0, 1, 1}, + {&__pyx_n_s__valid_knots, __pyx_k__valid_knots, sizeof(__pyx_k__valid_knots), 0, 0, 1, 1}, + {&__pyx_n_s__values, __pyx_k__values, sizeof(__pyx_k__values), 0, 0, 1, 1}, + {&__pyx_n_s__variable, __pyx_k__variable, sizeof(__pyx_k__variable), 0, 0, 1, 1}, + {&__pyx_n_s__variable_idx, __pyx_k__variable_idx, sizeof(__pyx_k__variable_idx), 0, 0, 1, 1}, + {&__pyx_n_s__weighted_transform, __pyx_k__weighted_transform, sizeof(__pyx_k__weighted_transform), 0, 0, 1, 1}, + {&__pyx_n_s__weights, __pyx_k__weights, sizeof(__pyx_k__weights), 0, 0, 1, 1}, + {&__pyx_n_s__workspace, __pyx_k__workspace, sizeof(__pyx_k__workspace), 0, 0, 1, 1}, + {&__pyx_n_s__x, __pyx_k__x, sizeof(__pyx_k__x), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_NotImplemented = __Pyx_GetBuiltinName(__pyx_n_s__NotImplemented); if (!__pyx_builtin_NotImplemented) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s__NotImplementedError); if (!__pyx_builtin_NotImplementedError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s__super); if (!__pyx_builtin_super) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + + /* "_basis.pyx":573 + * if bf.is_pruned(): + * continue + * bf.apply(X,B[:,col],recurse=True) # <<<<<<<<<<<<<< + * col += 1 + * + */ + __pyx_k_slice_9 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_9); + __Pyx_GIVEREF(__pyx_k_slice_9); + + /* "numpy.pxd":215 + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + */ + __pyx_k_tuple_11 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_10)); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_11); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11)); + + /* "numpy.pxd":219 + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * + * info.buf = PyArray_DATA(self) + */ + __pyx_k_tuple_13 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_12)); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_13); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13)); + + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_k_tuple_15 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_14)); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_15); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15)); + + /* "numpy.pxd":799 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == c'>' and little_endian) or + */ + __pyx_k_tuple_18 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_17)); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_18); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18)); + + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_k_tuple_19 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_14)); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_19); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19)); + + /* "numpy.pxd":823 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings + */ + __pyx_k_tuple_21 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_20)); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_21); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21)); + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC init_basis(void); /*proto*/ +PyMODINIT_FUNC init_basis(void) +#else +PyMODINIT_FUNC PyInit__basis(void); /*proto*/ +PyMODINIT_FUNC PyInit__basis(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__basis(void)", 0); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __Pyx_CyFunction_USED + if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_basis"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + Py_INCREF(__pyx_d); + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyDict_GetItemString(modules, "_basis")) { + if (unlikely(PyDict_SetItemString(modules, "_basis", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if CYTHON_COMPILING_IN_PYPY + Py_INCREF(__pyx_b); + #endif + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) + if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + if (__pyx_module_is_main__basis) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Global init code ---*/ + /*--- Variable export code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + __pyx_vtabptr_6_basis_BasisFunction = &__pyx_vtable_6_basis_BasisFunction; + __pyx_vtable_6_basis_BasisFunction.has_knot = (int (*)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_13BasisFunction_has_knot; + __pyx_vtable_6_basis_BasisFunction.is_prunable = (int (*)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_13BasisFunction_is_prunable; + __pyx_vtable_6_basis_BasisFunction.is_pruned = (int (*)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_13BasisFunction_is_pruned; + __pyx_vtable_6_basis_BasisFunction.is_splittable = (int (*)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_13BasisFunction_is_splittable; + __pyx_vtable_6_basis_BasisFunction.make_splittable = (int (*)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_13BasisFunction_make_splittable; + __pyx_vtable_6_basis_BasisFunction.make_unsplittable = (int (*)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_13BasisFunction_make_unsplittable; + __pyx_vtable_6_basis_BasisFunction.get_children = (PyObject *(*)(struct __pyx_obj_6_basis_BasisFunction *))__pyx_f_6_basis_13BasisFunction_get_children; + __pyx_vtable_6_basis_BasisFunction._set_parent = (PyObject *(*)(struct __pyx_obj_6_basis_BasisFunction *, struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_13BasisFunction__set_parent; + __pyx_vtable_6_basis_BasisFunction._add_child = (PyObject *(*)(struct __pyx_obj_6_basis_BasisFunction *, struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_13BasisFunction__add_child; + __pyx_vtable_6_basis_BasisFunction.get_parent = (struct __pyx_obj_6_basis_BasisFunction *(*)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_13BasisFunction_get_parent; + __pyx_vtable_6_basis_BasisFunction.prune = (PyObject *(*)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_13BasisFunction_prune; + __pyx_vtable_6_basis_BasisFunction.unprune = (PyObject *(*)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_13BasisFunction_unprune; + __pyx_vtable_6_basis_BasisFunction.knots = (PyObject *(*)(struct __pyx_obj_6_basis_BasisFunction *, __pyx_t_6_basis_INDEX_t, int __pyx_skip_dispatch))__pyx_f_6_basis_13BasisFunction_knots; + __pyx_vtable_6_basis_BasisFunction.degree = (__pyx_t_6_basis_INDEX_t (*)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_13BasisFunction_degree; + __pyx_vtable_6_basis_BasisFunction.apply = (PyObject *(*)(struct __pyx_obj_6_basis_BasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_6_basis_13BasisFunction_apply *__pyx_optional_args))__pyx_f_6_basis_13BasisFunction_apply; + __pyx_vtable_6_basis_BasisFunction.valid_knots = (PyArrayObject *(*)(struct __pyx_obj_6_basis_BasisFunction *, PyArrayObject *, PyArrayObject *, int, __pyx_t_6_basis_INDEX_t, int, int, __pyx_t_6_basis_FLOAT_t, __pyx_t_6_basis_INDEX_t, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_6_basis_13BasisFunction_valid_knots; + if (PyType_Ready(&__pyx_type_6_basis_BasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_6_basis_BasisFunction.tp_dict, __pyx_vtabptr_6_basis_BasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "BasisFunction", (PyObject *)&__pyx_type_6_basis_BasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6_basis_BasisFunction = &__pyx_type_6_basis_BasisFunction; + __pyx_vtabptr_6_basis_ConstantBasisFunction = &__pyx_vtable_6_basis_ConstantBasisFunction; + __pyx_vtable_6_basis_ConstantBasisFunction.__pyx_base = *__pyx_vtabptr_6_basis_BasisFunction; + __pyx_vtable_6_basis_ConstantBasisFunction.__pyx_base._set_parent = (PyObject *(*)(struct __pyx_obj_6_basis_BasisFunction *, struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_21ConstantBasisFunction__set_parent; + __pyx_vtable_6_basis_ConstantBasisFunction.__pyx_base.get_parent = (struct __pyx_obj_6_basis_BasisFunction *(*)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_21ConstantBasisFunction_get_parent; + __pyx_vtable_6_basis_ConstantBasisFunction.__pyx_base.degree = (__pyx_t_6_basis_INDEX_t (*)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_21ConstantBasisFunction_degree; + __pyx_vtable_6_basis_ConstantBasisFunction.__pyx_base.apply = (PyObject *(*)(struct __pyx_obj_6_basis_BasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_6_basis_13BasisFunction_apply *__pyx_optional_args))__pyx_f_6_basis_21ConstantBasisFunction_apply; + __pyx_vtable_6_basis_ConstantBasisFunction.translate = (PyObject *(*)(struct __pyx_obj_6_basis_ConstantBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch))__pyx_f_6_basis_21ConstantBasisFunction_translate; + __pyx_vtable_6_basis_ConstantBasisFunction.scale = (__pyx_t_6_basis_FLOAT_t (*)(struct __pyx_obj_6_basis_ConstantBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_6_basis_21ConstantBasisFunction_scale; + __pyx_type_6_basis_ConstantBasisFunction.tp_base = __pyx_ptype_6_basis_BasisFunction; + if (PyType_Ready(&__pyx_type_6_basis_ConstantBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_6_basis_ConstantBasisFunction.tp_dict, __pyx_vtabptr_6_basis_ConstantBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "ConstantBasisFunction", (PyObject *)&__pyx_type_6_basis_ConstantBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6_basis_ConstantBasisFunction = &__pyx_type_6_basis_ConstantBasisFunction; + __pyx_vtabptr_6_basis_HingeBasisFunction = &__pyx_vtable_6_basis_HingeBasisFunction; + __pyx_vtable_6_basis_HingeBasisFunction.__pyx_base = *__pyx_vtabptr_6_basis_BasisFunction; + __pyx_vtable_6_basis_HingeBasisFunction.__pyx_base.has_knot = (int (*)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_18HingeBasisFunction_has_knot; + __pyx_vtable_6_basis_HingeBasisFunction.__pyx_base.apply = (PyObject *(*)(struct __pyx_obj_6_basis_BasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_6_basis_13BasisFunction_apply *__pyx_optional_args))__pyx_f_6_basis_18HingeBasisFunction_apply; + __pyx_vtable_6_basis_HingeBasisFunction.translate = (PyObject *(*)(struct __pyx_obj_6_basis_HingeBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch))__pyx_f_6_basis_18HingeBasisFunction_translate; + __pyx_vtable_6_basis_HingeBasisFunction.scale = (__pyx_t_6_basis_FLOAT_t (*)(struct __pyx_obj_6_basis_HingeBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_6_basis_18HingeBasisFunction_scale; + __pyx_vtable_6_basis_HingeBasisFunction.get_variable = (__pyx_t_6_basis_INDEX_t (*)(struct __pyx_obj_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_18HingeBasisFunction_get_variable; + __pyx_vtable_6_basis_HingeBasisFunction.get_knot = (__pyx_t_6_basis_FLOAT_t (*)(struct __pyx_obj_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_18HingeBasisFunction_get_knot; + __pyx_vtable_6_basis_HingeBasisFunction.get_reverse = (int (*)(struct __pyx_obj_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_18HingeBasisFunction_get_reverse; + __pyx_vtable_6_basis_HingeBasisFunction.get_knot_idx = (__pyx_t_6_basis_INDEX_t (*)(struct __pyx_obj_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_18HingeBasisFunction_get_knot_idx; + __pyx_type_6_basis_HingeBasisFunction.tp_base = __pyx_ptype_6_basis_BasisFunction; + if (PyType_Ready(&__pyx_type_6_basis_HingeBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_6_basis_HingeBasisFunction.tp_dict, __pyx_vtabptr_6_basis_HingeBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "HingeBasisFunction", (PyObject *)&__pyx_type_6_basis_HingeBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6_basis_HingeBasisFunction = &__pyx_type_6_basis_HingeBasisFunction; + __pyx_vtabptr_6_basis_LinearBasisFunction = &__pyx_vtable_6_basis_LinearBasisFunction; + __pyx_vtable_6_basis_LinearBasisFunction.__pyx_base = *__pyx_vtabptr_6_basis_BasisFunction; + __pyx_vtable_6_basis_LinearBasisFunction.__pyx_base.apply = (PyObject *(*)(struct __pyx_obj_6_basis_BasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_6_basis_13BasisFunction_apply *__pyx_optional_args))__pyx_f_6_basis_19LinearBasisFunction_apply; + __pyx_vtable_6_basis_LinearBasisFunction.translate = (PyObject *(*)(struct __pyx_obj_6_basis_LinearBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch))__pyx_f_6_basis_19LinearBasisFunction_translate; + __pyx_vtable_6_basis_LinearBasisFunction.scale = (__pyx_t_6_basis_FLOAT_t (*)(struct __pyx_obj_6_basis_LinearBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_6_basis_19LinearBasisFunction_scale; + __pyx_vtable_6_basis_LinearBasisFunction.get_variable = (__pyx_t_6_basis_INDEX_t (*)(struct __pyx_obj_6_basis_LinearBasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_19LinearBasisFunction_get_variable; + __pyx_type_6_basis_LinearBasisFunction.tp_base = __pyx_ptype_6_basis_BasisFunction; + if (PyType_Ready(&__pyx_type_6_basis_LinearBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_6_basis_LinearBasisFunction.tp_dict, __pyx_vtabptr_6_basis_LinearBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "LinearBasisFunction", (PyObject *)&__pyx_type_6_basis_LinearBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6_basis_LinearBasisFunction = &__pyx_type_6_basis_LinearBasisFunction; + __pyx_vtabptr_6_basis_Basis = &__pyx_vtable_6_basis_Basis; + __pyx_vtable_6_basis_Basis.translate = (PyObject *(*)(struct __pyx_obj_6_basis_Basis *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_6_basis_5Basis_translate; + __pyx_vtable_6_basis_Basis.scale = (PyObject *(*)(struct __pyx_obj_6_basis_Basis *, PyArrayObject *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_6_basis_5Basis_scale; + __pyx_vtable_6_basis_Basis.get_root = (struct __pyx_obj_6_basis_BasisFunction *(*)(struct __pyx_obj_6_basis_Basis *, int __pyx_skip_dispatch))__pyx_f_6_basis_5Basis_get_root; + __pyx_vtable_6_basis_Basis.append = (PyObject *(*)(struct __pyx_obj_6_basis_Basis *, struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_5Basis_append; + __pyx_vtable_6_basis_Basis.plen = (__pyx_t_6_basis_INDEX_t (*)(struct __pyx_obj_6_basis_Basis *, int __pyx_skip_dispatch))__pyx_f_6_basis_5Basis_plen; + __pyx_vtable_6_basis_Basis.get = (struct __pyx_obj_6_basis_BasisFunction *(*)(struct __pyx_obj_6_basis_Basis *, __pyx_t_6_basis_INDEX_t, int __pyx_skip_dispatch))__pyx_f_6_basis_5Basis_get; + __pyx_vtable_6_basis_Basis.transform = (PyObject *(*)(struct __pyx_obj_6_basis_Basis *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_6_basis_5Basis_transform; + __pyx_vtable_6_basis_Basis.weighted_transform = (PyObject *(*)(struct __pyx_obj_6_basis_Basis *, PyArrayObject *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_6_basis_5Basis_weighted_transform; + if (PyType_Ready(&__pyx_type_6_basis_Basis) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_6_basis_Basis.tp_dict, __pyx_vtabptr_6_basis_Basis) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "Basis", (PyObject *)&__pyx_type_6_basis_Basis) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6_basis_Basis = &__pyx_type_6_basis_Basis; + __pyx_vtabptr_6_basis_PicklePlaceHolderBasisFunction = &__pyx_vtable_6_basis_PicklePlaceHolderBasisFunction; + __pyx_vtable_6_basis_PicklePlaceHolderBasisFunction.__pyx_base = *__pyx_vtabptr_6_basis_BasisFunction; + __pyx_type_6_basis_PicklePlaceHolderBasisFunction.tp_base = __pyx_ptype_6_basis_BasisFunction; + if (PyType_Ready(&__pyx_type_6_basis_PicklePlaceHolderBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_6_basis_PicklePlaceHolderBasisFunction.tp_dict, __pyx_vtabptr_6_basis_PicklePlaceHolderBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "PicklePlaceHolderBasisFunction", (PyObject *)&__pyx_type_6_basis_PicklePlaceHolderBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6_basis_PicklePlaceHolderBasisFunction = &__pyx_type_6_basis_PicklePlaceHolderBasisFunction; + if (PyType_Ready(&__pyx_type_6_basis___pyx_scope_struct__piter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6_basis___pyx_scope_struct__piter = &__pyx_type_6_basis___pyx_scope_struct__piter; + /*--- Type import code ---*/ + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", + #if CYTHON_COMPILING_IN_PYPY + sizeof(PyTypeObject), + #else + sizeof(PyHeapTypeObject), + #endif + 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Variable import code ---*/ + /*--- Function import code ---*/ + __pyx_t_1 = __Pyx_ImportModule("_util"); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_t_1, "log2", (void (**)(void))&__pyx_f_5_util_log2, "__pyx_t_5_util_FLOAT_t (__pyx_t_5_util_FLOAT_t)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_t_1, "apply_weights_2d", (void (**)(void))&__pyx_f_5_util_apply_weights_2d, "PyObject *(PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + Py_DECREF(__pyx_t_1); __pyx_t_1 = 0; + /*--- Execution code ---*/ + + /* "_basis.pyx":10 + * from libc.math cimport log + * from libc.math cimport abs + * cdef FLOAT_t ZERO_TOL = 1e-16 # <<<<<<<<<<<<<< + * import numpy as np + * + */ + __pyx_v_6_basis_ZERO_TOL = 1e-16; + + /* "_basis.pyx":11 + * from libc.math cimport abs + * cdef FLOAT_t ZERO_TOL = 1e-16 + * import numpy as np # <<<<<<<<<<<<<< + * + * cdef class BasisFunction: + */ + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__np, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "_basis.pyx":284 + * '''This is a place holder for unpickling the basis function tree.''' + * + * pickle_place_holder = PicklePlaceHolderBasisFunction() # <<<<<<<<<<<<<< + * + * cdef class ConstantBasisFunction(BasisFunction): + */ + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6_basis_PicklePlaceHolderBasisFunction)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__pickle_place_holder, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "_basis.pyx":1 + * # distutils: language = c # <<<<<<<<<<<<<< + * # cython: cdivision = True + * # cython: boundscheck = False + */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + if (PyDict_SetItem(__pyx_d, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "numpy.pxd":975 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None + */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + if (__pyx_m) { + __Pyx_AddTraceback("init _basis", __pyx_clineno, __pyx_lineno, __pyx_filename); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init _basis"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* Runtime support code */ +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif /* CYTHON_REFNANNY */ + +static PyObject *__Pyx_GetBuiltinName(PyObject *name) { + PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); + if (unlikely(!result)) { + PyErr_Format(PyExc_NameError, +#if PY_MAJOR_VERSION >= 3 + "name '%U' is not defined", name); +#else + "name '%s' is not defined", PyString_AS_STRING(name)); +#endif + } + return result; +} + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static CYTHON_INLINE int __Pyx_CheckKeywordStrings( + PyObject *kwdict, + const char* function_name, + int kw_allowed) +{ + PyObject* key = 0; + Py_ssize_t pos = 0; +#if CPYTHON_COMPILING_IN_PYPY + if (!kw_allowed && PyDict_Next(kwdict, &pos, &key, 0)) + goto invalid_keyword; + return 1; +#else + while (PyDict_Next(kwdict, &pos, &key, 0)) { + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) + #endif + if (unlikely(!PyUnicode_Check(key))) + goto invalid_keyword_type; + } + if ((!kw_allowed) && unlikely(key)) + goto invalid_keyword; + return 1; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + return 0; +#endif +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif + return 0; +} + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + if (unlikely(!type)) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(PyObject_TypeCheck(obj, type))) + return 1; + PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", + Py_TYPE(obj)->tp_name, type->tp_name); + return 0; +} + +static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { + PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); +} + +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact) +{ + if (!type) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (none_allowed && obj == Py_None) return 1; + else if (exact) { + if (Py_TYPE(obj) == type) return 1; + } + else { + if (PyObject_TypeCheck(obj, type)) return 1; + } + PyErr_Format(PyExc_TypeError, + "Argument '%s' has incorrect type (expected %s, got %s)", + name, type->tp_name, Py_TYPE(obj)->tp_name); + return 0; +} + +static CYTHON_INLINE PyObject* __Pyx_PyObject_Append(PyObject* L, PyObject* x) { + if (likely(PyList_CheckExact(L))) { + if (unlikely(__Pyx_PyList_Append(L, x) < 0)) return NULL; + Py_INCREF(Py_None); + return Py_None; /* this is just to have an accurate signature */ + } else { + return __Pyx_PyObject_CallMethod1(L, __pyx_n_s__append, x); + } +} + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck) { +#if CYTHON_COMPILING_IN_CPYTHON + if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o); + if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck) { +#if CYTHON_COMPILING_IN_CPYTHON + if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, + int is_list, int wraparound, int boundscheck) { +#if CYTHON_COMPILING_IN_CPYTHON + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) { + PyObject *r = PyList_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } + else if (PyTuple_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } else { + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (PyErr_ExceptionMatches(PyExc_OverflowError)) + PyErr_Clear(); + else + return NULL; + } + } + return m->sq_item(o, i); + } + } +#else + if (is_list || PySequence_Check(o)) { + return PySequence_GetItem(o, i); + } +#endif + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + +static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { + int r; + if (!j) return -1; + r = PyObject_SetItem(o, j, v); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, + int is_list, int wraparound, int boundscheck) { +#if CYTHON_COMPILING_IN_CPYTHON + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o)); + if ((!boundscheck) || likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { + PyObject* old = PyList_GET_ITEM(o, n); + Py_INCREF(v); + PyList_SET_ITEM(o, n, v); + Py_DECREF(old); + return 1; + } + } else { + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_ass_item)) { + if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (PyErr_ExceptionMatches(PyExc_OverflowError)) + PyErr_Clear(); + else + return -1; + } + } + return m->sq_ass_item(o, i, v); + } + } +#else +#if CYTHON_COMPILING_IN_PYPY + if (is_list || (PySequence_Check(o) && !PyDict_Check(o))) { +#else + if (is_list || PySequence_Check(o)) { +#endif + return PySequence_SetItem(o, i, v); + } +#endif + return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v); +} + +static CYTHON_INLINE int __Pyx_IsLittleEndian(void) { + unsigned int n = 1; + return *(unsigned char*)(&n) != 0; +} +static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, + __Pyx_BufFmt_StackElem* stack, + __Pyx_TypeInfo* type) { + stack[0].field = &ctx->root; + stack[0].parent_offset = 0; + ctx->root.type = type; + ctx->root.name = "buffer dtype"; + ctx->root.offset = 0; + ctx->head = stack; + ctx->head->field = &ctx->root; + ctx->fmt_offset = 0; + ctx->head->parent_offset = 0; + ctx->new_packmode = '@'; + ctx->enc_packmode = '@'; + ctx->new_count = 1; + ctx->enc_count = 0; + ctx->enc_type = 0; + ctx->is_complex = 0; + ctx->is_valid_array = 0; + ctx->struct_alignment = 0; + while (type->typegroup == 'S') { + ++ctx->head; + ctx->head->field = type->fields; + ctx->head->parent_offset = 0; + type = type->fields->type; + } +} +static int __Pyx_BufFmt_ParseNumber(const char** ts) { + int count; + const char* t = *ts; + if (*t < '0' || *t > '9') { + return -1; + } else { + count = *t++ - '0'; + while (*t >= '0' && *t < '9') { + count *= 10; + count += *t++ - '0'; + } + } + *ts = t; + return count; +} +static int __Pyx_BufFmt_ExpectNumber(const char **ts) { + int number = __Pyx_BufFmt_ParseNumber(ts); + if (number == -1) /* First char was not a digit */ + PyErr_Format(PyExc_ValueError,\ + "Does not understand character buffer dtype format string ('%c')", **ts); + return number; +} +static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { + PyErr_Format(PyExc_ValueError, + "Unexpected format string character: '%c'", ch); +} +static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { + switch (ch) { + case 'c': return "'char'"; + case 'b': return "'signed char'"; + case 'B': return "'unsigned char'"; + case 'h': return "'short'"; + case 'H': return "'unsigned short'"; + case 'i': return "'int'"; + case 'I': return "'unsigned int'"; + case 'l': return "'long'"; + case 'L': return "'unsigned long'"; + case 'q': return "'long long'"; + case 'Q': return "'unsigned long long'"; + case 'f': return (is_complex ? "'complex float'" : "'float'"); + case 'd': return (is_complex ? "'complex double'" : "'double'"); + case 'g': return (is_complex ? "'complex long double'" : "'long double'"); + case 'T': return "a struct"; + case 'O': return "Python object"; + case 'P': return "a pointer"; + case 's': case 'p': return "a string"; + case 0: return "end"; + default: return "unparseable format string"; + } +} +static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return 2; + case 'i': case 'I': case 'l': case 'L': return 4; + case 'q': case 'Q': return 8; + case 'f': return (is_complex ? 8 : 4); + case 'd': return (is_complex ? 16 : 8); + case 'g': { + PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g').."); + return 0; + } + case 'O': case 'P': return sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} +static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { + switch (ch) { + case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(short); + case 'i': case 'I': return sizeof(int); + case 'l': case 'L': return sizeof(long); + #ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(PY_LONG_LONG); + #endif + case 'f': return sizeof(float) * (is_complex ? 2 : 1); + case 'd': return sizeof(double) * (is_complex ? 2 : 1); + case 'g': return sizeof(long double) * (is_complex ? 2 : 1); + case 'O': case 'P': return sizeof(void*); + default: { + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } + } +} +typedef struct { char c; short x; } __Pyx_st_short; +typedef struct { char c; int x; } __Pyx_st_int; +typedef struct { char c; long x; } __Pyx_st_long; +typedef struct { char c; float x; } __Pyx_st_float; +typedef struct { char c; double x; } __Pyx_st_double; +typedef struct { char c; long double x; } __Pyx_st_longdouble; +typedef struct { char c; void *x; } __Pyx_st_void_p; +#ifdef HAVE_LONG_LONG +typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; +#endif +static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); + case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); + case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); +#ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG); +#endif + case 'f': return sizeof(__Pyx_st_float) - sizeof(float); + case 'd': return sizeof(__Pyx_st_double) - sizeof(double); + case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double); + case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} +/* These are for computing the padding at the end of the struct to align + on the first member of the struct. This will probably the same as above, + but we don't have any guarantees. + */ +typedef struct { short x; char c; } __Pyx_pad_short; +typedef struct { int x; char c; } __Pyx_pad_int; +typedef struct { long x; char c; } __Pyx_pad_long; +typedef struct { float x; char c; } __Pyx_pad_float; +typedef struct { double x; char c; } __Pyx_pad_double; +typedef struct { long double x; char c; } __Pyx_pad_longdouble; +typedef struct { void *x; char c; } __Pyx_pad_void_p; +#ifdef HAVE_LONG_LONG +typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong; +#endif +static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short); + case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int); + case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long); +#ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG); +#endif + case 'f': return sizeof(__Pyx_pad_float) - sizeof(float); + case 'd': return sizeof(__Pyx_pad_double) - sizeof(double); + case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double); + case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} +static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { + switch (ch) { + case 'c': + return 'H'; + case 'b': case 'h': case 'i': + case 'l': case 'q': case 's': case 'p': + return 'I'; + case 'B': case 'H': case 'I': case 'L': case 'Q': + return 'U'; + case 'f': case 'd': case 'g': + return (is_complex ? 'C' : 'R'); + case 'O': + return 'O'; + case 'P': + return 'P'; + default: { + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } + } +} +static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { + if (ctx->head == NULL || ctx->head->field == &ctx->root) { + const char* expected; + const char* quote; + if (ctx->head == NULL) { + expected = "end"; + quote = ""; + } else { + expected = ctx->head->field->type->name; + quote = "'"; + } + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch, expected %s%s%s but got %s", + quote, expected, quote, + __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex)); + } else { + __Pyx_StructField* field = ctx->head->field; + __Pyx_StructField* parent = (ctx->head - 1)->field; + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'", + field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex), + parent->type->name, field->name); + } +} +static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { + char group; + size_t size, offset, arraysize = 1; + if (ctx->enc_type == 0) return 0; + if (ctx->head->field->type->arraysize[0]) { + int i, ndim = 0; + if (ctx->enc_type == 's' || ctx->enc_type == 'p') { + ctx->is_valid_array = ctx->head->field->type->ndim == 1; + ndim = 1; + if (ctx->enc_count != ctx->head->field->type->arraysize[0]) { + PyErr_Format(PyExc_ValueError, + "Expected a dimension of size %zu, got %zu", + ctx->head->field->type->arraysize[0], ctx->enc_count); + return -1; + } + } + if (!ctx->is_valid_array) { + PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d", + ctx->head->field->type->ndim, ndim); + return -1; + } + for (i = 0; i < ctx->head->field->type->ndim; i++) { + arraysize *= ctx->head->field->type->arraysize[i]; + } + ctx->is_valid_array = 0; + ctx->enc_count = 1; + } + group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); + do { + __Pyx_StructField* field = ctx->head->field; + __Pyx_TypeInfo* type = field->type; + if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') { + size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); + } else { + size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); + } + if (ctx->enc_packmode == '@') { + size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); + size_t align_mod_offset; + if (align_at == 0) return -1; + align_mod_offset = ctx->fmt_offset % align_at; + if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; + if (ctx->struct_alignment == 0) + ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type, + ctx->is_complex); + } + if (type->size != size || type->typegroup != group) { + if (type->typegroup == 'C' && type->fields != NULL) { + size_t parent_offset = ctx->head->parent_offset + field->offset; + ++ctx->head; + ctx->head->field = type->fields; + ctx->head->parent_offset = parent_offset; + continue; + } + if ((type->typegroup == 'H' || group == 'H') && type->size == size) { + } else { + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } + } + offset = ctx->head->parent_offset + field->offset; + if (ctx->fmt_offset != offset) { + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected", + (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); + return -1; + } + ctx->fmt_offset += size; + if (arraysize) + ctx->fmt_offset += (arraysize - 1) * size; + --ctx->enc_count; /* Consume from buffer string */ + while (1) { + if (field == &ctx->root) { + ctx->head = NULL; + if (ctx->enc_count != 0) { + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } + break; /* breaks both loops as ctx->enc_count == 0 */ + } + ctx->head->field = ++field; + if (field->type == NULL) { + --ctx->head; + field = ctx->head->field; + continue; + } else if (field->type->typegroup == 'S') { + size_t parent_offset = ctx->head->parent_offset + field->offset; + if (field->type->fields->type == NULL) continue; /* empty struct */ + field = field->type->fields; + ++ctx->head; + ctx->head->field = field; + ctx->head->parent_offset = parent_offset; + break; + } else { + break; + } + } + } while (ctx->enc_count); + ctx->enc_type = 0; + ctx->is_complex = 0; + return 0; +} +static CYTHON_INLINE PyObject * +__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) +{ + const char *ts = *tsp; + int i = 0, number; + int ndim = ctx->head->field->type->ndim; +; + ++ts; + if (ctx->new_count != 1) { + PyErr_SetString(PyExc_ValueError, + "Cannot handle repeated arrays in format string"); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + while (*ts && *ts != ')') { + if (isspace(*ts)) + continue; + number = __Pyx_BufFmt_ExpectNumber(&ts); + if (number == -1) return NULL; + if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) + return PyErr_Format(PyExc_ValueError, + "Expected a dimension of size %zu, got %d", + ctx->head->field->type->arraysize[i], number); + if (*ts != ',' && *ts != ')') + return PyErr_Format(PyExc_ValueError, + "Expected a comma in format string, got '%c'", *ts); + if (*ts == ',') ts++; + i++; + } + if (i != ndim) + return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d", + ctx->head->field->type->ndim, i); + if (!*ts) { + PyErr_SetString(PyExc_ValueError, + "Unexpected end of format string, expected ')'"); + return NULL; + } + ctx->is_valid_array = 1; + ctx->new_count = 1; + *tsp = ++ts; + return Py_None; +} +static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { + int got_Z = 0; + while (1) { + switch(*ts) { + case 0: + if (ctx->enc_type != 0 && ctx->head == NULL) { + __Pyx_BufFmt_RaiseExpected(ctx); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + if (ctx->head != NULL) { + __Pyx_BufFmt_RaiseExpected(ctx); + return NULL; + } + return ts; + case ' ': + case 10: + case 13: + ++ts; + break; + case '<': + if (!__Pyx_IsLittleEndian()) { + PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); + return NULL; + } + ctx->new_packmode = '='; + ++ts; + break; + case '>': + case '!': + if (__Pyx_IsLittleEndian()) { + PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); + return NULL; + } + ctx->new_packmode = '='; + ++ts; + break; + case '=': + case '@': + case '^': + ctx->new_packmode = *ts++; + break; + case 'T': /* substruct */ + { + const char* ts_after_sub; + size_t i, struct_count = ctx->new_count; + size_t struct_alignment = ctx->struct_alignment; + ctx->new_count = 1; + ++ts; + if (*ts != '{') { + PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_type = 0; /* Erase processed last struct element */ + ctx->enc_count = 0; + ctx->struct_alignment = 0; + ++ts; + ts_after_sub = ts; + for (i = 0; i != struct_count; ++i) { + ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); + if (!ts_after_sub) return NULL; + } + ts = ts_after_sub; + if (struct_alignment) ctx->struct_alignment = struct_alignment; + } + break; + case '}': /* end of substruct; either repeat or move on */ + { + size_t alignment = ctx->struct_alignment; + ++ts; + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_type = 0; /* Erase processed last struct element */ + if (alignment && ctx->fmt_offset % alignment) { + ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment); + } + } + return ts; + case 'x': + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->fmt_offset += ctx->new_count; + ctx->new_count = 1; + ctx->enc_count = 0; + ctx->enc_type = 0; + ctx->enc_packmode = ctx->new_packmode; + ++ts; + break; + case 'Z': + got_Z = 1; + ++ts; + if (*ts != 'f' && *ts != 'd' && *ts != 'g') { + __Pyx_BufFmt_RaiseUnexpectedChar('Z'); + return NULL; + } /* fall through */ + case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': + case 'l': case 'L': case 'q': case 'Q': + case 'f': case 'd': case 'g': + case 'O': case 's': case 'p': + if (ctx->enc_type == *ts && got_Z == ctx->is_complex && + ctx->enc_packmode == ctx->new_packmode) { + ctx->enc_count += ctx->new_count; + } else { + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_count = ctx->new_count; + ctx->enc_packmode = ctx->new_packmode; + ctx->enc_type = *ts; + ctx->is_complex = got_Z; + } + ++ts; + ctx->new_count = 1; + got_Z = 0; + break; + case ':': + ++ts; + while(*ts != ':') ++ts; + ++ts; + break; + case '(': + if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL; + break; + default: + { + int number = __Pyx_BufFmt_ExpectNumber(&ts); + if (number == -1) return NULL; + ctx->new_count = (size_t)number; + } + } + } +} +static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { + buf->buf = NULL; + buf->obj = NULL; + buf->strides = __Pyx_zeros; + buf->shape = __Pyx_zeros; + buf->suboffsets = __Pyx_minusones; +} +static CYTHON_INLINE int __Pyx_GetBufferAndValidate( + Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, + int nd, int cast, __Pyx_BufFmt_StackElem* stack) +{ + if (obj == Py_None || obj == NULL) { + __Pyx_ZeroBuffer(buf); + return 0; + } + buf->buf = NULL; + if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail; + if (buf->ndim != nd) { + PyErr_Format(PyExc_ValueError, + "Buffer has wrong number of dimensions (expected %d, got %d)", + nd, buf->ndim); + goto fail; + } + if (!cast) { + __Pyx_BufFmt_Context ctx; + __Pyx_BufFmt_Init(&ctx, stack, dtype); + if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; + } + if ((unsigned)buf->itemsize != dtype->size) { + PyErr_Format(PyExc_ValueError, + "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)", + buf->itemsize, (buf->itemsize > 1) ? "s" : "", + dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : ""); + goto fail; + } + if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; + return 0; +fail:; + __Pyx_ZeroBuffer(buf); + return -1; +} +static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { + if (info->buf == NULL) return; + if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; + __Pyx_ReleaseBuffer(info); +} + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_Restore(type, value, tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#else + PyErr_Fetch(type, value, tb); +#endif +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AsString(kw_name)); + #endif +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; + } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; + } + } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { + PyObject *result; +#if CYTHON_COMPILING_IN_CPYTHON + result = PyDict_GetItem(__pyx_d, name); + if (result) { + Py_INCREF(result); + } else { +#else + result = PyObject_GetItem(__pyx_d, name); + if (!result) { + PyErr_Clear(); +#endif + result = __Pyx_GetBuiltinName(name); + } + return result; +} + +static void __Pyx_RaiseBufferFallbackError(void) { + PyErr_Format(PyExc_ValueError, + "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!"); +} + +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, + CYTHON_UNUSED PyObject *cause) { + Py_XINCREF(type); + if (!value || value == Py_None) + value = NULL; + else + Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + } + #if PY_VERSION_HEX < 0x02050000 + if (PyClass_Check(type)) { + #else + if (PyType_Check(type)) { + #endif +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + value = type; + #if PY_VERSION_HEX < 0x02050000 + if (PyInstance_Check(type)) { + type = (PyObject*) ((PyInstanceObject*)type)->in_class; + Py_INCREF(type); + } else { + type = 0; + PyErr_SetString(PyExc_TypeError, + "raise: exception must be an old-style class or instance"); + goto raise_error; + } + #else + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + #endif + } + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} +#else /* Python 3+ */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (PyExceptionClass_Check(type)) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyEval_CallObject(type, args); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } +#if PY_VERSION_HEX >= 0x03030000 + if (cause) { +#else + if (cause && cause != Py_None) { +#endif + PyObject *fixed_cause; + if (cause == Py_None) { + fixed_cause = NULL; + } else if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); + } + PyErr_SetObject(type, value); + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } +bad: + Py_XDECREF(owned_instance); + return; +} +#endif + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); +} + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", + index, (index == 1) ? "" : "s"); +} + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +static CYTHON_INLINE int __Pyx_IterFinish(void) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + PyObject* exc_type = tstate->curexc_type; + if (unlikely(exc_type)) { + if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { + PyObject *exc_value, *exc_tb; + exc_value = tstate->curexc_value; + exc_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + Py_DECREF(exc_type); + Py_XDECREF(exc_value); + Py_XDECREF(exc_tb); + return 0; + } else { + return -1; + } + } + return 0; +#else + if (unlikely(PyErr_Occurred())) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { + PyErr_Clear(); + return 0; + } else { + return -1; + } + } + return 0; +#endif +} + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; + } else { + return __Pyx_IterFinish(); + } + return 0; +} + +#if PY_MAJOR_VERSION < 3 +static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { + #if PY_VERSION_HEX >= 0x02060000 + if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); + #endif + if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags); + #if PY_VERSION_HEX < 0x02060000 + if (obj->ob_type->tp_dict) { + PyObject *getbuffer_cobj = PyObject_GetItem( + obj->ob_type->tp_dict, __pyx_n_s____pyx_getbuffer); + if (getbuffer_cobj) { + getbufferproc func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj); + Py_DECREF(getbuffer_cobj); + if (!func) + goto fail; + return func(obj, view, flags); + } else { + PyErr_Clear(); + } + } + #endif + PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name); +#if PY_VERSION_HEX < 0x02060000 +fail: +#endif + return -1; +} +static void __Pyx_ReleaseBuffer(Py_buffer *view) { + PyObject *obj = view->obj; + if (!obj) return; + #if PY_VERSION_HEX >= 0x02060000 + if (PyObject_CheckBuffer(obj)) { + PyBuffer_Release(view); + return; + } + #endif + if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; } + #if PY_VERSION_HEX < 0x02060000 + if (obj->ob_type->tp_dict) { + PyObject *releasebuffer_cobj = PyObject_GetItem( + obj->ob_type->tp_dict, __pyx_n_s____pyx_releasebuffer); + if (releasebuffer_cobj) { + releasebufferproc func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj); + Py_DECREF(releasebuffer_cobj); + if (!func) + goto fail; + func(obj, view); + return; + } else { + PyErr_Clear(); + } + } + #endif + goto nofail; +#if PY_VERSION_HEX < 0x02060000 +fail: +#endif + PyErr_WriteUnraisable(obj); +nofail: + Py_DECREF(obj); + view->obj = NULL; +} +#endif /* PY_MAJOR_VERSION < 3 */ + + + static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_import; + py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s____import__); + if (!py_import) + goto bad; + #endif + if (from_list) + list = from_list; + else { + empty_list = PyList_New(0); + if (!empty_list) + goto bad; + list = empty_list; + } + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + #if PY_VERSION_HEX >= 0x02050000 + { + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.')) { + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_level = PyInt_FromLong(1); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, global_dict, empty_dict, list, 1); + #endif + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; /* try absolute import on failure */ + } + #endif + if (!module) { + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, global_dict, empty_dict, list, level); + #endif + } + } + #else + if (level>0) { + PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); + goto bad; + } + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, NULL); + #endif +bad: + #if PY_VERSION_HEX < 0x03030000 + Py_XDECREF(py_import); + #endif + Py_XDECREF(empty_list); + Py_XDECREF(empty_dict); + return module; +} + +static CYTHON_INLINE npy_ulonglong __Pyx_PyInt_from_py_npy_ulonglong(PyObject* x) { + const npy_ulonglong neg_one = (npy_ulonglong)-1, const_zero = (npy_ulonglong)0; + const int is_unsigned = const_zero < neg_one; + if (sizeof(npy_ulonglong) == sizeof(char)) { + if (is_unsigned) + return (npy_ulonglong)__Pyx_PyInt_AsUnsignedChar(x); + else + return (npy_ulonglong)__Pyx_PyInt_AsSignedChar(x); + } else if (sizeof(npy_ulonglong) == sizeof(short)) { + if (is_unsigned) + return (npy_ulonglong)__Pyx_PyInt_AsUnsignedShort(x); + else + return (npy_ulonglong)__Pyx_PyInt_AsSignedShort(x); + } else if (sizeof(npy_ulonglong) == sizeof(int)) { + if (is_unsigned) + return (npy_ulonglong)__Pyx_PyInt_AsUnsignedInt(x); + else + return (npy_ulonglong)__Pyx_PyInt_AsSignedInt(x); + } else if (sizeof(npy_ulonglong) == sizeof(long)) { + if (is_unsigned) + return (npy_ulonglong)__Pyx_PyInt_AsUnsignedLong(x); + else + return (npy_ulonglong)__Pyx_PyInt_AsSignedLong(x); + } else if (sizeof(npy_ulonglong) == sizeof(PY_LONG_LONG)) { + if (is_unsigned) + return (npy_ulonglong)__Pyx_PyInt_AsUnsignedLongLong(x); + else + return (npy_ulonglong)__Pyx_PyInt_AsSignedLongLong(x); + } else { + #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); + #else + npy_ulonglong val; + PyObject *v = __Pyx_PyNumber_Int(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } + #endif + return (npy_ulonglong)-1; + } +} + +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_ulonglong(npy_ulonglong val) { + const npy_ulonglong neg_one = (npy_ulonglong)-1, const_zero = (npy_ulonglong)0; + const int is_unsigned = const_zero < neg_one; + if ((sizeof(npy_ulonglong) == sizeof(char)) || + (sizeof(npy_ulonglong) == sizeof(short))) { + return PyInt_FromLong((long)val); + } else if ((sizeof(npy_ulonglong) == sizeof(int)) || + (sizeof(npy_ulonglong) == sizeof(long))) { + if (is_unsigned) + return PyLong_FromUnsignedLong((unsigned long)val); + else + return PyInt_FromLong((long)val); + } else if (sizeof(npy_ulonglong) == sizeof(PY_LONG_LONG)) { + if (is_unsigned) + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); + else + return PyLong_FromLongLong((PY_LONG_LONG)val); + } else { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + return _PyLong_FromByteArray(bytes, sizeof(npy_ulonglong), + little, !is_unsigned); + } +} + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return ::std::complex< float >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return x + y*(__pyx_t_float_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + __pyx_t_float_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +#if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtf(z.real*z.real + z.imag*z.imag); + #else + return hypotf(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + float denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(a, a); + case 3: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, a); + case 4: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_absf(a); + theta = atan2f(a.imag, a.real); + } + lnr = logf(r); + z_r = expf(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosf(z_theta); + z.imag = z_r * sinf(z_theta); + return z; + } + #endif +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return ::std::complex< double >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return x + y*(__pyx_t_double_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + __pyx_t_double_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +#if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrt(z.real*z.real + z.imag*z.imag); + #else + return hypot(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(a, a); + case 3: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, a); + case 4: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_abs(a); + theta = atan2(a.imag, a.real); + } + lnr = log(r); + z_r = exp(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cos(z_theta); + z.imag = z_r * sin(z_theta); + return z; + } + #endif +#endif + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(unsigned long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (unsigned long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)PyLong_AsUnsignedLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(unsigned long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(unsigned long) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(unsigned long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (unsigned long)PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)PyLong_AsUnsignedLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(long) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (long)PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(signed long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (signed long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)PyLong_AsUnsignedLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(signed long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(signed long) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(signed long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (signed long)PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, + CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) { + PyObject *old_exc, *old_val, *old_tb; + PyObject *ctx; + __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); + #if PY_MAJOR_VERSION < 3 + ctx = PyString_FromString(name); + #else + ctx = PyUnicode_FromString(name); + #endif + __Pyx_ErrRestore(old_exc, old_val, old_tb); + if (!ctx) { + PyErr_WriteUnraisable(Py_None); + } else { + PyErr_WriteUnraisable(ctx); + Py_DECREF(ctx); + } +} + +static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + tstate->exc_type = *type; + tstate->exc_value = *value; + tstate->exc_traceback = *tb; +#else + PyErr_GetExcInfo(&tmp_type, &tmp_value, &tmp_tb); + PyErr_SetExcInfo(*type, *value, *tb); +#endif + *type = tmp_type; + *value = tmp_value; + *tb = tmp_tb; +} + +static PyObject *__Pyx_Generator_Next(PyObject *self); +static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value); +static PyObject *__Pyx_Generator_Close(PyObject *self); +static PyObject *__Pyx_Generator_Throw(PyObject *gen, PyObject *args); +static PyTypeObject *__pyx_GeneratorType = 0; +#define __Pyx_Generator_CheckExact(obj) (Py_TYPE(obj) == __pyx_GeneratorType) +#define __Pyx_Generator_Undelegate(gen) Py_CLEAR((gen)->yieldfrom) +#if 1 || PY_VERSION_HEX < 0x030300B0 +static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue) { + PyObject *et, *ev, *tb; + PyObject *value = NULL; + __Pyx_ErrFetch(&et, &ev, &tb); + if (!et) { + Py_XDECREF(tb); + Py_XDECREF(ev); + Py_INCREF(Py_None); + *pvalue = Py_None; + return 0; + } + if (unlikely(et != PyExc_StopIteration) && + unlikely(!PyErr_GivenExceptionMatches(et, PyExc_StopIteration))) { + __Pyx_ErrRestore(et, ev, tb); + return -1; + } + if (likely(et == PyExc_StopIteration)) { + if (likely(!ev) || !PyObject_IsInstance(ev, PyExc_StopIteration)) { + if (!ev) { + Py_INCREF(Py_None); + ev = Py_None; + } + Py_XDECREF(tb); + Py_DECREF(et); + *pvalue = ev; + return 0; + } + } + PyErr_NormalizeException(&et, &ev, &tb); + if (unlikely(!PyObject_IsInstance(ev, PyExc_StopIteration))) { + __Pyx_ErrRestore(et, ev, tb); + return -1; + } + Py_XDECREF(tb); + Py_DECREF(et); +#if PY_VERSION_HEX >= 0x030300A0 + value = ((PyStopIterationObject *)ev)->value; + Py_INCREF(value); + Py_DECREF(ev); +#else + { + PyObject* args = PyObject_GetAttr(ev, __pyx_n_s__args); + Py_DECREF(ev); + if (likely(args)) { + value = PyObject_GetItem(args, 0); + Py_DECREF(args); + } + if (unlikely(!value)) { + __Pyx_ErrRestore(NULL, NULL, NULL); + Py_INCREF(Py_None); + value = Py_None; + } + } +#endif + *pvalue = value; + return 0; +} +#endif +static CYTHON_INLINE +void __Pyx_Generator_ExceptionClear(__pyx_GeneratorObject *self) { + PyObject *exc_type = self->exc_type; + PyObject *exc_value = self->exc_value; + PyObject *exc_traceback = self->exc_traceback; + self->exc_type = NULL; + self->exc_value = NULL; + self->exc_traceback = NULL; + Py_XDECREF(exc_type); + Py_XDECREF(exc_value); + Py_XDECREF(exc_traceback); +} +static CYTHON_INLINE +int __Pyx_Generator_CheckRunning(__pyx_GeneratorObject *gen) { + if (unlikely(gen->is_running)) { + PyErr_SetString(PyExc_ValueError, + "generator already executing"); + return 1; + } + return 0; +} +static CYTHON_INLINE +PyObject *__Pyx_Generator_SendEx(__pyx_GeneratorObject *self, PyObject *value) { + PyObject *retval; + assert(!self->is_running); + if (unlikely(self->resume_label == 0)) { + if (unlikely(value && value != Py_None)) { + PyErr_SetString(PyExc_TypeError, + "can't send non-None value to a " + "just-started generator"); + return NULL; + } + } + if (unlikely(self->resume_label == -1)) { + PyErr_SetNone(PyExc_StopIteration); + return NULL; + } + if (value) { +#if CYTHON_COMPILING_IN_PYPY +#else + /* Generators always return to their most recent caller, not + * necessarily their creator. */ + if (self->exc_traceback) { + PyThreadState *tstate = PyThreadState_GET(); + PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback; + PyFrameObject *f = tb->tb_frame; + Py_XINCREF(tstate->frame); + assert(f->f_back == NULL); + f->f_back = tstate->frame; + } +#endif + __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value, + &self->exc_traceback); + } else { + __Pyx_Generator_ExceptionClear(self); + } + self->is_running = 1; + retval = self->body((PyObject *) self, value); + self->is_running = 0; + if (retval) { + __Pyx_ExceptionSwap(&self->exc_type, &self->exc_value, + &self->exc_traceback); +#if CYTHON_COMPILING_IN_PYPY +#else + /* Don't keep the reference to f_back any longer than necessary. It + * may keep a chain of frames alive or it could create a reference + * cycle. */ + if (self->exc_traceback) { + PyTracebackObject *tb = (PyTracebackObject *) self->exc_traceback; + PyFrameObject *f = tb->tb_frame; + Py_CLEAR(f->f_back); + } +#endif + } else { + __Pyx_Generator_ExceptionClear(self); + } + return retval; +} +static CYTHON_INLINE +PyObject *__Pyx_Generator_FinishDelegation(__pyx_GeneratorObject *gen) { + PyObject *ret; + PyObject *val = NULL; + __Pyx_Generator_Undelegate(gen); + __Pyx_PyGen_FetchStopIterationValue(&val); + ret = __Pyx_Generator_SendEx(gen, val); + Py_XDECREF(val); + return ret; +} +static PyObject *__Pyx_Generator_Next(PyObject *self) { + __pyx_GeneratorObject *gen = (__pyx_GeneratorObject*) self; + PyObject *yf = gen->yieldfrom; + if (unlikely(__Pyx_Generator_CheckRunning(gen))) + return NULL; + if (yf) { + PyObject *ret; + gen->is_running = 1; + ret = Py_TYPE(yf)->tp_iternext(yf); + gen->is_running = 0; + if (likely(ret)) { + return ret; + } + return __Pyx_Generator_FinishDelegation(gen); + } + return __Pyx_Generator_SendEx(gen, Py_None); +} +static PyObject *__Pyx_Generator_Send(PyObject *self, PyObject *value) { + __pyx_GeneratorObject *gen = (__pyx_GeneratorObject*) self; + PyObject *yf = gen->yieldfrom; + if (unlikely(__Pyx_Generator_CheckRunning(gen))) + return NULL; + if (yf) { + PyObject *ret; + gen->is_running = 1; + if (__Pyx_Generator_CheckExact(yf)) { + ret = __Pyx_Generator_Send(yf, value); + } else { + if (value == Py_None) + ret = PyIter_Next(yf); + else + ret = __Pyx_PyObject_CallMethod1(yf, __pyx_n_s__send, value); + } + gen->is_running = 0; + if (likely(ret)) { + return ret; + } + return __Pyx_Generator_FinishDelegation(gen); + } + return __Pyx_Generator_SendEx(gen, value); +} +static int __Pyx_Generator_CloseIter(__pyx_GeneratorObject *gen, PyObject *yf) { + PyObject *retval = NULL; + int err = 0; + if (__Pyx_Generator_CheckExact(yf)) { + retval = __Pyx_Generator_Close(yf); + if (!retval) + return -1; + } else { + PyObject *meth; + gen->is_running = 1; + meth = PyObject_GetAttr(yf, __pyx_n_s__close); + if (unlikely(!meth)) { + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_WriteUnraisable(yf); + } + PyErr_Clear(); + } else { + retval = PyObject_CallFunction(meth, NULL); + Py_DECREF(meth); + if (!retval) + err = -1; + } + gen->is_running = 0; + } + Py_XDECREF(retval); + return err; +} +static PyObject *__Pyx_Generator_Close(PyObject *self) { + __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; + PyObject *retval, *raised_exception; + PyObject *yf = gen->yieldfrom; + int err = 0; + if (unlikely(__Pyx_Generator_CheckRunning(gen))) + return NULL; + if (yf) { + Py_INCREF(yf); + err = __Pyx_Generator_CloseIter(gen, yf); + __Pyx_Generator_Undelegate(gen); + Py_DECREF(yf); + } + if (err == 0) +#if PY_VERSION_HEX < 0x02050000 + PyErr_SetNone(PyExc_StopIteration); +#else + PyErr_SetNone(PyExc_GeneratorExit); +#endif + retval = __Pyx_Generator_SendEx(gen, NULL); + if (retval) { + Py_DECREF(retval); + PyErr_SetString(PyExc_RuntimeError, + "generator ignored GeneratorExit"); + return NULL; + } + raised_exception = PyErr_Occurred(); + if (!raised_exception + || raised_exception == PyExc_StopIteration +#if PY_VERSION_HEX >= 0x02050000 + || raised_exception == PyExc_GeneratorExit + || PyErr_GivenExceptionMatches(raised_exception, PyExc_GeneratorExit) +#endif + || PyErr_GivenExceptionMatches(raised_exception, PyExc_StopIteration)) + { + if (raised_exception) PyErr_Clear(); /* ignore these errors */ + Py_INCREF(Py_None); + return Py_None; + } + return NULL; +} +static PyObject *__Pyx_Generator_Throw(PyObject *self, PyObject *args) { + __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; + PyObject *typ; + PyObject *tb = NULL; + PyObject *val = NULL; + PyObject *yf = gen->yieldfrom; + if (!PyArg_UnpackTuple(args, (char *)"throw", 1, 3, &typ, &val, &tb)) + return NULL; + if (unlikely(__Pyx_Generator_CheckRunning(gen))) + return NULL; + if (yf) { + PyObject *ret; + Py_INCREF(yf); +#if PY_VERSION_HEX >= 0x02050000 + if (PyErr_GivenExceptionMatches(typ, PyExc_GeneratorExit)) { + int err = __Pyx_Generator_CloseIter(gen, yf); + Py_DECREF(yf); + __Pyx_Generator_Undelegate(gen); + if (err < 0) + return __Pyx_Generator_SendEx(gen, NULL); + goto throw_here; + } +#endif + gen->is_running = 1; + if (__Pyx_Generator_CheckExact(yf)) { + ret = __Pyx_Generator_Throw(yf, args); + } else { + PyObject *meth = PyObject_GetAttr(yf, __pyx_n_s__throw); + if (unlikely(!meth)) { + Py_DECREF(yf); + if (!PyErr_ExceptionMatches(PyExc_AttributeError)) { + gen->is_running = 0; + return NULL; + } + PyErr_Clear(); + __Pyx_Generator_Undelegate(gen); + gen->is_running = 0; + goto throw_here; + } + ret = PyObject_CallObject(meth, args); + Py_DECREF(meth); + } + gen->is_running = 0; + Py_DECREF(yf); + if (!ret) { + ret = __Pyx_Generator_FinishDelegation(gen); + } + return ret; + } +throw_here: + __Pyx_Raise(typ, val, tb, NULL); + return __Pyx_Generator_SendEx(gen, NULL); +} +static int __Pyx_Generator_traverse(PyObject *self, visitproc visit, void *arg) { + __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; + Py_VISIT(gen->closure); + Py_VISIT(gen->classobj); + Py_VISIT(gen->yieldfrom); + Py_VISIT(gen->exc_type); + Py_VISIT(gen->exc_value); + Py_VISIT(gen->exc_traceback); + return 0; +} +static int __Pyx_Generator_clear(PyObject *self) { + __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; + Py_CLEAR(gen->closure); + Py_CLEAR(gen->classobj); + Py_CLEAR(gen->yieldfrom); + Py_CLEAR(gen->exc_type); + Py_CLEAR(gen->exc_value); + Py_CLEAR(gen->exc_traceback); + return 0; +} +static void __Pyx_Generator_dealloc(PyObject *self) { + __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; + PyObject_GC_UnTrack(gen); + if (gen->gi_weakreflist != NULL) + PyObject_ClearWeakRefs(self); + PyObject_GC_Track(self); + if (gen->resume_label > 0) { + Py_TYPE(gen)->tp_del(self); + if (self->ob_refcnt > 0) + return; /* resurrected. :( */ + } + PyObject_GC_UnTrack(self); + __Pyx_Generator_clear(self); + PyObject_GC_Del(gen); +} +static void __Pyx_Generator_del(PyObject *self) { + PyObject *res; + PyObject *error_type, *error_value, *error_traceback; + __pyx_GeneratorObject *gen = (__pyx_GeneratorObject *) self; + if (gen->resume_label <= 0) + return ; + assert(self->ob_refcnt == 0); + self->ob_refcnt = 1; + __Pyx_ErrFetch(&error_type, &error_value, &error_traceback); + res = __Pyx_Generator_Close(self); + if (res == NULL) + PyErr_WriteUnraisable(self); + else + Py_DECREF(res); + __Pyx_ErrRestore(error_type, error_value, error_traceback); + /* Undo the temporary resurrection; can't use DECREF here, it would + * cause a recursive call. + */ + assert(self->ob_refcnt > 0); + if (--self->ob_refcnt == 0) + return; /* this is the normal path out */ + /* close() resurrected it! Make it look like the original Py_DECREF + * never happened. + */ + { + Py_ssize_t refcnt = self->ob_refcnt; + _Py_NewReference(self); + self->ob_refcnt = refcnt; + } +#if CYTHON_COMPILING_IN_CPYTHON + assert(PyType_IS_GC(self->ob_type) && + _Py_AS_GC(self)->gc.gc_refs != _PyGC_REFS_UNTRACKED); + /* If Py_REF_DEBUG, _Py_NewReference bumped _Py_RefTotal, so + * we need to undo that. */ + _Py_DEC_REFTOTAL; +#endif + /* If Py_TRACE_REFS, _Py_NewReference re-added self to the object + * chain, so no more to do there. + * If COUNT_ALLOCS, the original decref bumped tp_frees, and + * _Py_NewReference bumped tp_allocs: both of those need to be + * undone. + */ +#ifdef COUNT_ALLOCS + --Py_TYPE(self)->tp_frees; + --Py_TYPE(self)->tp_allocs; +#endif +} +static PyMemberDef __pyx_Generator_memberlist[] = { + {(char *) "gi_running", +#if PY_VERSION_HEX >= 0x02060000 + T_BOOL, +#else + T_BYTE, +#endif + offsetof(__pyx_GeneratorObject, is_running), + READONLY, + NULL}, + {0, 0, 0, 0, 0} +}; +static PyMethodDef __pyx_Generator_methods[] = { + {__Pyx_NAMESTR("send"), (PyCFunction) __Pyx_Generator_Send, METH_O, 0}, + {__Pyx_NAMESTR("throw"), (PyCFunction) __Pyx_Generator_Throw, METH_VARARGS, 0}, + {__Pyx_NAMESTR("close"), (PyCFunction) __Pyx_Generator_Close, METH_NOARGS, 0}, + {0, 0, 0, 0} +}; +static PyTypeObject __pyx_GeneratorType_type = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("generator"), /*tp_name*/ + sizeof(__pyx_GeneratorObject), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + (destructor) __Pyx_Generator_dealloc,/*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ +#if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ +#else + 0, /*reserved*/ +#endif + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_HAVE_GC, /* tp_flags*/ + 0, /*tp_doc*/ + (traverseproc) __Pyx_Generator_traverse, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + offsetof(__pyx_GeneratorObject, gi_weakreflist), /* tp_weaklistoffse */ + 0, /*tp_iter*/ + (iternextfunc) __Pyx_Generator_Next, /*tp_iternext*/ + __pyx_Generator_methods, /*tp_methods*/ + __pyx_Generator_memberlist, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + 0, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + __Pyx_Generator_del, /*tp_del*/ +#if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ +#endif +}; +static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body, + PyObject *closure) { + __pyx_GeneratorObject *gen = + PyObject_GC_New(__pyx_GeneratorObject, &__pyx_GeneratorType_type); + if (gen == NULL) + return NULL; + gen->body = body; + gen->closure = closure; + Py_XINCREF(closure); + gen->is_running = 0; + gen->resume_label = 0; + gen->classobj = NULL; + gen->yieldfrom = NULL; + gen->exc_type = NULL; + gen->exc_value = NULL; + gen->exc_traceback = NULL; + gen->gi_weakreflist = NULL; + PyObject_GC_Track(gen); + return gen; +} +static int __pyx_Generator_init(void) { + __pyx_GeneratorType_type.tp_getattro = PyObject_GenericGetAttr; + __pyx_GeneratorType_type.tp_iter = PyObject_SelfIter; + if (PyType_Ready(&__pyx_GeneratorType_type)) { + return -1; + } + __pyx_GeneratorType = &__pyx_GeneratorType_type; + return 0; +} + +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + +static int __Pyx_SetVtable(PyObject *dict, void *vtable) { +#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) + PyObject *ob = PyCapsule_New(vtable, 0, 0); +#else + PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); +#endif + if (!ob) + goto bad; + if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0) + goto bad; + Py_DECREF(ob); + return 0; +bad: + Py_XDECREF(ob); + return -1; +} + +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + py_name = __Pyx_PyIdentifier_FromString(name); + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + +#ifndef __PYX_HAVE_RT_ImportType +#define __PYX_HAVE_RT_ImportType +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, + size_t size, int strict) +{ + PyObject *py_module = 0; + PyObject *result = 0; + PyObject *py_name = 0; + char warning[200]; + Py_ssize_t basicsize; +#ifdef Py_LIMITED_API + PyObject *py_basicsize; +#endif + py_module = __Pyx_ImportModule(module_name); + if (!py_module) + goto bad; + py_name = __Pyx_PyIdentifier_FromString(class_name); + if (!py_name) + goto bad; + result = PyObject_GetAttr(py_module, py_name); + Py_DECREF(py_name); + py_name = 0; + Py_DECREF(py_module); + py_module = 0; + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%s.%s is not a type object", + module_name, class_name); + goto bad; + } +#ifndef Py_LIMITED_API + basicsize = ((PyTypeObject *)result)->tp_basicsize; +#else + py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); + if (!py_basicsize) + goto bad; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = 0; + if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) + goto bad; +#endif + if (!strict && (size_t)basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility", + module_name, class_name); + #if PY_VERSION_HEX < 0x02050000 + if (PyErr_Warn(NULL, warning) < 0) goto bad; + #else + if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; + #endif + } + else if ((size_t)basicsize != size) { + PyErr_Format(PyExc_ValueError, + "%s.%s has the wrong size, try recompiling", + module_name, class_name); + goto bad; + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(py_module); + Py_XDECREF(result); + return NULL; +} +#endif + +#ifndef __PYX_HAVE_RT_ImportFunction +#define __PYX_HAVE_RT_ImportFunction +static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { + PyObject *d = 0; + PyObject *cobj = 0; + union { + void (*fp)(void); + void *p; + } tmp; + d = PyObject_GetAttrString(module, (char *)"__pyx_capi__"); + if (!d) + goto bad; + cobj = PyDict_GetItemString(d, funcname); + if (!cobj) { + PyErr_Format(PyExc_ImportError, + "%s does not export expected C function %s", + PyModule_GetName(module), funcname); + goto bad; + } +#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3 && PY_MINOR_VERSION==0) + if (!PyCapsule_IsValid(cobj, sig)) { + PyErr_Format(PyExc_TypeError, + "C function %s.%s has wrong signature (expected %s, got %s)", + PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj)); + goto bad; + } + tmp.p = PyCapsule_GetPointer(cobj, sig); +#else + {const char *desc, *s1, *s2; + desc = (const char *)PyCObject_GetDesc(cobj); + if (!desc) + goto bad; + s1 = desc; s2 = sig; + while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; } + if (*s1 != *s2) { + PyErr_Format(PyExc_TypeError, + "C function %s.%s has wrong signature (expected %s, got %s)", + PyModule_GetName(module), funcname, sig, desc); + goto bad; + } + tmp.p = PyCObject_AsVoidPtr(cobj);} +#endif + *f = tmp.fp; + if (!(*f)) + goto bad; + Py_DECREF(d); + return 0; +bad: + Py_XDECREF(d); + return -1; +} +#endif + +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = (start + end) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); +} + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(filename); + #else + py_srcfile = PyUnicode_FromString(filename); + #endif + if (!py_srcfile) goto bad; + if (c_line) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_code = __Pyx_PyCode_New( + 0, /*int argcount,*/ + 0, /*int kwonlyargcount,*/ + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + py_line, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + Py_DECREF(py_srcfile); + Py_DECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_globals = 0; + PyFrameObject *py_frame = 0; + py_code = __pyx_find_code_object(c_line ? c_line : py_line); + if (!py_code) { + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) goto bad; + __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + } + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = py_line; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char* c_str) { + return __Pyx_PyUnicode_FromStringAndSize(c_str, strlen(c_str)); +} +static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) { + Py_ssize_t ignore; + return __Pyx_PyObject_AsStringAndSize(o, &ignore); +} +static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT + if ( +#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + __Pyx_sys_getdefaultencoding_not_ascii && +#endif + PyUnicode_Check(o)) { +#if PY_VERSION_HEX < 0x03030000 + char* defenc_c; + PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); + if (!defenc) return NULL; + defenc_c = PyBytes_AS_STRING(defenc); +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + { + char* end = defenc_c + PyBytes_GET_SIZE(defenc); + char* c; + for (c = defenc_c; c < end; c++) { + if ((unsigned char) (*c) >= 128) { + PyUnicode_AsASCIIString(o); + return NULL; + } + } + } +#endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/ + *length = PyBytes_GET_SIZE(defenc); + return defenc_c; +#else /* PY_VERSION_HEX < 0x03030000 */ + if (PyUnicode_READY(o) == -1) return NULL; +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + if (PyUnicode_IS_ASCII(o)) { + *length = PyUnicode_GET_DATA_SIZE(o); + return PyUnicode_AsUTF8(o); + } else { + PyUnicode_AsASCIIString(o); + return NULL; + } +#else /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */ + return PyUnicode_AsUTF8AndSize(o, length); +#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */ +#endif /* PY_VERSION_HEX < 0x03030000 */ + } else +#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */ + { + char* result; + int r = PyBytes_AsStringAndSize(o, &result, length); + if (r < 0) { + return NULL; + } else { + return result; + } + } +} +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_MAJOR_VERSION < 3 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_MAJOR_VERSION < 3 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_MAJOR_VERSION < 3 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + if ((val != (unsigned PY_LONG_LONG)-1) || !PyErr_Occurred()) + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff --git a/sklearn/earth/_basis.pxd b/sklearn/earth/_basis.pxd new file mode 100644 index 0000000000000..7a6a9e87c751f --- /dev/null +++ b/sklearn/earth/_basis.pxd @@ -0,0 +1,127 @@ +cimport numpy as cnp +ctypedef cnp.float64_t FLOAT_t +ctypedef cnp.intp_t INT_t +ctypedef cnp.ulong_t INDEX_t +ctypedef cnp.uint8_t BOOL_t + +cdef class BasisFunction: + '''Abstract. Subclasses must implement the apply, translate, scale, and __init__ methods.''' + + cdef BasisFunction parent + cdef dict child_map + cdef list children + cdef bint pruned + cdef bint prunable + cdef bint splittable + + cpdef bint has_knot(BasisFunction self) + + cpdef bint is_prunable(BasisFunction self) + + cpdef bint is_pruned(BasisFunction self) + + cpdef bint is_splittable(BasisFunction self) + + cpdef bint make_splittable(BasisFunction self) + + cpdef bint make_unsplittable(BasisFunction self) + + cdef list get_children(BasisFunction self) + + cpdef _set_parent(self,BasisFunction parent) + + cpdef _add_child(self,BasisFunction child) + + cpdef BasisFunction get_parent(self) + + cpdef prune(self) + + cpdef unprune(self) + + cpdef knots(BasisFunction self, INDEX_t variable) + + cpdef INDEX_t degree(BasisFunction self) + + cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) + + cpdef cnp.ndarray[INT_t, ndim=1] valid_knots(BasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] values, cnp.ndarray[FLOAT_t,ndim=1] variable, int variable_idx, INDEX_t check_every, int endspan, int minspan, FLOAT_t minspan_alpha, INDEX_t n, cnp.ndarray[INT_t,ndim=1] workspace) + + +cdef class ConstantBasisFunction(BasisFunction): + + cpdef INDEX_t degree(ConstantBasisFunction self) + + cpdef translate(ConstantBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse) + + cpdef FLOAT_t scale(ConstantBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts) + + cpdef _set_parent(self,BasisFunction parent) + + cpdef BasisFunction get_parent(self) + + cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) + + +cdef class HingeBasisFunction(BasisFunction): + cdef FLOAT_t knot + cdef INDEX_t knot_idx + cdef INDEX_t variable + cdef bint reverse + cdef str label + + cpdef bint has_knot(HingeBasisFunction self) + + cpdef translate(HingeBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse) + + cpdef FLOAT_t scale(HingeBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts) + + cpdef INDEX_t get_variable(self) + + cpdef FLOAT_t get_knot(self) + + cpdef bint get_reverse(self) + + cpdef INDEX_t get_knot_idx(self) + + cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) + +cdef class LinearBasisFunction(BasisFunction): + cdef INDEX_t variable + cdef str label + + cpdef translate(LinearBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse) + + cpdef FLOAT_t scale(LinearBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts) + + cpdef INDEX_t get_variable(self) + + cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) + + + +cdef class Basis: + '''A wrapper that provides functionality related to a set of BasisFunctions with a + common ConstantBasisFunction ancestor. Retains the order in which BasisFunctions are + added.''' + + cdef list order + + cpdef translate(Basis self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts) + + cpdef scale(Basis self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, cnp.ndarray[FLOAT_t,ndim=1] beta) + + cpdef BasisFunction get_root(Basis self) + + cpdef append(Basis self, BasisFunction basis_function) + + cpdef INDEX_t plen(Basis self) + + cpdef BasisFunction get(Basis self, INDEX_t i) + + cpdef transform(Basis self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=2] B) + + cpdef weighted_transform(Basis self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=2] B, cnp.ndarray[FLOAT_t,ndim=1] weights) + + + + \ No newline at end of file diff --git a/sklearn/earth/_basis.pyx b/sklearn/earth/_basis.pyx new file mode 100644 index 0000000000000..64e61bf66bef0 --- /dev/null +++ b/sklearn/earth/_basis.pyx @@ -0,0 +1,582 @@ +# distutils: language = c +# cython: cdivision = True +# cython: boundscheck = False +# cython: wraparound = False +# cython: profile = False + +from _util cimport log2, apply_weights_2d +from libc.math cimport log +from libc.math cimport abs +cdef FLOAT_t ZERO_TOL = 1e-16 +import numpy as np + +cdef class BasisFunction: + + def __cinit__(BasisFunction self): + self.pruned = False + self.children = [] + self.prunable = True + self.child_map = {} + self.splittable = True + + def __reduce__(self): + return (self.__class__, (), self._getstate()) + + def _get_root(self): + return self.parent._get_root() + + def _getstate(self): + result = {'pruned': self.pruned, + 'children': self.children, + 'prunable': self.prunable, + 'child_map': self.child_map, + 'splittable': self.splittable} + result.update(self._get_parent_state()) + return result + + def _get_parent_state(self): + return {'parent': self.parent} + + def _set_parent_state(self, state): + self.parent = state['parent'] + + def __setstate__(self, state): + self.pruned = state['pruned'] + self.children = state['children'] + self.prunable = state['prunable'] + self.child_map = state['child_map'] + self.splittable = state['splittable'] + self._set_parent_state(state) + + def _eq(self, other): + if self.__class__ is not other.__class__: + return False + self_state = self._getstate() + other_state = other._getstate() + del self_state['children'] + del self_state['child_map'] + del other_state['children'] + del other_state['child_map'] + return self_state == other_state + + def __richcmp__(self, other, method): + if method == 2: + return self._eq(other) + elif method == 3: + return not self._eq(other) + else: + return NotImplemented + + cpdef bint has_knot(BasisFunction self): + return False + + cpdef bint is_prunable(BasisFunction self): + return self.prunable + + cpdef bint is_pruned(BasisFunction self): + return self.pruned + + cpdef bint is_splittable(BasisFunction self): + return self.splittable + + cpdef bint make_splittable(BasisFunction self): + self.splittable = True + + cpdef bint make_unsplittable(BasisFunction self): + self.splittable = False + + cdef list get_children(BasisFunction self): + return self.children + + cpdef _set_parent(self,BasisFunction parent): + '''Calls _add_child.''' + self.parent = parent + self.parent._add_child(self) + + cpdef _add_child(self,BasisFunction child): + '''Called by _set_parent.''' + cdef INDEX_t n = len(self.children) + self.children.append(child) + cdef int var = child.get_variable() + if var in self.child_map: + self.child_map[var].append(n) + else: + self.child_map[var] = [n] + + cpdef BasisFunction get_parent(self): + return self.parent + + cpdef prune(self): + self.pruned = True + + cpdef unprune(self): + self.pruned = False + + cpdef knots(BasisFunction self, INDEX_t variable): + + cdef list children + cdef BasisFunction child + if variable in self.child_map: + children = self.child_map[variable] + else: + return [] + cdef INDEX_t n = len(children) + cdef INDEX_t i + cdef list result = [] + cdef int idx + for i in range(n): + idx = children[i] + child = self.get_children()[idx] + if child.has_knot(): + result.append(child.get_knot_idx()) + return result + + cpdef INDEX_t degree(BasisFunction self): + return self.parent.degree() + 1 + + cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = True): + ''' + X - Data matrix + b - parent vector + recurse - If False, assume b already contains the result of the parent function. Otherwise, recurse to compute + parent function. + ''' + + cpdef cnp.ndarray[INT_t, ndim=1] valid_knots(BasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] values, cnp.ndarray[FLOAT_t,ndim=1] variable, int variable_idx, INDEX_t check_every, int endspan, int minspan, FLOAT_t minspan_alpha, INDEX_t n, cnp.ndarray[INT_t,ndim=1] workspace): + ''' + values - The unsorted values of self in the data set + variable - The sorted values of variable in the data set + variable_idx - The index of the variable in the data set + workspace - An m-vector (where m is the number of samples) used internally + ''' + cdef INDEX_t i + cdef INDEX_t j + cdef INDEX_t k + cdef INDEX_t m = values.shape[0] + cdef FLOAT_t float_tmp + cdef INT_t int_tmp + cdef INDEX_t count + cdef int minspan_ + cdef cnp.ndarray[INT_t, ndim=1] result + cdef INDEX_t num_used + cdef INDEX_t prev + cdef INDEX_t start + cdef int idx + cdef int last_idx + cdef FLOAT_t first_var_value = variable[m-1] + cdef FLOAT_t last_var_value = variable[m-1] + + #Calculate the used knots + cdef list used_knots = self.knots(variable_idx) + used_knots.sort() + + #Initialize workspace to 1 where value is nonzero + #Also, find first_var_value as the maximum variable + #where value is nonzero and last_var_value to the + #minimum variable where value is nonzero + count = 0 + for i in range(m): + if abs(values[i]) > ZERO_TOL: + workspace[i] = 1 + count += 1 + if variable[i] >= first_var_value: + first_var_value = variable[i] + last_var_value = variable[i] + else: + workspace[i] = 0 + + #Calculate minspan + if minspan < 0: + minspan_ = (-log2(-(1.0/(n*count))*log(1.0-minspan_alpha)) / 2.5) + else: + minspan_ = minspan + + #Take out the used points and apply minspan + num_used = len(used_knots) + prev = 0 + last_idx = -1 + for i in range(num_used): + idx = used_knots[i] + if last_idx == idx: + continue + workspace[idx] = 0 + j = idx + k = 0 + while j > prev + 1 and k < minspan_: + if workspace[j-1]: + workspace[j-1] = False + k += 1 + j -= 1 + j = idx + 1 + k = 0 + while j < m and k < minspan_: + if workspace[j]: + workspace[j] = False + k += 1 + j += 1 + prev = idx + last_idx = idx + + #Apply endspan + i = 0 + j = 0 + while i < endspan: + if workspace[j]: + workspace[j] = 0 + i += 1 + j += 1 + if j == m: + break + i = 0 + j = m - 1 + while i < endspan: + if workspace[j]: + workspace[j] = 0 + i += 1 + if j == 0: + break + j -= 1 + + #Implement check_every + int_tmp = 0 + count = 0 + for i in range(m): + if workspace[i]: + if (int_tmp % check_every) != 0: + workspace[i] = 0 + else: + count += 1 + int_tmp += 1 + else: + int_tmp = 0 + + #Make sure the greatest value is not a candidate (this can happen if the first endspan+1 values are the same) + for i in range(m): + if workspace[i]: + if variable[i] == first_var_value: + workspace[i] = 0 + count -= 1 + else: + break + + #Also make sure the least value is not a candidate + for i in range(m): + if workspace[m-i-1]: + if variable[m-i-1] == last_var_value: + workspace[m-i-1] = 0 + count -= 1 + else: + break + + #Create result array and return + result = np.empty(shape=count,dtype=int) + j = 0 + for i in range(m): + if workspace[i]: + result[j] = i + j += 1 + + return result + +cdef class PicklePlaceHolderBasisFunction(BasisFunction): + '''This is a place holder for unpickling the basis function tree.''' + +pickle_place_holder = PicklePlaceHolderBasisFunction() + +cdef class ConstantBasisFunction(BasisFunction): + def __init__(self): #@DuplicatedSignature + self.prunable = False + + def _get_root(self): + return self + + def _get_parent_state(self): + return {} + + def _set_parent_state(self, state): + pass + + cpdef INDEX_t degree(ConstantBasisFunction self): + return 0 + + cpdef translate(ConstantBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse): + pass + + cpdef FLOAT_t scale(ConstantBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): + return 1.0 + + cpdef _set_parent(self,BasisFunction parent): + raise NotImplementedError + + cpdef BasisFunction get_parent(self): + raise NotImplementedError + + cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = False): + ''' + X - Data matrix + b - parent vector + recurse - The ConstantBasisFunction is the parent of all BasisFunctions and never has a parent. + Therefore the recurse argument is ignored. This spares child BasisFunctions from + having to know whether their parents have parents. + ''' + cdef INDEX_t i #@DuplicatedSignature + cdef INDEX_t m = len(b) + for i in range(m): + b[i] = 1.0 + + def __str__(self): + return '(Intercept)' + +cdef class HingeBasisFunction(BasisFunction): + + def __init__(self, BasisFunction parent, FLOAT_t knot, INDEX_t knot_idx, INDEX_t variable, bint reverse, label=None): #@DuplicatedSignature + self.knot = knot + self.knot_idx = knot_idx + self.variable = variable + self.reverse = reverse + self.label = label if label is not None else 'x'+str(variable) + self._set_parent(parent) + + def __reduce__(self): + return (self.__class__, (pickle_place_holder, 1.0, 1, 1, True, ''), self._getstate()) + + def _getstate(self): + result = super(HingeBasisFunction, self)._getstate() + result.update({'knot': self.knot, + 'knot_idx': self.knot_idx, + 'variable': self.variable, + 'reverse': self.reverse, + 'label': self.label}) + return result + + def __setstate__(self, state): + self.knot = state['knot'] + self.knot_idx = state['knot_idx'] + self.variable = state['variable'] + self.reverse = state['reverse'] + self.label = state['label'] + super(HingeBasisFunction, self).__setstate__(state) + + cpdef bint has_knot(HingeBasisFunction self): + return True + + cpdef translate(HingeBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse): + self.knot = slopes[self.variable]*self.knot + intercepts[self.variable] + if slopes[self.variable] < 0: + self.reverse = not self.reverse + if recurse: + self.parent.translate(slopes,intercepts) + + cpdef FLOAT_t scale(HingeBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): + result = self.parent.scale(slopes,intercepts) + result /= slopes[self.variable] + return result + + def __str__(self): + result = '' + if self.variable is not None: + if not self.reverse: + if self.knot >= 0: + result = 'h(%s-%G)' % (self.label,self.knot) + else: + result = 'h(%s+%G)' % (self.label,-self.knot) + else: + result = 'h(%G-%s)' % (self.knot,self.label) + parent = str(self.parent) if not self.parent.__class__ is ConstantBasisFunction else '' + if parent != '': + result += '*%s' % (str(self.parent),) + return result + + cpdef INDEX_t get_variable(self): + return self.variable + + cpdef FLOAT_t get_knot(self): + return self.knot + + cpdef bint get_reverse(self): + return self.reverse + + cpdef INDEX_t get_knot_idx(self): + return self.knot_idx + + cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = True): + ''' + X - Data matrix + b - parent vector + recurse - If False, assume b already contains the result of the parent function. Otherwise, recurse to compute + parent function. + ''' + if recurse: + self.parent.apply(X,b,recurse=True) + cdef INDEX_t i #@DuplicatedSignature + cdef INDEX_t m = len(b) #@DuplicatedSignature + cdef FLOAT_t tmp + if self.reverse: + for i in range(m): + tmp = self.knot - X[i,self.variable] + if tmp < 0: + tmp = 0.0 + b[i] *= tmp + else: + for i in range(m): + tmp = X[i,self.variable] - self.knot + if tmp < 0: + tmp = 0.0 + b[i] *= tmp + +cdef class LinearBasisFunction(BasisFunction): + def __init__(self, BasisFunction parent, INDEX_t variable, label=None): #@DuplicatedSignature + self.variable = variable + self.label = label if label is not None else 'x'+str(variable) + self._set_parent(parent) + + def __reduce__(self): + return (self.__class__, (pickle_place_holder, 1, ''), self._getstate()) + + def _getstate(self): + result = super(LinearBasisFunction, self)._getstate() + result.update({'variable': self.variable, + 'label': self.label}) + return result + + def __setstate__(self, state): + self.variable = state['variable'] + self.label = state['label'] + super(LinearBasisFunction, self).__setstate__(state) + + cpdef translate(LinearBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse): + pass + + cpdef FLOAT_t scale(LinearBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): + result = self.parent.scale(slopes,intercepts) + result /= slopes[self.variable] + return result + + def __str__(LinearBasisFunction self): + result = self.label + if not self.parent.__class__ is ConstantBasisFunction: + parent = str(self.parent) + result += '*'+parent + return result + + cpdef INDEX_t get_variable(self): + return self.variable + + cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = True): + ''' + X - Data matrix + b - parent vector + recurse - If False, assume b already contains the result of the parent function. Otherwise, recurse to compute + parent function. + ''' + if recurse: + self.parent.apply(X,b,recurse=True) + cdef INDEX_t i #@DuplicatedSignature + cdef INDEX_t m = len(b) #@DuplicatedSignature + for i in range(m): + b[i] *= X[i,self.variable] + +cdef class Basis: + '''A container that provides functionality related to a set of BasisFunctions with a + common ConstantBasisFunction ancestor. Retains the order in which BasisFunctions are + added.''' + + def __init__(Basis self): #@DuplicatedSignature + self.order = [] + + def __reduce__(self): + return (self.__class__, (), self._getstate()) + + def _getstate(self): + return {'order': self.order} + + def __setstate__(self, state): + self.order = state['order'] + + def __richcmp__(self, other, method): + if method == 2: + return self._eq(other) + elif method == 3: + return not self._eq(other) + else: + return NotImplemented + + def _eq(self, other): + return self.__class__ is other.__class__ and self._getstate() == other._getstate() + + def piter(Basis self): + for bf in self.order: + if not bf.is_pruned(): + yield bf + + def __str__(Basis self): + cdef INDEX_t i + cdef INDEX_t n = len(self) + result = '' + for i in range(n): + result += str(self[i]) + result += '\n' + return result + + cpdef translate(Basis self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): + cdef INDEX_t n = len(self) + cdef INDEX_t i #@DuplicatedSignature + for i in range(n): + self.order[i].translate(slopes,intercepts,False) + + cpdef scale(Basis self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, cnp.ndarray[FLOAT_t,ndim=1] beta): + cdef INDEX_t n = len(self) #@DuplicatedSignature + cdef INDEX_t i #@DuplicatedSignature + cdef INDEX_t j = 0 + for i in range(n): + if self.order[i].is_pruned(): + continue + beta[j] *= self.order[i].scale(slopes,intercepts) + j += 1 + + cpdef BasisFunction get_root(Basis self): + return self.root + + cpdef append(Basis self, BasisFunction basis_function): + self.order.append(basis_function) + + def __iter__(Basis self): + return self.order.__iter__() + + def __len__(Basis self): + return self.order.__len__() + + cpdef BasisFunction get(Basis self, INDEX_t i): + return self.order[i] + + def __getitem__(Basis self, INDEX_t i): + return self.get(i) + + cpdef INDEX_t plen(Basis self): + cdef INDEX_t length = 0 + cdef INDEX_t i + cdef INDEX_t n = len(self.order) + for i in range(n): + if not self.order[i].is_pruned(): + length += 1 + return length + + cpdef transform(Basis self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=2] B): + cdef INDEX_t i #@DuplicatedSignature + cdef INDEX_t n = self.__len__() + cdef BasisFunction bf + cdef INDEX_t col = 0 + for i in range(n): + bf = self.order[i] + if bf.is_pruned(): + continue + bf.apply(X,B[:,col],recurse=True) + col += 1 + + cpdef weighted_transform(Basis self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=2] B, cnp.ndarray[FLOAT_t,ndim=1] weights): + cdef INDEX_t i #@DuplicatedSignature + cdef INDEX_t n = self.__len__() + + self.transform(X,B) + apply_weights_2d(B,weights) + diff --git a/sklearn/earth/_forward.c b/sklearn/earth/_forward.c new file mode 100644 index 0000000000000..22f047ad96fec --- /dev/null +++ b/sklearn/earth/_forward.c @@ -0,0 +1,14004 @@ +/* Generated by Cython 0.19 on Sat Jul 20 23:46:45 2013 */ + +#define PY_SSIZE_T_CLEAN +#ifndef CYTHON_USE_PYLONG_INTERNALS +#ifdef PYLONG_BITS_IN_DIGIT +#define CYTHON_USE_PYLONG_INTERNALS 0 +#else +#include "pyconfig.h" +#ifdef PYLONG_BITS_IN_DIGIT +#define CYTHON_USE_PYLONG_INTERNALS 1 +#else +#define CYTHON_USE_PYLONG_INTERNALS 0 +#endif +#endif +#endif +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x02040000 + #error Cython requires Python 2.4+. +#else +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#ifdef PYPY_VERSION +#define CYTHON_COMPILING_IN_PYPY 1 +#define CYTHON_COMPILING_IN_CPYTHON 0 +#else +#define CYTHON_COMPILING_IN_PYPY 0 +#define CYTHON_COMPILING_IN_CPYTHON 1 +#endif +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define CYTHON_FORMAT_SSIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \ + (PyErr_Format(PyExc_TypeError, \ + "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ + (PyObject*)0)) + #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) + #define __PYX_BUILD_PY_SSIZE_T "i" +#else + #define __PYX_BUILD_PY_SSIZE_T "n" + #define CYTHON_FORMAT_SSIZE_T "z" + #define __Pyx_PyIndex_Check PyIndex_Check +#endif +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) + #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) + typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); + typedef void (*releasebufferproc)(PyObject *, Py_buffer *); +#endif +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#endif +#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 + #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") +#endif +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif +#if PY_VERSION_HEX < 0x02060000 + #define Py_TPFLAGS_HAVE_VERSION_TAG 0 +#endif +#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) + #define CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) +#else + #define CYTHON_PEP393_ENABLED 0 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) + #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#endif +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject + #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check + #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel +#endif +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) + #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) +#else + #define __Pyx_PyBaseString_Check(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || \ + PyString_Check(obj) || PyUnicode_Check(obj)) + #define __Pyx_PyBaseString_CheckExact(obj) (Py_TYPE(obj) == &PyBaseString_Type) +#endif +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) +#endif +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif +#ifdef NAN +#define __PYX_NAN() ((float) NAN) +#else +static CYTHON_INLINE float __PYX_NAN() { + /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and + a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is + a quiet NaN. */ + float value; + memset(&value, 0xFF, sizeof(value)); + return value; +} +#endif + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES +#endif +#include +#define __PYX_HAVE___forward +#define __PYX_HAVE_API___forward +#include "string.h" +#include "stdio.h" +#include "stdlib.h" +#include "numpy/arrayobject.h" +#include "numpy/ufuncobject.h" +#include "math.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif +typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding; + const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + +#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 +#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0 +#define __PYX_DEFAULT_STRING_ENCODING "" +#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString +#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); +static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); +#define __Pyx_PyBytes_FromString PyBytes_FromString +#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*); +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString + #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +#else + #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString + #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize +#endif +#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_FromUString(s) __Pyx_PyObject_FromString((char*)s) +#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s) +#define __Pyx_PyStr_FromUString(s) __Pyx_PyStr_FromString((char*)s) +#define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((char*)s) +#if PY_MAJOR_VERSION < 3 +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) +{ + const Py_UNICODE *u_end = u; + while (*u_end++) ; + return u_end - u - 1; +} +#else +#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen +#endif +#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) +#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode +#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); +#if CYTHON_COMPILING_IN_CPYTHON +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) +#else +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) +#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII +static int __Pyx_sys_getdefaultencoding_not_ascii; +static int __Pyx_init_sys_getdefaultencoding_params() { + PyObject* sys = NULL; + PyObject* default_encoding = NULL; + PyObject* ascii_chars_u = NULL; + PyObject* ascii_chars_b = NULL; + sys = PyImport_ImportModule("sys"); + if (sys == NULL) goto bad; + default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); + if (default_encoding == NULL) goto bad; + if (strcmp(PyBytes_AsString(default_encoding), "ascii") == 0) { + __Pyx_sys_getdefaultencoding_not_ascii = 0; + } else { + const char* default_encoding_c = PyBytes_AS_STRING(default_encoding); + char ascii_chars[128]; + int c; + for (c = 0; c < 128; c++) { + ascii_chars[c] = c; + } + __Pyx_sys_getdefaultencoding_not_ascii = 1; + ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); + if (ascii_chars_u == NULL) goto bad; + ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); + if (ascii_chars_b == NULL || strncmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { + PyErr_Format( + PyExc_ValueError, + "This module compiled with c_string_encoding=ascii, but default encoding '%s' is not a superset of ascii.", + default_encoding_c); + goto bad; + } + } + Py_XDECREF(sys); + Py_XDECREF(default_encoding); + Py_XDECREF(ascii_chars_u); + Py_XDECREF(ascii_chars_b); + return 0; +bad: + Py_XDECREF(sys); + Py_XDECREF(default_encoding); + Py_XDECREF(ascii_chars_u); + Py_XDECREF(ascii_chars_b); + return -1; +} +#endif +#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 +#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) +#else +#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) +#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT +static char* __PYX_DEFAULT_STRING_ENCODING; +static int __Pyx_init_sys_getdefaultencoding_params() { + PyObject* sys = NULL; + PyObject* default_encoding = NULL; + char* default_encoding_c; + sys = PyImport_ImportModule("sys"); + if (sys == NULL) goto bad; + default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); + if (default_encoding == NULL) goto bad; + default_encoding_c = PyBytes_AS_STRING(default_encoding); + __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); + strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); + Py_DECREF(sys); + Py_DECREF(default_encoding); + return 0; +bad: + Py_XDECREF(sys); + Py_XDECREF(default_encoding); + return -1; +} +#endif +#endif + + +#ifdef __GNUC__ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_d; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + +#if !defined(CYTHON_CCOMPLEX) + #if defined(__cplusplus) + #define CYTHON_CCOMPLEX 1 + #elif defined(_Complex_I) + #define CYTHON_CCOMPLEX 1 + #else + #define CYTHON_CCOMPLEX 0 + #endif +#endif +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #include + #else + #include + #endif +#endif +#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) + #undef _Complex_I + #define _Complex_I 1.0fj +#endif + + +static const char *__pyx_f[] = { + "_forward.pyx", + "numpy.pxd", + "type.pxd", + "_basis.pxd", + "_record.pxd", +}; +#define IS_UNSIGNED(type) (((type) -1) > 0) +struct __Pyx_StructField_; +#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) +typedef struct { + const char* name; /* for error messages only */ + struct __Pyx_StructField_* fields; + size_t size; /* sizeof(type) */ + size_t arraysize[8]; /* length of array in each dimension */ + int ndim; + char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject, c_H_ar */ + char is_unsigned; + int flags; +} __Pyx_TypeInfo; +typedef struct __Pyx_StructField_ { + __Pyx_TypeInfo* type; + const char* name; + size_t offset; +} __Pyx_StructField; +typedef struct { + __Pyx_StructField* field; + size_t parent_offset; +} __Pyx_BufFmt_StackElem; +typedef struct { + __Pyx_StructField root; + __Pyx_BufFmt_StackElem* head; + size_t fmt_offset; + size_t new_count, enc_count; + size_t struct_alignment; + int is_complex; + char enc_type; + char new_packmode; + char enc_packmode; + char is_valid_array; +} __Pyx_BufFmt_Context; + + +/* "numpy.pxd":723 + * # in Cython to enable them only on the right systems. + * + * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + */ +typedef npy_int8 __pyx_t_5numpy_int8_t; + +/* "numpy.pxd":724 + * + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t + */ +typedef npy_int16 __pyx_t_5numpy_int16_t; + +/* "numpy.pxd":725 + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< + * ctypedef npy_int64 int64_t + * #ctypedef npy_int96 int96_t + */ +typedef npy_int32 __pyx_t_5numpy_int32_t; + +/* "numpy.pxd":726 + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< + * #ctypedef npy_int96 int96_t + * #ctypedef npy_int128 int128_t + */ +typedef npy_int64 __pyx_t_5numpy_int64_t; + +/* "numpy.pxd":730 + * #ctypedef npy_int128 int128_t + * + * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + */ +typedef npy_uint8 __pyx_t_5numpy_uint8_t; + +/* "numpy.pxd":731 + * + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t + */ +typedef npy_uint16 __pyx_t_5numpy_uint16_t; + +/* "numpy.pxd":732 + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< + * ctypedef npy_uint64 uint64_t + * #ctypedef npy_uint96 uint96_t + */ +typedef npy_uint32 __pyx_t_5numpy_uint32_t; + +/* "numpy.pxd":733 + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< + * #ctypedef npy_uint96 uint96_t + * #ctypedef npy_uint128 uint128_t + */ +typedef npy_uint64 __pyx_t_5numpy_uint64_t; + +/* "numpy.pxd":737 + * #ctypedef npy_uint128 uint128_t + * + * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< + * ctypedef npy_float64 float64_t + * #ctypedef npy_float80 float80_t + */ +typedef npy_float32 __pyx_t_5numpy_float32_t; + +/* "numpy.pxd":738 + * + * ctypedef npy_float32 float32_t + * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< + * #ctypedef npy_float80 float80_t + * #ctypedef npy_float128 float128_t + */ +typedef npy_float64 __pyx_t_5numpy_float64_t; + +/* "numpy.pxd":747 + * # The int types are mapped a bit surprising -- + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t + */ +typedef npy_long __pyx_t_5numpy_int_t; + +/* "numpy.pxd":748 + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong longlong_t + * + */ +typedef npy_longlong __pyx_t_5numpy_long_t; + +/* "numpy.pxd":749 + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_ulong uint_t + */ +typedef npy_longlong __pyx_t_5numpy_longlong_t; + +/* "numpy.pxd":751 + * ctypedef npy_longlong longlong_t + * + * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t + */ +typedef npy_ulong __pyx_t_5numpy_uint_t; + +/* "numpy.pxd":752 + * + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulonglong_t + * + */ +typedef npy_ulonglong __pyx_t_5numpy_ulong_t; + +/* "numpy.pxd":753 + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_intp intp_t + */ +typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; + +/* "numpy.pxd":755 + * ctypedef npy_ulonglong ulonglong_t + * + * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< + * ctypedef npy_uintp uintp_t + * + */ +typedef npy_intp __pyx_t_5numpy_intp_t; + +/* "numpy.pxd":756 + * + * ctypedef npy_intp intp_t + * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< + * + * ctypedef npy_double float_t + */ +typedef npy_uintp __pyx_t_5numpy_uintp_t; + +/* "numpy.pxd":758 + * ctypedef npy_uintp uintp_t + * + * ctypedef npy_double float_t # <<<<<<<<<<<<<< + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t + */ +typedef npy_double __pyx_t_5numpy_float_t; + +/* "numpy.pxd":759 + * + * ctypedef npy_double float_t + * ctypedef npy_double double_t # <<<<<<<<<<<<<< + * ctypedef npy_longdouble longdouble_t + * + */ +typedef npy_double __pyx_t_5numpy_double_t; + +/* "numpy.pxd":760 + * ctypedef npy_double float_t + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cfloat cfloat_t + */ +typedef npy_longdouble __pyx_t_5numpy_longdouble_t; + +/* "_basis.pxd":2 + * cimport numpy as cnp + * ctypedef cnp.float64_t FLOAT_t # <<<<<<<<<<<<<< + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t + */ +typedef __pyx_t_5numpy_float64_t __pyx_t_6_basis_FLOAT_t; + +/* "_basis.pxd":3 + * cimport numpy as cnp + * ctypedef cnp.float64_t FLOAT_t + * ctypedef cnp.intp_t INT_t # <<<<<<<<<<<<<< + * ctypedef cnp.ulong_t INDEX_t + * ctypedef cnp.uint8_t BOOL_t + */ +typedef __pyx_t_5numpy_intp_t __pyx_t_6_basis_INT_t; + +/* "_basis.pxd":4 + * ctypedef cnp.float64_t FLOAT_t + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t # <<<<<<<<<<<<<< + * ctypedef cnp.uint8_t BOOL_t + * + */ +typedef __pyx_t_5numpy_ulong_t __pyx_t_6_basis_INDEX_t; + +/* "_basis.pxd":5 + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t + * ctypedef cnp.uint8_t BOOL_t # <<<<<<<<<<<<<< + * + * cdef class BasisFunction: + */ +typedef __pyx_t_5numpy_uint8_t __pyx_t_6_basis_BOOL_t; + +/* "_record.pxd":2 + * cimport numpy as cnp + * ctypedef cnp.float64_t FLOAT_t # <<<<<<<<<<<<<< + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t + */ +typedef __pyx_t_5numpy_float64_t __pyx_t_7_record_FLOAT_t; + +/* "_record.pxd":3 + * cimport numpy as cnp + * ctypedef cnp.float64_t FLOAT_t + * ctypedef cnp.intp_t INT_t # <<<<<<<<<<<<<< + * ctypedef cnp.ulong_t INDEX_t + * ctypedef cnp.uint8_t BOOL_t + */ +typedef __pyx_t_5numpy_intp_t __pyx_t_7_record_INT_t; + +/* "_record.pxd":4 + * ctypedef cnp.float64_t FLOAT_t + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t # <<<<<<<<<<<<<< + * ctypedef cnp.uint8_t BOOL_t + * from _basis cimport Basis + */ +typedef __pyx_t_5numpy_ulong_t __pyx_t_7_record_INDEX_t; + +/* "_record.pxd":5 + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t + * ctypedef cnp.uint8_t BOOL_t # <<<<<<<<<<<<<< + * from _basis cimport Basis + * + */ +typedef __pyx_t_5numpy_uint8_t __pyx_t_7_record_BOOL_t; + +/* "_util.pxd":2 + * cimport numpy as cnp + * ctypedef cnp.float64_t FLOAT_t # <<<<<<<<<<<<<< + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t + */ +typedef __pyx_t_5numpy_float64_t __pyx_t_5_util_FLOAT_t; + +/* "_util.pxd":3 + * cimport numpy as cnp + * ctypedef cnp.float64_t FLOAT_t + * ctypedef cnp.intp_t INT_t # <<<<<<<<<<<<<< + * ctypedef cnp.ulong_t INDEX_t + * ctypedef cnp.uint8_t BOOL_t + */ +typedef __pyx_t_5numpy_intp_t __pyx_t_5_util_INT_t; + +/* "_util.pxd":4 + * ctypedef cnp.float64_t FLOAT_t + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t # <<<<<<<<<<<<<< + * ctypedef cnp.uint8_t BOOL_t + * + */ +typedef __pyx_t_5numpy_ulong_t __pyx_t_5_util_INDEX_t; + +/* "_util.pxd":5 + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t + * ctypedef cnp.uint8_t BOOL_t # <<<<<<<<<<<<<< + * + * cdef FLOAT_t log2(FLOAT_t x) + */ +typedef __pyx_t_5numpy_uint8_t __pyx_t_5_util_BOOL_t; + +/* "_forward.pxd":3 + * cimport numpy as cnp + * import numpy as np + * ctypedef cnp.float64_t FLOAT_t # <<<<<<<<<<<<<< + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t + */ +typedef __pyx_t_5numpy_float64_t __pyx_t_8_forward_FLOAT_t; + +/* "_forward.pxd":4 + * import numpy as np + * ctypedef cnp.float64_t FLOAT_t + * ctypedef cnp.intp_t INT_t # <<<<<<<<<<<<<< + * ctypedef cnp.ulong_t INDEX_t + * ctypedef cnp.uint8_t BOOL_t + */ +typedef __pyx_t_5numpy_intp_t __pyx_t_8_forward_INT_t; + +/* "_forward.pxd":5 + * ctypedef cnp.float64_t FLOAT_t + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t # <<<<<<<<<<<<<< + * ctypedef cnp.uint8_t BOOL_t + * from _basis cimport Basis + */ +typedef __pyx_t_5numpy_ulong_t __pyx_t_8_forward_INDEX_t; + +/* "_forward.pxd":6 + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t + * ctypedef cnp.uint8_t BOOL_t # <<<<<<<<<<<<<< + * from _basis cimport Basis + * from _record cimport ForwardPassRecord + */ +typedef __pyx_t_5numpy_uint8_t __pyx_t_8_forward_BOOL_t; +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< float > __pyx_t_float_complex; + #else + typedef float _Complex __pyx_t_float_complex; + #endif +#else + typedef struct { float real, imag; } __pyx_t_float_complex; +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< double > __pyx_t_double_complex; + #else + typedef double _Complex __pyx_t_double_complex; + #endif +#else + typedef struct { double real, imag; } __pyx_t_double_complex; +#endif + + +/*--- Type declarations ---*/ +struct __pyx_obj_7_record_Record; +struct __pyx_obj_7_record_PruningPassRecord; +struct __pyx_obj_7_record_Iteration; +struct __pyx_obj_7_record_ForwardPassIteration; +struct __pyx_obj_7_record_FirstForwardPassIteration; +struct __pyx_obj_6_basis_Basis; +struct __pyx_obj_8_forward_ForwardPasser; +struct __pyx_obj_6_basis_BasisFunction; +struct __pyx_obj_6_basis_LinearBasisFunction; +struct __pyx_obj_7_record_PruningPassIteration; +struct __pyx_obj_7_record_FirstPruningPassIteration; +struct __pyx_obj_6_basis_HingeBasisFunction; +struct __pyx_obj_7_record_ForwardPassRecord; +struct __pyx_obj_6_basis_ConstantBasisFunction; + +/* "numpy.pxd":762 + * ctypedef npy_longdouble longdouble_t + * + * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t + */ +typedef npy_cfloat __pyx_t_5numpy_cfloat_t; + +/* "numpy.pxd":763 + * + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< + * ctypedef npy_clongdouble clongdouble_t + * + */ +typedef npy_cdouble __pyx_t_5numpy_cdouble_t; + +/* "numpy.pxd":764 + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cdouble complex_t + */ +typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; + +/* "numpy.pxd":766 + * ctypedef npy_clongdouble clongdouble_t + * + * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew1(a): + */ +typedef npy_cdouble __pyx_t_5numpy_complex_t; +struct __pyx_opt_args_6_basis_13BasisFunction_apply; +struct __pyx_opt_args_6_basis_21ConstantBasisFunction_apply; +struct __pyx_opt_args_6_basis_18HingeBasisFunction_apply; +struct __pyx_opt_args_6_basis_19LinearBasisFunction_apply; + +/* "_basis.pxd":45 + * cpdef INDEX_t degree(BasisFunction self) + * + * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) # <<<<<<<<<<<<<< + * + * cpdef cnp.ndarray[INT_t, ndim=1] valid_knots(BasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] values, cnp.ndarray[FLOAT_t,ndim=1] variable, int variable_idx, INDEX_t check_every, int endspan, int minspan, FLOAT_t minspan_alpha, INDEX_t n, cnp.ndarray[INT_t,ndim=1] workspace) + */ +struct __pyx_opt_args_6_basis_13BasisFunction_apply { + int __pyx_n; + int recurse; +}; + +/* "_basis.pxd":62 + * cpdef BasisFunction get_parent(self) + * + * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) # <<<<<<<<<<<<<< + * + * + */ +struct __pyx_opt_args_6_basis_21ConstantBasisFunction_apply { + int __pyx_n; + int recurse; +}; + +/* "_basis.pxd":86 + * cpdef INDEX_t get_knot_idx(self) + * + * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) # <<<<<<<<<<<<<< + * + * cdef class LinearBasisFunction(BasisFunction): + */ +struct __pyx_opt_args_6_basis_18HingeBasisFunction_apply { + int __pyx_n; + int recurse; +}; + +/* "_basis.pxd":98 + * cpdef INDEX_t get_variable(self) + * + * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) # <<<<<<<<<<<<<< + * + * + */ +struct __pyx_opt_args_6_basis_19LinearBasisFunction_apply { + int __pyx_n; + int recurse; +}; + +/* "_forward.pxd":10 + * from _record cimport ForwardPassRecord + * + * ctypedef enum StoppingCondition: # <<<<<<<<<<<<<< + * MAXTERMS=0, + * MAXRSQ=1, + */ +enum __pyx_t_8_forward_StoppingCondition { + __pyx_e_8_forward_MAXTERMS = 0, + __pyx_e_8_forward_MAXRSQ = 1, + __pyx_e_8_forward_NOIMPRV = 2, + __pyx_e_8_forward_LOWGRSQ = 3, + __pyx_e_8_forward_NOCAND = 4 +}; +typedef enum __pyx_t_8_forward_StoppingCondition __pyx_t_8_forward_StoppingCondition; + +/* "_record.pxd":8 + * from _basis cimport Basis + * + * cdef class Record: # <<<<<<<<<<<<<< + * cdef list iterations + * cdef int num_samples + */ +struct __pyx_obj_7_record_Record { + PyObject_HEAD + struct __pyx_vtabstruct_7_record_Record *__pyx_vtab; + PyObject *iterations; + int num_samples; + int num_variables; + __pyx_t_7_record_FLOAT_t penalty; + __pyx_t_7_record_FLOAT_t sst; +}; + + +/* "_record.pxd":25 + * cpdef FLOAT_t grsq(Record self, INDEX_t iteration) + * + * cdef class PruningPassRecord(Record): # <<<<<<<<<<<<<< + * cdef INDEX_t selected + * + */ +struct __pyx_obj_7_record_PruningPassRecord { + struct __pyx_obj_7_record_Record __pyx_base; + __pyx_t_7_record_INDEX_t selected; +}; + + +/* "_record.pxd":39 + * cpdef set_stopping_condition(ForwardPassRecord self, int stopping_condition) + * + * cdef class Iteration: # <<<<<<<<<<<<<< + * cdef FLOAT_t mse + * cdef INDEX_t size + */ +struct __pyx_obj_7_record_Iteration { + PyObject_HEAD + struct __pyx_vtabstruct_7_record_Iteration *__pyx_vtab; + __pyx_t_7_record_FLOAT_t mse; + __pyx_t_7_record_INDEX_t size; +}; + + +/* "_record.pxd":55 + * pass + * + * cdef class ForwardPassIteration(Iteration): # <<<<<<<<<<<<<< + * cdef INDEX_t parent + * cdef INDEX_t variable + */ +struct __pyx_obj_7_record_ForwardPassIteration { + struct __pyx_obj_7_record_Iteration __pyx_base; + __pyx_t_7_record_INDEX_t parent; + __pyx_t_7_record_INDEX_t variable; + __pyx_t_7_record_FLOAT_t knot; + int code; + int no_candidates; +}; + + +/* "_record.pxd":66 + * cpdef no_further_candidates(ForwardPassIteration self) + * + * cdef class FirstForwardPassIteration(ForwardPassIteration): # <<<<<<<<<<<<<< + * cpdef INDEX_t get_size(FirstForwardPassIteration self) + */ +struct __pyx_obj_7_record_FirstForwardPassIteration { + struct __pyx_obj_7_record_ForwardPassIteration __pyx_base; +}; + + +/* "_basis.pxd":102 + * + * + * cdef class Basis: # <<<<<<<<<<<<<< + * '''A wrapper that provides functionality related to a set of BasisFunctions with a + * common ConstantBasisFunction ancestor. Retains the order in which BasisFunctions are + */ +struct __pyx_obj_6_basis_Basis { + PyObject_HEAD + struct __pyx_vtabstruct_6_basis_Basis *__pyx_vtab; + PyObject *order; +}; + + +/* "_forward.pxd":17 + * NOCAND=4 + * + * cdef class ForwardPasser: # <<<<<<<<<<<<<< + * + * #User selected parameters + */ +struct __pyx_obj_8_forward_ForwardPasser { + PyObject_HEAD + struct __pyx_vtabstruct_8_forward_ForwardPasser *__pyx_vtab; + int endspan; + int minspan; + __pyx_t_8_forward_FLOAT_t endspan_alpha; + __pyx_t_8_forward_FLOAT_t minspan_alpha; + int max_terms; + int max_degree; + __pyx_t_8_forward_FLOAT_t thresh; + __pyx_t_8_forward_FLOAT_t penalty; + int check_every; + int min_search_points; + PyObject *xlabels; + __pyx_t_8_forward_FLOAT_t zero_tol; + PyArrayObject *X; + PyArrayObject *y; + PyArrayObject *weights; + __pyx_t_8_forward_INDEX_t m; + __pyx_t_8_forward_INDEX_t n; + __pyx_t_8_forward_FLOAT_t sst; + __pyx_t_8_forward_FLOAT_t y_squared; + PyArrayObject *B; + PyArrayObject *B_orth; + PyArrayObject *c; + PyArrayObject *norms; + PyArrayObject *u; + PyArrayObject *B_orth_times_parent_cum; + __pyx_t_8_forward_FLOAT_t c_squared; + PyArrayObject *sort_tracker; + PyArrayObject *sorting; + PyArrayObject *mwork; + PyArrayObject *linear_variables; + struct __pyx_obj_7_record_ForwardPassRecord *record; + struct __pyx_obj_6_basis_Basis *basis; +}; + + +/* "_basis.pxd":7 + * ctypedef cnp.uint8_t BOOL_t + * + * cdef class BasisFunction: # <<<<<<<<<<<<<< + * '''Abstract. Subclasses must implement the apply, translate, scale, and __init__ methods.''' + * + */ +struct __pyx_obj_6_basis_BasisFunction { + PyObject_HEAD + struct __pyx_vtabstruct_6_basis_BasisFunction *__pyx_vtab; + struct __pyx_obj_6_basis_BasisFunction *parent; + PyObject *child_map; + PyObject *children; + int pruned; + int prunable; + int splittable; +}; + + +/* "_basis.pxd":88 + * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) + * + * cdef class LinearBasisFunction(BasisFunction): # <<<<<<<<<<<<<< + * cdef INDEX_t variable + * cdef str label + */ +struct __pyx_obj_6_basis_LinearBasisFunction { + struct __pyx_obj_6_basis_BasisFunction __pyx_base; + __pyx_t_6_basis_INDEX_t variable; + PyObject *label; +}; + + +/* "_record.pxd":47 + * cpdef INDEX_t get_size(Iteration self) + * + * cdef class PruningPassIteration(Iteration): # <<<<<<<<<<<<<< + * cdef INDEX_t pruned + * + */ +struct __pyx_obj_7_record_PruningPassIteration { + struct __pyx_obj_7_record_Iteration __pyx_base; + __pyx_t_7_record_INDEX_t pruned; +}; + + +/* "_record.pxd":52 + * cpdef INDEX_t get_pruned(PruningPassIteration self) + * + * cdef class FirstPruningPassIteration(PruningPassIteration): # <<<<<<<<<<<<<< + * pass + * + */ +struct __pyx_obj_7_record_FirstPruningPassIteration { + struct __pyx_obj_7_record_PruningPassIteration __pyx_base; +}; + + +/* "_basis.pxd":65 + * + * + * cdef class HingeBasisFunction(BasisFunction): # <<<<<<<<<<<<<< + * cdef FLOAT_t knot + * cdef INDEX_t knot_idx + */ +struct __pyx_obj_6_basis_HingeBasisFunction { + struct __pyx_obj_6_basis_BasisFunction __pyx_base; + __pyx_t_6_basis_FLOAT_t knot; + __pyx_t_6_basis_INDEX_t knot_idx; + __pyx_t_6_basis_INDEX_t variable; + int reverse; + PyObject *label; +}; + + +/* "_record.pxd":34 + * cpdef roll_back(PruningPassRecord self, Basis basis) + * + * cdef class ForwardPassRecord(Record): # <<<<<<<<<<<<<< + * cdef int stopping_condition + * + */ +struct __pyx_obj_7_record_ForwardPassRecord { + struct __pyx_obj_7_record_Record __pyx_base; + int stopping_condition; +}; + + +/* "_basis.pxd":50 + * + * + * cdef class ConstantBasisFunction(BasisFunction): # <<<<<<<<<<<<<< + * + * cpdef INDEX_t degree(ConstantBasisFunction self) + */ +struct __pyx_obj_6_basis_ConstantBasisFunction { + struct __pyx_obj_6_basis_BasisFunction __pyx_base; +}; + + + +/* "_basis.pxd":102 + * + * + * cdef class Basis: # <<<<<<<<<<<<<< + * '''A wrapper that provides functionality related to a set of BasisFunctions with a + * common ConstantBasisFunction ancestor. Retains the order in which BasisFunctions are + */ + +struct __pyx_vtabstruct_6_basis_Basis { + PyObject *(*translate)(struct __pyx_obj_6_basis_Basis *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); + PyObject *(*scale)(struct __pyx_obj_6_basis_Basis *, PyArrayObject *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); + struct __pyx_obj_6_basis_BasisFunction *(*get_root)(struct __pyx_obj_6_basis_Basis *, int __pyx_skip_dispatch); + PyObject *(*append)(struct __pyx_obj_6_basis_Basis *, struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + __pyx_t_6_basis_INDEX_t (*plen)(struct __pyx_obj_6_basis_Basis *, int __pyx_skip_dispatch); + struct __pyx_obj_6_basis_BasisFunction *(*get)(struct __pyx_obj_6_basis_Basis *, __pyx_t_6_basis_INDEX_t, int __pyx_skip_dispatch); + PyObject *(*transform)(struct __pyx_obj_6_basis_Basis *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); + PyObject *(*weighted_transform)(struct __pyx_obj_6_basis_Basis *, PyArrayObject *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_6_basis_Basis *__pyx_vtabptr_6_basis_Basis; + + +/* "_basis.pxd":7 + * ctypedef cnp.uint8_t BOOL_t + * + * cdef class BasisFunction: # <<<<<<<<<<<<<< + * '''Abstract. Subclasses must implement the apply, translate, scale, and __init__ methods.''' + * + */ + +struct __pyx_vtabstruct_6_basis_BasisFunction { + int (*has_knot)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + int (*is_prunable)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + int (*is_pruned)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + int (*is_splittable)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + int (*make_splittable)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + int (*make_unsplittable)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*get_children)(struct __pyx_obj_6_basis_BasisFunction *); + PyObject *(*_set_parent)(struct __pyx_obj_6_basis_BasisFunction *, struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*_add_child)(struct __pyx_obj_6_basis_BasisFunction *, struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + struct __pyx_obj_6_basis_BasisFunction *(*get_parent)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*prune)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*unprune)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*knots)(struct __pyx_obj_6_basis_BasisFunction *, __pyx_t_6_basis_INDEX_t, int __pyx_skip_dispatch); + __pyx_t_6_basis_INDEX_t (*degree)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*apply)(struct __pyx_obj_6_basis_BasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_6_basis_13BasisFunction_apply *__pyx_optional_args); + PyArrayObject *(*valid_knots)(struct __pyx_obj_6_basis_BasisFunction *, PyArrayObject *, PyArrayObject *, int, __pyx_t_6_basis_INDEX_t, int, int, __pyx_t_6_basis_FLOAT_t, __pyx_t_6_basis_INDEX_t, PyArrayObject *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_6_basis_BasisFunction *__pyx_vtabptr_6_basis_BasisFunction; + + +/* "_basis.pxd":88 + * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) + * + * cdef class LinearBasisFunction(BasisFunction): # <<<<<<<<<<<<<< + * cdef INDEX_t variable + * cdef str label + */ + +struct __pyx_vtabstruct_6_basis_LinearBasisFunction { + struct __pyx_vtabstruct_6_basis_BasisFunction __pyx_base; + PyObject *(*translate)(struct __pyx_obj_6_basis_LinearBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch); + __pyx_t_6_basis_FLOAT_t (*scale)(struct __pyx_obj_6_basis_LinearBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); + __pyx_t_6_basis_INDEX_t (*get_variable)(struct __pyx_obj_6_basis_LinearBasisFunction *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_6_basis_LinearBasisFunction *__pyx_vtabptr_6_basis_LinearBasisFunction; + + +/* "_record.pxd":39 + * cpdef set_stopping_condition(ForwardPassRecord self, int stopping_condition) + * + * cdef class Iteration: # <<<<<<<<<<<<<< + * cdef FLOAT_t mse + * cdef INDEX_t size + */ + +struct __pyx_vtabstruct_7_record_Iteration { + __pyx_t_7_record_FLOAT_t (*get_mse)(struct __pyx_obj_7_record_Iteration *, int __pyx_skip_dispatch); + __pyx_t_7_record_INDEX_t (*get_size)(struct __pyx_obj_7_record_Iteration *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_7_record_Iteration *__pyx_vtabptr_7_record_Iteration; + + +/* "_record.pxd":55 + * pass + * + * cdef class ForwardPassIteration(Iteration): # <<<<<<<<<<<<<< + * cdef INDEX_t parent + * cdef INDEX_t variable + */ + +struct __pyx_vtabstruct_7_record_ForwardPassIteration { + struct __pyx_vtabstruct_7_record_Iteration __pyx_base; + PyObject *(*set_no_candidates)(struct __pyx_obj_7_record_ForwardPassIteration *, int, int __pyx_skip_dispatch); + PyObject *(*no_further_candidates)(struct __pyx_obj_7_record_ForwardPassIteration *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_7_record_ForwardPassIteration *__pyx_vtabptr_7_record_ForwardPassIteration; + + +/* "_record.pxd":66 + * cpdef no_further_candidates(ForwardPassIteration self) + * + * cdef class FirstForwardPassIteration(ForwardPassIteration): # <<<<<<<<<<<<<< + * cpdef INDEX_t get_size(FirstForwardPassIteration self) + */ + +struct __pyx_vtabstruct_7_record_FirstForwardPassIteration { + struct __pyx_vtabstruct_7_record_ForwardPassIteration __pyx_base; +}; +static struct __pyx_vtabstruct_7_record_FirstForwardPassIteration *__pyx_vtabptr_7_record_FirstForwardPassIteration; + + +/* "_record.pxd":47 + * cpdef INDEX_t get_size(Iteration self) + * + * cdef class PruningPassIteration(Iteration): # <<<<<<<<<<<<<< + * cdef INDEX_t pruned + * + */ + +struct __pyx_vtabstruct_7_record_PruningPassIteration { + struct __pyx_vtabstruct_7_record_Iteration __pyx_base; + __pyx_t_7_record_INDEX_t (*get_pruned)(struct __pyx_obj_7_record_PruningPassIteration *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_7_record_PruningPassIteration *__pyx_vtabptr_7_record_PruningPassIteration; + + +/* "_basis.pxd":50 + * + * + * cdef class ConstantBasisFunction(BasisFunction): # <<<<<<<<<<<<<< + * + * cpdef INDEX_t degree(ConstantBasisFunction self) + */ + +struct __pyx_vtabstruct_6_basis_ConstantBasisFunction { + struct __pyx_vtabstruct_6_basis_BasisFunction __pyx_base; + PyObject *(*translate)(struct __pyx_obj_6_basis_ConstantBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch); + __pyx_t_6_basis_FLOAT_t (*scale)(struct __pyx_obj_6_basis_ConstantBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_6_basis_ConstantBasisFunction *__pyx_vtabptr_6_basis_ConstantBasisFunction; + + +/* "_record.pxd":8 + * from _basis cimport Basis + * + * cdef class Record: # <<<<<<<<<<<<<< + * cdef list iterations + * cdef int num_samples + */ + +struct __pyx_vtabstruct_7_record_Record { + PyObject *(*append)(struct __pyx_obj_7_record_Record *, struct __pyx_obj_7_record_Iteration *, int __pyx_skip_dispatch); + __pyx_t_7_record_FLOAT_t (*mse)(struct __pyx_obj_7_record_Record *, __pyx_t_7_record_INDEX_t, int __pyx_skip_dispatch); + __pyx_t_7_record_FLOAT_t (*rsq)(struct __pyx_obj_7_record_Record *, __pyx_t_7_record_INDEX_t, int __pyx_skip_dispatch); + __pyx_t_7_record_FLOAT_t (*gcv)(struct __pyx_obj_7_record_Record *, __pyx_t_7_record_INDEX_t, int __pyx_skip_dispatch); + __pyx_t_7_record_FLOAT_t (*grsq)(struct __pyx_obj_7_record_Record *, __pyx_t_7_record_INDEX_t, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_7_record_Record *__pyx_vtabptr_7_record_Record; + + +/* "_record.pxd":25 + * cpdef FLOAT_t grsq(Record self, INDEX_t iteration) + * + * cdef class PruningPassRecord(Record): # <<<<<<<<<<<<<< + * cdef INDEX_t selected + * + */ + +struct __pyx_vtabstruct_7_record_PruningPassRecord { + struct __pyx_vtabstruct_7_record_Record __pyx_base; + PyObject *(*set_selected)(struct __pyx_obj_7_record_PruningPassRecord *, __pyx_t_7_record_INDEX_t, int __pyx_skip_dispatch); + __pyx_t_7_record_INDEX_t (*get_selected)(struct __pyx_obj_7_record_PruningPassRecord *, int __pyx_skip_dispatch); + PyObject *(*roll_back)(struct __pyx_obj_7_record_PruningPassRecord *, struct __pyx_obj_6_basis_Basis *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_7_record_PruningPassRecord *__pyx_vtabptr_7_record_PruningPassRecord; + + +/* "_record.pxd":34 + * cpdef roll_back(PruningPassRecord self, Basis basis) + * + * cdef class ForwardPassRecord(Record): # <<<<<<<<<<<<<< + * cdef int stopping_condition + * + */ + +struct __pyx_vtabstruct_7_record_ForwardPassRecord { + struct __pyx_vtabstruct_7_record_Record __pyx_base; + PyObject *(*set_stopping_condition)(struct __pyx_obj_7_record_ForwardPassRecord *, int, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_7_record_ForwardPassRecord *__pyx_vtabptr_7_record_ForwardPassRecord; + + +/* "_basis.pxd":65 + * + * + * cdef class HingeBasisFunction(BasisFunction): # <<<<<<<<<<<<<< + * cdef FLOAT_t knot + * cdef INDEX_t knot_idx + */ + +struct __pyx_vtabstruct_6_basis_HingeBasisFunction { + struct __pyx_vtabstruct_6_basis_BasisFunction __pyx_base; + PyObject *(*translate)(struct __pyx_obj_6_basis_HingeBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch); + __pyx_t_6_basis_FLOAT_t (*scale)(struct __pyx_obj_6_basis_HingeBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); + __pyx_t_6_basis_INDEX_t (*get_variable)(struct __pyx_obj_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); + __pyx_t_6_basis_FLOAT_t (*get_knot)(struct __pyx_obj_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); + int (*get_reverse)(struct __pyx_obj_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); + __pyx_t_6_basis_INDEX_t (*get_knot_idx)(struct __pyx_obj_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_6_basis_HingeBasisFunction *__pyx_vtabptr_6_basis_HingeBasisFunction; + + +/* "_forward.pyx":23 + * } + * + * cdef class ForwardPasser: # <<<<<<<<<<<<<< + * + * def __init__(ForwardPasser self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] weights, **kwargs): + */ + +struct __pyx_vtabstruct_8_forward_ForwardPasser { + struct __pyx_obj_6_basis_Basis *(*get_basis)(struct __pyx_obj_8_forward_ForwardPasser *, int __pyx_skip_dispatch); + PyObject *(*init_linear_variables)(struct __pyx_obj_8_forward_ForwardPasser *, int __pyx_skip_dispatch); + PyObject *(*run)(struct __pyx_obj_8_forward_ForwardPasser *, int __pyx_skip_dispatch); + PyObject *(*stop_check)(struct __pyx_obj_8_forward_ForwardPasser *); + int (*orthonormal_update)(struct __pyx_obj_8_forward_ForwardPasser *, __pyx_t_8_forward_INDEX_t, int __pyx_skip_dispatch); + PyObject *(*orthonormal_downdate)(struct __pyx_obj_8_forward_ForwardPasser *, __pyx_t_8_forward_INDEX_t, int __pyx_skip_dispatch); + PyObject *(*next_pair)(struct __pyx_obj_8_forward_ForwardPasser *); + PyObject *(*best_knot)(struct __pyx_obj_8_forward_ForwardPasser *, __pyx_t_8_forward_INDEX_t, __pyx_t_8_forward_INDEX_t, __pyx_t_8_forward_INDEX_t, PyArrayObject *, PyArrayObject *, __pyx_t_8_forward_FLOAT_t *, __pyx_t_8_forward_FLOAT_t *, __pyx_t_8_forward_INDEX_t *); +}; +static struct __pyx_vtabstruct_8_forward_ForwardPasser *__pyx_vtabptr_8_forward_ForwardPasser; + + +/* "_record.pxd":52 + * cpdef INDEX_t get_pruned(PruningPassIteration self) + * + * cdef class FirstPruningPassIteration(PruningPassIteration): # <<<<<<<<<<<<<< + * pass + * + */ + +struct __pyx_vtabstruct_7_record_FirstPruningPassIteration { + struct __pyx_vtabstruct_7_record_PruningPassIteration __pyx_base; +}; +static struct __pyx_vtabstruct_7_record_FirstPruningPassIteration *__pyx_vtabptr_7_record_FirstPruningPassIteration; +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; +#ifdef WITH_THREAD + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + if (acquire_gil) { \ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + PyGILState_Release(__pyx_gilstate_save); \ + } else { \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) +#endif + #define __Pyx_RefNannyFinishContext() \ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name, acquire_gil) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif /* CYTHON_REFNANNY */ +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) + +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_getattr)) + return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); +#endif + return PyObject_GetAttr(obj, attr_name); +} +#else +#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#endif + +static PyObject *__Pyx_GetBuiltinName(PyObject *name); /*proto*/ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ + const char* function_name); /*proto*/ + +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact); /*proto*/ + +static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, + __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); +static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ + +static CYTHON_INLINE int __Pyx_PyDict_Contains(PyObject* item, PyObject* dict, int eq) { + int result = PyDict_Contains(dict, item); + return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); +} + +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { + PyObject *value; + value = PyDict_GetItemWithError(d, key); + if (unlikely(!value)) { + if (!PyErr_Occurred()) { + PyObject* args = PyTuple_Pack(1, key); + if (likely(args)) + PyErr_SetObject(PyExc_KeyError, args); + Py_XDECREF(args); + } + return NULL; + } + Py_INCREF(value); + return value; +} +#else + #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) +#endif + +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len)) { + Py_INCREF(x); + PyList_SET_ITEM(list, len, x); + Py_SIZE(list) = len+1; + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) +#endif + +static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /*proto*/ + +#define __Pyx_SetItemInt(o, i, v, size, to_py_func, is_list, wraparound, boundscheck) \ + (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_SetItemInt_Fast(o, i, v, is_list, wraparound, boundscheck) : \ + __Pyx_SetItemInt_Generic(o, to_py_func(i), v)) +static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v); +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, + int is_list, int wraparound, int boundscheck); + +static CYTHON_INLINE int __Pyx_PySequence_Contains(PyObject* item, PyObject* seq, int eq) { + int result = PySequence_Contains(seq, item); + return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); +} + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ + +#define __Pyx_GetItemInt(o, i, size, to_py_func, is_list, wraparound, boundscheck) \ + (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Fast(o, i, is_list, wraparound, boundscheck) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) +#define __Pyx_GetItemInt_List(o, i, size, to_py_func, is_list, wraparound, boundscheck) \ + (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_List_Fast(o, i, wraparound, boundscheck) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck); +#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func, is_list, wraparound, boundscheck) \ + (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Tuple_Fast(o, i, wraparound, boundscheck) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck); +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, + int is_list, int wraparound, int boundscheck); + +static void __Pyx_RaiseBufferFallbackError(void); /*proto*/ + +#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) +#define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1) +#define __Pyx_PyObject_DelSlice(obj, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound) \ + __Pyx_PyObject_SetSlice(obj, (PyObject*)NULL, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound) +static CYTHON_INLINE int __Pyx_PyObject_SetSlice( + PyObject* obj, PyObject* value, Py_ssize_t cstart, Py_ssize_t cstop, + PyObject** py_start, PyObject** py_stop, PyObject** py_slice, + int has_cstart, int has_cstop, int wraparound); + +static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); + +static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/ + +typedef struct { + Py_ssize_t shape, strides, suboffsets; +} __Pyx_Buf_DimInfo; +typedef struct { + size_t refcount; + Py_buffer pybuffer; +} __Pyx_Buffer; +typedef struct { + __Pyx_Buffer *rcbuffer; + char *data; + __Pyx_Buf_DimInfo diminfo[8]; +} __Pyx_LocalBuf_ND; + +#if PY_MAJOR_VERSION < 3 + static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); + static void __Pyx_ReleaseBuffer(Py_buffer *view); +#else + #define __Pyx_GetBuffer PyObject_GetBuffer + #define __Pyx_ReleaseBuffer PyBuffer_Release +#endif + + +static Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0}; +static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1}; + +static CYTHON_INLINE npy_ulonglong __Pyx_PyInt_from_py_npy_ulonglong(PyObject *); + +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_ulonglong(npy_ulonglong); + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #define __Pyx_CREAL(z) ((z).real()) + #define __Pyx_CIMAG(z) ((z).imag()) + #else + #define __Pyx_CREAL(z) (__real__(z)) + #define __Pyx_CIMAG(z) (__imag__(z)) + #endif +#else + #define __Pyx_CREAL(z) ((z).real) + #define __Pyx_CIMAG(z) ((z).imag) +#endif +#if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX + #define __Pyx_SET_CREAL(z,x) ((z).real(x)) + #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) +#else + #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) + #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) +#endif + +static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); + +#if CYTHON_CCOMPLEX + #define __Pyx_c_eqf(a, b) ((a)==(b)) + #define __Pyx_c_sumf(a, b) ((a)+(b)) + #define __Pyx_c_difff(a, b) ((a)-(b)) + #define __Pyx_c_prodf(a, b) ((a)*(b)) + #define __Pyx_c_quotf(a, b) ((a)/(b)) + #define __Pyx_c_negf(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zerof(z) ((z)==(float)0) + #define __Pyx_c_conjf(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_absf(z) (::std::abs(z)) + #define __Pyx_c_powf(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zerof(z) ((z)==0) + #define __Pyx_c_conjf(z) (conjf(z)) + #if 1 + #define __Pyx_c_absf(z) (cabsf(z)) + #define __Pyx_c_powf(a, b) (cpowf(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex); + #endif +#endif + +static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); + +#if CYTHON_CCOMPLEX + #define __Pyx_c_eq(a, b) ((a)==(b)) + #define __Pyx_c_sum(a, b) ((a)+(b)) + #define __Pyx_c_diff(a, b) ((a)-(b)) + #define __Pyx_c_prod(a, b) ((a)*(b)) + #define __Pyx_c_quot(a, b) ((a)/(b)) + #define __Pyx_c_neg(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero(z) ((z)==(double)0) + #define __Pyx_c_conj(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs(z) (::std::abs(z)) + #define __Pyx_c_pow(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero(z) ((z)==0) + #define __Pyx_c_conj(z) (conj(z)) + #if 1 + #define __Pyx_c_abs(z) (cabs(z)) + #define __Pyx_c_pow(a, b) (cpow(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex); + #endif +#endif + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static void __Pyx_WriteUnraisable(const char *name, int clineno, + int lineno, const char *filename); /*proto*/ + +static int __Pyx_check_binary_version(void); + +static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ + +#if !defined(__Pyx_PyIdentifier_FromString) +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) +#else + #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) +#endif +#endif + +static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ + +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ + +static void* __Pyx_GetVtable(PyObject *dict); /*proto*/ + +static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig); /*proto*/ + +typedef struct { + int code_line; + PyCodeObject* code_object; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); + +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + + +/* Module declarations from 'cpython.buffer' */ + +/* Module declarations from 'cpython.ref' */ + +/* Module declarations from 'libc.string' */ + +/* Module declarations from 'libc.stdio' */ + +/* Module declarations from 'cpython.object' */ + +/* Module declarations from '__builtin__' */ + +/* Module declarations from 'cpython.type' */ +static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; + +/* Module declarations from 'libc.stdlib' */ + +/* Module declarations from 'numpy' */ + +/* Module declarations from 'numpy' */ +static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; +static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; +static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; +static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; +static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ + +/* Module declarations from '_basis' */ +static PyTypeObject *__pyx_ptype_6_basis_BasisFunction = 0; +static PyTypeObject *__pyx_ptype_6_basis_ConstantBasisFunction = 0; +static PyTypeObject *__pyx_ptype_6_basis_HingeBasisFunction = 0; +static PyTypeObject *__pyx_ptype_6_basis_LinearBasisFunction = 0; +static PyTypeObject *__pyx_ptype_6_basis_Basis = 0; + +/* Module declarations from '_record' */ +static PyTypeObject *__pyx_ptype_7_record_Record = 0; +static PyTypeObject *__pyx_ptype_7_record_PruningPassRecord = 0; +static PyTypeObject *__pyx_ptype_7_record_ForwardPassRecord = 0; +static PyTypeObject *__pyx_ptype_7_record_Iteration = 0; +static PyTypeObject *__pyx_ptype_7_record_PruningPassIteration = 0; +static PyTypeObject *__pyx_ptype_7_record_FirstPruningPassIteration = 0; +static PyTypeObject *__pyx_ptype_7_record_ForwardPassIteration = 0; +static PyTypeObject *__pyx_ptype_7_record_FirstForwardPassIteration = 0; + +/* Module declarations from '_util' */ +static __pyx_t_5_util_FLOAT_t (*__pyx_f_5_util_log2)(__pyx_t_5_util_FLOAT_t); /*proto*/ +static PyObject *(*__pyx_f_5_util_apply_weights_1d)(PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); /*proto*/ +static __pyx_t_5_util_FLOAT_t (*__pyx_f_5_util_gcv_adjust)(__pyx_t_5_util_INDEX_t, __pyx_t_5_util_INDEX_t, __pyx_t_5_util_FLOAT_t, int __pyx_skip_dispatch); /*proto*/ + +/* Module declarations from 'libc.math' */ + +/* Module declarations from '_forward' */ +static PyTypeObject *__pyx_ptype_8_forward_ForwardPasser = 0; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t = { "FLOAT_t", NULL, sizeof(__pyx_t_8_forward_FLOAT_t), { 0 }, 0, 'R', 0, 0 }; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_8_forward_INT_t = { "INT_t", NULL, sizeof(__pyx_t_8_forward_INT_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_8_forward_INT_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_8_forward_INT_t), 0 }; +#define __Pyx_MODULE_NAME "_forward" +int __pyx_module_is_main__forward = 0; + +/* Implementation of '_forward' */ +static PyObject *__pyx_builtin_range; +static PyObject *__pyx_builtin_IndexError; +static PyObject *__pyx_builtin_round; +static PyObject *__pyx_builtin_ValueError; +static PyObject *__pyx_builtin_RuntimeError; +static int __pyx_pf_8_forward_13ForwardPasser___init__(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_y, PyArrayObject *__pyx_v_weights, PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_8_forward_13ForwardPasser_2get_basis(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_8_forward_13ForwardPasser_4init_linear_variables(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_8_forward_13ForwardPasser_6get_B_orth(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_8_forward_13ForwardPasser_8run(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_8_forward_13ForwardPasser_10orthonormal_update(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self, __pyx_t_8_forward_INDEX_t __pyx_v_k); /* proto */ +static PyObject *__pyx_pf_8_forward_13ForwardPasser_12orthonormal_downdate(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self, __pyx_t_8_forward_INDEX_t __pyx_v_k); /* proto */ +static PyObject *__pyx_pf_8_forward_13ForwardPasser_14trace(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self); /* proto */ +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ +static PyObject *__pyx_tp_new_8_forward_ForwardPasser(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static char __pyx_k_1[] = "Unknown variable selected in linvars argument."; +static char __pyx_k_3[] = "init_linear_variables"; +static char __pyx_k_6[] = "no_further_candidates"; +static char __pyx_k_7[] = "orthonormal_downdate"; +static char __pyx_k_23[] = "ndarray is not C contiguous"; +static char __pyx_k_25[] = "ndarray is not Fortran contiguous"; +static char __pyx_k_27[] = "Non-native byte order not supported"; +static char __pyx_k_29[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_30[] = "Format string allocated too short, see comment in numpy.pxd"; +static char __pyx_k_33[] = "Format string allocated too short."; +static char __pyx_k_35[] = "Reached maximum number of terms"; +static char __pyx_k_36[] = "Achieved RSQ value within threshold of 1"; +static char __pyx_k_37[] = "Improvement below threshold"; +static char __pyx_k_38[] = "GRSQ too low"; +static char __pyx_k_39[] = "No remaining candidate knot locations"; +static char __pyx_k__B[] = "B"; +static char __pyx_k__C[] = "C"; +static char __pyx_k__H[] = "H"; +static char __pyx_k__I[] = "I"; +static char __pyx_k__L[] = "L"; +static char __pyx_k__O[] = "O"; +static char __pyx_k__Q[] = "Q"; +static char __pyx_k__X[] = "X"; +static char __pyx_k__b[] = "b"; +static char __pyx_k__d[] = "d"; +static char __pyx_k__f[] = "f"; +static char __pyx_k__g[] = "g"; +static char __pyx_k__h[] = "h"; +static char __pyx_k__i[] = "i"; +static char __pyx_k__l[] = "l"; +static char __pyx_k__q[] = "q"; +static char __pyx_k__x[] = "x"; +static char __pyx_k__y[] = "y"; +static char __pyx_k__Zd[] = "Zd"; +static char __pyx_k__Zf[] = "Zf"; +static char __pyx_k__Zg[] = "Zg"; +static char __pyx_k__np[] = "np"; +static char __pyx_k__dot[] = "dot"; +static char __pyx_k__int[] = "int"; +static char __pyx_k__nan[] = "nan"; +static char __pyx_k__run[] = "run"; +static char __pyx_k__sum[] = "sum"; +static char __pyx_k__copy[] = "copy"; +static char __pyx_k__ones[] = "ones"; +static char __pyx_k__sqrt[] = "sqrt"; +static char __pyx_k__dtype[] = "dtype"; +static char __pyx_k__empty[] = "empty"; +static char __pyx_k__float[] = "float"; +static char __pyx_k__index[] = "index"; +static char __pyx_k__numpy[] = "numpy"; +static char __pyx_k__order[] = "order"; +static char __pyx_k__range[] = "range"; +static char __pyx_k__round[] = "round"; +static char __pyx_k__shape[] = "shape"; +static char __pyx_k__zeros[] = "zeros"; +static char __pyx_k__thresh[] = "thresh"; +static char __pyx_k____len__[] = "__len__"; +static char __pyx_k__argsort[] = "argsort"; +static char __pyx_k__endspan[] = "endspan"; +static char __pyx_k__linvars[] = "linvars"; +static char __pyx_k__minspan[] = "minspan"; +static char __pyx_k__penalty[] = "penalty"; +static char __pyx_k__weights[] = "weights"; +static char __pyx_k__xlabels[] = "xlabels"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__get_size[] = "get_size"; +static char __pyx_k__get_basis[] = "get_basis"; +static char __pyx_k__max_terms[] = "max_terms"; +static char __pyx_k__IndexError[] = "IndexError"; +static char __pyx_k__ValueError[] = "ValueError"; +static char __pyx_k____import__[] = "__import__"; +static char __pyx_k__max_degree[] = "max_degree"; +static char __pyx_k__check_every[] = "check_every"; +static char __pyx_k__RuntimeError[] = "RuntimeError"; +static char __pyx_k__endspan_alpha[] = "endspan_alpha"; +static char __pyx_k__minspan_alpha[] = "minspan_alpha"; +static char __pyx_k____pyx_getbuffer[] = "__pyx_getbuffer"; +static char __pyx_k__min_search_points[] = "min_search_points"; +static char __pyx_k__set_no_candidates[] = "set_no_candidates"; +static char __pyx_k__orthonormal_update[] = "orthonormal_update"; +static char __pyx_k____pyx_releasebuffer[] = "__pyx_releasebuffer"; +static char __pyx_k__stopping_conditions[] = "stopping_conditions"; +static PyObject *__pyx_kp_s_1; +static PyObject *__pyx_kp_u_23; +static PyObject *__pyx_kp_u_25; +static PyObject *__pyx_kp_u_27; +static PyObject *__pyx_kp_u_29; +static PyObject *__pyx_n_s_3; +static PyObject *__pyx_kp_u_30; +static PyObject *__pyx_kp_u_33; +static PyObject *__pyx_kp_s_35; +static PyObject *__pyx_kp_s_36; +static PyObject *__pyx_kp_s_37; +static PyObject *__pyx_kp_s_38; +static PyObject *__pyx_kp_s_39; +static PyObject *__pyx_n_s_6; +static PyObject *__pyx_n_s_7; +static PyObject *__pyx_n_s__C; +static PyObject *__pyx_n_s__IndexError; +static PyObject *__pyx_n_s__RuntimeError; +static PyObject *__pyx_n_s__ValueError; +static PyObject *__pyx_n_s__X; +static PyObject *__pyx_n_s____import__; +static PyObject *__pyx_n_s____len__; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____pyx_getbuffer; +static PyObject *__pyx_n_s____pyx_releasebuffer; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s__argsort; +static PyObject *__pyx_n_s__check_every; +static PyObject *__pyx_n_s__copy; +static PyObject *__pyx_n_s__dot; +static PyObject *__pyx_n_s__dtype; +static PyObject *__pyx_n_s__empty; +static PyObject *__pyx_n_s__endspan; +static PyObject *__pyx_n_s__endspan_alpha; +static PyObject *__pyx_n_s__float; +static PyObject *__pyx_n_s__get_basis; +static PyObject *__pyx_n_s__get_size; +static PyObject *__pyx_n_s__index; +static PyObject *__pyx_n_s__int; +static PyObject *__pyx_n_s__linvars; +static PyObject *__pyx_n_s__max_degree; +static PyObject *__pyx_n_s__max_terms; +static PyObject *__pyx_n_s__min_search_points; +static PyObject *__pyx_n_s__minspan; +static PyObject *__pyx_n_s__minspan_alpha; +static PyObject *__pyx_n_s__nan; +static PyObject *__pyx_n_s__np; +static PyObject *__pyx_n_s__numpy; +static PyObject *__pyx_n_s__ones; +static PyObject *__pyx_n_s__order; +static PyObject *__pyx_n_s__orthonormal_update; +static PyObject *__pyx_n_s__penalty; +static PyObject *__pyx_n_s__range; +static PyObject *__pyx_n_s__round; +static PyObject *__pyx_n_s__run; +static PyObject *__pyx_n_s__set_no_candidates; +static PyObject *__pyx_n_s__shape; +static PyObject *__pyx_n_s__sqrt; +static PyObject *__pyx_n_s__stopping_conditions; +static PyObject *__pyx_n_s__sum; +static PyObject *__pyx_n_s__thresh; +static PyObject *__pyx_n_s__weights; +static PyObject *__pyx_n_s__x; +static PyObject *__pyx_n_s__xlabels; +static PyObject *__pyx_n_s__y; +static PyObject *__pyx_n_s__zeros; +static PyObject *__pyx_int_0; +static PyObject *__pyx_int_1; +static PyObject *__pyx_int_2; +static PyObject *__pyx_int_neg_1; +static PyObject *__pyx_int_15; +static PyObject *__pyx_int_100; +static PyObject *__pyx_k_slice_4; +static PyObject *__pyx_k_slice_5; +static PyObject *__pyx_k_slice_8; +static PyObject *__pyx_k_slice_9; +static PyObject *__pyx_k_tuple_2; +static PyObject *__pyx_k_slice_10; +static PyObject *__pyx_k_slice_11; +static PyObject *__pyx_k_slice_12; +static PyObject *__pyx_k_slice_13; +static PyObject *__pyx_k_slice_14; +static PyObject *__pyx_k_slice_15; +static PyObject *__pyx_k_slice_16; +static PyObject *__pyx_k_slice_17; +static PyObject *__pyx_k_slice_18; +static PyObject *__pyx_k_slice_19; +static PyObject *__pyx_k_slice_20; +static PyObject *__pyx_k_slice_21; +static PyObject *__pyx_k_slice_22; +static PyObject *__pyx_k_tuple_24; +static PyObject *__pyx_k_tuple_26; +static PyObject *__pyx_k_tuple_28; +static PyObject *__pyx_k_tuple_31; +static PyObject *__pyx_k_tuple_32; +static PyObject *__pyx_k_tuple_34; + +/* Python wrapper */ +static int __pyx_pw_8_forward_13ForwardPasser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_8_forward_13ForwardPasser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_X = 0; + PyArrayObject *__pyx_v_y = 0; + PyArrayObject *__pyx_v_weights = 0; + PyObject *__pyx_v_kwargs = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1; + __Pyx_GOTREF(__pyx_v_kwargs); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__y,&__pyx_n_s__weights,0}; + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weights)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_X = ((PyArrayObject *)values[0]); + __pyx_v_y = ((PyArrayObject *)values[1]); + __pyx_v_weights = ((PyArrayObject *)values[2]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; + __Pyx_AddTraceback("_forward.ForwardPasser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weights), __pyx_ptype_5numpy_ndarray, 1, "weights", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_8_forward_13ForwardPasser___init__(((struct __pyx_obj_8_forward_ForwardPasser *)__pyx_v_self), __pyx_v_X, __pyx_v_y, __pyx_v_weights, __pyx_v_kwargs); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_forward.pyx":25 + * cdef class ForwardPasser: + * + * def __init__(ForwardPasser self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] weights, **kwargs): # <<<<<<<<<<<<<< + * cdef INDEX_t i + * self.X = X + */ + +static int __pyx_pf_8_forward_13ForwardPasser___init__(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_y, PyArrayObject *__pyx_v_weights, PyObject *__pyx_v_kwargs) { + __pyx_t_8_forward_INDEX_t __pyx_v_i; + PyObject *__pyx_v_linvar = NULL; + __Pyx_LocalBuf_ND __pyx_pybuffernd_X; + __Pyx_Buffer __pyx_pybuffer_X; + __Pyx_LocalBuf_ND __pyx_pybuffernd_weights; + __Pyx_Buffer __pyx_pybuffer_weights; + __Pyx_LocalBuf_ND __pyx_pybuffernd_y; + __Pyx_Buffer __pyx_pybuffer_y; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; + __pyx_t_8_forward_FLOAT_t __pyx_t_6; + __pyx_t_8_forward_INDEX_t __pyx_t_7; + __pyx_t_8_forward_INDEX_t __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + long __pyx_t_10; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + Py_ssize_t __pyx_t_13; + PyObject *(*__pyx_t_14)(PyObject *); + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + __pyx_pybuffer_X.pybuffer.buf = NULL; + __pyx_pybuffer_X.refcount = 0; + __pyx_pybuffernd_X.data = NULL; + __pyx_pybuffernd_X.rcbuffer = &__pyx_pybuffer_X; + __pyx_pybuffer_y.pybuffer.buf = NULL; + __pyx_pybuffer_y.refcount = 0; + __pyx_pybuffernd_y.data = NULL; + __pyx_pybuffernd_y.rcbuffer = &__pyx_pybuffer_y; + __pyx_pybuffer_weights.pybuffer.buf = NULL; + __pyx_pybuffer_weights.refcount = 0; + __pyx_pybuffernd_weights.data = NULL; + __pyx_pybuffernd_weights.rcbuffer = &__pyx_pybuffer_weights; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_y.diminfo[0].strides = __pyx_pybuffernd_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y.diminfo[0].shape = __pyx_pybuffernd_y.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_weights.diminfo[0].strides = __pyx_pybuffernd_weights.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weights.diminfo[0].shape = __pyx_pybuffernd_weights.rcbuffer->pybuffer.shape[0]; + + /* "_forward.pyx":27 + * def __init__(ForwardPasser self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] weights, **kwargs): + * cdef INDEX_t i + * self.X = X # <<<<<<<<<<<<<< + * self.y = y.copy() + * self.weights = weights + */ + __Pyx_INCREF(((PyObject *)__pyx_v_X)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_X)); + __Pyx_GOTREF(__pyx_v_self->X); + __Pyx_DECREF(((PyObject *)__pyx_v_self->X)); + __pyx_v_self->X = ((PyArrayObject *)__pyx_v_X); + + /* "_forward.pyx":28 + * cdef INDEX_t i + * self.X = X + * self.y = y.copy() # <<<<<<<<<<<<<< + * self.weights = weights + * apply_weights_1d(self.y, self.weights) + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_y), __pyx_n_s__copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_v_self->y); + __Pyx_DECREF(((PyObject *)__pyx_v_self->y)); + __pyx_v_self->y = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "_forward.pyx":29 + * self.X = X + * self.y = y.copy() + * self.weights = weights # <<<<<<<<<<<<<< + * apply_weights_1d(self.y, self.weights) + * self.m = self.X.shape[0] + */ + __Pyx_INCREF(((PyObject *)__pyx_v_weights)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_weights)); + __Pyx_GOTREF(__pyx_v_self->weights); + __Pyx_DECREF(((PyObject *)__pyx_v_self->weights)); + __pyx_v_self->weights = ((PyArrayObject *)__pyx_v_weights); + + /* "_forward.pyx":30 + * self.y = y.copy() + * self.weights = weights + * apply_weights_1d(self.y, self.weights) # <<<<<<<<<<<<<< + * self.m = self.X.shape[0] + * self.n = self.X.shape[1] + */ + __pyx_t_2 = ((PyObject *)__pyx_v_self->y); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_1 = ((PyObject *)__pyx_v_self->weights); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = __pyx_f_5_util_apply_weights_1d(((PyArrayObject *)__pyx_t_2), ((PyArrayObject *)__pyx_t_1), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "_forward.pyx":31 + * self.weights = weights + * apply_weights_1d(self.y, self.weights) + * self.m = self.X.shape[0] # <<<<<<<<<<<<<< + * self.n = self.X.shape[1] + * self.endspan = kwargs['endspan'] if 'endspan' in kwargs else -1 + */ + __pyx_v_self->m = (__pyx_v_self->X->dimensions[0]); + + /* "_forward.pyx":32 + * apply_weights_1d(self.y, self.weights) + * self.m = self.X.shape[0] + * self.n = self.X.shape[1] # <<<<<<<<<<<<<< + * self.endspan = kwargs['endspan'] if 'endspan' in kwargs else -1 + * self.minspan = kwargs['minspan'] if 'minspan' in kwargs else -1 + */ + __pyx_v_self->n = (__pyx_v_self->X->dimensions[1]); + + /* "_forward.pyx":33 + * self.m = self.X.shape[0] + * self.n = self.X.shape[1] + * self.endspan = kwargs['endspan'] if 'endspan' in kwargs else -1 # <<<<<<<<<<<<<< + * self.minspan = kwargs['minspan'] if 'minspan' in kwargs else -1 + * self.endspan_alpha = kwargs['endspan_alpha'] if 'endspan_alpha' in kwargs else .05 + */ + __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__endspan), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_4) { + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__endspan)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; + __pyx_t_1 = 0; + } else { + __Pyx_INCREF(__pyx_int_neg_1); + __pyx_t_3 = __pyx_int_neg_1; + } + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_self->endspan = __pyx_t_5; + + /* "_forward.pyx":34 + * self.n = self.X.shape[1] + * self.endspan = kwargs['endspan'] if 'endspan' in kwargs else -1 + * self.minspan = kwargs['minspan'] if 'minspan' in kwargs else -1 # <<<<<<<<<<<<<< + * self.endspan_alpha = kwargs['endspan_alpha'] if 'endspan_alpha' in kwargs else .05 + * self.minspan_alpha = kwargs['minspan_alpha'] if 'minspan_alpha' in kwargs else .05 + */ + __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__minspan), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_4) { + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__minspan)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; + __pyx_t_1 = 0; + } else { + __Pyx_INCREF(__pyx_int_neg_1); + __pyx_t_3 = __pyx_int_neg_1; + } + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_self->minspan = __pyx_t_5; + + /* "_forward.pyx":35 + * self.endspan = kwargs['endspan'] if 'endspan' in kwargs else -1 + * self.minspan = kwargs['minspan'] if 'minspan' in kwargs else -1 + * self.endspan_alpha = kwargs['endspan_alpha'] if 'endspan_alpha' in kwargs else .05 # <<<<<<<<<<<<<< + * self.minspan_alpha = kwargs['minspan_alpha'] if 'minspan_alpha' in kwargs else .05 + * self.max_terms = kwargs['max_terms'] if 'max_terms' in kwargs else 2*self.n + 10 + */ + __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__endspan_alpha), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_4) { + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__endspan_alpha)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; + __pyx_t_1 = 0; + } else { + __pyx_t_1 = PyFloat_FromDouble(.05); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; + __pyx_t_1 = 0; + } + __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_self->endspan_alpha = __pyx_t_6; + + /* "_forward.pyx":36 + * self.minspan = kwargs['minspan'] if 'minspan' in kwargs else -1 + * self.endspan_alpha = kwargs['endspan_alpha'] if 'endspan_alpha' in kwargs else .05 + * self.minspan_alpha = kwargs['minspan_alpha'] if 'minspan_alpha' in kwargs else .05 # <<<<<<<<<<<<<< + * self.max_terms = kwargs['max_terms'] if 'max_terms' in kwargs else 2*self.n + 10 + * self.max_degree = kwargs['max_degree'] if 'max_degree' in kwargs else 1 + */ + __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__minspan_alpha), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_4) { + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__minspan_alpha)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; + __pyx_t_1 = 0; + } else { + __pyx_t_1 = PyFloat_FromDouble(.05); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; + __pyx_t_1 = 0; + } + __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_self->minspan_alpha = __pyx_t_6; + + /* "_forward.pyx":37 + * self.endspan_alpha = kwargs['endspan_alpha'] if 'endspan_alpha' in kwargs else .05 + * self.minspan_alpha = kwargs['minspan_alpha'] if 'minspan_alpha' in kwargs else .05 + * self.max_terms = kwargs['max_terms'] if 'max_terms' in kwargs else 2*self.n + 10 # <<<<<<<<<<<<<< + * self.max_degree = kwargs['max_degree'] if 'max_degree' in kwargs else 1 + * self.thresh = kwargs['thresh'] if 'thresh' in kwargs else 0.001 + */ + __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__max_terms), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_4) { + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__max_terms)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; + __pyx_t_1 = 0; + } else { + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((2 * __pyx_v_self->n) + 10)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; + __pyx_t_1 = 0; + } + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_self->max_terms = __pyx_t_5; + + /* "_forward.pyx":38 + * self.minspan_alpha = kwargs['minspan_alpha'] if 'minspan_alpha' in kwargs else .05 + * self.max_terms = kwargs['max_terms'] if 'max_terms' in kwargs else 2*self.n + 10 + * self.max_degree = kwargs['max_degree'] if 'max_degree' in kwargs else 1 # <<<<<<<<<<<<<< + * self.thresh = kwargs['thresh'] if 'thresh' in kwargs else 0.001 + * self.penalty = kwargs['penalty'] if 'penalty' in kwargs else 3.0 + */ + __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__max_degree), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_4) { + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__max_degree)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; + __pyx_t_1 = 0; + } else { + __Pyx_INCREF(__pyx_int_1); + __pyx_t_3 = __pyx_int_1; + } + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_self->max_degree = __pyx_t_5; + + /* "_forward.pyx":39 + * self.max_terms = kwargs['max_terms'] if 'max_terms' in kwargs else 2*self.n + 10 + * self.max_degree = kwargs['max_degree'] if 'max_degree' in kwargs else 1 + * self.thresh = kwargs['thresh'] if 'thresh' in kwargs else 0.001 # <<<<<<<<<<<<<< + * self.penalty = kwargs['penalty'] if 'penalty' in kwargs else 3.0 + * self.check_every = kwargs['check_every'] if 'check_every' in kwargs else -1 + */ + __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__thresh), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_4) { + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__thresh)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; + __pyx_t_1 = 0; + } else { + __pyx_t_1 = PyFloat_FromDouble(0.001); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; + __pyx_t_1 = 0; + } + __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_self->thresh = __pyx_t_6; + + /* "_forward.pyx":40 + * self.max_degree = kwargs['max_degree'] if 'max_degree' in kwargs else 1 + * self.thresh = kwargs['thresh'] if 'thresh' in kwargs else 0.001 + * self.penalty = kwargs['penalty'] if 'penalty' in kwargs else 3.0 # <<<<<<<<<<<<<< + * self.check_every = kwargs['check_every'] if 'check_every' in kwargs else -1 + * self.min_search_points = kwargs['min_search_points'] if 'min_search_points' in kwargs else 100 + */ + __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__penalty), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_4) { + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__penalty)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; + __pyx_t_1 = 0; + } else { + __pyx_t_1 = PyFloat_FromDouble(3.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; + __pyx_t_1 = 0; + } + __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_self->penalty = __pyx_t_6; + + /* "_forward.pyx":41 + * self.thresh = kwargs['thresh'] if 'thresh' in kwargs else 0.001 + * self.penalty = kwargs['penalty'] if 'penalty' in kwargs else 3.0 + * self.check_every = kwargs['check_every'] if 'check_every' in kwargs else -1 # <<<<<<<<<<<<<< + * self.min_search_points = kwargs['min_search_points'] if 'min_search_points' in kwargs else 100 + * self.xlabels = kwargs['xlabels'] if 'xlabels' in kwargs else ['x'+str(i) for i in range(self.n)] + */ + __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__check_every), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_4) { + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__check_every)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; + __pyx_t_1 = 0; + } else { + __Pyx_INCREF(__pyx_int_neg_1); + __pyx_t_3 = __pyx_int_neg_1; + } + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_self->check_every = __pyx_t_5; + + /* "_forward.pyx":42 + * self.penalty = kwargs['penalty'] if 'penalty' in kwargs else 3.0 + * self.check_every = kwargs['check_every'] if 'check_every' in kwargs else -1 + * self.min_search_points = kwargs['min_search_points'] if 'min_search_points' in kwargs else 100 # <<<<<<<<<<<<<< + * self.xlabels = kwargs['xlabels'] if 'xlabels' in kwargs else ['x'+str(i) for i in range(self.n)] + * if self.check_every < 0: + */ + __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__min_search_points), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_4) { + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__min_search_points)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; + __pyx_t_1 = 0; + } else { + __Pyx_INCREF(__pyx_int_100); + __pyx_t_3 = __pyx_int_100; + } + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_self->min_search_points = __pyx_t_5; + + /* "_forward.pyx":43 + * self.check_every = kwargs['check_every'] if 'check_every' in kwargs else -1 + * self.min_search_points = kwargs['min_search_points'] if 'min_search_points' in kwargs else 100 + * self.xlabels = kwargs['xlabels'] if 'xlabels' in kwargs else ['x'+str(i) for i in range(self.n)] # <<<<<<<<<<<<<< + * if self.check_every < 0: + * self.check_every = (self.m / self.min_search_points) if self.m > self.min_search_points else 1 + */ + __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__xlabels), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_4) { + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__xlabels)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; + __pyx_t_1 = 0; + } else { + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = __pyx_v_self->n; + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { + __pyx_v_i = __pyx_t_8; + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + __pyx_t_9 = PyNumber_Add(((PyObject *)__pyx_n_s__x), __pyx_t_2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_9))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __pyx_t_3 = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + } + if (!(likely(PyList_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_v_self->xlabels); + __Pyx_DECREF(((PyObject *)__pyx_v_self->xlabels)); + __pyx_v_self->xlabels = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + + /* "_forward.pyx":44 + * self.min_search_points = kwargs['min_search_points'] if 'min_search_points' in kwargs else 100 + * self.xlabels = kwargs['xlabels'] if 'xlabels' in kwargs else ['x'+str(i) for i in range(self.n)] + * if self.check_every < 0: # <<<<<<<<<<<<<< + * self.check_every = (self.m / self.min_search_points) if self.m > self.min_search_points else 1 + * self.sst = (np.dot(self.y,self.y) - (np.dot(np.sqrt(self.weights),self.y) / np.sqrt(np.sum(self.weights)))**2) / self.m + */ + __pyx_t_4 = (__pyx_v_self->check_every < 0); + if (__pyx_t_4) { + + /* "_forward.pyx":45 + * self.xlabels = kwargs['xlabels'] if 'xlabels' in kwargs else ['x'+str(i) for i in range(self.n)] + * if self.check_every < 0: + * self.check_every = (self.m / self.min_search_points) if self.m > self.min_search_points else 1 # <<<<<<<<<<<<<< + * self.sst = (np.dot(self.y,self.y) - (np.dot(np.sqrt(self.weights),self.y) / np.sqrt(np.sum(self.weights)))**2) / self.m + * self.y_squared = np.dot(self.y,self.y) + */ + if ((__pyx_v_self->m > __pyx_v_self->min_search_points)) { + __pyx_t_10 = ((int)(__pyx_v_self->m / __pyx_v_self->min_search_points)); + } else { + __pyx_t_10 = 1; + } + __pyx_v_self->check_every = __pyx_t_10; + goto __pyx_L5; + } + __pyx_L5:; + + /* "_forward.pyx":46 + * if self.check_every < 0: + * self.check_every = (self.m / self.min_search_points) if self.m > self.min_search_points else 1 + * self.sst = (np.dot(self.y,self.y) - (np.dot(np.sqrt(self.weights),self.y) / np.sqrt(np.sum(self.weights)))**2) / self.m # <<<<<<<<<<<<<< + * self.y_squared = np.dot(self.y,self.y) + * self.record = ForwardPassRecord(self.m,self.n,self.penalty,self.sst) + */ + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__dot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_self->y)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self->y)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->y)); + __Pyx_INCREF(((PyObject *)__pyx_v_self->y)); + PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_self->y)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->y)); + __pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__dot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__sqrt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_self->weights)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self->weights)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->weights)); + __pyx_t_11 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_11); + __Pyx_GIVEREF(__pyx_t_11); + __Pyx_INCREF(((PyObject *)__pyx_v_self->y)); + PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_self->y)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->y)); + __pyx_t_11 = 0; + __pyx_t_11 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__sqrt); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__sum); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_self->weights)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self->weights)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->weights)); + __pyx_t_12 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + __pyx_t_12 = 0; + __pyx_t_12 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_11, __pyx_t_12); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyNumber_Power(__pyx_t_3, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Subtract(__pyx_t_9, __pyx_t_12); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_9 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_12); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_9); if (unlikely((__pyx_t_6 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_v_self->sst = __pyx_t_6; + + /* "_forward.pyx":47 + * self.check_every = (self.m / self.min_search_points) if self.m > self.min_search_points else 1 + * self.sst = (np.dot(self.y,self.y) - (np.dot(np.sqrt(self.weights),self.y) / np.sqrt(np.sum(self.weights)))**2) / self.m + * self.y_squared = np.dot(self.y,self.y) # <<<<<<<<<<<<<< + * self.record = ForwardPassRecord(self.m,self.n,self.penalty,self.sst) + * self.basis = Basis() + */ + __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__dot); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_INCREF(((PyObject *)__pyx_v_self->y)); + PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_v_self->y)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->y)); + __Pyx_INCREF(((PyObject *)__pyx_v_self->y)); + PyTuple_SET_ITEM(__pyx_t_9, 1, ((PyObject *)__pyx_v_self->y)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->y)); + __pyx_t_3 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_self->y_squared = __pyx_t_6; + + /* "_forward.pyx":48 + * self.sst = (np.dot(self.y,self.y) - (np.dot(np.sqrt(self.weights),self.y) / np.sqrt(np.sum(self.weights)))**2) / self.m + * self.y_squared = np.dot(self.y,self.y) + * self.record = ForwardPassRecord(self.m,self.n,self.penalty,self.sst) # <<<<<<<<<<<<<< + * self.basis = Basis() + * self.basis.append(ConstantBasisFunction()) + */ + __pyx_t_3 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_9 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->n); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_12 = PyFloat_FromDouble(__pyx_v_self->penalty); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_11 = PyFloat_FromDouble(__pyx_v_self->sst); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_11); + __Pyx_GIVEREF(__pyx_t_11); + __pyx_t_3 = 0; + __pyx_t_9 = 0; + __pyx_t_12 = 0; + __pyx_t_11 = 0; + __pyx_t_11 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7_record_ForwardPassRecord)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_GIVEREF(__pyx_t_11); + __Pyx_GOTREF(__pyx_v_self->record); + __Pyx_DECREF(((PyObject *)__pyx_v_self->record)); + __pyx_v_self->record = ((struct __pyx_obj_7_record_ForwardPassRecord *)__pyx_t_11); + __pyx_t_11 = 0; + + /* "_forward.pyx":49 + * self.y_squared = np.dot(self.y,self.y) + * self.record = ForwardPassRecord(self.m,self.n,self.penalty,self.sst) + * self.basis = Basis() # <<<<<<<<<<<<<< + * self.basis.append(ConstantBasisFunction()) + * + */ + __pyx_t_11 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6_basis_Basis)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_GIVEREF(__pyx_t_11); + __Pyx_GOTREF(__pyx_v_self->basis); + __Pyx_DECREF(((PyObject *)__pyx_v_self->basis)); + __pyx_v_self->basis = ((struct __pyx_obj_6_basis_Basis *)__pyx_t_11); + __pyx_t_11 = 0; + + /* "_forward.pyx":50 + * self.record = ForwardPassRecord(self.m,self.n,self.penalty,self.sst) + * self.basis = Basis() + * self.basis.append(ConstantBasisFunction()) # <<<<<<<<<<<<<< + * + * self.sorting = np.empty(shape=self.m, dtype=np.int) + */ + __pyx_t_11 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6_basis_ConstantBasisFunction)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->append(__pyx_v_self->basis, ((struct __pyx_obj_6_basis_BasisFunction *)__pyx_t_11), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "_forward.pyx":52 + * self.basis.append(ConstantBasisFunction()) + * + * self.sorting = np.empty(shape=self.m, dtype=np.int) # <<<<<<<<<<<<<< + * self.mwork = np.empty(shape=self.m, dtype=np.int) + * self.u = np.empty(shape=self.max_terms, dtype=float) + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_12 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__shape), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__int); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_9); + __Pyx_GOTREF(__pyx_v_self->sorting); + __Pyx_DECREF(((PyObject *)__pyx_v_self->sorting)); + __pyx_v_self->sorting = ((PyArrayObject *)__pyx_t_9); + __pyx_t_9 = 0; + + /* "_forward.pyx":53 + * + * self.sorting = np.empty(shape=self.m, dtype=np.int) + * self.mwork = np.empty(shape=self.m, dtype=np.int) # <<<<<<<<<<<<<< + * self.u = np.empty(shape=self.max_terms, dtype=float) + * self.B_orth_times_parent_cum = np.empty(shape=self.max_terms,dtype=np.float) + */ + __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + __pyx_t_11 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__shape), __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s__int); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_12); + __Pyx_GOTREF(__pyx_v_self->mwork); + __Pyx_DECREF(((PyObject *)__pyx_v_self->mwork)); + __pyx_v_self->mwork = ((PyArrayObject *)__pyx_t_12); + __pyx_t_12 = 0; + + /* "_forward.pyx":54 + * self.sorting = np.empty(shape=self.m, dtype=np.int) + * self.mwork = np.empty(shape=self.m, dtype=np.int) + * self.u = np.empty(shape=self.max_terms, dtype=float) # <<<<<<<<<<<<<< + * self.B_orth_times_parent_cum = np.empty(shape=self.max_terms,dtype=np.float) + * self.B = np.ones(shape=(self.m,self.max_terms), order='C',dtype=np.float) + */ + __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__empty); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_12)); + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__shape), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)(&PyFloat_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->u); + __Pyx_DECREF(((PyObject *)__pyx_v_self->u)); + __pyx_v_self->u = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "_forward.pyx":55 + * self.mwork = np.empty(shape=self.m, dtype=np.int) + * self.u = np.empty(shape=self.max_terms, dtype=float) + * self.B_orth_times_parent_cum = np.empty(shape=self.max_terms,dtype=np.float) # <<<<<<<<<<<<<< + * self.B = np.ones(shape=(self.m,self.max_terms), order='C',dtype=np.float) + * self.basis.weighted_transform(self.X,self.B,self.weights) + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_9 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__shape), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__float); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_11) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_11, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_11); + __Pyx_GOTREF(__pyx_v_self->B_orth_times_parent_cum); + __Pyx_DECREF(((PyObject *)__pyx_v_self->B_orth_times_parent_cum)); + __pyx_v_self->B_orth_times_parent_cum = ((PyArrayObject *)__pyx_t_11); + __pyx_t_11 = 0; + + /* "_forward.pyx":56 + * self.u = np.empty(shape=self.max_terms, dtype=float) + * self.B_orth_times_parent_cum = np.empty(shape=self.max_terms,dtype=np.float) + * self.B = np.ones(shape=(self.m,self.max_terms), order='C',dtype=np.float) # <<<<<<<<<<<<<< + * self.basis.weighted_transform(self.X,self.B,self.weights) + * self.B_orth = self.B.copy() #An orthogonal matrix with the same column space as B + */ + __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s__ones); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_11)); + __pyx_t_12 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_9 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_12 = 0; + __pyx_t_9 = 0; + if (PyDict_SetItem(__pyx_t_11, ((PyObject *)__pyx_n_s__shape), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_11, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__float); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_11, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_11)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; + if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_9); + __Pyx_GOTREF(__pyx_v_self->B); + __Pyx_DECREF(((PyObject *)__pyx_v_self->B)); + __pyx_v_self->B = ((PyArrayObject *)__pyx_t_9); + __pyx_t_9 = 0; + + /* "_forward.pyx":57 + * self.B_orth_times_parent_cum = np.empty(shape=self.max_terms,dtype=np.float) + * self.B = np.ones(shape=(self.m,self.max_terms), order='C',dtype=np.float) + * self.basis.weighted_transform(self.X,self.B,self.weights) # <<<<<<<<<<<<<< + * self.B_orth = self.B.copy() #An orthogonal matrix with the same column space as B + * self.u = np.empty(shape=self.max_terms, dtype=np.float) + */ + __pyx_t_9 = ((PyObject *)__pyx_v_self->X); + __Pyx_INCREF(__pyx_t_9); + __pyx_t_11 = ((PyObject *)__pyx_v_self->B); + __Pyx_INCREF(__pyx_t_11); + __pyx_t_1 = ((PyObject *)__pyx_v_self->weights); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = ((struct __pyx_vtabstruct_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->weighted_transform(__pyx_v_self->basis, ((PyArrayObject *)__pyx_t_9), ((PyArrayObject *)__pyx_t_11), ((PyArrayObject *)__pyx_t_1), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "_forward.pyx":58 + * self.B = np.ones(shape=(self.m,self.max_terms), order='C',dtype=np.float) + * self.basis.weighted_transform(self.X,self.B,self.weights) + * self.B_orth = self.B.copy() #An orthogonal matrix with the same column space as B # <<<<<<<<<<<<<< + * self.u = np.empty(shape=self.max_terms, dtype=np.float) + * self.c = np.empty(shape=self.max_terms, dtype=np.float) + */ + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->B), __pyx_n_s__copy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->B_orth); + __Pyx_DECREF(((PyObject *)__pyx_v_self->B_orth)); + __pyx_v_self->B_orth = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "_forward.pyx":59 + * self.basis.weighted_transform(self.X,self.B,self.weights) + * self.B_orth = self.B.copy() #An orthogonal matrix with the same column space as B + * self.u = np.empty(shape=self.max_terms, dtype=np.float) # <<<<<<<<<<<<<< + * self.c = np.empty(shape=self.max_terms, dtype=np.float) + * self.norms = np.empty(shape=self.max_terms, dtype=np.float) + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_11 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__shape), __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s__float); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_9); + __Pyx_GOTREF(__pyx_v_self->u); + __Pyx_DECREF(((PyObject *)__pyx_v_self->u)); + __pyx_v_self->u = ((PyArrayObject *)__pyx_t_9); + __pyx_t_9 = 0; + + /* "_forward.pyx":60 + * self.B_orth = self.B.copy() #An orthogonal matrix with the same column space as B + * self.u = np.empty(shape=self.max_terms, dtype=np.float) + * self.c = np.empty(shape=self.max_terms, dtype=np.float) # <<<<<<<<<<<<<< + * self.norms = np.empty(shape=self.max_terms, dtype=np.float) + * self.c_squared = 0.0 + */ + __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_9)); + __pyx_t_3 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__shape), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__float); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + if (!(likely(((__pyx_t_11) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_11, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_11); + __Pyx_GOTREF(__pyx_v_self->c); + __Pyx_DECREF(((PyObject *)__pyx_v_self->c)); + __pyx_v_self->c = ((PyArrayObject *)__pyx_t_11); + __pyx_t_11 = 0; + + /* "_forward.pyx":61 + * self.u = np.empty(shape=self.max_terms, dtype=np.float) + * self.c = np.empty(shape=self.max_terms, dtype=np.float) + * self.norms = np.empty(shape=self.max_terms, dtype=np.float) # <<<<<<<<<<<<<< + * self.c_squared = 0.0 + * self.sort_tracker = np.empty(shape=self.m, dtype=np.int) + */ + __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s__empty); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_11)); + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_11, ((PyObject *)__pyx_n_s__shape), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__float); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_t_11, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_11)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_GOTREF(__pyx_v_self->norms); + __Pyx_DECREF(((PyObject *)__pyx_v_self->norms)); + __pyx_v_self->norms = ((PyArrayObject *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "_forward.pyx":62 + * self.c = np.empty(shape=self.max_terms, dtype=np.float) + * self.norms = np.empty(shape=self.max_terms, dtype=np.float) + * self.c_squared = 0.0 # <<<<<<<<<<<<<< + * self.sort_tracker = np.empty(shape=self.m, dtype=np.int) + * for i in range(self.m): + */ + __pyx_v_self->c_squared = 0.0; + + /* "_forward.pyx":63 + * self.norms = np.empty(shape=self.max_terms, dtype=np.float) + * self.c_squared = 0.0 + * self.sort_tracker = np.empty(shape=self.m, dtype=np.int) # <<<<<<<<<<<<<< + * for i in range(self.m): + * self.sort_tracker[i] = i + */ + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_9 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__shape), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__int); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->sort_tracker); + __Pyx_DECREF(((PyObject *)__pyx_v_self->sort_tracker)); + __pyx_v_self->sort_tracker = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "_forward.pyx":64 + * self.c_squared = 0.0 + * self.sort_tracker = np.empty(shape=self.m, dtype=np.int) + * for i in range(self.m): # <<<<<<<<<<<<<< + * self.sort_tracker[i] = i + * self.zero_tol = 1e-6 + */ + __pyx_t_7 = __pyx_v_self->m; + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { + __pyx_v_i = __pyx_t_8; + + /* "_forward.pyx":65 + * self.sort_tracker = np.empty(shape=self.m, dtype=np.int) + * for i in range(self.m): + * self.sort_tracker[i] = i # <<<<<<<<<<<<<< + * self.zero_tol = 1e-6 + * + */ + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_self->sort_tracker), __pyx_v_i, __pyx_t_1, sizeof(__pyx_t_8_forward_INDEX_t)+1, __Pyx_PyInt_to_py_npy_ulonglong, 0, 0, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_forward.pyx":66 + * for i in range(self.m): + * self.sort_tracker[i] = i + * self.zero_tol = 1e-6 # <<<<<<<<<<<<<< + * + * self.linear_variables = np.zeros(shape=self.n,dtype=np.int) + */ + __pyx_v_self->zero_tol = 1e-6; + + /* "_forward.pyx":68 + * self.zero_tol = 1e-6 + * + * self.linear_variables = np.zeros(shape=self.n,dtype=np.int) # <<<<<<<<<<<<<< + * self.init_linear_variables() + * + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_11 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->n); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__shape), __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s__int); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_9); + __Pyx_GOTREF(__pyx_v_self->linear_variables); + __Pyx_DECREF(((PyObject *)__pyx_v_self->linear_variables)); + __pyx_v_self->linear_variables = ((PyArrayObject *)__pyx_t_9); + __pyx_t_9 = 0; + + /* "_forward.pyx":69 + * + * self.linear_variables = np.zeros(shape=self.n,dtype=np.int) + * self.init_linear_variables() # <<<<<<<<<<<<<< + * + * #Add in user selected linear variables + */ + __pyx_t_9 = ((struct __pyx_vtabstruct_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->init_linear_variables(__pyx_v_self, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "_forward.pyx":72 + * + * #Add in user selected linear variables + * if 'linvars' in kwargs: # <<<<<<<<<<<<<< + * for linvar in kwargs['linvars']: + * if linvar in self.xlabels: + */ + __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__linvars), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_4) { + + /* "_forward.pyx":73 + * #Add in user selected linear variables + * if 'linvars' in kwargs: + * for linvar in kwargs['linvars']: # <<<<<<<<<<<<<< + * if linvar in self.xlabels: + * self.linear_variables[self.xlabels.index(linvar)] = 1 + */ + __pyx_t_9 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__linvars)); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + if (PyList_CheckExact(__pyx_t_9) || PyTuple_CheckExact(__pyx_t_9)) { + __pyx_t_1 = __pyx_t_9; __Pyx_INCREF(__pyx_t_1); __pyx_t_13 = 0; + __pyx_t_14 = NULL; + } else { + __pyx_t_13 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_14 = Py_TYPE(__pyx_t_1)->tp_iternext; + } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + for (;;) { + if (!__pyx_t_14 && PyList_CheckExact(__pyx_t_1)) { + if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_9 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_9); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_9 = PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_14 && PyTuple_CheckExact(__pyx_t_1)) { + if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_9); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_9 = PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_9 = __pyx_t_14(__pyx_t_1); + if (unlikely(!__pyx_t_9)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_9); + } + __Pyx_XDECREF(__pyx_v_linvar); + __pyx_v_linvar = __pyx_t_9; + __pyx_t_9 = 0; + + /* "_forward.pyx":74 + * if 'linvars' in kwargs: + * for linvar in kwargs['linvars']: + * if linvar in self.xlabels: # <<<<<<<<<<<<<< + * self.linear_variables[self.xlabels.index(linvar)] = 1 + * elif linvar in range(self.n): + */ + __pyx_t_4 = (__Pyx_PySequence_Contains(__pyx_v_linvar, ((PyObject *)__pyx_v_self->xlabels), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_4) { + + /* "_forward.pyx":75 + * for linvar in kwargs['linvars']: + * if linvar in self.xlabels: + * self.linear_variables[self.xlabels.index(linvar)] = 1 # <<<<<<<<<<<<<< + * elif linvar in range(self.n): + * self.linear_variables[linvar] = 1 + */ + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->xlabels), __pyx_n_s__index); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_linvar); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_linvar); + __Pyx_GIVEREF(__pyx_v_linvar); + __pyx_t_11 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + if (PyObject_SetItem(((PyObject *)__pyx_v_self->linear_variables), __pyx_t_11, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + goto __pyx_L11; + } + + /* "_forward.pyx":76 + * if linvar in self.xlabels: + * self.linear_variables[self.xlabels.index(linvar)] = 1 + * elif linvar in range(self.n): # <<<<<<<<<<<<<< + * self.linear_variables[linvar] = 1 + * else: + */ + __pyx_t_11 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->n); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_11); + __Pyx_GIVEREF(__pyx_t_11); + __pyx_t_11 = 0; + __pyx_t_11 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_4 = (__Pyx_PySequence_Contains(__pyx_v_linvar, __pyx_t_11, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + if (__pyx_t_4) { + + /* "_forward.pyx":77 + * self.linear_variables[self.xlabels.index(linvar)] = 1 + * elif linvar in range(self.n): + * self.linear_variables[linvar] = 1 # <<<<<<<<<<<<<< + * else: + * raise IndexError('Unknown variable selected in linvars argument.') + */ + if (PyObject_SetItem(((PyObject *)__pyx_v_self->linear_variables), __pyx_v_linvar, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L11; + } + /*else*/ { + + /* "_forward.pyx":79 + * self.linear_variables[linvar] = 1 + * else: + * raise IndexError('Unknown variable selected in linvars argument.') # <<<<<<<<<<<<<< + * + * #Initialize B_orth, c, and c_squared (assuming column 0 of B_orth is already filled with 1) + */ + __pyx_t_11 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_Raise(__pyx_t_11, 0, 0, 0); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L11:; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L8; + } + __pyx_L8:; + + /* "_forward.pyx":82 + * + * #Initialize B_orth, c, and c_squared (assuming column 0 of B_orth is already filled with 1) + * self.orthonormal_update(0) # <<<<<<<<<<<<<< + * + * cpdef Basis get_basis(ForwardPasser self): + */ + ((struct __pyx_vtabstruct_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_update(__pyx_v_self, 0, 0); + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("_forward.ForwardPasser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF(__pyx_v_linvar); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_forward.pyx":84 + * self.orthonormal_update(0) + * + * cpdef Basis get_basis(ForwardPasser self): # <<<<<<<<<<<<<< + * return self.basis + * + */ + +static PyObject *__pyx_pw_8_forward_13ForwardPasser_3get_basis(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static struct __pyx_obj_6_basis_Basis *__pyx_f_8_forward_13ForwardPasser_get_basis(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self, int __pyx_skip_dispatch) { + struct __pyx_obj_6_basis_Basis *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_basis", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_basis); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8_forward_13ForwardPasser_3get_basis)) { + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6_basis_Basis))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((struct __pyx_obj_6_basis_Basis *)__pyx_t_2); + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_forward.pyx":85 + * + * cpdef Basis get_basis(ForwardPasser self): + * return self.basis # <<<<<<<<<<<<<< + * + * cpdef init_linear_variables(ForwardPasser self): + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)__pyx_v_self->basis)); + __pyx_r = __pyx_v_self->basis; + goto __pyx_L0; + + __pyx_r = ((struct __pyx_obj_6_basis_Basis *)Py_None); __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("_forward.ForwardPasser.get_basis", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_8_forward_13ForwardPasser_3get_basis(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_8_forward_13ForwardPasser_3get_basis(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_basis (wrapper)", 0); + __pyx_r = __pyx_pf_8_forward_13ForwardPasser_2get_basis(((struct __pyx_obj_8_forward_ForwardPasser *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_forward.pyx":84 + * self.orthonormal_update(0) + * + * cpdef Basis get_basis(ForwardPasser self): # <<<<<<<<<<<<<< + * return self.basis + * + */ + +static PyObject *__pyx_pf_8_forward_13ForwardPasser_2get_basis(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_basis", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->get_basis(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_forward.ForwardPasser.get_basis", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_forward.pyx":87 + * return self.basis + * + * cpdef init_linear_variables(ForwardPasser self): # <<<<<<<<<<<<<< + * cdef INDEX_t variable + * cdef INDEX_t endspan + */ + +static PyObject *__pyx_pw_8_forward_13ForwardPasser_5init_linear_variables(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_f_8_forward_13ForwardPasser_init_linear_variables(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self, int __pyx_skip_dispatch) { + __pyx_t_8_forward_INDEX_t __pyx_v_variable; + __pyx_t_8_forward_INDEX_t __pyx_v_endspan; + PyArrayObject *__pyx_v_order = 0; + PyArrayObject *__pyx_v_linear_variables = 0; + PyArrayObject *__pyx_v_B = 0; + PyArrayObject *__pyx_v_X = 0; + struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_root_basis_function = 0; + __Pyx_LocalBuf_ND __pyx_pybuffernd_B; + __Pyx_Buffer __pyx_pybuffer_B; + __Pyx_LocalBuf_ND __pyx_pybuffernd_X; + __Pyx_Buffer __pyx_pybuffer_X; + __Pyx_LocalBuf_ND __pyx_pybuffernd_linear_variables; + __Pyx_Buffer __pyx_pybuffer_linear_variables; + __Pyx_LocalBuf_ND __pyx_pybuffernd_order; + __Pyx_Buffer __pyx_pybuffer_order; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyArrayObject *__pyx_t_3 = NULL; + PyArrayObject *__pyx_t_4 = NULL; + PyArrayObject *__pyx_t_5 = NULL; + int __pyx_t_6; + __pyx_t_8_forward_INDEX_t __pyx_t_7; + __pyx_t_8_forward_INDEX_t __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + PyArrayObject *__pyx_t_10 = NULL; + int __pyx_t_11; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + PyObject *__pyx_t_15 = NULL; + __pyx_t_8_forward_INDEX_t __pyx_t_16; + __pyx_t_8_forward_INDEX_t __pyx_t_17; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("init_linear_variables", 0); + __pyx_pybuffer_order.pybuffer.buf = NULL; + __pyx_pybuffer_order.refcount = 0; + __pyx_pybuffernd_order.data = NULL; + __pyx_pybuffernd_order.rcbuffer = &__pyx_pybuffer_order; + __pyx_pybuffer_linear_variables.pybuffer.buf = NULL; + __pyx_pybuffer_linear_variables.refcount = 0; + __pyx_pybuffernd_linear_variables.data = NULL; + __pyx_pybuffernd_linear_variables.rcbuffer = &__pyx_pybuffer_linear_variables; + __pyx_pybuffer_B.pybuffer.buf = NULL; + __pyx_pybuffer_B.refcount = 0; + __pyx_pybuffernd_B.data = NULL; + __pyx_pybuffernd_B.rcbuffer = &__pyx_pybuffer_B; + __pyx_pybuffer_X.pybuffer.buf = NULL; + __pyx_pybuffer_X.refcount = 0; + __pyx_pybuffernd_X.data = NULL; + __pyx_pybuffernd_X.rcbuffer = &__pyx_pybuffer_X; + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8_forward_13ForwardPasser_5init_linear_variables)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_forward.pyx":91 + * cdef INDEX_t endspan + * cdef cnp.ndarray[INT_t, ndim=1] order + * cdef cnp.ndarray[INT_t, ndim=1] linear_variables = self.linear_variables # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t, ndim=2] B = self.B + * cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X + */ + __pyx_t_3 = ((PyArrayObject *)__pyx_v_self->linear_variables); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_linear_variables.rcbuffer->pybuffer, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_linear_variables = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_linear_variables.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_linear_variables.diminfo[0].strides = __pyx_pybuffernd_linear_variables.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_linear_variables.diminfo[0].shape = __pyx_pybuffernd_linear_variables.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_3 = 0; + __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->linear_variables))); + __pyx_v_linear_variables = ((PyArrayObject *)__pyx_v_self->linear_variables); + + /* "_forward.pyx":92 + * cdef cnp.ndarray[INT_t, ndim=1] order + * cdef cnp.ndarray[INT_t, ndim=1] linear_variables = self.linear_variables + * cdef cnp.ndarray[FLOAT_t, ndim=2] B = self.B # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X + * if self.endspan < 0: + */ + __pyx_t_4 = ((PyArrayObject *)__pyx_v_self->B); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + __pyx_v_B = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_B.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_B.diminfo[0].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B.diminfo[0].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B.diminfo[1].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B.diminfo[1].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_4 = 0; + __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->B))); + __pyx_v_B = ((PyArrayObject *)__pyx_v_self->B); + + /* "_forward.pyx":93 + * cdef cnp.ndarray[INT_t, ndim=1] linear_variables = self.linear_variables + * cdef cnp.ndarray[FLOAT_t, ndim=2] B = self.B + * cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X # <<<<<<<<<<<<<< + * if self.endspan < 0: + * endspan = round(3 - log2(self.endspan_alpha/self.n)) + */ + __pyx_t_5 = ((PyArrayObject *)__pyx_v_self->X); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + __pyx_v_X = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_5 = 0; + __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->X))); + __pyx_v_X = ((PyArrayObject *)__pyx_v_self->X); + + /* "_forward.pyx":94 + * cdef cnp.ndarray[FLOAT_t, ndim=2] B = self.B + * cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X + * if self.endspan < 0: # <<<<<<<<<<<<<< + * endspan = round(3 - log2(self.endspan_alpha/self.n)) + * cdef ConstantBasisFunction root_basis_function = self.basis[0] + */ + __pyx_t_6 = (__pyx_v_self->endspan < 0); + if (__pyx_t_6) { + + /* "_forward.pyx":95 + * cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X + * if self.endspan < 0: + * endspan = round(3 - log2(self.endspan_alpha/self.n)) # <<<<<<<<<<<<<< + * cdef ConstantBasisFunction root_basis_function = self.basis[0] + * for variable in range(self.n): + */ + __pyx_t_1 = PyFloat_FromDouble((3.0 - __pyx_f_5_util_log2((__pyx_v_self->endspan_alpha / __pyx_v_self->n)))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_round, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_7 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_7 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_endspan = __pyx_t_7; + goto __pyx_L3; + } + __pyx_L3:; + + /* "_forward.pyx":96 + * if self.endspan < 0: + * endspan = round(3 - log2(self.endspan_alpha/self.n)) + * cdef ConstantBasisFunction root_basis_function = self.basis[0] # <<<<<<<<<<<<<< + * for variable in range(self.n): + * order = np.argsort(X[:,variable])[::-1] + */ + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->basis), 0, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6_basis_ConstantBasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_root_basis_function = ((struct __pyx_obj_6_basis_ConstantBasisFunction *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "_forward.pyx":97 + * endspan = round(3 - log2(self.endspan_alpha/self.n)) + * cdef ConstantBasisFunction root_basis_function = self.basis[0] + * for variable in range(self.n): # <<<<<<<<<<<<<< + * order = np.argsort(X[:,variable])[::-1] + * if root_basis_function.valid_knots(B[order,0], X[order,variable], + */ + __pyx_t_7 = __pyx_v_self->n; + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { + __pyx_v_variable = __pyx_t_8; + + /* "_forward.pyx":98 + * cdef ConstantBasisFunction root_basis_function = self.basis[0] + * for variable in range(self.n): + * order = np.argsort(X[:,variable])[::-1] # <<<<<<<<<<<<<< + * if root_basis_function.valid_knots(B[order,0], X[order,variable], + * variable, self.check_every, endspan, + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__argsort); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_INCREF(__pyx_k_slice_4); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_k_slice_4); + __Pyx_GIVEREF(__pyx_k_slice_4); + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_X), ((PyObject *)__pyx_t_9)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + __pyx_t_9 = PyObject_GetItem(__pyx_t_1, __pyx_k_slice_5); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = ((PyArrayObject *)__pyx_t_9); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_order.rcbuffer->pybuffer); + __pyx_t_11 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_order.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); + if (unlikely(__pyx_t_11 < 0)) { + PyErr_Fetch(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_order.rcbuffer->pybuffer, (PyObject*)__pyx_v_order, &__Pyx_TypeInfo_nn___pyx_t_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_12, __pyx_t_13, __pyx_t_14); + } + } + __pyx_pybuffernd_order.diminfo[0].strides = __pyx_pybuffernd_order.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_order.diminfo[0].shape = __pyx_pybuffernd_order.rcbuffer->pybuffer.shape[0]; + if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_10 = 0; + __Pyx_XDECREF(((PyObject *)__pyx_v_order)); + __pyx_v_order = ((PyArrayObject *)__pyx_t_9); + __pyx_t_9 = 0; + + /* "_forward.pyx":99 + * for variable in range(self.n): + * order = np.argsort(X[:,variable])[::-1] + * if root_basis_function.valid_knots(B[order,0], X[order,variable], # <<<<<<<<<<<<<< + * variable, self.check_every, endspan, + * self.minspan, self.minspan_alpha, + */ + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_INCREF(((PyObject *)__pyx_v_order)); + PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_v_order)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_order)); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_9)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_v_order)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_order)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_order)); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_9 = 0; + __pyx_t_9 = PyObject_GetItem(((PyObject *)__pyx_v_X), ((PyObject *)__pyx_t_2)); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "_forward.pyx":102 + * variable, self.check_every, endspan, + * self.minspan, self.minspan_alpha, + * self.n, self.mwork).shape[0] == 0: # <<<<<<<<<<<<<< + * linear_variables[variable] = 1 + * else: + */ + __pyx_t_2 = ((PyObject *)__pyx_v_self->mwork); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_15 = ((PyObject *)((struct __pyx_vtabstruct_6_basis_ConstantBasisFunction *)__pyx_v_root_basis_function->__pyx_base.__pyx_vtab)->__pyx_base.valid_knots(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_root_basis_function), ((PyArrayObject *)__pyx_t_1), ((PyArrayObject *)__pyx_t_9), __pyx_v_variable, __pyx_v_self->check_every, __pyx_v_endspan, __pyx_v_self->minspan, __pyx_v_self->minspan_alpha, __pyx_v_self->n, ((PyArrayObject *)__pyx_t_2), 0)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_6 = ((((PyArrayObject *)__pyx_t_15)->dimensions[0]) == 0); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + if (__pyx_t_6) { + + /* "_forward.pyx":103 + * self.minspan, self.minspan_alpha, + * self.n, self.mwork).shape[0] == 0: + * linear_variables[variable] = 1 # <<<<<<<<<<<<<< + * else: + * linear_variables[variable] = 0 + */ + __pyx_t_16 = __pyx_v_variable; + *__Pyx_BufPtrStrided1d(__pyx_t_8_forward_INT_t *, __pyx_pybuffernd_linear_variables.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_linear_variables.diminfo[0].strides) = 1; + goto __pyx_L6; + } + /*else*/ { + + /* "_forward.pyx":105 + * linear_variables[variable] = 1 + * else: + * linear_variables[variable] = 0 # <<<<<<<<<<<<<< + * + * def get_B_orth(ForwardPasser self): + */ + __pyx_t_17 = __pyx_v_variable; + *__Pyx_BufPtrStrided1d(__pyx_t_8_forward_INT_t *, __pyx_pybuffernd_linear_variables.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_linear_variables.diminfo[0].strides) = 0; + } + __pyx_L6:; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_15); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_B.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_linear_variables.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_order.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("_forward.ForwardPasser.init_linear_variables", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_B.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_linear_variables.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_order.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_order); + __Pyx_XDECREF((PyObject *)__pyx_v_linear_variables); + __Pyx_XDECREF((PyObject *)__pyx_v_B); + __Pyx_XDECREF((PyObject *)__pyx_v_X); + __Pyx_XDECREF((PyObject *)__pyx_v_root_basis_function); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_8_forward_13ForwardPasser_5init_linear_variables(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_8_forward_13ForwardPasser_5init_linear_variables(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("init_linear_variables (wrapper)", 0); + __pyx_r = __pyx_pf_8_forward_13ForwardPasser_4init_linear_variables(((struct __pyx_obj_8_forward_ForwardPasser *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_forward.pyx":87 + * return self.basis + * + * cpdef init_linear_variables(ForwardPasser self): # <<<<<<<<<<<<<< + * cdef INDEX_t variable + * cdef INDEX_t endspan + */ + +static PyObject *__pyx_pf_8_forward_13ForwardPasser_4init_linear_variables(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("init_linear_variables", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->init_linear_variables(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_forward.ForwardPasser.init_linear_variables", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_8_forward_13ForwardPasser_7get_B_orth(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_8_forward_13ForwardPasser_7get_B_orth(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_B_orth (wrapper)", 0); + __pyx_r = __pyx_pf_8_forward_13ForwardPasser_6get_B_orth(((struct __pyx_obj_8_forward_ForwardPasser *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_forward.pyx":107 + * linear_variables[variable] = 0 + * + * def get_B_orth(ForwardPasser self): # <<<<<<<<<<<<<< + * return self.B_orth + * + */ + +static PyObject *__pyx_pf_8_forward_13ForwardPasser_6get_B_orth(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_B_orth", 0); + + /* "_forward.pyx":108 + * + * def get_B_orth(ForwardPasser self): + * return self.B_orth # <<<<<<<<<<<<<< + * + * cpdef run(ForwardPasser self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->B_orth)); + __pyx_r = ((PyObject *)__pyx_v_self->B_orth); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_forward.pyx":110 + * return self.B_orth + * + * cpdef run(ForwardPasser self): # <<<<<<<<<<<<<< + * cdef INDEX_t i + * while True: + */ + +static PyObject *__pyx_pw_8_forward_13ForwardPasser_9run(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_f_8_forward_13ForwardPasser_run(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self, int __pyx_skip_dispatch) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("run", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__run); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8_forward_13ForwardPasser_9run)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_forward.pyx":112 + * cpdef run(ForwardPasser self): + * cdef INDEX_t i + * while True: # <<<<<<<<<<<<<< + * self.next_pair() + * if self.stop_check(): + */ + while (1) { + if (!1) break; + + /* "_forward.pyx":113 + * cdef INDEX_t i + * while True: + * self.next_pair() # <<<<<<<<<<<<<< + * if self.stop_check(): + * break + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->next_pair(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "_forward.pyx":114 + * while True: + * self.next_pair() + * if self.stop_check(): # <<<<<<<<<<<<<< + * break + * + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->stop_check(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_3) { + + /* "_forward.pyx":115 + * self.next_pair() + * if self.stop_check(): + * break # <<<<<<<<<<<<<< + * + * cdef stop_check(ForwardPasser self): + */ + goto __pyx_L4_break; + goto __pyx_L5; + } + __pyx_L5:; + } + __pyx_L4_break:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("_forward.ForwardPasser.run", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_8_forward_13ForwardPasser_9run(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_8_forward_13ForwardPasser_9run(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("run (wrapper)", 0); + __pyx_r = __pyx_pf_8_forward_13ForwardPasser_8run(((struct __pyx_obj_8_forward_ForwardPasser *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_forward.pyx":110 + * return self.B_orth + * + * cpdef run(ForwardPasser self): # <<<<<<<<<<<<<< + * cdef INDEX_t i + * while True: + */ + +static PyObject *__pyx_pf_8_forward_13ForwardPasser_8run(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("run", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->run(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_forward.ForwardPasser.run", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_forward.pyx":117 + * break + * + * cdef stop_check(ForwardPasser self): # <<<<<<<<<<<<<< + * last = self.record.__len__() - 1 + * if self.record.iterations[last].get_size() + 2 > self.max_terms: + */ + +static PyObject *__pyx_f_8_forward_13ForwardPasser_stop_check(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self) { + PyObject *__pyx_v_last = NULL; + PyObject *__pyx_v_rsq = NULL; + PyObject *__pyx_v_previous_rsq = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + __pyx_t_7_record_INDEX_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("stop_check", 0); + + /* "_forward.pyx":118 + * + * cdef stop_check(ForwardPasser self): + * last = self.record.__len__() - 1 # <<<<<<<<<<<<<< + * if self.record.iterations[last].get_size() + 2 > self.max_terms: + * self.record.stopping_condition = MAXTERMS + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->record), __pyx_n_s____len__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_last = __pyx_t_1; + __pyx_t_1 = 0; + + /* "_forward.pyx":119 + * cdef stop_check(ForwardPasser self): + * last = self.record.__len__() - 1 + * if self.record.iterations[last].get_size() + 2 > self.max_terms: # <<<<<<<<<<<<<< + * self.record.stopping_condition = MAXTERMS + * return True + */ + if (unlikely(((PyObject *)__pyx_v_self->record->__pyx_base.iterations) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self->record->__pyx_base.iterations), __pyx_v_last); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__get_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_int_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_4) { + + /* "_forward.pyx":120 + * last = self.record.__len__() - 1 + * if self.record.iterations[last].get_size() + 2 > self.max_terms: + * self.record.stopping_condition = MAXTERMS # <<<<<<<<<<<<<< + * return True + * rsq = self.record.rsq(last) + */ + __pyx_v_self->record->stopping_condition = __pyx_e_8_forward_MAXTERMS; + + /* "_forward.pyx":121 + * if self.record.iterations[last].get_size() + 2 > self.max_terms: + * self.record.stopping_condition = MAXTERMS + * return True # <<<<<<<<<<<<<< + * rsq = self.record.rsq(last) + * if rsq > 1 - self.thresh: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "_forward.pyx":122 + * self.record.stopping_condition = MAXTERMS + * return True + * rsq = self.record.rsq(last) # <<<<<<<<<<<<<< + * if rsq > 1 - self.thresh: + * self.record.stopping_condition = MAXRSQ + */ + __pyx_t_5 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_last); if (unlikely((__pyx_t_5 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7_record_ForwardPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->__pyx_base.rsq(((struct __pyx_obj_7_record_Record *)__pyx_v_self->record), __pyx_t_5, 0)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_v_rsq = __pyx_t_3; + __pyx_t_3 = 0; + + /* "_forward.pyx":123 + * return True + * rsq = self.record.rsq(last) + * if rsq > 1 - self.thresh: # <<<<<<<<<<<<<< + * self.record.stopping_condition = MAXRSQ + * return True + */ + __pyx_t_3 = PyFloat_FromDouble((1.0 - __pyx_v_self->thresh)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_RichCompare(__pyx_v_rsq, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_4) { + + /* "_forward.pyx":124 + * rsq = self.record.rsq(last) + * if rsq > 1 - self.thresh: + * self.record.stopping_condition = MAXRSQ # <<<<<<<<<<<<<< + * return True + * previous_rsq = self.record.rsq(last - 1) + */ + __pyx_v_self->record->stopping_condition = __pyx_e_8_forward_MAXRSQ; + + /* "_forward.pyx":125 + * if rsq > 1 - self.thresh: + * self.record.stopping_condition = MAXRSQ + * return True # <<<<<<<<<<<<<< + * previous_rsq = self.record.rsq(last - 1) + * if rsq - previous_rsq < self.thresh: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + goto __pyx_L4; + } + __pyx_L4:; + + /* "_forward.pyx":126 + * self.record.stopping_condition = MAXRSQ + * return True + * previous_rsq = self.record.rsq(last - 1) # <<<<<<<<<<<<<< + * if rsq - previous_rsq < self.thresh: + * self.record.stopping_condition = NOIMPRV + */ + __pyx_t_1 = PyNumber_Subtract(__pyx_v_last, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_5 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7_record_ForwardPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->__pyx_base.rsq(((struct __pyx_obj_7_record_Record *)__pyx_v_self->record), __pyx_t_5, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_previous_rsq = __pyx_t_1; + __pyx_t_1 = 0; + + /* "_forward.pyx":127 + * return True + * previous_rsq = self.record.rsq(last - 1) + * if rsq - previous_rsq < self.thresh: # <<<<<<<<<<<<<< + * self.record.stopping_condition = NOIMPRV + * return True + */ + __pyx_t_1 = PyNumber_Subtract(__pyx_v_rsq, __pyx_v_previous_rsq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->thresh); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_4) { + + /* "_forward.pyx":128 + * previous_rsq = self.record.rsq(last - 1) + * if rsq - previous_rsq < self.thresh: + * self.record.stopping_condition = NOIMPRV # <<<<<<<<<<<<<< + * return True + * if self.record.grsq(last) < -10: + */ + __pyx_v_self->record->stopping_condition = __pyx_e_8_forward_NOIMPRV; + + /* "_forward.pyx":129 + * if rsq - previous_rsq < self.thresh: + * self.record.stopping_condition = NOIMPRV + * return True # <<<<<<<<<<<<<< + * if self.record.grsq(last) < -10: + * self.record.stopping_condition = LOWGRSQ + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + goto __pyx_L5; + } + __pyx_L5:; + + /* "_forward.pyx":130 + * self.record.stopping_condition = NOIMPRV + * return True + * if self.record.grsq(last) < -10: # <<<<<<<<<<<<<< + * self.record.stopping_condition = LOWGRSQ + * return True + */ + __pyx_t_5 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_last); if (unlikely((__pyx_t_5 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (((struct __pyx_vtabstruct_7_record_ForwardPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->__pyx_base.grsq(((struct __pyx_obj_7_record_Record *)__pyx_v_self->record), __pyx_t_5, 0) < -10.0); + if (__pyx_t_4) { + + /* "_forward.pyx":131 + * return True + * if self.record.grsq(last) < -10: + * self.record.stopping_condition = LOWGRSQ # <<<<<<<<<<<<<< + * return True + * if self.record.iterations[last].no_further_candidates(): + */ + __pyx_v_self->record->stopping_condition = __pyx_e_8_forward_LOWGRSQ; + + /* "_forward.pyx":132 + * if self.record.grsq(last) < -10: + * self.record.stopping_condition = LOWGRSQ + * return True # <<<<<<<<<<<<<< + * if self.record.iterations[last].no_further_candidates(): + * self.record.stopping_condition = NOCAND + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + goto __pyx_L6; + } + __pyx_L6:; + + /* "_forward.pyx":133 + * self.record.stopping_condition = LOWGRSQ + * return True + * if self.record.iterations[last].no_further_candidates(): # <<<<<<<<<<<<<< + * self.record.stopping_condition = NOCAND + * return True + */ + if (unlikely(((PyObject *)__pyx_v_self->record->__pyx_base.iterations) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_self->record->__pyx_base.iterations), __pyx_v_last); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (__pyx_t_4) { + + /* "_forward.pyx":134 + * return True + * if self.record.iterations[last].no_further_candidates(): + * self.record.stopping_condition = NOCAND # <<<<<<<<<<<<<< + * return True + * return False + */ + __pyx_v_self->record->stopping_condition = __pyx_e_8_forward_NOCAND; + + /* "_forward.pyx":135 + * if self.record.iterations[last].no_further_candidates(): + * self.record.stopping_condition = NOCAND + * return True # <<<<<<<<<<<<<< + * return False + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + goto __pyx_L7; + } + __pyx_L7:; + + /* "_forward.pyx":136 + * self.record.stopping_condition = NOCAND + * return True + * return False # <<<<<<<<<<<<<< + * + * cpdef int orthonormal_update(ForwardPasser self, INDEX_t k): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("_forward.ForwardPasser.stop_check", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_last); + __Pyx_XDECREF(__pyx_v_rsq); + __Pyx_XDECREF(__pyx_v_previous_rsq); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_forward.pyx":138 + * return False + * + * cpdef int orthonormal_update(ForwardPasser self, INDEX_t k): # <<<<<<<<<<<<<< + * '''Orthogonalize and normalize column k of B_orth against all previous columns of B_orth.''' + * #Currently implemented using modified Gram-Schmidt process + */ + +static PyObject *__pyx_pw_8_forward_13ForwardPasser_11orthonormal_update(PyObject *__pyx_v_self, PyObject *__pyx_arg_k); /*proto*/ +static int __pyx_f_8_forward_13ForwardPasser_orthonormal_update(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self, __pyx_t_8_forward_INDEX_t __pyx_v_k, int __pyx_skip_dispatch) { + PyArrayObject *__pyx_v_B_orth = 0; + PyArrayObject *__pyx_v_c = 0; + PyArrayObject *__pyx_v_y = 0; + PyArrayObject *__pyx_v_norms = 0; + __pyx_t_8_forward_INDEX_t __pyx_v_i; + __pyx_t_8_forward_INDEX_t __pyx_v_j; + __pyx_t_8_forward_FLOAT_t __pyx_v_nrm; + __pyx_t_8_forward_FLOAT_t __pyx_v_nrm0; + __pyx_t_8_forward_FLOAT_t __pyx_v_dot_prod; + __Pyx_LocalBuf_ND __pyx_pybuffernd_B_orth; + __Pyx_Buffer __pyx_pybuffer_B_orth; + __Pyx_LocalBuf_ND __pyx_pybuffernd_c; + __Pyx_Buffer __pyx_pybuffer_c; + __Pyx_LocalBuf_ND __pyx_pybuffernd_norms; + __Pyx_Buffer __pyx_pybuffer_norms; + __Pyx_LocalBuf_ND __pyx_pybuffernd_y; + __Pyx_Buffer __pyx_pybuffer_y; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyArrayObject *__pyx_t_5 = NULL; + PyArrayObject *__pyx_t_6 = NULL; + PyArrayObject *__pyx_t_7 = NULL; + PyArrayObject *__pyx_t_8 = NULL; + __pyx_t_8_forward_INDEX_t __pyx_t_9; + __pyx_t_8_forward_INDEX_t __pyx_t_10; + __pyx_t_8_forward_INDEX_t __pyx_t_11; + __pyx_t_8_forward_INDEX_t __pyx_t_12; + __pyx_t_8_forward_INDEX_t __pyx_t_13; + __pyx_t_8_forward_INDEX_t __pyx_t_14; + int __pyx_t_15; + __pyx_t_8_forward_INDEX_t __pyx_t_16; + __pyx_t_8_forward_INDEX_t __pyx_t_17; + __pyx_t_8_forward_INDEX_t __pyx_t_18; + __pyx_t_8_forward_INDEX_t __pyx_t_19; + __pyx_t_8_forward_INDEX_t __pyx_t_20; + __pyx_t_8_forward_INDEX_t __pyx_t_21; + __pyx_t_8_forward_INDEX_t __pyx_t_22; + __pyx_t_8_forward_INDEX_t __pyx_t_23; + __pyx_t_8_forward_INDEX_t __pyx_t_24; + __pyx_t_8_forward_INDEX_t __pyx_t_25; + __pyx_t_8_forward_INDEX_t __pyx_t_26; + __pyx_t_8_forward_INDEX_t __pyx_t_27; + int __pyx_t_28; + int __pyx_t_29; + __pyx_t_8_forward_INDEX_t __pyx_t_30; + __pyx_t_8_forward_INDEX_t __pyx_t_31; + __pyx_t_8_forward_INDEX_t __pyx_t_32; + __pyx_t_8_forward_INDEX_t __pyx_t_33; + __pyx_t_8_forward_INDEX_t __pyx_t_34; + __pyx_t_8_forward_INDEX_t __pyx_t_35; + __pyx_t_8_forward_INDEX_t __pyx_t_36; + __pyx_t_8_forward_INDEX_t __pyx_t_37; + __pyx_t_8_forward_INDEX_t __pyx_t_38; + __pyx_t_8_forward_INDEX_t __pyx_t_39; + __pyx_t_8_forward_INDEX_t __pyx_t_40; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("orthonormal_update", 0); + __pyx_pybuffer_B_orth.pybuffer.buf = NULL; + __pyx_pybuffer_B_orth.refcount = 0; + __pyx_pybuffernd_B_orth.data = NULL; + __pyx_pybuffernd_B_orth.rcbuffer = &__pyx_pybuffer_B_orth; + __pyx_pybuffer_c.pybuffer.buf = NULL; + __pyx_pybuffer_c.refcount = 0; + __pyx_pybuffernd_c.data = NULL; + __pyx_pybuffernd_c.rcbuffer = &__pyx_pybuffer_c; + __pyx_pybuffer_y.pybuffer.buf = NULL; + __pyx_pybuffer_y.refcount = 0; + __pyx_pybuffernd_y.data = NULL; + __pyx_pybuffernd_y.rcbuffer = &__pyx_pybuffer_y; + __pyx_pybuffer_norms.pybuffer.buf = NULL; + __pyx_pybuffer_norms.refcount = 0; + __pyx_pybuffernd_norms.data = NULL; + __pyx_pybuffernd_norms.rcbuffer = &__pyx_pybuffer_norms; + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__orthonormal_update); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8_forward_13ForwardPasser_11orthonormal_update)) { + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_4; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_forward.pyx":143 + * #TODO: Optimize - replace some for loops with calls to blas + * + * cdef cnp.ndarray[FLOAT_t, ndim=2] B_orth = self.B_orth # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t, ndim=1] c = self.c + * cdef cnp.ndarray[FLOAT_t, ndim=1] y = self.y + */ + __pyx_t_5 = ((PyArrayObject *)__pyx_v_self->B_orth); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B_orth.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { + __pyx_v_B_orth = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_B_orth.diminfo[0].strides = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B_orth.diminfo[0].shape = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B_orth.diminfo[1].strides = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B_orth.diminfo[1].shape = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_5 = 0; + __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->B_orth))); + __pyx_v_B_orth = ((PyArrayObject *)__pyx_v_self->B_orth); + + /* "_forward.pyx":144 + * + * cdef cnp.ndarray[FLOAT_t, ndim=2] B_orth = self.B_orth + * cdef cnp.ndarray[FLOAT_t, ndim=1] c = self.c # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t, ndim=1] y = self.y + * cdef cnp.ndarray[FLOAT_t, ndim=1] norms = self.norms + */ + __pyx_t_6 = ((PyArrayObject *)__pyx_v_self->c); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_c.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_c = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_c.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_c.diminfo[0].strides = __pyx_pybuffernd_c.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_c.diminfo[0].shape = __pyx_pybuffernd_c.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_6 = 0; + __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->c))); + __pyx_v_c = ((PyArrayObject *)__pyx_v_self->c); + + /* "_forward.pyx":145 + * cdef cnp.ndarray[FLOAT_t, ndim=2] B_orth = self.B_orth + * cdef cnp.ndarray[FLOAT_t, ndim=1] c = self.c + * cdef cnp.ndarray[FLOAT_t, ndim=1] y = self.y # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t, ndim=1] norms = self.norms + * + */ + __pyx_t_7 = ((PyArrayObject *)__pyx_v_self->y); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_y = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_y.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_y.diminfo[0].strides = __pyx_pybuffernd_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y.diminfo[0].shape = __pyx_pybuffernd_y.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_7 = 0; + __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->y))); + __pyx_v_y = ((PyArrayObject *)__pyx_v_self->y); + + /* "_forward.pyx":146 + * cdef cnp.ndarray[FLOAT_t, ndim=1] c = self.c + * cdef cnp.ndarray[FLOAT_t, ndim=1] y = self.y + * cdef cnp.ndarray[FLOAT_t, ndim=1] norms = self.norms # <<<<<<<<<<<<<< + * + * cdef INDEX_t i + */ + __pyx_t_8 = ((PyArrayObject *)__pyx_v_self->norms); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_norms.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_norms = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_norms.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_norms.diminfo[0].strides = __pyx_pybuffernd_norms.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_norms.diminfo[0].shape = __pyx_pybuffernd_norms.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_8 = 0; + __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->norms))); + __pyx_v_norms = ((PyArrayObject *)__pyx_v_self->norms); + + /* "_forward.pyx":155 + * + * #Get the original norm + * nrm0 = 0.0 # <<<<<<<<<<<<<< + * for i in range(self.m): + * nrm0 += B_orth[i,k]*B_orth[i,k] + */ + __pyx_v_nrm0 = 0.0; + + /* "_forward.pyx":156 + * #Get the original norm + * nrm0 = 0.0 + * for i in range(self.m): # <<<<<<<<<<<<<< + * nrm0 += B_orth[i,k]*B_orth[i,k] + * nrm0 = sqrt(nrm0) + */ + __pyx_t_9 = __pyx_v_self->m; + for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { + __pyx_v_i = __pyx_t_10; + + /* "_forward.pyx":157 + * nrm0 = 0.0 + * for i in range(self.m): + * nrm0 += B_orth[i,k]*B_orth[i,k] # <<<<<<<<<<<<<< + * nrm0 = sqrt(nrm0) + * + */ + __pyx_t_11 = __pyx_v_i; + __pyx_t_12 = __pyx_v_k; + __pyx_t_13 = __pyx_v_i; + __pyx_t_14 = __pyx_v_k; + __pyx_v_nrm0 = (__pyx_v_nrm0 + ((*__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_B_orth.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_B_orth.diminfo[1].strides)))); + } + + /* "_forward.pyx":158 + * for i in range(self.m): + * nrm0 += B_orth[i,k]*B_orth[i,k] + * nrm0 = sqrt(nrm0) # <<<<<<<<<<<<<< + * + * #Orthogonalize + */ + __pyx_v_nrm0 = sqrt(__pyx_v_nrm0); + + /* "_forward.pyx":161 + * + * #Orthogonalize + * if k > 0: # <<<<<<<<<<<<<< + * for i in range(k): + * dot_prod = 0.0 + */ + __pyx_t_15 = (__pyx_v_k > 0); + if (__pyx_t_15) { + + /* "_forward.pyx":162 + * #Orthogonalize + * if k > 0: + * for i in range(k): # <<<<<<<<<<<<<< + * dot_prod = 0.0 + * for j in range(self.m): + */ + __pyx_t_9 = __pyx_v_k; + for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { + __pyx_v_i = __pyx_t_10; + + /* "_forward.pyx":163 + * if k > 0: + * for i in range(k): + * dot_prod = 0.0 # <<<<<<<<<<<<<< + * for j in range(self.m): + * dot_prod += B_orth[j,k]*B_orth[j,i] + */ + __pyx_v_dot_prod = 0.0; + + /* "_forward.pyx":164 + * for i in range(k): + * dot_prod = 0.0 + * for j in range(self.m): # <<<<<<<<<<<<<< + * dot_prod += B_orth[j,k]*B_orth[j,i] + * for j in range(self.m): + */ + __pyx_t_16 = __pyx_v_self->m; + for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { + __pyx_v_j = __pyx_t_17; + + /* "_forward.pyx":165 + * dot_prod = 0.0 + * for j in range(self.m): + * dot_prod += B_orth[j,k]*B_orth[j,i] # <<<<<<<<<<<<<< + * for j in range(self.m): + * B_orth[j,k] -= B_orth[j,i] * dot_prod + */ + __pyx_t_18 = __pyx_v_j; + __pyx_t_19 = __pyx_v_k; + __pyx_t_20 = __pyx_v_j; + __pyx_t_21 = __pyx_v_i; + __pyx_v_dot_prod = (__pyx_v_dot_prod + ((*__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_B_orth.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_B_orth.diminfo[1].strides)))); + } + + /* "_forward.pyx":166 + * for j in range(self.m): + * dot_prod += B_orth[j,k]*B_orth[j,i] + * for j in range(self.m): # <<<<<<<<<<<<<< + * B_orth[j,k] -= B_orth[j,i] * dot_prod + * + */ + __pyx_t_16 = __pyx_v_self->m; + for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { + __pyx_v_j = __pyx_t_17; + + /* "_forward.pyx":167 + * dot_prod += B_orth[j,k]*B_orth[j,i] + * for j in range(self.m): + * B_orth[j,k] -= B_orth[j,i] * dot_prod # <<<<<<<<<<<<<< + * + * #Normalize + */ + __pyx_t_22 = __pyx_v_j; + __pyx_t_23 = __pyx_v_i; + __pyx_t_24 = __pyx_v_j; + __pyx_t_25 = __pyx_v_k; + *__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_B_orth.diminfo[1].strides) -= ((*__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_B_orth.diminfo[1].strides)) * __pyx_v_dot_prod); + } + } + goto __pyx_L5; + } + __pyx_L5:; + + /* "_forward.pyx":170 + * + * #Normalize + * nrm = 0.0 # <<<<<<<<<<<<<< + * for i in range(self.m): + * nrm += B_orth[i,k]*B_orth[i,k] + */ + __pyx_v_nrm = 0.0; + + /* "_forward.pyx":171 + * #Normalize + * nrm = 0.0 + * for i in range(self.m): # <<<<<<<<<<<<<< + * nrm += B_orth[i,k]*B_orth[i,k] + * nrm = sqrt(nrm) + */ + __pyx_t_9 = __pyx_v_self->m; + for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { + __pyx_v_i = __pyx_t_10; + + /* "_forward.pyx":172 + * nrm = 0.0 + * for i in range(self.m): + * nrm += B_orth[i,k]*B_orth[i,k] # <<<<<<<<<<<<<< + * nrm = sqrt(nrm) + * norms[k] = nrm + */ + __pyx_t_16 = __pyx_v_i; + __pyx_t_17 = __pyx_v_k; + __pyx_t_26 = __pyx_v_i; + __pyx_t_27 = __pyx_v_k; + __pyx_v_nrm = (__pyx_v_nrm + ((*__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_B_orth.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_B_orth.diminfo[1].strides)))); + } + + /* "_forward.pyx":173 + * for i in range(self.m): + * nrm += B_orth[i,k]*B_orth[i,k] + * nrm = sqrt(nrm) # <<<<<<<<<<<<<< + * norms[k] = nrm + * + */ + __pyx_v_nrm = sqrt(__pyx_v_nrm); + + /* "_forward.pyx":174 + * nrm += B_orth[i,k]*B_orth[i,k] + * nrm = sqrt(nrm) + * norms[k] = nrm # <<<<<<<<<<<<<< + * + * if nrm0 <= self.zero_tol or nrm/nrm0 <= self.zero_tol: + */ + __pyx_t_9 = __pyx_v_k; + *__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_norms.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_norms.diminfo[0].strides) = __pyx_v_nrm; + + /* "_forward.pyx":176 + * norms[k] = nrm + * + * if nrm0 <= self.zero_tol or nrm/nrm0 <= self.zero_tol: # <<<<<<<<<<<<<< + * for i in range(self.m): + * B_orth[i,k] = 0.0 + */ + __pyx_t_15 = (__pyx_v_nrm0 <= __pyx_v_self->zero_tol); + if (!__pyx_t_15) { + __pyx_t_28 = ((__pyx_v_nrm / __pyx_v_nrm0) <= __pyx_v_self->zero_tol); + __pyx_t_29 = __pyx_t_28; + } else { + __pyx_t_29 = __pyx_t_15; + } + if (__pyx_t_29) { + + /* "_forward.pyx":177 + * + * if nrm0 <= self.zero_tol or nrm/nrm0 <= self.zero_tol: + * for i in range(self.m): # <<<<<<<<<<<<<< + * B_orth[i,k] = 0.0 + * c[k] = 0.0 + */ + __pyx_t_10 = __pyx_v_self->m; + for (__pyx_t_30 = 0; __pyx_t_30 < __pyx_t_10; __pyx_t_30+=1) { + __pyx_v_i = __pyx_t_30; + + /* "_forward.pyx":178 + * if nrm0 <= self.zero_tol or nrm/nrm0 <= self.zero_tol: + * for i in range(self.m): + * B_orth[i,k] = 0.0 # <<<<<<<<<<<<<< + * c[k] = 0.0 + * return 1 #The new column is in the column space of the previous columns + */ + __pyx_t_31 = __pyx_v_i; + __pyx_t_32 = __pyx_v_k; + *__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_B_orth.diminfo[1].strides) = 0.0; + } + + /* "_forward.pyx":179 + * for i in range(self.m): + * B_orth[i,k] = 0.0 + * c[k] = 0.0 # <<<<<<<<<<<<<< + * return 1 #The new column is in the column space of the previous columns + * for i in range(self.m): + */ + __pyx_t_10 = __pyx_v_k; + *__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_c.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_c.diminfo[0].strides) = 0.0; + + /* "_forward.pyx":180 + * B_orth[i,k] = 0.0 + * c[k] = 0.0 + * return 1 #The new column is in the column space of the previous columns # <<<<<<<<<<<<<< + * for i in range(self.m): + * B_orth[i,k] /= nrm + */ + __pyx_r = 1; + goto __pyx_L0; + goto __pyx_L14; + } + __pyx_L14:; + + /* "_forward.pyx":181 + * c[k] = 0.0 + * return 1 #The new column is in the column space of the previous columns + * for i in range(self.m): # <<<<<<<<<<<<<< + * B_orth[i,k] /= nrm + * + */ + __pyx_t_30 = __pyx_v_self->m; + for (__pyx_t_33 = 0; __pyx_t_33 < __pyx_t_30; __pyx_t_33+=1) { + __pyx_v_i = __pyx_t_33; + + /* "_forward.pyx":182 + * return 1 #The new column is in the column space of the previous columns + * for i in range(self.m): + * B_orth[i,k] /= nrm # <<<<<<<<<<<<<< + * + * #Update c + */ + __pyx_t_34 = __pyx_v_i; + __pyx_t_35 = __pyx_v_k; + *__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_B_orth.diminfo[1].strides) /= __pyx_v_nrm; + } + + /* "_forward.pyx":185 + * + * #Update c + * c[k] = 0.0 # <<<<<<<<<<<<<< + * for i in range(self.m): + * c[k] += B_orth[i,k]*y[i] + */ + __pyx_t_30 = __pyx_v_k; + *__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_c.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_c.diminfo[0].strides) = 0.0; + + /* "_forward.pyx":186 + * #Update c + * c[k] = 0.0 + * for i in range(self.m): # <<<<<<<<<<<<<< + * c[k] += B_orth[i,k]*y[i] + * self.c_squared += c[k]**2 + */ + __pyx_t_33 = __pyx_v_self->m; + for (__pyx_t_36 = 0; __pyx_t_36 < __pyx_t_33; __pyx_t_36+=1) { + __pyx_v_i = __pyx_t_36; + + /* "_forward.pyx":187 + * c[k] = 0.0 + * for i in range(self.m): + * c[k] += B_orth[i,k]*y[i] # <<<<<<<<<<<<<< + * self.c_squared += c[k]**2 + * + */ + __pyx_t_37 = __pyx_v_i; + __pyx_t_38 = __pyx_v_k; + __pyx_t_39 = __pyx_v_i; + __pyx_t_40 = __pyx_v_k; + *__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_c.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_c.diminfo[0].strides) += ((*__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_38, __pyx_pybuffernd_B_orth.diminfo[1].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_y.diminfo[0].strides))); + } + + /* "_forward.pyx":188 + * for i in range(self.m): + * c[k] += B_orth[i,k]*y[i] + * self.c_squared += c[k]**2 # <<<<<<<<<<<<<< + * + * return 0 #No problems + */ + __pyx_t_33 = __pyx_v_k; + __pyx_v_self->c_squared = (__pyx_v_self->c_squared + pow((*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_c.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_c.diminfo[0].strides)), 2.0)); + + /* "_forward.pyx":190 + * self.c_squared += c[k]**2 + * + * return 0 #No problems # <<<<<<<<<<<<<< + * + * cpdef orthonormal_downdate(ForwardPasser self, INDEX_t k): + */ + __pyx_r = 0; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_B_orth.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_c.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_norms.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_WriteUnraisable("_forward.ForwardPasser.orthonormal_update", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_B_orth.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_c.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_norms.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_B_orth); + __Pyx_XDECREF((PyObject *)__pyx_v_c); + __Pyx_XDECREF((PyObject *)__pyx_v_y); + __Pyx_XDECREF((PyObject *)__pyx_v_norms); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_8_forward_13ForwardPasser_11orthonormal_update(PyObject *__pyx_v_self, PyObject *__pyx_arg_k); /*proto*/ +static char __pyx_doc_8_forward_13ForwardPasser_10orthonormal_update[] = "Orthogonalize and normalize column k of B_orth against all previous columns of B_orth."; +static PyObject *__pyx_pw_8_forward_13ForwardPasser_11orthonormal_update(PyObject *__pyx_v_self, PyObject *__pyx_arg_k) { + __pyx_t_8_forward_INDEX_t __pyx_v_k; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("orthonormal_update (wrapper)", 0); + assert(__pyx_arg_k); { + __pyx_v_k = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_arg_k); if (unlikely((__pyx_v_k == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("_forward.ForwardPasser.orthonormal_update", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_8_forward_13ForwardPasser_10orthonormal_update(((struct __pyx_obj_8_forward_ForwardPasser *)__pyx_v_self), ((__pyx_t_8_forward_INDEX_t)__pyx_v_k)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_forward.pyx":138 + * return False + * + * cpdef int orthonormal_update(ForwardPasser self, INDEX_t k): # <<<<<<<<<<<<<< + * '''Orthogonalize and normalize column k of B_orth against all previous columns of B_orth.''' + * #Currently implemented using modified Gram-Schmidt process + */ + +static PyObject *__pyx_pf_8_forward_13ForwardPasser_10orthonormal_update(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self, __pyx_t_8_forward_INDEX_t __pyx_v_k) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("orthonormal_update", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyInt_FromLong(((struct __pyx_vtabstruct_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_update(__pyx_v_self, __pyx_v_k, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_forward.ForwardPasser.orthonormal_update", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_forward.pyx":192 + * return 0 #No problems + * + * cpdef orthonormal_downdate(ForwardPasser self, INDEX_t k): # <<<<<<<<<<<<<< + * ''' + * Undo the effects of the last orthonormal update. You can only undo the last orthonormal update this way. + */ + +static PyObject *__pyx_pw_8_forward_13ForwardPasser_13orthonormal_downdate(PyObject *__pyx_v_self, PyObject *__pyx_arg_k); /*proto*/ +static PyObject *__pyx_f_8_forward_13ForwardPasser_orthonormal_downdate(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self, __pyx_t_8_forward_INDEX_t __pyx_v_k, int __pyx_skip_dispatch) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __pyx_t_8_forward_FLOAT_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("orthonormal_downdate", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8_forward_13ForwardPasser_13orthonormal_downdate)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_forward.pyx":199 + * can simply be ignored until they are overwritten). + * ''' + * self.c_squared -= self.c[k]**2 # <<<<<<<<<<<<<< + * + * def trace(self): + */ + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->c_squared); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->c), __pyx_v_k, sizeof(__pyx_t_8_forward_INDEX_t)+1, __Pyx_PyInt_to_py_npy_ulonglong, 0, 0, 0); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Power(__pyx_t_2, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_InPlaceSubtract(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_self->c_squared = __pyx_t_4; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("_forward.ForwardPasser.orthonormal_downdate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_8_forward_13ForwardPasser_13orthonormal_downdate(PyObject *__pyx_v_self, PyObject *__pyx_arg_k); /*proto*/ +static char __pyx_doc_8_forward_13ForwardPasser_12orthonormal_downdate[] = "\n Undo the effects of the last orthonormal update. You can only undo the last orthonormal update this way.\n There will be no warning of any kind if you mess this up. You'll just get wrong answers.\n In reality, all this does is downdate c_squared (the elements of c and B_orth are left alone, since they\n can simply be ignored until they are overwritten).\n "; +static PyObject *__pyx_pw_8_forward_13ForwardPasser_13orthonormal_downdate(PyObject *__pyx_v_self, PyObject *__pyx_arg_k) { + __pyx_t_8_forward_INDEX_t __pyx_v_k; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("orthonormal_downdate (wrapper)", 0); + assert(__pyx_arg_k); { + __pyx_v_k = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_arg_k); if (unlikely((__pyx_v_k == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("_forward.ForwardPasser.orthonormal_downdate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_8_forward_13ForwardPasser_12orthonormal_downdate(((struct __pyx_obj_8_forward_ForwardPasser *)__pyx_v_self), ((__pyx_t_8_forward_INDEX_t)__pyx_v_k)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_forward.pyx":192 + * return 0 #No problems + * + * cpdef orthonormal_downdate(ForwardPasser self, INDEX_t k): # <<<<<<<<<<<<<< + * ''' + * Undo the effects of the last orthonormal update. You can only undo the last orthonormal update this way. + */ + +static PyObject *__pyx_pf_8_forward_13ForwardPasser_12orthonormal_downdate(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self, __pyx_t_8_forward_INDEX_t __pyx_v_k) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("orthonormal_downdate", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_downdate(__pyx_v_self, __pyx_v_k, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_forward.ForwardPasser.orthonormal_downdate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_8_forward_13ForwardPasser_15trace(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_8_forward_13ForwardPasser_15trace(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("trace (wrapper)", 0); + __pyx_r = __pyx_pf_8_forward_13ForwardPasser_14trace(((struct __pyx_obj_8_forward_ForwardPasser *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_forward.pyx":201 + * self.c_squared -= self.c[k]**2 + * + * def trace(self): # <<<<<<<<<<<<<< + * return self.record + * + */ + +static PyObject *__pyx_pf_8_forward_13ForwardPasser_14trace(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("trace", 0); + + /* "_forward.pyx":202 + * + * def trace(self): + * return self.record # <<<<<<<<<<<<<< + * + * cdef next_pair(ForwardPasser self): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_self->record)); + __pyx_r = ((PyObject *)__pyx_v_self->record); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_forward.pyx":204 + * return self.record + * + * cdef next_pair(ForwardPasser self): # <<<<<<<<<<<<<< + * cdef INDEX_t variable + * cdef INDEX_t parent_idx + */ + +static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self) { + __pyx_t_8_forward_INDEX_t __pyx_v_variable; + __pyx_t_8_forward_INDEX_t __pyx_v_parent_idx; + __pyx_t_8_forward_INDEX_t __pyx_v_parent_degree; + struct __pyx_obj_6_basis_BasisFunction *__pyx_v_parent = 0; + PyArrayObject *__pyx_v_candidates_idx = 0; + __pyx_t_8_forward_FLOAT_t __pyx_v_knot; + __pyx_t_8_forward_FLOAT_t __pyx_v_mse; + __pyx_t_8_forward_INDEX_t __pyx_v_knot_idx; + __pyx_t_8_forward_FLOAT_t __pyx_v_knot_choice; + __pyx_t_8_forward_FLOAT_t __pyx_v_mse_choice; + int __pyx_v_knot_idx_choice; + __pyx_t_8_forward_INDEX_t __pyx_v_parent_idx_choice; + struct __pyx_obj_6_basis_BasisFunction *__pyx_v_parent_choice = 0; + __pyx_t_8_forward_INDEX_t __pyx_v_variable_choice; + int __pyx_v_first; + struct __pyx_obj_6_basis_BasisFunction *__pyx_v_bf1 = 0; + struct __pyx_obj_6_basis_BasisFunction *__pyx_v_bf2 = 0; + __pyx_t_8_forward_INDEX_t __pyx_v_k; + __pyx_t_8_forward_INDEX_t __pyx_v_endspan; + int __pyx_v_linear_dependence; + int __pyx_v_dependent; + __pyx_t_8_forward_FLOAT_t __pyx_v_gcv_factor_k_plus_1; + __pyx_t_8_forward_FLOAT_t __pyx_v_gcv_factor_k_plus_2; + __pyx_t_8_forward_FLOAT_t __pyx_v_gcv_; + __pyx_t_8_forward_FLOAT_t __pyx_v_mse_; + __pyx_t_8_forward_INDEX_t __pyx_v_i; + PyArrayObject *__pyx_v_X = 0; + PyArrayObject *__pyx_v_B = 0; + PyArrayObject *__pyx_v_B_orth = 0; + CYTHON_UNUSED PyArrayObject *__pyx_v_y = 0; + PyArrayObject *__pyx_v_linear_variables = 0; + PyArrayObject *__pyx_v_sorting = 0; + PyObject *__pyx_v_label = NULL; + __Pyx_LocalBuf_ND __pyx_pybuffernd_B; + __Pyx_Buffer __pyx_pybuffer_B; + __Pyx_LocalBuf_ND __pyx_pybuffernd_B_orth; + __Pyx_Buffer __pyx_pybuffer_B_orth; + __Pyx_LocalBuf_ND __pyx_pybuffernd_X; + __Pyx_Buffer __pyx_pybuffer_X; + __Pyx_LocalBuf_ND __pyx_pybuffernd_candidates_idx; + __Pyx_Buffer __pyx_pybuffer_candidates_idx; + __Pyx_LocalBuf_ND __pyx_pybuffernd_linear_variables; + __Pyx_Buffer __pyx_pybuffer_linear_variables; + __Pyx_LocalBuf_ND __pyx_pybuffernd_sorting; + __Pyx_Buffer __pyx_pybuffer_sorting; + __Pyx_LocalBuf_ND __pyx_pybuffernd_y; + __Pyx_Buffer __pyx_pybuffer_y; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyArrayObject *__pyx_t_3 = NULL; + PyArrayObject *__pyx_t_4 = NULL; + PyArrayObject *__pyx_t_5 = NULL; + PyArrayObject *__pyx_t_6 = NULL; + PyArrayObject *__pyx_t_7 = NULL; + PyArrayObject *__pyx_t_8 = NULL; + int __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + __pyx_t_8_forward_INDEX_t __pyx_t_11; + __pyx_t_8_forward_INDEX_t __pyx_t_12; + PyObject *__pyx_t_13 = NULL; + __pyx_t_8_forward_INDEX_t __pyx_t_14; + __pyx_t_8_forward_INDEX_t __pyx_t_15; + __pyx_t_8_forward_INDEX_t __pyx_t_16; + __pyx_t_8_forward_INDEX_t __pyx_t_17; + __pyx_t_8_forward_INDEX_t __pyx_t_18; + __pyx_t_8_forward_INDEX_t __pyx_t_19; + __pyx_t_8_forward_INDEX_t __pyx_t_20; + __pyx_t_8_forward_INDEX_t __pyx_t_21; + __pyx_t_8_forward_INDEX_t __pyx_t_22; + __pyx_t_8_forward_INDEX_t __pyx_t_23; + __pyx_t_8_forward_INDEX_t __pyx_t_24; + __pyx_t_8_forward_INDEX_t __pyx_t_25; + __pyx_t_8_forward_INDEX_t __pyx_t_26; + __pyx_t_8_forward_INDEX_t __pyx_t_27; + __pyx_t_8_forward_INT_t __pyx_t_28; + PyObject *__pyx_t_29 = NULL; + int __pyx_t_30; + PyObject *__pyx_t_31 = NULL; + PyObject *__pyx_t_32 = NULL; + PyObject *__pyx_t_33 = NULL; + PyObject *__pyx_t_34 = NULL; + int __pyx_t_35; + int __pyx_t_36; + PyObject *__pyx_t_37 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("next_pair", 0); + __pyx_pybuffer_candidates_idx.pybuffer.buf = NULL; + __pyx_pybuffer_candidates_idx.refcount = 0; + __pyx_pybuffernd_candidates_idx.data = NULL; + __pyx_pybuffernd_candidates_idx.rcbuffer = &__pyx_pybuffer_candidates_idx; + __pyx_pybuffer_X.pybuffer.buf = NULL; + __pyx_pybuffer_X.refcount = 0; + __pyx_pybuffernd_X.data = NULL; + __pyx_pybuffernd_X.rcbuffer = &__pyx_pybuffer_X; + __pyx_pybuffer_B.pybuffer.buf = NULL; + __pyx_pybuffer_B.refcount = 0; + __pyx_pybuffernd_B.data = NULL; + __pyx_pybuffernd_B.rcbuffer = &__pyx_pybuffer_B; + __pyx_pybuffer_B_orth.pybuffer.buf = NULL; + __pyx_pybuffer_B_orth.refcount = 0; + __pyx_pybuffernd_B_orth.data = NULL; + __pyx_pybuffernd_B_orth.rcbuffer = &__pyx_pybuffer_B_orth; + __pyx_pybuffer_y.pybuffer.buf = NULL; + __pyx_pybuffer_y.refcount = 0; + __pyx_pybuffernd_y.data = NULL; + __pyx_pybuffernd_y.rcbuffer = &__pyx_pybuffer_y; + __pyx_pybuffer_linear_variables.pybuffer.buf = NULL; + __pyx_pybuffer_linear_variables.refcount = 0; + __pyx_pybuffernd_linear_variables.data = NULL; + __pyx_pybuffernd_linear_variables.rcbuffer = &__pyx_pybuffer_linear_variables; + __pyx_pybuffer_sorting.pybuffer.buf = NULL; + __pyx_pybuffer_sorting.refcount = 0; + __pyx_pybuffernd_sorting.data = NULL; + __pyx_pybuffernd_sorting.rcbuffer = &__pyx_pybuffer_sorting; + + /* "_forward.pyx":220 + * cdef BasisFunction parent_choice + * cdef INDEX_t variable_choice + * cdef bint first = True # <<<<<<<<<<<<<< + * cdef BasisFunction bf1 + * cdef BasisFunction bf2 + */ + __pyx_v_first = 1; + + /* "_forward.pyx":223 + * cdef BasisFunction bf1 + * cdef BasisFunction bf2 + * cdef INDEX_t k = len(self.basis) # <<<<<<<<<<<<<< + * cdef INDEX_t endspan + * cdef bint linear_dependence + */ + __pyx_t_1 = ((PyObject *)__pyx_v_self->basis); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_k = __pyx_t_2; + + /* "_forward.pyx":227 + * cdef bint linear_dependence + * cdef bint dependent + * cdef FLOAT_t gcv_factor_k_plus_1 = gcv_adjust(k+1,self.m,self.penalty) # <<<<<<<<<<<<<< + * cdef FLOAT_t gcv_factor_k_plus_2 = gcv_adjust(k+2,self.m,self.penalty) + * cdef FLOAT_t gcv_ + */ + __pyx_v_gcv_factor_k_plus_1 = __pyx_f_5_util_gcv_adjust((__pyx_v_k + 1), __pyx_v_self->m, __pyx_v_self->penalty, 0); + + /* "_forward.pyx":228 + * cdef bint dependent + * cdef FLOAT_t gcv_factor_k_plus_1 = gcv_adjust(k+1,self.m,self.penalty) + * cdef FLOAT_t gcv_factor_k_plus_2 = gcv_adjust(k+2,self.m,self.penalty) # <<<<<<<<<<<<<< + * cdef FLOAT_t gcv_ + * cdef FLOAT_t mse_ + */ + __pyx_v_gcv_factor_k_plus_2 = __pyx_f_5_util_gcv_adjust((__pyx_v_k + 2), __pyx_v_self->m, __pyx_v_self->penalty, 0); + + /* "_forward.pyx":233 + * cdef INDEX_t i + * + * cdef cnp.ndarray[FLOAT_t,ndim=2] X = self.X # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t,ndim=2] B = self.B + * cdef cnp.ndarray[FLOAT_t,ndim=2] B_orth = self.B_orth + */ + __pyx_t_3 = ((PyArrayObject *)__pyx_v_self->X); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + __pyx_v_X = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_3 = 0; + __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->X))); + __pyx_v_X = ((PyArrayObject *)__pyx_v_self->X); + + /* "_forward.pyx":234 + * + * cdef cnp.ndarray[FLOAT_t,ndim=2] X = self.X + * cdef cnp.ndarray[FLOAT_t,ndim=2] B = self.B # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t,ndim=2] B_orth = self.B_orth + * cdef cnp.ndarray[FLOAT_t,ndim=1] y = self.y + */ + __pyx_t_4 = ((PyArrayObject *)__pyx_v_self->B); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { + __pyx_v_B = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_B.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_B.diminfo[0].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B.diminfo[0].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B.diminfo[1].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B.diminfo[1].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_4 = 0; + __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->B))); + __pyx_v_B = ((PyArrayObject *)__pyx_v_self->B); + + /* "_forward.pyx":235 + * cdef cnp.ndarray[FLOAT_t,ndim=2] X = self.X + * cdef cnp.ndarray[FLOAT_t,ndim=2] B = self.B + * cdef cnp.ndarray[FLOAT_t,ndim=2] B_orth = self.B_orth # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t,ndim=1] y = self.y + * cdef cnp.ndarray[INT_t,ndim=1] linear_variables = self.linear_variables + */ + __pyx_t_5 = ((PyArrayObject *)__pyx_v_self->B_orth); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B_orth.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { + __pyx_v_B_orth = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_B_orth.diminfo[0].strides = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B_orth.diminfo[0].shape = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B_orth.diminfo[1].strides = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B_orth.diminfo[1].shape = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_5 = 0; + __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->B_orth))); + __pyx_v_B_orth = ((PyArrayObject *)__pyx_v_self->B_orth); + + /* "_forward.pyx":236 + * cdef cnp.ndarray[FLOAT_t,ndim=2] B = self.B + * cdef cnp.ndarray[FLOAT_t,ndim=2] B_orth = self.B_orth + * cdef cnp.ndarray[FLOAT_t,ndim=1] y = self.y # <<<<<<<<<<<<<< + * cdef cnp.ndarray[INT_t,ndim=1] linear_variables = self.linear_variables + * cdef cnp.ndarray[INT_t,ndim=1] sorting = self.sorting + */ + __pyx_t_6 = ((PyArrayObject *)__pyx_v_self->y); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_y = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_y.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_y.diminfo[0].strides = __pyx_pybuffernd_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y.diminfo[0].shape = __pyx_pybuffernd_y.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_6 = 0; + __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->y))); + __pyx_v_y = ((PyArrayObject *)__pyx_v_self->y); + + /* "_forward.pyx":237 + * cdef cnp.ndarray[FLOAT_t,ndim=2] B_orth = self.B_orth + * cdef cnp.ndarray[FLOAT_t,ndim=1] y = self.y + * cdef cnp.ndarray[INT_t,ndim=1] linear_variables = self.linear_variables # <<<<<<<<<<<<<< + * cdef cnp.ndarray[INT_t,ndim=1] sorting = self.sorting + * + */ + __pyx_t_7 = ((PyArrayObject *)__pyx_v_self->linear_variables); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_linear_variables.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_linear_variables = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_linear_variables.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_linear_variables.diminfo[0].strides = __pyx_pybuffernd_linear_variables.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_linear_variables.diminfo[0].shape = __pyx_pybuffernd_linear_variables.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_7 = 0; + __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->linear_variables))); + __pyx_v_linear_variables = ((PyArrayObject *)__pyx_v_self->linear_variables); + + /* "_forward.pyx":238 + * cdef cnp.ndarray[FLOAT_t,ndim=1] y = self.y + * cdef cnp.ndarray[INT_t,ndim=1] linear_variables = self.linear_variables + * cdef cnp.ndarray[INT_t,ndim=1] sorting = self.sorting # <<<<<<<<<<<<<< + * + * if self.endspan < 0: + */ + __pyx_t_8 = ((PyArrayObject *)__pyx_v_self->sorting); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sorting.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_sorting = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_sorting.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_sorting.diminfo[0].strides = __pyx_pybuffernd_sorting.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sorting.diminfo[0].shape = __pyx_pybuffernd_sorting.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_8 = 0; + __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->sorting))); + __pyx_v_sorting = ((PyArrayObject *)__pyx_v_self->sorting); + + /* "_forward.pyx":240 + * cdef cnp.ndarray[INT_t,ndim=1] sorting = self.sorting + * + * if self.endspan < 0: # <<<<<<<<<<<<<< + * endspan = round(3 - log2(self.endspan_alpha/self.n)) + * + */ + __pyx_t_9 = (__pyx_v_self->endspan < 0); + if (__pyx_t_9) { + + /* "_forward.pyx":241 + * + * if self.endspan < 0: + * endspan = round(3 - log2(self.endspan_alpha/self.n)) # <<<<<<<<<<<<<< + * + * #Iterate over variables + */ + __pyx_t_1 = PyFloat_FromDouble((3.0 - __pyx_f_5_util_log2((__pyx_v_self->endspan_alpha / __pyx_v_self->n)))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_round, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __pyx_t_11 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_11 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_endspan = __pyx_t_11; + goto __pyx_L3; + } + __pyx_L3:; + + /* "_forward.pyx":244 + * + * #Iterate over variables + * for variable in range(self.n): # <<<<<<<<<<<<<< + * + * #Sort the data + */ + __pyx_t_11 = __pyx_v_self->n; + for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { + __pyx_v_variable = __pyx_t_12; + + /* "_forward.pyx":247 + * + * #Sort the data + * sorting[:] = np.argsort(X[:,variable])[::-1] #TODO: eliminate Python call / data copy # <<<<<<<<<<<<<< + * + * #Iterate over parents + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__argsort); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_INCREF(__pyx_k_slice_8); + PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_k_slice_8); + __Pyx_GIVEREF(__pyx_k_slice_8); + PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_X), ((PyObject *)__pyx_t_13)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; + __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; + __pyx_t_13 = PyObject_GetItem(__pyx_t_1, __pyx_k_slice_9); if (!__pyx_t_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__Pyx_PyObject_SetSlice(((PyObject *)__pyx_v_sorting), __pyx_t_13, 0, 0, NULL, NULL, &__pyx_k_slice_10, 0, 0, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + + /* "_forward.pyx":250 + * + * #Iterate over parents + * for parent_idx in range(k): # <<<<<<<<<<<<<< + * linear_dependence = False + * + */ + __pyx_t_14 = __pyx_v_k; + for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { + __pyx_v_parent_idx = __pyx_t_15; + + /* "_forward.pyx":251 + * #Iterate over parents + * for parent_idx in range(k): + * linear_dependence = False # <<<<<<<<<<<<<< + * + * parent = self.basis.get(parent_idx) + */ + __pyx_v_linear_dependence = 0; + + /* "_forward.pyx":253 + * linear_dependence = False + * + * parent = self.basis.get(parent_idx) # <<<<<<<<<<<<<< + * if self.max_degree >= 0: + * parent_degree = parent.degree() + */ + __pyx_t_13 = ((PyObject *)((struct __pyx_vtabstruct_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->get(__pyx_v_self->basis, __pyx_v_parent_idx, 0)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_XDECREF(((PyObject *)__pyx_v_parent)); + __pyx_v_parent = ((struct __pyx_obj_6_basis_BasisFunction *)__pyx_t_13); + __pyx_t_13 = 0; + + /* "_forward.pyx":254 + * + * parent = self.basis.get(parent_idx) + * if self.max_degree >= 0: # <<<<<<<<<<<<<< + * parent_degree = parent.degree() + * if parent_degree >= self.max_degree: + */ + __pyx_t_9 = (__pyx_v_self->max_degree >= 0); + if (__pyx_t_9) { + + /* "_forward.pyx":255 + * parent = self.basis.get(parent_idx) + * if self.max_degree >= 0: + * parent_degree = parent.degree() # <<<<<<<<<<<<<< + * if parent_degree >= self.max_degree: + * continue + */ + __pyx_v_parent_degree = ((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_parent->__pyx_vtab)->degree(__pyx_v_parent, 0); + + /* "_forward.pyx":256 + * if self.max_degree >= 0: + * parent_degree = parent.degree() + * if parent_degree >= self.max_degree: # <<<<<<<<<<<<<< + * continue + * if not parent.is_splittable(): + */ + __pyx_t_9 = (__pyx_v_parent_degree >= __pyx_v_self->max_degree); + if (__pyx_t_9) { + + /* "_forward.pyx":257 + * parent_degree = parent.degree() + * if parent_degree >= self.max_degree: + * continue # <<<<<<<<<<<<<< + * if not parent.is_splittable(): + * continue + */ + goto __pyx_L6_continue; + goto __pyx_L9; + } + __pyx_L9:; + goto __pyx_L8; + } + __pyx_L8:; + + /* "_forward.pyx":258 + * if parent_degree >= self.max_degree: + * continue + * if not parent.is_splittable(): # <<<<<<<<<<<<<< + * continue + * + */ + __pyx_t_9 = (!((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_parent->__pyx_vtab)->is_splittable(__pyx_v_parent, 0)); + if (__pyx_t_9) { + + /* "_forward.pyx":259 + * continue + * if not parent.is_splittable(): + * continue # <<<<<<<<<<<<<< + * + * #Add the linear term to B + */ + goto __pyx_L6_continue; + goto __pyx_L10; + } + __pyx_L10:; + + /* "_forward.pyx":262 + * + * #Add the linear term to B + * for i in range(self.m): # <<<<<<<<<<<<<< + * B[i,k] = B[i,parent_idx]*X[i,variable] + * + */ + __pyx_t_16 = __pyx_v_self->m; + for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { + __pyx_v_i = __pyx_t_17; + + /* "_forward.pyx":263 + * #Add the linear term to B + * for i in range(self.m): + * B[i,k] = B[i,parent_idx]*X[i,variable] # <<<<<<<<<<<<<< + * + * #Orthonormalize + */ + __pyx_t_18 = __pyx_v_i; + __pyx_t_19 = __pyx_v_parent_idx; + __pyx_t_20 = __pyx_v_i; + __pyx_t_21 = __pyx_v_variable; + __pyx_t_22 = __pyx_v_i; + __pyx_t_23 = __pyx_v_k; + *__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_B.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_B.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_B.diminfo[1].strides) = ((*__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_B.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_B.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_B.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_X.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_X.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_X.diminfo[1].strides))); + } + + /* "_forward.pyx":266 + * + * #Orthonormalize + * for i in range(self.m): # <<<<<<<<<<<<<< + * B_orth[i,k] = B[i,k] + * linear_dependence = self.orthonormal_update(k) + */ + __pyx_t_16 = __pyx_v_self->m; + for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { + __pyx_v_i = __pyx_t_17; + + /* "_forward.pyx":267 + * #Orthonormalize + * for i in range(self.m): + * B_orth[i,k] = B[i,k] # <<<<<<<<<<<<<< + * linear_dependence = self.orthonormal_update(k) + * + */ + __pyx_t_24 = __pyx_v_i; + __pyx_t_25 = __pyx_v_k; + __pyx_t_26 = __pyx_v_i; + __pyx_t_27 = __pyx_v_k; + *__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_B_orth.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_B.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_B.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_B.diminfo[1].strides)); + } + + /* "_forward.pyx":268 + * for i in range(self.m): + * B_orth[i,k] = B[i,k] + * linear_dependence = self.orthonormal_update(k) # <<<<<<<<<<<<<< + * + * #If a new hinge function does not improve the gcv over the linear term + */ + __pyx_v_linear_dependence = ((struct __pyx_vtabstruct_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_update(__pyx_v_self, __pyx_v_k, 0); + + /* "_forward.pyx":275 + * #another term never increases, but the gcv may because it penalizes additional + * #terms. + * mse_ = (self.y_squared - self.c_squared) / self.m # <<<<<<<<<<<<<< + * gcv_ = gcv_factor_k_plus_1*(self.y_squared - self.c_squared) / self.m + * + */ + __pyx_v_mse_ = ((__pyx_v_self->y_squared - __pyx_v_self->c_squared) / __pyx_v_self->m); + + /* "_forward.pyx":276 + * #terms. + * mse_ = (self.y_squared - self.c_squared) / self.m + * gcv_ = gcv_factor_k_plus_1*(self.y_squared - self.c_squared) / self.m # <<<<<<<<<<<<<< + * + * if linear_variables[variable]: + */ + __pyx_v_gcv_ = ((__pyx_v_gcv_factor_k_plus_1 * (__pyx_v_self->y_squared - __pyx_v_self->c_squared)) / __pyx_v_self->m); + + /* "_forward.pyx":278 + * gcv_ = gcv_factor_k_plus_1*(self.y_squared - self.c_squared) / self.m + * + * if linear_variables[variable]: # <<<<<<<<<<<<<< + * mse = mse_ + * knot_idx = -1 + */ + __pyx_t_16 = __pyx_v_variable; + __pyx_t_28 = (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_INT_t *, __pyx_pybuffernd_linear_variables.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_linear_variables.diminfo[0].strides)); + if (__pyx_t_28) { + + /* "_forward.pyx":279 + * + * if linear_variables[variable]: + * mse = mse_ # <<<<<<<<<<<<<< + * knot_idx = -1 + * else: + */ + __pyx_v_mse = __pyx_v_mse_; + + /* "_forward.pyx":280 + * if linear_variables[variable]: + * mse = mse_ + * knot_idx = -1 # <<<<<<<<<<<<<< + * else: + * + */ + __pyx_v_knot_idx = -1; + goto __pyx_L15; + } + /*else*/ { + + /* "_forward.pyx":284 + * + * #Find the valid knot candidates + * candidates_idx = parent.valid_knots(B[sorting,parent_idx], X[sorting,variable], variable, self.check_every, endspan, self.minspan, self.minspan_alpha, self.n, self.mwork) # <<<<<<<<<<<<<< + * + * if len(candidates_idx) > 0: + */ + __pyx_t_13 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_parent_idx); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_v_sorting)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_sorting)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_sorting)); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_13); + __Pyx_GIVEREF(__pyx_t_13); + __pyx_t_13 = 0; + __pyx_t_13 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_1)); if (!__pyx_t_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_13) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_13, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_INCREF(((PyObject *)__pyx_v_sorting)); + PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_v_sorting)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_sorting)); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_X), ((PyObject *)__pyx_t_10)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = ((PyObject *)__pyx_v_self->mwork); + __Pyx_INCREF(__pyx_t_10); + __pyx_t_29 = ((PyObject *)((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_parent->__pyx_vtab)->valid_knots(__pyx_v_parent, ((PyArrayObject *)__pyx_t_13), ((PyArrayObject *)__pyx_t_1), __pyx_v_variable, __pyx_v_self->check_every, __pyx_v_endspan, __pyx_v_self->minspan, __pyx_v_self->minspan_alpha, __pyx_v_self->n, ((PyArrayObject *)__pyx_t_10), 0)); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_29); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_candidates_idx.rcbuffer->pybuffer); + __pyx_t_30 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_candidates_idx.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_29), &__Pyx_TypeInfo_nn___pyx_t_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); + if (unlikely(__pyx_t_30 < 0)) { + PyErr_Fetch(&__pyx_t_31, &__pyx_t_32, &__pyx_t_33); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_candidates_idx.rcbuffer->pybuffer, (PyObject*)__pyx_v_candidates_idx, &__Pyx_TypeInfo_nn___pyx_t_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_31); Py_XDECREF(__pyx_t_32); Py_XDECREF(__pyx_t_33); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_31, __pyx_t_32, __pyx_t_33); + } + } + __pyx_pybuffernd_candidates_idx.diminfo[0].strides = __pyx_pybuffernd_candidates_idx.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_candidates_idx.diminfo[0].shape = __pyx_pybuffernd_candidates_idx.rcbuffer->pybuffer.shape[0]; + if (unlikely(__pyx_t_30 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_XDECREF(((PyObject *)__pyx_v_candidates_idx)); + __pyx_v_candidates_idx = ((PyArrayObject *)__pyx_t_29); + __pyx_t_29 = 0; + + /* "_forward.pyx":286 + * candidates_idx = parent.valid_knots(B[sorting,parent_idx], X[sorting,variable], variable, self.check_every, endspan, self.minspan, self.minspan_alpha, self.n, self.mwork) + * + * if len(candidates_idx) > 0: # <<<<<<<<<<<<<< + * #Choose the best candidate (if no candidate is an improvement on the linear term in terms of gcv, knot_idx is set to -1 + * + */ + __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_candidates_idx)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = (__pyx_t_2 > 0); + if (__pyx_t_9) { + + /* "_forward.pyx":290 + * + * #Find the best knot location for this parent and variable combination + * self.best_knot(parent_idx,variable,k,candidates_idx,sorting,&mse,&knot,&knot_idx) # <<<<<<<<<<<<<< + * + * #If the hinge function does not decrease the gcv then just keep the linear term + */ + __pyx_t_29 = ((struct __pyx_vtabstruct_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->best_knot(__pyx_v_self, __pyx_v_parent_idx, __pyx_v_variable, __pyx_v_k, ((PyArrayObject *)__pyx_v_candidates_idx), ((PyArrayObject *)__pyx_v_sorting), (&__pyx_v_mse), (&__pyx_v_knot), (&__pyx_v_knot_idx)); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_29); + __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; + + /* "_forward.pyx":293 + * + * #If the hinge function does not decrease the gcv then just keep the linear term + * if gcv_factor_k_plus_2*mse >= gcv_: # <<<<<<<<<<<<<< + * mse = mse_ + * knot_idx = -1 + */ + __pyx_t_9 = ((__pyx_v_gcv_factor_k_plus_2 * __pyx_v_mse) >= __pyx_v_gcv_); + if (__pyx_t_9) { + + /* "_forward.pyx":294 + * #If the hinge function does not decrease the gcv then just keep the linear term + * if gcv_factor_k_plus_2*mse >= gcv_: + * mse = mse_ # <<<<<<<<<<<<<< + * knot_idx = -1 + * + */ + __pyx_v_mse = __pyx_v_mse_; + + /* "_forward.pyx":295 + * if gcv_factor_k_plus_2*mse >= gcv_: + * mse = mse_ + * knot_idx = -1 # <<<<<<<<<<<<<< + * + * else: + */ + __pyx_v_knot_idx = -1; + goto __pyx_L17; + } + __pyx_L17:; + goto __pyx_L16; + } + /*else*/ { + + /* "_forward.pyx":299 + * else: + * #Do an orthonormal downdate and skip to the next iteration + * self.orthonormal_downdate(k) # <<<<<<<<<<<<<< + * continue + * + */ + __pyx_t_29 = ((struct __pyx_vtabstruct_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_downdate(__pyx_v_self, __pyx_v_k, 0); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_29); + __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; + + /* "_forward.pyx":300 + * #Do an orthonormal downdate and skip to the next iteration + * self.orthonormal_downdate(k) + * continue # <<<<<<<<<<<<<< + * + * #Do an orthonormal downdate + */ + goto __pyx_L6_continue; + } + __pyx_L16:; + } + __pyx_L15:; + + /* "_forward.pyx":303 + * + * #Do an orthonormal downdate + * self.orthonormal_downdate(k) # <<<<<<<<<<<<<< + * + * #Update the choices + */ + __pyx_t_29 = ((struct __pyx_vtabstruct_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_downdate(__pyx_v_self, __pyx_v_k, 0); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_29); + __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; + + /* "_forward.pyx":306 + * + * #Update the choices + * if first: # <<<<<<<<<<<<<< + * knot_choice = knot + * mse_choice = mse + */ + if (__pyx_v_first) { + + /* "_forward.pyx":307 + * #Update the choices + * if first: + * knot_choice = knot # <<<<<<<<<<<<<< + * mse_choice = mse + * knot_idx_choice = knot_idx + */ + __pyx_v_knot_choice = __pyx_v_knot; + + /* "_forward.pyx":308 + * if first: + * knot_choice = knot + * mse_choice = mse # <<<<<<<<<<<<<< + * knot_idx_choice = knot_idx + * parent_idx_choice = parent_idx + */ + __pyx_v_mse_choice = __pyx_v_mse; + + /* "_forward.pyx":309 + * knot_choice = knot + * mse_choice = mse + * knot_idx_choice = knot_idx # <<<<<<<<<<<<<< + * parent_idx_choice = parent_idx + * parent_choice = parent + */ + __pyx_v_knot_idx_choice = __pyx_v_knot_idx; + + /* "_forward.pyx":310 + * mse_choice = mse + * knot_idx_choice = knot_idx + * parent_idx_choice = parent_idx # <<<<<<<<<<<<<< + * parent_choice = parent + * variable_choice = variable + */ + __pyx_v_parent_idx_choice = __pyx_v_parent_idx; + + /* "_forward.pyx":311 + * knot_idx_choice = knot_idx + * parent_idx_choice = parent_idx + * parent_choice = parent # <<<<<<<<<<<<<< + * variable_choice = variable + * first = False + */ + __Pyx_INCREF(((PyObject *)__pyx_v_parent)); + __Pyx_XDECREF(((PyObject *)__pyx_v_parent_choice)); + __pyx_v_parent_choice = __pyx_v_parent; + + /* "_forward.pyx":312 + * parent_idx_choice = parent_idx + * parent_choice = parent + * variable_choice = variable # <<<<<<<<<<<<<< + * first = False + * dependent = linear_dependence + */ + __pyx_v_variable_choice = __pyx_v_variable; + + /* "_forward.pyx":313 + * parent_choice = parent + * variable_choice = variable + * first = False # <<<<<<<<<<<<<< + * dependent = linear_dependence + * if mse < mse_choice: + */ + __pyx_v_first = 0; + + /* "_forward.pyx":314 + * variable_choice = variable + * first = False + * dependent = linear_dependence # <<<<<<<<<<<<<< + * if mse < mse_choice: + * knot_choice = knot + */ + __pyx_v_dependent = __pyx_v_linear_dependence; + goto __pyx_L18; + } + __pyx_L18:; + + /* "_forward.pyx":315 + * first = False + * dependent = linear_dependence + * if mse < mse_choice: # <<<<<<<<<<<<<< + * knot_choice = knot + * mse_choice = mse + */ + __pyx_t_9 = (__pyx_v_mse < __pyx_v_mse_choice); + if (__pyx_t_9) { + + /* "_forward.pyx":316 + * dependent = linear_dependence + * if mse < mse_choice: + * knot_choice = knot # <<<<<<<<<<<<<< + * mse_choice = mse + * knot_idx_choice = knot_idx + */ + __pyx_v_knot_choice = __pyx_v_knot; + + /* "_forward.pyx":317 + * if mse < mse_choice: + * knot_choice = knot + * mse_choice = mse # <<<<<<<<<<<<<< + * knot_idx_choice = knot_idx + * parent_idx_choice = parent_idx + */ + __pyx_v_mse_choice = __pyx_v_mse; + + /* "_forward.pyx":318 + * knot_choice = knot + * mse_choice = mse + * knot_idx_choice = knot_idx # <<<<<<<<<<<<<< + * parent_idx_choice = parent_idx + * parent_choice = parent + */ + __pyx_v_knot_idx_choice = __pyx_v_knot_idx; + + /* "_forward.pyx":319 + * mse_choice = mse + * knot_idx_choice = knot_idx + * parent_idx_choice = parent_idx # <<<<<<<<<<<<<< + * parent_choice = parent + * variable_choice = variable + */ + __pyx_v_parent_idx_choice = __pyx_v_parent_idx; + + /* "_forward.pyx":320 + * knot_idx_choice = knot_idx + * parent_idx_choice = parent_idx + * parent_choice = parent # <<<<<<<<<<<<<< + * variable_choice = variable + * dependent = linear_dependence + */ + __Pyx_INCREF(((PyObject *)__pyx_v_parent)); + __Pyx_XDECREF(((PyObject *)__pyx_v_parent_choice)); + __pyx_v_parent_choice = __pyx_v_parent; + + /* "_forward.pyx":321 + * parent_idx_choice = parent_idx + * parent_choice = parent + * variable_choice = variable # <<<<<<<<<<<<<< + * dependent = linear_dependence + * + */ + __pyx_v_variable_choice = __pyx_v_variable; + + /* "_forward.pyx":322 + * parent_choice = parent + * variable_choice = variable + * dependent = linear_dependence # <<<<<<<<<<<<<< + * + * #Make sure at least one candidate was checked + */ + __pyx_v_dependent = __pyx_v_linear_dependence; + goto __pyx_L19; + } + __pyx_L19:; + __pyx_L6_continue:; + } + } + + /* "_forward.pyx":325 + * + * #Make sure at least one candidate was checked + * if first: # <<<<<<<<<<<<<< + * self.record[-1].set_no_candidates(True) + * return + */ + if (__pyx_v_first) { + + /* "_forward.pyx":326 + * #Make sure at least one candidate was checked + * if first: + * self.record[-1].set_no_candidates(True) # <<<<<<<<<<<<<< + * return + * + */ + __pyx_t_29 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->record), -1, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_29) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_29); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_29, __pyx_n_s__set_no_candidates); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; + __pyx_t_29 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_29); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_29); + __Pyx_GIVEREF(__pyx_t_29); + __pyx_t_29 = 0; + __pyx_t_29 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_29); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; + + /* "_forward.pyx":327 + * if first: + * self.record[-1].set_no_candidates(True) + * return # <<<<<<<<<<<<<< + * + * #Add the new basis functions + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + goto __pyx_L20; + } + __pyx_L20:; + + /* "_forward.pyx":330 + * + * #Add the new basis functions + * parent = self.basis.get(parent_idx) # <<<<<<<<<<<<<< + * label = self.xlabels[variable_choice] + * if knot_idx_choice != -1: + */ + __pyx_t_29 = ((PyObject *)((struct __pyx_vtabstruct_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->get(__pyx_v_self->basis, __pyx_v_parent_idx, 0)); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_29); + __Pyx_XDECREF(((PyObject *)__pyx_v_parent)); + __pyx_v_parent = ((struct __pyx_obj_6_basis_BasisFunction *)__pyx_t_29); + __pyx_t_29 = 0; + + /* "_forward.pyx":331 + * #Add the new basis functions + * parent = self.basis.get(parent_idx) + * label = self.xlabels[variable_choice] # <<<<<<<<<<<<<< + * if knot_idx_choice != -1: + * #Add the new basis functions + */ + if (unlikely(((PyObject *)__pyx_v_self->xlabels) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_29 = PyList_GET_ITEM(__pyx_v_self->xlabels, __pyx_v_variable_choice); + __Pyx_INCREF(__pyx_t_29); + __pyx_v_label = __pyx_t_29; + __pyx_t_29 = 0; + + /* "_forward.pyx":332 + * parent = self.basis.get(parent_idx) + * label = self.xlabels[variable_choice] + * if knot_idx_choice != -1: # <<<<<<<<<<<<<< + * #Add the new basis functions + * bf1 = HingeBasisFunction(parent_choice,knot_choice,knot_idx_choice,variable_choice,False,label) + */ + __pyx_t_9 = (__pyx_v_knot_idx_choice != -1); + if (__pyx_t_9) { + + /* "_forward.pyx":334 + * if knot_idx_choice != -1: + * #Add the new basis functions + * bf1 = HingeBasisFunction(parent_choice,knot_choice,knot_idx_choice,variable_choice,False,label) # <<<<<<<<<<<<<< + * bf2 = HingeBasisFunction(parent_choice,knot_choice,knot_idx_choice,variable_choice,True,label) + * bf1.apply(X,B[:,k]) + */ + if (unlikely(!__pyx_v_parent_choice)) { __Pyx_RaiseUnboundLocalError("parent_choice"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_29 = PyFloat_FromDouble(__pyx_v_knot_choice); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_29); + __pyx_t_1 = PyInt_FromLong(__pyx_v_knot_idx_choice); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable_choice); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_13 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_34 = PyTuple_New(6); if (unlikely(!__pyx_t_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_34); + __Pyx_INCREF(((PyObject *)__pyx_v_parent_choice)); + PyTuple_SET_ITEM(__pyx_t_34, 0, ((PyObject *)__pyx_v_parent_choice)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_parent_choice)); + PyTuple_SET_ITEM(__pyx_t_34, 1, __pyx_t_29); + __Pyx_GIVEREF(__pyx_t_29); + PyTuple_SET_ITEM(__pyx_t_34, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_34, 3, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_34, 4, __pyx_t_13); + __Pyx_GIVEREF(__pyx_t_13); + __Pyx_INCREF(__pyx_v_label); + PyTuple_SET_ITEM(__pyx_t_34, 5, __pyx_v_label); + __Pyx_GIVEREF(__pyx_v_label); + __pyx_t_29 = 0; + __pyx_t_1 = 0; + __pyx_t_10 = 0; + __pyx_t_13 = 0; + __pyx_t_13 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6_basis_HingeBasisFunction)), ((PyObject *)__pyx_t_34), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(((PyObject *)__pyx_t_34)); __pyx_t_34 = 0; + __pyx_v_bf1 = ((struct __pyx_obj_6_basis_BasisFunction *)__pyx_t_13); + __pyx_t_13 = 0; + + /* "_forward.pyx":335 + * #Add the new basis functions + * bf1 = HingeBasisFunction(parent_choice,knot_choice,knot_idx_choice,variable_choice,False,label) + * bf2 = HingeBasisFunction(parent_choice,knot_choice,knot_idx_choice,variable_choice,True,label) # <<<<<<<<<<<<<< + * bf1.apply(X,B[:,k]) + * bf2.apply(X,B[:,k+1]) + */ + __pyx_t_13 = PyFloat_FromDouble(__pyx_v_knot_choice); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_34 = PyInt_FromLong(__pyx_v_knot_idx_choice); if (unlikely(!__pyx_t_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_34); + __pyx_t_10 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable_choice); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_29 = PyTuple_New(6); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_29); + __Pyx_INCREF(((PyObject *)__pyx_v_parent_choice)); + PyTuple_SET_ITEM(__pyx_t_29, 0, ((PyObject *)__pyx_v_parent_choice)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_parent_choice)); + PyTuple_SET_ITEM(__pyx_t_29, 1, __pyx_t_13); + __Pyx_GIVEREF(__pyx_t_13); + PyTuple_SET_ITEM(__pyx_t_29, 2, __pyx_t_34); + __Pyx_GIVEREF(__pyx_t_34); + PyTuple_SET_ITEM(__pyx_t_29, 3, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_29, 4, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_label); + PyTuple_SET_ITEM(__pyx_t_29, 5, __pyx_v_label); + __Pyx_GIVEREF(__pyx_v_label); + __pyx_t_13 = 0; + __pyx_t_34 = 0; + __pyx_t_10 = 0; + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6_basis_HingeBasisFunction)), ((PyObject *)__pyx_t_29), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_29)); __pyx_t_29 = 0; + __pyx_v_bf2 = ((struct __pyx_obj_6_basis_BasisFunction *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "_forward.pyx":336 + * bf1 = HingeBasisFunction(parent_choice,knot_choice,knot_idx_choice,variable_choice,False,label) + * bf2 = HingeBasisFunction(parent_choice,knot_choice,knot_idx_choice,variable_choice,True,label) + * bf1.apply(X,B[:,k]) # <<<<<<<<<<<<<< + * bf2.apply(X,B[:,k+1]) + * self.basis.append(bf1) + */ + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_29 = PyTuple_New(2); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_29); + __Pyx_INCREF(__pyx_k_slice_11); + PyTuple_SET_ITEM(__pyx_t_29, 0, __pyx_k_slice_11); + __Pyx_GIVEREF(__pyx_k_slice_11); + PyTuple_SET_ITEM(__pyx_t_29, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_29)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_29)); __pyx_t_29 = 0; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_29 = ((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_bf1->__pyx_vtab)->apply(__pyx_v_bf1, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_t_1), 0, NULL); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_29); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; + + /* "_forward.pyx":337 + * bf2 = HingeBasisFunction(parent_choice,knot_choice,knot_idx_choice,variable_choice,True,label) + * bf1.apply(X,B[:,k]) + * bf2.apply(X,B[:,k+1]) # <<<<<<<<<<<<<< + * self.basis.append(bf1) + * self.basis.append(bf2) + */ + __pyx_t_29 = __Pyx_PyInt_to_py_npy_ulonglong((__pyx_v_k + 1)); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_29); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_k_slice_12); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_k_slice_12); + __Pyx_GIVEREF(__pyx_k_slice_12); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_29); + __Pyx_GIVEREF(__pyx_t_29); + __pyx_t_29 = 0; + __pyx_t_29 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_1)); if (!__pyx_t_29) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_29); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_29) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_29, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_bf2->__pyx_vtab)->apply(__pyx_v_bf2, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_t_29), 0, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "_forward.pyx":338 + * bf1.apply(X,B[:,k]) + * bf2.apply(X,B[:,k+1]) + * self.basis.append(bf1) # <<<<<<<<<<<<<< + * self.basis.append(bf2) + * + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->append(__pyx_v_self->basis, __pyx_v_bf1, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "_forward.pyx":339 + * bf2.apply(X,B[:,k+1]) + * self.basis.append(bf1) + * self.basis.append(bf2) # <<<<<<<<<<<<<< + * + * #Orthogonalize the new basis + */ + __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->append(__pyx_v_self->basis, __pyx_v_bf2, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "_forward.pyx":342 + * + * #Orthogonalize the new basis + * B_orth[:,k] = B[:,k] # <<<<<<<<<<<<<< + * if self.orthonormal_update(k) == 1: + * bf1.make_unsplittable() + */ + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_29 = PyTuple_New(2); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_29); + __Pyx_INCREF(__pyx_k_slice_13); + PyTuple_SET_ITEM(__pyx_t_29, 0, __pyx_k_slice_13); + __Pyx_GIVEREF(__pyx_k_slice_13); + PyTuple_SET_ITEM(__pyx_t_29, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_29)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_29)); __pyx_t_29 = 0; + __pyx_t_29 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_29); + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_INCREF(__pyx_k_slice_14); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_k_slice_14); + __Pyx_GIVEREF(__pyx_k_slice_14); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_29); + __Pyx_GIVEREF(__pyx_t_29); + __pyx_t_29 = 0; + if (PyObject_SetItem(((PyObject *)__pyx_v_B_orth), ((PyObject *)__pyx_t_10), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "_forward.pyx":343 + * #Orthogonalize the new basis + * B_orth[:,k] = B[:,k] + * if self.orthonormal_update(k) == 1: # <<<<<<<<<<<<<< + * bf1.make_unsplittable() + * B_orth[:,k+1] = B[:,k+1] + */ + __pyx_t_9 = (((struct __pyx_vtabstruct_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_update(__pyx_v_self, __pyx_v_k, 0) == 1); + if (__pyx_t_9) { + + /* "_forward.pyx":344 + * B_orth[:,k] = B[:,k] + * if self.orthonormal_update(k) == 1: + * bf1.make_unsplittable() # <<<<<<<<<<<<<< + * B_orth[:,k+1] = B[:,k+1] + * if self.orthonormal_update(k+1) == 1: + */ + ((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_bf1->__pyx_vtab)->make_unsplittable(__pyx_v_bf1, 0); + goto __pyx_L22; + } + __pyx_L22:; + + /* "_forward.pyx":345 + * if self.orthonormal_update(k) == 1: + * bf1.make_unsplittable() + * B_orth[:,k+1] = B[:,k+1] # <<<<<<<<<<<<<< + * if self.orthonormal_update(k+1) == 1: + * bf2.make_unsplittable() + */ + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong((__pyx_v_k + 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_INCREF(__pyx_k_slice_15); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_k_slice_15); + __Pyx_GIVEREF(__pyx_k_slice_15); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_10)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_PyInt_to_py_npy_ulonglong((__pyx_v_k + 1)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_29 = PyTuple_New(2); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_29); + __Pyx_INCREF(__pyx_k_slice_16); + PyTuple_SET_ITEM(__pyx_t_29, 0, __pyx_k_slice_16); + __Pyx_GIVEREF(__pyx_k_slice_16); + PyTuple_SET_ITEM(__pyx_t_29, 1, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + __pyx_t_10 = 0; + if (PyObject_SetItem(((PyObject *)__pyx_v_B_orth), ((PyObject *)__pyx_t_29), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_29)); __pyx_t_29 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "_forward.pyx":346 + * bf1.make_unsplittable() + * B_orth[:,k+1] = B[:,k+1] + * if self.orthonormal_update(k+1) == 1: # <<<<<<<<<<<<<< + * bf2.make_unsplittable() + * elif not dependent and knot_idx_choice == -1: + */ + __pyx_t_9 = (((struct __pyx_vtabstruct_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_update(__pyx_v_self, (__pyx_v_k + 1), 0) == 1); + if (__pyx_t_9) { + + /* "_forward.pyx":347 + * B_orth[:,k+1] = B[:,k+1] + * if self.orthonormal_update(k+1) == 1: + * bf2.make_unsplittable() # <<<<<<<<<<<<<< + * elif not dependent and knot_idx_choice == -1: + * #In this case, only add the linear basis function + */ + ((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_bf2->__pyx_vtab)->make_unsplittable(__pyx_v_bf2, 0); + goto __pyx_L23; + } + __pyx_L23:; + goto __pyx_L21; + } + + /* "_forward.pyx":348 + * if self.orthonormal_update(k+1) == 1: + * bf2.make_unsplittable() + * elif not dependent and knot_idx_choice == -1: # <<<<<<<<<<<<<< + * #In this case, only add the linear basis function + * bf1 = LinearBasisFunction(parent_choice,variable_choice,label) + */ + __pyx_t_9 = (!__pyx_v_dependent); + if (__pyx_t_9) { + __pyx_t_35 = (__pyx_v_knot_idx_choice == -1); + __pyx_t_36 = __pyx_t_35; + } else { + __pyx_t_36 = __pyx_t_9; + } + if (__pyx_t_36) { + + /* "_forward.pyx":350 + * elif not dependent and knot_idx_choice == -1: + * #In this case, only add the linear basis function + * bf1 = LinearBasisFunction(parent_choice,variable_choice,label) # <<<<<<<<<<<<<< + * bf1.apply(X,B[:,k]) + * self.basis.append(bf1) + */ + if (unlikely(!__pyx_v_parent_choice)) { __Pyx_RaiseUnboundLocalError("parent_choice"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable_choice); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_29 = PyTuple_New(3); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_29); + __Pyx_INCREF(((PyObject *)__pyx_v_parent_choice)); + PyTuple_SET_ITEM(__pyx_t_29, 0, ((PyObject *)__pyx_v_parent_choice)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_parent_choice)); + PyTuple_SET_ITEM(__pyx_t_29, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_label); + PyTuple_SET_ITEM(__pyx_t_29, 2, __pyx_v_label); + __Pyx_GIVEREF(__pyx_v_label); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6_basis_LinearBasisFunction)), ((PyObject *)__pyx_t_29), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_29)); __pyx_t_29 = 0; + __pyx_v_bf1 = ((struct __pyx_obj_6_basis_BasisFunction *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "_forward.pyx":351 + * #In this case, only add the linear basis function + * bf1 = LinearBasisFunction(parent_choice,variable_choice,label) + * bf1.apply(X,B[:,k]) # <<<<<<<<<<<<<< + * self.basis.append(bf1) + * + */ + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_29 = PyTuple_New(2); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_29); + __Pyx_INCREF(__pyx_k_slice_17); + PyTuple_SET_ITEM(__pyx_t_29, 0, __pyx_k_slice_17); + __Pyx_GIVEREF(__pyx_k_slice_17); + PyTuple_SET_ITEM(__pyx_t_29, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_29)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_29)); __pyx_t_29 = 0; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_29 = ((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_bf1->__pyx_vtab)->apply(__pyx_v_bf1, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_t_1), 0, NULL); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_29); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; + + /* "_forward.pyx":352 + * bf1 = LinearBasisFunction(parent_choice,variable_choice,label) + * bf1.apply(X,B[:,k]) + * self.basis.append(bf1) # <<<<<<<<<<<<<< + * + * #Orthogonalize the new basis + */ + __pyx_t_29 = ((struct __pyx_vtabstruct_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->append(__pyx_v_self->basis, __pyx_v_bf1, 0); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_29); + __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; + + /* "_forward.pyx":355 + * + * #Orthogonalize the new basis + * B_orth[:,k] = B[:,k] # <<<<<<<<<<<<<< + * if self.orthonormal_update(k) == 1: + * bf1.make_unsplittable() + */ + __pyx_t_29 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_29); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_k_slice_18); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_k_slice_18); + __Pyx_GIVEREF(__pyx_k_slice_18); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_29); + __Pyx_GIVEREF(__pyx_t_29); + __pyx_t_29 = 0; + __pyx_t_29 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_1)); if (!__pyx_t_29) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_29); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_INCREF(__pyx_k_slice_19); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_k_slice_19); + __Pyx_GIVEREF(__pyx_k_slice_19); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + if (PyObject_SetItem(((PyObject *)__pyx_v_B_orth), ((PyObject *)__pyx_t_10), __pyx_t_29) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; + + /* "_forward.pyx":356 + * #Orthogonalize the new basis + * B_orth[:,k] = B[:,k] + * if self.orthonormal_update(k) == 1: # <<<<<<<<<<<<<< + * bf1.make_unsplittable() + * else:#dependent and knot_idx_choice == -1 + */ + __pyx_t_36 = (((struct __pyx_vtabstruct_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_update(__pyx_v_self, __pyx_v_k, 0) == 1); + if (__pyx_t_36) { + + /* "_forward.pyx":357 + * B_orth[:,k] = B[:,k] + * if self.orthonormal_update(k) == 1: + * bf1.make_unsplittable() # <<<<<<<<<<<<<< + * else:#dependent and knot_idx_choice == -1 + * #In this case there were no acceptable choices remaining, so end the forward pass + */ + ((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_bf1->__pyx_vtab)->make_unsplittable(__pyx_v_bf1, 0); + goto __pyx_L24; + } + __pyx_L24:; + goto __pyx_L21; + } + /*else*/ { + + /* "_forward.pyx":360 + * else:#dependent and knot_idx_choice == -1 + * #In this case there were no acceptable choices remaining, so end the forward pass + * self.record[-1].set_no_candidates(True) # <<<<<<<<<<<<<< + * return + * + */ + __pyx_t_29 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->record), -1, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_29) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_29); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_29, __pyx_n_s__set_no_candidates); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; + __pyx_t_29 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_29); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_29); + __Pyx_GIVEREF(__pyx_t_29); + __pyx_t_29 = 0; + __pyx_t_29 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_29); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; + + /* "_forward.pyx":361 + * #In this case there were no acceptable choices remaining, so end the forward pass + * self.record[-1].set_no_candidates(True) + * return # <<<<<<<<<<<<<< + * + * #Update the build record + */ + __Pyx_XDECREF(__pyx_r); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + } + __pyx_L21:; + + /* "_forward.pyx":364 + * + * #Update the build record + * self.record.append(ForwardPassIteration(parent_idx_choice,variable_choice,knot_idx_choice,mse_choice,len(self.basis))) # <<<<<<<<<<<<<< + * + * cdef best_knot(ForwardPasser self, INDEX_t parent, INDEX_t variable, INDEX_t k, cnp.ndarray[INT_t,ndim=1] candidates, cnp.ndarray[INT_t,ndim=1] order, FLOAT_t * mse, FLOAT_t * knot, INDEX_t * knot_idx): + */ + __pyx_t_29 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_parent_idx_choice); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_29); + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable_choice); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = PyInt_FromLong(__pyx_v_knot_idx_choice); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_34 = PyFloat_FromDouble(__pyx_v_mse_choice); if (unlikely(!__pyx_t_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_34); + __pyx_t_13 = ((PyObject *)__pyx_v_self->basis); + __Pyx_INCREF(__pyx_t_13); + __pyx_t_2 = PyObject_Length(__pyx_t_13); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_37 = PyTuple_New(5); if (unlikely(!__pyx_t_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_37); + PyTuple_SET_ITEM(__pyx_t_37, 0, __pyx_t_29); + __Pyx_GIVEREF(__pyx_t_29); + PyTuple_SET_ITEM(__pyx_t_37, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_37, 2, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_37, 3, __pyx_t_34); + __Pyx_GIVEREF(__pyx_t_34); + PyTuple_SET_ITEM(__pyx_t_37, 4, __pyx_t_13); + __Pyx_GIVEREF(__pyx_t_13); + __pyx_t_29 = 0; + __pyx_t_1 = 0; + __pyx_t_10 = 0; + __pyx_t_34 = 0; + __pyx_t_13 = 0; + __pyx_t_13 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7_record_ForwardPassIteration)), ((PyObject *)__pyx_t_37), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(((PyObject *)__pyx_t_37)); __pyx_t_37 = 0; + __pyx_t_37 = ((struct __pyx_vtabstruct_7_record_ForwardPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->__pyx_base.append(((struct __pyx_obj_7_record_Record *)__pyx_v_self->record), ((struct __pyx_obj_7_record_Iteration *)__pyx_t_13), 0); if (unlikely(!__pyx_t_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_37); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_29); + __Pyx_XDECREF(__pyx_t_34); + __Pyx_XDECREF(__pyx_t_37); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_B.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_B_orth.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_candidates_idx.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_linear_variables.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sorting.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("_forward.ForwardPasser.next_pair", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_B.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_B_orth.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_candidates_idx.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_linear_variables.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sorting.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_parent); + __Pyx_XDECREF((PyObject *)__pyx_v_candidates_idx); + __Pyx_XDECREF((PyObject *)__pyx_v_parent_choice); + __Pyx_XDECREF((PyObject *)__pyx_v_bf1); + __Pyx_XDECREF((PyObject *)__pyx_v_bf2); + __Pyx_XDECREF((PyObject *)__pyx_v_X); + __Pyx_XDECREF((PyObject *)__pyx_v_B); + __Pyx_XDECREF((PyObject *)__pyx_v_B_orth); + __Pyx_XDECREF((PyObject *)__pyx_v_y); + __Pyx_XDECREF((PyObject *)__pyx_v_linear_variables); + __Pyx_XDECREF((PyObject *)__pyx_v_sorting); + __Pyx_XDECREF(__pyx_v_label); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_forward.pyx":366 + * self.record.append(ForwardPassIteration(parent_idx_choice,variable_choice,knot_idx_choice,mse_choice,len(self.basis))) + * + * cdef best_knot(ForwardPasser self, INDEX_t parent, INDEX_t variable, INDEX_t k, cnp.ndarray[INT_t,ndim=1] candidates, cnp.ndarray[INT_t,ndim=1] order, FLOAT_t * mse, FLOAT_t * knot, INDEX_t * knot_idx): # <<<<<<<<<<<<<< + * ''' + * Find the best knot location (in terms of squared error). + */ + +static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self, __pyx_t_8_forward_INDEX_t __pyx_v_parent, __pyx_t_8_forward_INDEX_t __pyx_v_variable, __pyx_t_8_forward_INDEX_t __pyx_v_k, PyArrayObject *__pyx_v_candidates, PyArrayObject *__pyx_v_order, __pyx_t_8_forward_FLOAT_t *__pyx_v_mse, __pyx_t_8_forward_FLOAT_t *__pyx_v_knot, __pyx_t_8_forward_INDEX_t *__pyx_v_knot_idx) { + PyArrayObject *__pyx_v_b = 0; + PyArrayObject *__pyx_v_b_parent = 0; + PyArrayObject *__pyx_v_u = 0; + PyArrayObject *__pyx_v_B_orth = 0; + PyArrayObject *__pyx_v_X = 0; + PyArrayObject *__pyx_v_y = 0; + PyArrayObject *__pyx_v_c = 0; + PyArrayObject *__pyx_v_B_orth_times_parent_cum = 0; + CYTHON_UNUSED PyArrayObject *__pyx_v_B = 0; + __pyx_t_8_forward_INDEX_t __pyx_v_num_candidates; + __pyx_t_8_forward_INDEX_t __pyx_v_h; + __pyx_t_8_forward_INDEX_t __pyx_v_i; + __pyx_t_8_forward_INDEX_t __pyx_v_j; + __pyx_t_8_forward_INDEX_t __pyx_v_i_; + __pyx_t_8_forward_INDEX_t __pyx_v_j_; + __pyx_t_8_forward_FLOAT_t __pyx_v_u_end; + __pyx_t_8_forward_FLOAT_t __pyx_v_c_end; + __pyx_t_8_forward_FLOAT_t __pyx_v_z_end_squared; + __pyx_t_8_forward_INDEX_t __pyx_v_candidate_idx; + __pyx_t_8_forward_INDEX_t __pyx_v_last_candidate_idx; + __pyx_t_8_forward_INDEX_t __pyx_v_last_last_candidate_idx; + __pyx_t_8_forward_INDEX_t __pyx_v_best_candidate_idx; + __pyx_t_8_forward_FLOAT_t __pyx_v_candidate; + __pyx_t_8_forward_FLOAT_t __pyx_v_last_candidate; + __pyx_t_8_forward_FLOAT_t __pyx_v_best_candidate; + __pyx_t_8_forward_FLOAT_t __pyx_v_best_z_end_squared; + __pyx_t_8_forward_FLOAT_t __pyx_v_y_cum; + __pyx_t_8_forward_FLOAT_t __pyx_v_b_times_parent_cum; + __pyx_t_8_forward_FLOAT_t __pyx_v_diff; + __pyx_t_8_forward_FLOAT_t __pyx_v_delta_b_squared; + __pyx_t_8_forward_FLOAT_t __pyx_v_delta_c_end; + __pyx_t_8_forward_FLOAT_t __pyx_v_delta_u_end; + __pyx_t_8_forward_FLOAT_t __pyx_v_parent_squared_cum; + __pyx_t_8_forward_FLOAT_t __pyx_v_parent_times_y_cum; + __pyx_t_8_forward_FLOAT_t __pyx_v_u_dot_c; + __pyx_t_8_forward_FLOAT_t __pyx_v_u_dot_u; + __pyx_t_8_forward_FLOAT_t __pyx_v_float_tmp; + __pyx_t_8_forward_FLOAT_t __pyx_v_delta_b_j; + __pyx_t_8_forward_FLOAT_t __pyx_v_z_denom; + __Pyx_LocalBuf_ND __pyx_pybuffernd_B; + __Pyx_Buffer __pyx_pybuffer_B; + __Pyx_LocalBuf_ND __pyx_pybuffernd_B_orth; + __Pyx_Buffer __pyx_pybuffer_B_orth; + __Pyx_LocalBuf_ND __pyx_pybuffernd_B_orth_times_parent_cum; + __Pyx_Buffer __pyx_pybuffer_B_orth_times_parent_cum; + __Pyx_LocalBuf_ND __pyx_pybuffernd_X; + __Pyx_Buffer __pyx_pybuffer_X; + __Pyx_LocalBuf_ND __pyx_pybuffernd_b; + __Pyx_Buffer __pyx_pybuffer_b; + __Pyx_LocalBuf_ND __pyx_pybuffernd_b_parent; + __Pyx_Buffer __pyx_pybuffer_b_parent; + __Pyx_LocalBuf_ND __pyx_pybuffernd_c; + __Pyx_Buffer __pyx_pybuffer_c; + __Pyx_LocalBuf_ND __pyx_pybuffernd_candidates; + __Pyx_Buffer __pyx_pybuffer_candidates; + __Pyx_LocalBuf_ND __pyx_pybuffernd_order; + __Pyx_Buffer __pyx_pybuffer_order; + __Pyx_LocalBuf_ND __pyx_pybuffernd_u; + __Pyx_Buffer __pyx_pybuffer_u; + __Pyx_LocalBuf_ND __pyx_pybuffernd_y; + __Pyx_Buffer __pyx_pybuffer_y; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyArrayObject *__pyx_t_3 = NULL; + PyArrayObject *__pyx_t_4 = NULL; + PyArrayObject *__pyx_t_5 = NULL; + PyArrayObject *__pyx_t_6 = NULL; + PyArrayObject *__pyx_t_7 = NULL; + PyArrayObject *__pyx_t_8 = NULL; + PyArrayObject *__pyx_t_9 = NULL; + long __pyx_t_10; + __pyx_t_8_forward_INDEX_t __pyx_t_11; + __pyx_t_8_forward_INT_t __pyx_t_12; + __pyx_t_8_forward_INDEX_t __pyx_t_13; + __pyx_t_8_forward_INDEX_t __pyx_t_14; + __pyx_t_8_forward_INDEX_t __pyx_t_15; + __pyx_t_8_forward_INDEX_t __pyx_t_16; + __pyx_t_8_forward_INDEX_t __pyx_t_17; + __pyx_t_8_forward_INDEX_t __pyx_t_18; + __pyx_t_8_forward_INDEX_t __pyx_t_19; + int __pyx_t_20; + __pyx_t_8_forward_INDEX_t __pyx_t_21; + __pyx_t_8_forward_INDEX_t __pyx_t_22; + PyObject *__pyx_t_23 = NULL; + __pyx_t_8_forward_INDEX_t __pyx_t_24; + __pyx_t_8_forward_INDEX_t __pyx_t_25; + __pyx_t_8_forward_INDEX_t __pyx_t_26; + __pyx_t_8_forward_INDEX_t __pyx_t_27; + __pyx_t_8_forward_INDEX_t __pyx_t_28; + __pyx_t_8_forward_INDEX_t __pyx_t_29; + __pyx_t_8_forward_INDEX_t __pyx_t_30; + __pyx_t_8_forward_INDEX_t __pyx_t_31; + __pyx_t_8_forward_FLOAT_t __pyx_t_32; + long __pyx_t_33; + __pyx_t_8_forward_INDEX_t __pyx_t_34; + __pyx_t_8_forward_INDEX_t __pyx_t_35; + __pyx_t_8_forward_INDEX_t __pyx_t_36; + __pyx_t_8_forward_INDEX_t __pyx_t_37; + __pyx_t_8_forward_INDEX_t __pyx_t_38; + __pyx_t_8_forward_INDEX_t __pyx_t_39; + __pyx_t_8_forward_INDEX_t __pyx_t_40; + __pyx_t_8_forward_INDEX_t __pyx_t_41; + __pyx_t_8_forward_INDEX_t __pyx_t_42; + __pyx_t_8_forward_INDEX_t __pyx_t_43; + __pyx_t_8_forward_INT_t __pyx_t_44; + __pyx_t_8_forward_INDEX_t __pyx_t_45; + __pyx_t_8_forward_INDEX_t __pyx_t_46; + __pyx_t_8_forward_INDEX_t __pyx_t_47; + __pyx_t_8_forward_INDEX_t __pyx_t_48; + __pyx_t_8_forward_INDEX_t __pyx_t_49; + __pyx_t_8_forward_INDEX_t __pyx_t_50; + __pyx_t_8_forward_INDEX_t __pyx_t_51; + __pyx_t_8_forward_INDEX_t __pyx_t_52; + __pyx_t_8_forward_INDEX_t __pyx_t_53; + __pyx_t_8_forward_INDEX_t __pyx_t_54; + __pyx_t_8_forward_INDEX_t __pyx_t_55; + __pyx_t_8_forward_INDEX_t __pyx_t_56; + __pyx_t_8_forward_INDEX_t __pyx_t_57; + __pyx_t_8_forward_INDEX_t __pyx_t_58; + __pyx_t_8_forward_INDEX_t __pyx_t_59; + __pyx_t_8_forward_INDEX_t __pyx_t_60; + __pyx_t_8_forward_INDEX_t __pyx_t_61; + __pyx_t_8_forward_INDEX_t __pyx_t_62; + __pyx_t_8_forward_INDEX_t __pyx_t_63; + __pyx_t_8_forward_INDEX_t __pyx_t_64; + __pyx_t_8_forward_INDEX_t __pyx_t_65; + __pyx_t_8_forward_INDEX_t __pyx_t_66; + __pyx_t_8_forward_INDEX_t __pyx_t_67; + __pyx_t_8_forward_INDEX_t __pyx_t_68; + __pyx_t_8_forward_INDEX_t __pyx_t_69; + __pyx_t_8_forward_INDEX_t __pyx_t_70; + __pyx_t_8_forward_INDEX_t __pyx_t_71; + __pyx_t_8_forward_INDEX_t __pyx_t_72; + __pyx_t_8_forward_INDEX_t __pyx_t_73; + __pyx_t_8_forward_INDEX_t __pyx_t_74; + __pyx_t_8_forward_INDEX_t __pyx_t_75; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("best_knot", 0); + __pyx_pybuffer_b.pybuffer.buf = NULL; + __pyx_pybuffer_b.refcount = 0; + __pyx_pybuffernd_b.data = NULL; + __pyx_pybuffernd_b.rcbuffer = &__pyx_pybuffer_b; + __pyx_pybuffer_b_parent.pybuffer.buf = NULL; + __pyx_pybuffer_b_parent.refcount = 0; + __pyx_pybuffernd_b_parent.data = NULL; + __pyx_pybuffernd_b_parent.rcbuffer = &__pyx_pybuffer_b_parent; + __pyx_pybuffer_u.pybuffer.buf = NULL; + __pyx_pybuffer_u.refcount = 0; + __pyx_pybuffernd_u.data = NULL; + __pyx_pybuffernd_u.rcbuffer = &__pyx_pybuffer_u; + __pyx_pybuffer_B_orth.pybuffer.buf = NULL; + __pyx_pybuffer_B_orth.refcount = 0; + __pyx_pybuffernd_B_orth.data = NULL; + __pyx_pybuffernd_B_orth.rcbuffer = &__pyx_pybuffer_B_orth; + __pyx_pybuffer_X.pybuffer.buf = NULL; + __pyx_pybuffer_X.refcount = 0; + __pyx_pybuffernd_X.data = NULL; + __pyx_pybuffernd_X.rcbuffer = &__pyx_pybuffer_X; + __pyx_pybuffer_y.pybuffer.buf = NULL; + __pyx_pybuffer_y.refcount = 0; + __pyx_pybuffernd_y.data = NULL; + __pyx_pybuffernd_y.rcbuffer = &__pyx_pybuffer_y; + __pyx_pybuffer_c.pybuffer.buf = NULL; + __pyx_pybuffer_c.refcount = 0; + __pyx_pybuffernd_c.data = NULL; + __pyx_pybuffernd_c.rcbuffer = &__pyx_pybuffer_c; + __pyx_pybuffer_B_orth_times_parent_cum.pybuffer.buf = NULL; + __pyx_pybuffer_B_orth_times_parent_cum.refcount = 0; + __pyx_pybuffernd_B_orth_times_parent_cum.data = NULL; + __pyx_pybuffernd_B_orth_times_parent_cum.rcbuffer = &__pyx_pybuffer_B_orth_times_parent_cum; + __pyx_pybuffer_B.pybuffer.buf = NULL; + __pyx_pybuffer_B.refcount = 0; + __pyx_pybuffernd_B.data = NULL; + __pyx_pybuffernd_B.rcbuffer = &__pyx_pybuffer_B; + __pyx_pybuffer_candidates.pybuffer.buf = NULL; + __pyx_pybuffer_candidates.refcount = 0; + __pyx_pybuffernd_candidates.data = NULL; + __pyx_pybuffernd_candidates.rcbuffer = &__pyx_pybuffer_candidates; + __pyx_pybuffer_order.pybuffer.buf = NULL; + __pyx_pybuffer_order.refcount = 0; + __pyx_pybuffernd_order.data = NULL; + __pyx_pybuffernd_order.rcbuffer = &__pyx_pybuffer_order; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_candidates.rcbuffer->pybuffer, (PyObject*)__pyx_v_candidates, &__Pyx_TypeInfo_nn___pyx_t_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_candidates.diminfo[0].strides = __pyx_pybuffernd_candidates.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_candidates.diminfo[0].shape = __pyx_pybuffernd_candidates.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_order.rcbuffer->pybuffer, (PyObject*)__pyx_v_order, &__Pyx_TypeInfo_nn___pyx_t_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_order.diminfo[0].strides = __pyx_pybuffernd_order.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_order.diminfo[0].shape = __pyx_pybuffernd_order.rcbuffer->pybuffer.shape[0]; + + /* "_forward.pyx":377 + * ''' + * + * cdef cnp.ndarray[FLOAT_t, ndim=1] b = self.B[:,k+1] # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t, ndim=1] b_parent = self.B[:,parent] + * cdef cnp.ndarray[FLOAT_t, ndim=1] u = self.u + */ + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong((__pyx_v_k + 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_k_slice_20); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_k_slice_20); + __Pyx_GIVEREF(__pyx_k_slice_20); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self->B), ((PyObject *)__pyx_t_2)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = __pyx_t_1; + __Pyx_INCREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_2), &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_b = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_b.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_b.diminfo[0].strides = __pyx_pybuffernd_b.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_b.diminfo[0].shape = __pyx_pybuffernd_b.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_v_b = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "_forward.pyx":378 + * + * cdef cnp.ndarray[FLOAT_t, ndim=1] b = self.B[:,k+1] + * cdef cnp.ndarray[FLOAT_t, ndim=1] b_parent = self.B[:,parent] # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t, ndim=1] u = self.u + * cdef cnp.ndarray[FLOAT_t, ndim=2] B_orth = self.B_orth + */ + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_parent); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_k_slice_21); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_k_slice_21); + __Pyx_GIVEREF(__pyx_k_slice_21); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_self->B), ((PyObject *)__pyx_t_1)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = __pyx_t_2; + __Pyx_INCREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b_parent.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_b_parent = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_b_parent.diminfo[0].strides = __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_b_parent.diminfo[0].shape = __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_v_b_parent = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "_forward.pyx":379 + * cdef cnp.ndarray[FLOAT_t, ndim=1] b = self.B[:,k+1] + * cdef cnp.ndarray[FLOAT_t, ndim=1] b_parent = self.B[:,parent] + * cdef cnp.ndarray[FLOAT_t, ndim=1] u = self.u # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t, ndim=2] B_orth = self.B_orth + * cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X + */ + __pyx_t_3 = ((PyArrayObject *)__pyx_v_self->u); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_u.rcbuffer->pybuffer, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_u = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_u.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_u.diminfo[0].strides = __pyx_pybuffernd_u.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_u.diminfo[0].shape = __pyx_pybuffernd_u.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_3 = 0; + __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->u))); + __pyx_v_u = ((PyArrayObject *)__pyx_v_self->u); + + /* "_forward.pyx":380 + * cdef cnp.ndarray[FLOAT_t, ndim=1] b_parent = self.B[:,parent] + * cdef cnp.ndarray[FLOAT_t, ndim=1] u = self.u + * cdef cnp.ndarray[FLOAT_t, ndim=2] B_orth = self.B_orth # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X + * cdef cnp.ndarray[FLOAT_t, ndim=1] y = self.y + */ + __pyx_t_4 = ((PyArrayObject *)__pyx_v_self->B_orth); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B_orth.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + __pyx_v_B_orth = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_B_orth.diminfo[0].strides = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B_orth.diminfo[0].shape = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B_orth.diminfo[1].strides = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B_orth.diminfo[1].shape = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_4 = 0; + __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->B_orth))); + __pyx_v_B_orth = ((PyArrayObject *)__pyx_v_self->B_orth); + + /* "_forward.pyx":381 + * cdef cnp.ndarray[FLOAT_t, ndim=1] u = self.u + * cdef cnp.ndarray[FLOAT_t, ndim=2] B_orth = self.B_orth + * cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t, ndim=1] y = self.y + * cdef cnp.ndarray[FLOAT_t, ndim=1] c = self.c + */ + __pyx_t_5 = ((PyArrayObject *)__pyx_v_self->X); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + __pyx_v_X = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_5 = 0; + __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->X))); + __pyx_v_X = ((PyArrayObject *)__pyx_v_self->X); + + /* "_forward.pyx":382 + * cdef cnp.ndarray[FLOAT_t, ndim=2] B_orth = self.B_orth + * cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X + * cdef cnp.ndarray[FLOAT_t, ndim=1] y = self.y # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t, ndim=1] c = self.c + * cdef cnp.ndarray[FLOAT_t, ndim=1] B_orth_times_parent_cum = self.B_orth_times_parent_cum + */ + __pyx_t_6 = ((PyArrayObject *)__pyx_v_self->y); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_y = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_y.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_y.diminfo[0].strides = __pyx_pybuffernd_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y.diminfo[0].shape = __pyx_pybuffernd_y.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_6 = 0; + __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->y))); + __pyx_v_y = ((PyArrayObject *)__pyx_v_self->y); + + /* "_forward.pyx":383 + * cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X + * cdef cnp.ndarray[FLOAT_t, ndim=1] y = self.y + * cdef cnp.ndarray[FLOAT_t, ndim=1] c = self.c # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t, ndim=1] B_orth_times_parent_cum = self.B_orth_times_parent_cum + * cdef cnp.ndarray[FLOAT_t, ndim=2] B = self.B + */ + __pyx_t_7 = ((PyArrayObject *)__pyx_v_self->c); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_c.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_c = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_c.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_c.diminfo[0].strides = __pyx_pybuffernd_c.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_c.diminfo[0].shape = __pyx_pybuffernd_c.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_7 = 0; + __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->c))); + __pyx_v_c = ((PyArrayObject *)__pyx_v_self->c); + + /* "_forward.pyx":384 + * cdef cnp.ndarray[FLOAT_t, ndim=1] y = self.y + * cdef cnp.ndarray[FLOAT_t, ndim=1] c = self.c + * cdef cnp.ndarray[FLOAT_t, ndim=1] B_orth_times_parent_cum = self.B_orth_times_parent_cum # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t, ndim=2] B = self.B + * + */ + __pyx_t_8 = ((PyArrayObject *)__pyx_v_self->B_orth_times_parent_cum); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B_orth_times_parent_cum.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + __pyx_v_B_orth_times_parent_cum = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_B_orth_times_parent_cum.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_B_orth_times_parent_cum.diminfo[0].strides = __pyx_pybuffernd_B_orth_times_parent_cum.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B_orth_times_parent_cum.diminfo[0].shape = __pyx_pybuffernd_B_orth_times_parent_cum.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_8 = 0; + __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->B_orth_times_parent_cum))); + __pyx_v_B_orth_times_parent_cum = ((PyArrayObject *)__pyx_v_self->B_orth_times_parent_cum); + + /* "_forward.pyx":385 + * cdef cnp.ndarray[FLOAT_t, ndim=1] c = self.c + * cdef cnp.ndarray[FLOAT_t, ndim=1] B_orth_times_parent_cum = self.B_orth_times_parent_cum + * cdef cnp.ndarray[FLOAT_t, ndim=2] B = self.B # <<<<<<<<<<<<<< + * + * cdef INDEX_t num_candidates = candidates.shape[0] + */ + __pyx_t_9 = ((PyArrayObject *)__pyx_v_self->B); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + __pyx_v_B = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_B.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_B.diminfo[0].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B.diminfo[0].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B.diminfo[1].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B.diminfo[1].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_9 = 0; + __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->B))); + __pyx_v_B = ((PyArrayObject *)__pyx_v_self->B); + + /* "_forward.pyx":387 + * cdef cnp.ndarray[FLOAT_t, ndim=2] B = self.B + * + * cdef INDEX_t num_candidates = candidates.shape[0] # <<<<<<<<<<<<<< + * + * cdef INDEX_t h + */ + __pyx_v_num_candidates = (__pyx_v_candidates->dimensions[0]); + + /* "_forward.pyx":421 + * + * #Compute the initial basis function + * candidate_idx = candidates[0] # <<<<<<<<<<<<<< + * candidate = X[order[candidate_idx],variable] + * for i in range(self.m):#TODO: Vectorize? + */ + __pyx_t_10 = 0; + __pyx_v_candidate_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_INT_t *, __pyx_pybuffernd_candidates.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_candidates.diminfo[0].strides)); + + /* "_forward.pyx":422 + * #Compute the initial basis function + * candidate_idx = candidates[0] + * candidate = X[order[candidate_idx],variable] # <<<<<<<<<<<<<< + * for i in range(self.m):#TODO: Vectorize? + * b[i] = 0 + */ + __pyx_t_11 = __pyx_v_candidate_idx; + __pyx_t_12 = (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_INT_t *, __pyx_pybuffernd_order.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_order.diminfo[0].strides)); + __pyx_t_13 = __pyx_v_variable; + __pyx_v_candidate = (*__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_X.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_X.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_X.diminfo[1].strides)); + + /* "_forward.pyx":423 + * candidate_idx = candidates[0] + * candidate = X[order[candidate_idx],variable] + * for i in range(self.m):#TODO: Vectorize? # <<<<<<<<<<<<<< + * b[i] = 0 + * for i_ in range(self.m): + */ + __pyx_t_14 = __pyx_v_self->m; + for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { + __pyx_v_i = __pyx_t_15; + + /* "_forward.pyx":424 + * candidate = X[order[candidate_idx],variable] + * for i in range(self.m):#TODO: Vectorize? + * b[i] = 0 # <<<<<<<<<<<<<< + * for i_ in range(self.m): + * i = order[i_] + */ + __pyx_t_16 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_b.diminfo[0].strides) = 0.0; + } + + /* "_forward.pyx":425 + * for i in range(self.m):#TODO: Vectorize? + * b[i] = 0 + * for i_ in range(self.m): # <<<<<<<<<<<<<< + * i = order[i_] + * float_tmp = X[i,variable] - candidate + */ + __pyx_t_14 = __pyx_v_self->m; + for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { + __pyx_v_i_ = __pyx_t_15; + + /* "_forward.pyx":426 + * b[i] = 0 + * for i_ in range(self.m): + * i = order[i_] # <<<<<<<<<<<<<< + * float_tmp = X[i,variable] - candidate + * if float_tmp > 0: + */ + __pyx_t_17 = __pyx_v_i_; + __pyx_v_i = (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_INT_t *, __pyx_pybuffernd_order.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_order.diminfo[0].strides)); + + /* "_forward.pyx":427 + * for i_ in range(self.m): + * i = order[i_] + * float_tmp = X[i,variable] - candidate # <<<<<<<<<<<<<< + * if float_tmp > 0: + * b[i] = b_parent[i]*float_tmp + */ + __pyx_t_18 = __pyx_v_i; + __pyx_t_19 = __pyx_v_variable; + __pyx_v_float_tmp = ((*__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_X.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_X.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_X.diminfo[1].strides)) - __pyx_v_candidate); + + /* "_forward.pyx":428 + * i = order[i_] + * float_tmp = X[i,variable] - candidate + * if float_tmp > 0: # <<<<<<<<<<<<<< + * b[i] = b_parent[i]*float_tmp + * else: + */ + __pyx_t_20 = (__pyx_v_float_tmp > 0.0); + if (__pyx_t_20) { + + /* "_forward.pyx":429 + * float_tmp = X[i,variable] - candidate + * if float_tmp > 0: + * b[i] = b_parent[i]*float_tmp # <<<<<<<<<<<<<< + * else: + * break + */ + __pyx_t_21 = __pyx_v_i; + __pyx_t_22 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_b.diminfo[0].strides) = ((*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_b_parent.diminfo[0].strides)) * __pyx_v_float_tmp); + goto __pyx_L7; + } + /*else*/ { + + /* "_forward.pyx":431 + * b[i] = b_parent[i]*float_tmp + * else: + * break # <<<<<<<<<<<<<< + * + * #Compute the initial covariance column, u (not including the final element) + */ + goto __pyx_L6_break; + } + __pyx_L7:; + } + __pyx_L6_break:; + + /* "_forward.pyx":434 + * + * #Compute the initial covariance column, u (not including the final element) + * u[0:k+1] = np.dot(b,B_orth[:,0:k+1]) # <<<<<<<<<<<<<< + * + * #Compute the new last elements of c and u + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong((__pyx_v_k + 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_23 = PySlice_New(__pyx_int_0, __pyx_t_1, Py_None); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_23); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_k_slice_22); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_k_slice_22); + __Pyx_GIVEREF(__pyx_k_slice_22); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_23); + __Pyx_GIVEREF(__pyx_t_23); + __pyx_t_23 = 0; + __pyx_t_23 = PyObject_GetItem(((PyObject *)__pyx_v_B_orth), ((PyObject *)__pyx_t_1)); if (!__pyx_t_23) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_23); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_v_b)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_b)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_b)); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_23); + __Pyx_GIVEREF(__pyx_t_23); + __pyx_t_23 = 0; + __pyx_t_23 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_23); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (__Pyx_PyObject_SetSlice(((PyObject *)__pyx_v_u), __pyx_t_23, 0, (__pyx_v_k + 1), NULL, NULL, NULL, 1, 1, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; + + /* "_forward.pyx":437 + * + * #Compute the new last elements of c and u + * c_end = 0.0 # <<<<<<<<<<<<<< + * u_end = 0.0 + * for i in range(self.m): + */ + __pyx_v_c_end = 0.0; + + /* "_forward.pyx":438 + * #Compute the new last elements of c and u + * c_end = 0.0 + * u_end = 0.0 # <<<<<<<<<<<<<< + * for i in range(self.m): + * u_end += b[i]*b[i] + */ + __pyx_v_u_end = 0.0; + + /* "_forward.pyx":439 + * c_end = 0.0 + * u_end = 0.0 + * for i in range(self.m): # <<<<<<<<<<<<<< + * u_end += b[i]*b[i] + * c_end += b[i]*y[i] + */ + __pyx_t_14 = __pyx_v_self->m; + for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { + __pyx_v_i = __pyx_t_15; + + /* "_forward.pyx":440 + * u_end = 0.0 + * for i in range(self.m): + * u_end += b[i]*b[i] # <<<<<<<<<<<<<< + * c_end += b[i]*y[i] + * + */ + __pyx_t_24 = __pyx_v_i; + __pyx_t_25 = __pyx_v_i; + __pyx_v_u_end = (__pyx_v_u_end + ((*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_b.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_b.diminfo[0].strides)))); + + /* "_forward.pyx":441 + * for i in range(self.m): + * u_end += b[i]*b[i] + * c_end += b[i]*y[i] # <<<<<<<<<<<<<< + * + * #Compute the last element of z (the others are identical to c) + */ + __pyx_t_26 = __pyx_v_i; + __pyx_t_27 = __pyx_v_i; + __pyx_v_c_end = (__pyx_v_c_end + ((*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_b.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_y.diminfo[0].strides)))); + } + + /* "_forward.pyx":444 + * + * #Compute the last element of z (the others are identical to c) + * u_dot_c = 0.0 # <<<<<<<<<<<<<< + * u_dot_u = 0.0 + * for i in range(k+1): + */ + __pyx_v_u_dot_c = 0.0; + + /* "_forward.pyx":445 + * #Compute the last element of z (the others are identical to c) + * u_dot_c = 0.0 + * u_dot_u = 0.0 # <<<<<<<<<<<<<< + * for i in range(k+1): + * u_dot_u += u[i]*u[i] + */ + __pyx_v_u_dot_u = 0.0; + + /* "_forward.pyx":446 + * u_dot_c = 0.0 + * u_dot_u = 0.0 + * for i in range(k+1): # <<<<<<<<<<<<<< + * u_dot_u += u[i]*u[i] + * u_dot_c += u[i]*c[i] + */ + __pyx_t_14 = (__pyx_v_k + 1); + for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { + __pyx_v_i = __pyx_t_15; + + /* "_forward.pyx":447 + * u_dot_u = 0.0 + * for i in range(k+1): + * u_dot_u += u[i]*u[i] # <<<<<<<<<<<<<< + * u_dot_c += u[i]*c[i] + * z_denom = u_end - u_dot_u + */ + __pyx_t_28 = __pyx_v_i; + __pyx_t_29 = __pyx_v_i; + __pyx_v_u_dot_u = (__pyx_v_u_dot_u + ((*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_u.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_u.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_u.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_u.diminfo[0].strides)))); + + /* "_forward.pyx":448 + * for i in range(k+1): + * u_dot_u += u[i]*u[i] + * u_dot_c += u[i]*c[i] # <<<<<<<<<<<<<< + * z_denom = u_end - u_dot_u + * if z_denom <= self.zero_tol: + */ + __pyx_t_30 = __pyx_v_i; + __pyx_t_31 = __pyx_v_i; + __pyx_v_u_dot_c = (__pyx_v_u_dot_c + ((*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_u.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_u.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_c.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_c.diminfo[0].strides)))); + } + + /* "_forward.pyx":449 + * u_dot_u += u[i]*u[i] + * u_dot_c += u[i]*c[i] + * z_denom = u_end - u_dot_u # <<<<<<<<<<<<<< + * if z_denom <= self.zero_tol: + * z_end_squared = np.nan + */ + __pyx_v_z_denom = (__pyx_v_u_end - __pyx_v_u_dot_u); + + /* "_forward.pyx":450 + * u_dot_c += u[i]*c[i] + * z_denom = u_end - u_dot_u + * if z_denom <= self.zero_tol: # <<<<<<<<<<<<<< + * z_end_squared = np.nan + * else: + */ + __pyx_t_20 = (__pyx_v_z_denom <= __pyx_v_self->zero_tol); + if (__pyx_t_20) { + + /* "_forward.pyx":451 + * z_denom = u_end - u_dot_u + * if z_denom <= self.zero_tol: + * z_end_squared = np.nan # <<<<<<<<<<<<<< + * else: + * z_end_squared = ((c_end - u_dot_c)**2) / z_denom + */ + __pyx_t_23 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_23); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_23, __pyx_n_s__nan); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; + __pyx_t_32 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_32 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_z_end_squared = __pyx_t_32; + goto __pyx_L12; + } + /*else*/ { + + /* "_forward.pyx":453 + * z_end_squared = np.nan + * else: + * z_end_squared = ((c_end - u_dot_c)**2) / z_denom # <<<<<<<<<<<<<< + * + * #Minimizing the norm is actually equivalent to maximizing z_end_squared + */ + __pyx_v_z_end_squared = (pow((__pyx_v_c_end - __pyx_v_u_dot_c), 2.0) / __pyx_v_z_denom); + } + __pyx_L12:; + + /* "_forward.pyx":457 + * #Minimizing the norm is actually equivalent to maximizing z_end_squared + * #Store z_end_squared and the current candidate as the best knot choice + * best_z_end_squared = z_end_squared # <<<<<<<<<<<<<< + * best_candidate_idx = candidate_idx + * best_candidate = candidate + */ + __pyx_v_best_z_end_squared = __pyx_v_z_end_squared; + + /* "_forward.pyx":458 + * #Store z_end_squared and the current candidate as the best knot choice + * best_z_end_squared = z_end_squared + * best_candidate_idx = candidate_idx # <<<<<<<<<<<<<< + * best_candidate = candidate + * + */ + __pyx_v_best_candidate_idx = __pyx_v_candidate_idx; + + /* "_forward.pyx":459 + * best_z_end_squared = z_end_squared + * best_candidate_idx = candidate_idx + * best_candidate = candidate # <<<<<<<<<<<<<< + * + * #Initialize the accumulators + */ + __pyx_v_best_candidate = __pyx_v_candidate; + + /* "_forward.pyx":462 + * + * #Initialize the accumulators + * i = order[0] # <<<<<<<<<<<<<< + * last_candidate_idx = 0 + * y_cum = y[i] + */ + __pyx_t_33 = 0; + __pyx_v_i = (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_INT_t *, __pyx_pybuffernd_order.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_order.diminfo[0].strides)); + + /* "_forward.pyx":463 + * #Initialize the accumulators + * i = order[0] + * last_candidate_idx = 0 # <<<<<<<<<<<<<< + * y_cum = y[i] + * B_orth_times_parent_cum[0:k+1] = B_orth[i,0:k+1] * b_parent[i] + */ + __pyx_v_last_candidate_idx = 0; + + /* "_forward.pyx":464 + * i = order[0] + * last_candidate_idx = 0 + * y_cum = y[i] # <<<<<<<<<<<<<< + * B_orth_times_parent_cum[0:k+1] = B_orth[i,0:k+1] * b_parent[i] + * b_times_parent_cum = b[i] * b_parent[i] + */ + __pyx_t_14 = __pyx_v_i; + __pyx_v_y_cum = (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_y.diminfo[0].strides)); + + /* "_forward.pyx":465 + * last_candidate_idx = 0 + * y_cum = y[i] + * B_orth_times_parent_cum[0:k+1] = B_orth[i,0:k+1] * b_parent[i] # <<<<<<<<<<<<<< + * b_times_parent_cum = b[i] * b_parent[i] + * parent_squared_cum = b_parent[i] ** 2 + */ + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_23 = __Pyx_PyInt_to_py_npy_ulonglong((__pyx_v_k + 1)); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_23); + __pyx_t_2 = PySlice_New(__pyx_int_0, __pyx_t_23, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; + __pyx_t_23 = PyTuple_New(2); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_23); + PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_23, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_B_orth), ((PyObject *)__pyx_t_23)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_23)); __pyx_t_23 = 0; + __pyx_t_15 = __pyx_v_i; + __pyx_t_23 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_b_parent.diminfo[0].strides))); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_23); + __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_t_23); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; + if (__Pyx_PyObject_SetSlice(((PyObject *)__pyx_v_B_orth_times_parent_cum), __pyx_t_1, 0, (__pyx_v_k + 1), NULL, NULL, NULL, 1, 1, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "_forward.pyx":466 + * y_cum = y[i] + * B_orth_times_parent_cum[0:k+1] = B_orth[i,0:k+1] * b_parent[i] + * b_times_parent_cum = b[i] * b_parent[i] # <<<<<<<<<<<<<< + * parent_squared_cum = b_parent[i] ** 2 + * parent_times_y_cum = b_parent[i] * y[i] + */ + __pyx_t_34 = __pyx_v_i; + __pyx_t_35 = __pyx_v_i; + __pyx_v_b_times_parent_cum = ((*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_b.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_b_parent.diminfo[0].strides))); + + /* "_forward.pyx":467 + * B_orth_times_parent_cum[0:k+1] = B_orth[i,0:k+1] * b_parent[i] + * b_times_parent_cum = b[i] * b_parent[i] + * parent_squared_cum = b_parent[i] ** 2 # <<<<<<<<<<<<<< + * parent_times_y_cum = b_parent[i] * y[i] + * + */ + __pyx_t_36 = __pyx_v_i; + __pyx_v_parent_squared_cum = pow((*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_b_parent.diminfo[0].strides)), 2.0); + + /* "_forward.pyx":468 + * b_times_parent_cum = b[i] * b_parent[i] + * parent_squared_cum = b_parent[i] ** 2 + * parent_times_y_cum = b_parent[i] * y[i] # <<<<<<<<<<<<<< + * + * #Now loop over the remaining candidates and update z_end_squared for each, looking for the greatest value + */ + __pyx_t_37 = __pyx_v_i; + __pyx_t_38 = __pyx_v_i; + __pyx_v_parent_times_y_cum = ((*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_b_parent.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_y.diminfo[0].strides))); + + /* "_forward.pyx":471 + * + * #Now loop over the remaining candidates and update z_end_squared for each, looking for the greatest value + * for i_ in range(1,num_candidates): # <<<<<<<<<<<<<< + * i = order[i_] + * + */ + __pyx_t_39 = __pyx_v_num_candidates; + for (__pyx_t_40 = 1; __pyx_t_40 < __pyx_t_39; __pyx_t_40+=1) { + __pyx_v_i_ = __pyx_t_40; + + /* "_forward.pyx":472 + * #Now loop over the remaining candidates and update z_end_squared for each, looking for the greatest value + * for i_ in range(1,num_candidates): + * i = order[i_] # <<<<<<<<<<<<<< + * + * #Update the candidate + */ + __pyx_t_41 = __pyx_v_i_; + __pyx_v_i = (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_INT_t *, __pyx_pybuffernd_order.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_order.diminfo[0].strides)); + + /* "_forward.pyx":475 + * + * #Update the candidate + * last_last_candidate_idx = last_candidate_idx # <<<<<<<<<<<<<< + * last_candidate_idx = candidate_idx + * last_candidate = candidate + */ + __pyx_v_last_last_candidate_idx = __pyx_v_last_candidate_idx; + + /* "_forward.pyx":476 + * #Update the candidate + * last_last_candidate_idx = last_candidate_idx + * last_candidate_idx = candidate_idx # <<<<<<<<<<<<<< + * last_candidate = candidate + * candidate_idx = candidates[i_] + */ + __pyx_v_last_candidate_idx = __pyx_v_candidate_idx; + + /* "_forward.pyx":477 + * last_last_candidate_idx = last_candidate_idx + * last_candidate_idx = candidate_idx + * last_candidate = candidate # <<<<<<<<<<<<<< + * candidate_idx = candidates[i_] + * candidate = X[order[candidate_idx],variable] + */ + __pyx_v_last_candidate = __pyx_v_candidate; + + /* "_forward.pyx":478 + * last_candidate_idx = candidate_idx + * last_candidate = candidate + * candidate_idx = candidates[i_] # <<<<<<<<<<<<<< + * candidate = X[order[candidate_idx],variable] + * + */ + __pyx_t_42 = __pyx_v_i_; + __pyx_v_candidate_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_INT_t *, __pyx_pybuffernd_candidates.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_candidates.diminfo[0].strides)); + + /* "_forward.pyx":479 + * last_candidate = candidate + * candidate_idx = candidates[i_] + * candidate = X[order[candidate_idx],variable] # <<<<<<<<<<<<<< + * + * #Update the accumulators and compute delta_b + */ + __pyx_t_43 = __pyx_v_candidate_idx; + __pyx_t_44 = (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_INT_t *, __pyx_pybuffernd_order.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_order.diminfo[0].strides)); + __pyx_t_45 = __pyx_v_variable; + __pyx_v_candidate = (*__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_X.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_X.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_X.diminfo[1].strides)); + + /* "_forward.pyx":482 + * + * #Update the accumulators and compute delta_b + * diff = last_candidate - candidate # <<<<<<<<<<<<<< + * delta_c_end = 0.0 + * + */ + __pyx_v_diff = (__pyx_v_last_candidate - __pyx_v_candidate); + + /* "_forward.pyx":483 + * #Update the accumulators and compute delta_b + * diff = last_candidate - candidate + * delta_c_end = 0.0 # <<<<<<<<<<<<<< + * + * #What follows is a section of code that has been optimized for speed at the expense of + */ + __pyx_v_delta_c_end = 0.0; + + /* "_forward.pyx":514 + * + * #BEGIN HYPER-OPTIMIZED + * delta_b_squared = 0.0 # <<<<<<<<<<<<<< + * delta_c_end = 0.0 + * delta_u_end = 0.0 + */ + __pyx_v_delta_b_squared = 0.0; + + /* "_forward.pyx":515 + * #BEGIN HYPER-OPTIMIZED + * delta_b_squared = 0.0 + * delta_c_end = 0.0 # <<<<<<<<<<<<<< + * delta_u_end = 0.0 + * + */ + __pyx_v_delta_c_end = 0.0; + + /* "_forward.pyx":516 + * delta_b_squared = 0.0 + * delta_c_end = 0.0 + * delta_u_end = 0.0 # <<<<<<<<<<<<<< + * + * #Update the accumulators + */ + __pyx_v_delta_u_end = 0.0; + + /* "_forward.pyx":519 + * + * #Update the accumulators + * for j_ in range(last_last_candidate_idx+1,last_candidate_idx+1): # <<<<<<<<<<<<<< + * j = order[j_] + * y_cum += y[j] + */ + __pyx_t_46 = (__pyx_v_last_candidate_idx + 1); + for (__pyx_t_47 = (__pyx_v_last_last_candidate_idx + 1); __pyx_t_47 < __pyx_t_46; __pyx_t_47+=1) { + __pyx_v_j_ = __pyx_t_47; + + /* "_forward.pyx":520 + * #Update the accumulators + * for j_ in range(last_last_candidate_idx+1,last_candidate_idx+1): + * j = order[j_] # <<<<<<<<<<<<<< + * y_cum += y[j] + * for h in range(k+1):#TODO: BLAS + */ + __pyx_t_48 = __pyx_v_j_; + __pyx_v_j = (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_INT_t *, __pyx_pybuffernd_order.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_order.diminfo[0].strides)); + + /* "_forward.pyx":521 + * for j_ in range(last_last_candidate_idx+1,last_candidate_idx+1): + * j = order[j_] + * y_cum += y[j] # <<<<<<<<<<<<<< + * for h in range(k+1):#TODO: BLAS + * B_orth_times_parent_cum[h] += B_orth[j,h]*b_parent[j] + */ + __pyx_t_49 = __pyx_v_j; + __pyx_v_y_cum = (__pyx_v_y_cum + (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_49, __pyx_pybuffernd_y.diminfo[0].strides))); + + /* "_forward.pyx":522 + * j = order[j_] + * y_cum += y[j] + * for h in range(k+1):#TODO: BLAS # <<<<<<<<<<<<<< + * B_orth_times_parent_cum[h] += B_orth[j,h]*b_parent[j] + * b_times_parent_cum += b[j]*b_parent[j] + */ + __pyx_t_50 = (__pyx_v_k + 1); + for (__pyx_t_51 = 0; __pyx_t_51 < __pyx_t_50; __pyx_t_51+=1) { + __pyx_v_h = __pyx_t_51; + + /* "_forward.pyx":523 + * y_cum += y[j] + * for h in range(k+1):#TODO: BLAS + * B_orth_times_parent_cum[h] += B_orth[j,h]*b_parent[j] # <<<<<<<<<<<<<< + * b_times_parent_cum += b[j]*b_parent[j] + * parent_squared_cum += b_parent[j] ** 2 + */ + __pyx_t_52 = __pyx_v_j; + __pyx_t_53 = __pyx_v_h; + __pyx_t_54 = __pyx_v_j; + __pyx_t_55 = __pyx_v_h; + *__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth_times_parent_cum.rcbuffer->pybuffer.buf, __pyx_t_55, __pyx_pybuffernd_B_orth_times_parent_cum.diminfo[0].strides) += ((*__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_52, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_53, __pyx_pybuffernd_B_orth.diminfo[1].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_54, __pyx_pybuffernd_b_parent.diminfo[0].strides))); + } + + /* "_forward.pyx":524 + * for h in range(k+1):#TODO: BLAS + * B_orth_times_parent_cum[h] += B_orth[j,h]*b_parent[j] + * b_times_parent_cum += b[j]*b_parent[j] # <<<<<<<<<<<<<< + * parent_squared_cum += b_parent[j] ** 2 + * parent_times_y_cum += b_parent[j] * y[j] + */ + __pyx_t_50 = __pyx_v_j; + __pyx_t_51 = __pyx_v_j; + __pyx_v_b_times_parent_cum = (__pyx_v_b_times_parent_cum + ((*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_50, __pyx_pybuffernd_b.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_51, __pyx_pybuffernd_b_parent.diminfo[0].strides)))); + + /* "_forward.pyx":525 + * B_orth_times_parent_cum[h] += B_orth[j,h]*b_parent[j] + * b_times_parent_cum += b[j]*b_parent[j] + * parent_squared_cum += b_parent[j] ** 2 # <<<<<<<<<<<<<< + * parent_times_y_cum += b_parent[j] * y[j] + * delta_c_end += diff * parent_times_y_cum + */ + __pyx_t_56 = __pyx_v_j; + __pyx_v_parent_squared_cum = (__pyx_v_parent_squared_cum + pow((*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_56, __pyx_pybuffernd_b_parent.diminfo[0].strides)), 2.0)); + + /* "_forward.pyx":526 + * b_times_parent_cum += b[j]*b_parent[j] + * parent_squared_cum += b_parent[j] ** 2 + * parent_times_y_cum += b_parent[j] * y[j] # <<<<<<<<<<<<<< + * delta_c_end += diff * parent_times_y_cum + * delta_u_end += 2*diff * b_times_parent_cum + */ + __pyx_t_57 = __pyx_v_j; + __pyx_t_58 = __pyx_v_j; + __pyx_v_parent_times_y_cum = (__pyx_v_parent_times_y_cum + ((*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_57, __pyx_pybuffernd_b_parent.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_58, __pyx_pybuffernd_y.diminfo[0].strides)))); + } + + /* "_forward.pyx":527 + * parent_squared_cum += b_parent[j] ** 2 + * parent_times_y_cum += b_parent[j] * y[j] + * delta_c_end += diff * parent_times_y_cum # <<<<<<<<<<<<<< + * delta_u_end += 2*diff * b_times_parent_cum + * delta_b_squared = (diff**2)*parent_squared_cum + */ + __pyx_v_delta_c_end = (__pyx_v_delta_c_end + (__pyx_v_diff * __pyx_v_parent_times_y_cum)); + + /* "_forward.pyx":528 + * parent_times_y_cum += b_parent[j] * y[j] + * delta_c_end += diff * parent_times_y_cum + * delta_u_end += 2*diff * b_times_parent_cum # <<<<<<<<<<<<<< + * delta_b_squared = (diff**2)*parent_squared_cum + * + */ + __pyx_v_delta_u_end = (__pyx_v_delta_u_end + ((2.0 * __pyx_v_diff) * __pyx_v_b_times_parent_cum)); + + /* "_forward.pyx":529 + * delta_c_end += diff * parent_times_y_cum + * delta_u_end += 2*diff * b_times_parent_cum + * delta_b_squared = (diff**2)*parent_squared_cum # <<<<<<<<<<<<<< + * + * #Update u and a bunch of other stuff + */ + __pyx_v_delta_b_squared = (pow(__pyx_v_diff, 2.0) * __pyx_v_parent_squared_cum); + + /* "_forward.pyx":532 + * + * #Update u and a bunch of other stuff + * for j in range(k+1): # <<<<<<<<<<<<<< + * float_tmp = diff*B_orth_times_parent_cum[j] + * u_dot_c += float_tmp * c[j] + */ + __pyx_t_46 = (__pyx_v_k + 1); + for (__pyx_t_47 = 0; __pyx_t_47 < __pyx_t_46; __pyx_t_47+=1) { + __pyx_v_j = __pyx_t_47; + + /* "_forward.pyx":533 + * #Update u and a bunch of other stuff + * for j in range(k+1): + * float_tmp = diff*B_orth_times_parent_cum[j] # <<<<<<<<<<<<<< + * u_dot_c += float_tmp * c[j] + * u_dot_u += 2*u[j]*float_tmp + float_tmp*float_tmp + */ + __pyx_t_59 = __pyx_v_j; + __pyx_v_float_tmp = (__pyx_v_diff * (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth_times_parent_cum.rcbuffer->pybuffer.buf, __pyx_t_59, __pyx_pybuffernd_B_orth_times_parent_cum.diminfo[0].strides))); + + /* "_forward.pyx":534 + * for j in range(k+1): + * float_tmp = diff*B_orth_times_parent_cum[j] + * u_dot_c += float_tmp * c[j] # <<<<<<<<<<<<<< + * u_dot_u += 2*u[j]*float_tmp + float_tmp*float_tmp + * u[j] += float_tmp + */ + __pyx_t_60 = __pyx_v_j; + __pyx_v_u_dot_c = (__pyx_v_u_dot_c + (__pyx_v_float_tmp * (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_c.rcbuffer->pybuffer.buf, __pyx_t_60, __pyx_pybuffernd_c.diminfo[0].strides)))); + + /* "_forward.pyx":535 + * float_tmp = diff*B_orth_times_parent_cum[j] + * u_dot_c += float_tmp * c[j] + * u_dot_u += 2*u[j]*float_tmp + float_tmp*float_tmp # <<<<<<<<<<<<<< + * u[j] += float_tmp + * for j_ in range(last_candidate_idx+1,candidate_idx): + */ + __pyx_t_61 = __pyx_v_j; + __pyx_v_u_dot_u = (__pyx_v_u_dot_u + (((2.0 * (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_u.rcbuffer->pybuffer.buf, __pyx_t_61, __pyx_pybuffernd_u.diminfo[0].strides))) * __pyx_v_float_tmp) + (__pyx_v_float_tmp * __pyx_v_float_tmp))); + + /* "_forward.pyx":536 + * u_dot_c += float_tmp * c[j] + * u_dot_u += 2*u[j]*float_tmp + float_tmp*float_tmp + * u[j] += float_tmp # <<<<<<<<<<<<<< + * for j_ in range(last_candidate_idx+1,candidate_idx): + * j = order[j_] + */ + __pyx_t_62 = __pyx_v_j; + *__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_u.rcbuffer->pybuffer.buf, __pyx_t_62, __pyx_pybuffernd_u.diminfo[0].strides) += __pyx_v_float_tmp; + } + + /* "_forward.pyx":537 + * u_dot_u += 2*u[j]*float_tmp + float_tmp*float_tmp + * u[j] += float_tmp + * for j_ in range(last_candidate_idx+1,candidate_idx): # <<<<<<<<<<<<<< + * j = order[j_] + * delta_b_j = (X[j,variable] - candidate) * b_parent[j] + */ + __pyx_t_46 = __pyx_v_candidate_idx; + for (__pyx_t_47 = (__pyx_v_last_candidate_idx + 1); __pyx_t_47 < __pyx_t_46; __pyx_t_47+=1) { + __pyx_v_j_ = __pyx_t_47; + + /* "_forward.pyx":538 + * u[j] += float_tmp + * for j_ in range(last_candidate_idx+1,candidate_idx): + * j = order[j_] # <<<<<<<<<<<<<< + * delta_b_j = (X[j,variable] - candidate) * b_parent[j] + * delta_b_squared += delta_b_j**2 + */ + __pyx_t_63 = __pyx_v_j_; + __pyx_v_j = (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_INT_t *, __pyx_pybuffernd_order.rcbuffer->pybuffer.buf, __pyx_t_63, __pyx_pybuffernd_order.diminfo[0].strides)); + + /* "_forward.pyx":539 + * for j_ in range(last_candidate_idx+1,candidate_idx): + * j = order[j_] + * delta_b_j = (X[j,variable] - candidate) * b_parent[j] # <<<<<<<<<<<<<< + * delta_b_squared += delta_b_j**2 + * delta_c_end += delta_b_j * y[j] + */ + __pyx_t_64 = __pyx_v_j; + __pyx_t_65 = __pyx_v_variable; + __pyx_t_66 = __pyx_v_j; + __pyx_v_delta_b_j = (((*__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_X.rcbuffer->pybuffer.buf, __pyx_t_64, __pyx_pybuffernd_X.diminfo[0].strides, __pyx_t_65, __pyx_pybuffernd_X.diminfo[1].strides)) - __pyx_v_candidate) * (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_66, __pyx_pybuffernd_b_parent.diminfo[0].strides))); + + /* "_forward.pyx":540 + * j = order[j_] + * delta_b_j = (X[j,variable] - candidate) * b_parent[j] + * delta_b_squared += delta_b_j**2 # <<<<<<<<<<<<<< + * delta_c_end += delta_b_j * y[j] + * delta_u_end += 2*delta_b_j*b[j] + */ + __pyx_v_delta_b_squared = (__pyx_v_delta_b_squared + pow(__pyx_v_delta_b_j, 2.0)); + + /* "_forward.pyx":541 + * delta_b_j = (X[j,variable] - candidate) * b_parent[j] + * delta_b_squared += delta_b_j**2 + * delta_c_end += delta_b_j * y[j] # <<<<<<<<<<<<<< + * delta_u_end += 2*delta_b_j*b[j] + * for h in range(k+1): + */ + __pyx_t_67 = __pyx_v_j; + __pyx_v_delta_c_end = (__pyx_v_delta_c_end + (__pyx_v_delta_b_j * (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_67, __pyx_pybuffernd_y.diminfo[0].strides)))); + + /* "_forward.pyx":542 + * delta_b_squared += delta_b_j**2 + * delta_c_end += delta_b_j * y[j] + * delta_u_end += 2*delta_b_j*b[j] # <<<<<<<<<<<<<< + * for h in range(k+1): + * float_tmp = delta_b_j * B_orth[j,h] + */ + __pyx_t_68 = __pyx_v_j; + __pyx_v_delta_u_end = (__pyx_v_delta_u_end + ((2.0 * __pyx_v_delta_b_j) * (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_68, __pyx_pybuffernd_b.diminfo[0].strides)))); + + /* "_forward.pyx":543 + * delta_c_end += delta_b_j * y[j] + * delta_u_end += 2*delta_b_j*b[j] + * for h in range(k+1): # <<<<<<<<<<<<<< + * float_tmp = delta_b_j * B_orth[j,h] + * u_dot_c += float_tmp * c[h] + */ + __pyx_t_69 = (__pyx_v_k + 1); + for (__pyx_t_70 = 0; __pyx_t_70 < __pyx_t_69; __pyx_t_70+=1) { + __pyx_v_h = __pyx_t_70; + + /* "_forward.pyx":544 + * delta_u_end += 2*delta_b_j*b[j] + * for h in range(k+1): + * float_tmp = delta_b_j * B_orth[j,h] # <<<<<<<<<<<<<< + * u_dot_c += float_tmp * c[h] + * u_dot_u += 2*u[h]*float_tmp + float_tmp*float_tmp + */ + __pyx_t_71 = __pyx_v_j; + __pyx_t_72 = __pyx_v_h; + __pyx_v_float_tmp = (__pyx_v_delta_b_j * (*__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_71, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_72, __pyx_pybuffernd_B_orth.diminfo[1].strides))); + + /* "_forward.pyx":545 + * for h in range(k+1): + * float_tmp = delta_b_j * B_orth[j,h] + * u_dot_c += float_tmp * c[h] # <<<<<<<<<<<<<< + * u_dot_u += 2*u[h]*float_tmp + float_tmp*float_tmp + * u[h] += float_tmp + */ + __pyx_t_73 = __pyx_v_h; + __pyx_v_u_dot_c = (__pyx_v_u_dot_c + (__pyx_v_float_tmp * (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_c.rcbuffer->pybuffer.buf, __pyx_t_73, __pyx_pybuffernd_c.diminfo[0].strides)))); + + /* "_forward.pyx":546 + * float_tmp = delta_b_j * B_orth[j,h] + * u_dot_c += float_tmp * c[h] + * u_dot_u += 2*u[h]*float_tmp + float_tmp*float_tmp # <<<<<<<<<<<<<< + * u[h] += float_tmp + * b[j] += delta_b_j + */ + __pyx_t_74 = __pyx_v_h; + __pyx_v_u_dot_u = (__pyx_v_u_dot_u + (((2.0 * (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_u.rcbuffer->pybuffer.buf, __pyx_t_74, __pyx_pybuffernd_u.diminfo[0].strides))) * __pyx_v_float_tmp) + (__pyx_v_float_tmp * __pyx_v_float_tmp))); + + /* "_forward.pyx":547 + * u_dot_c += float_tmp * c[h] + * u_dot_u += 2*u[h]*float_tmp + float_tmp*float_tmp + * u[h] += float_tmp # <<<<<<<<<<<<<< + * b[j] += delta_b_j + * + */ + __pyx_t_75 = __pyx_v_h; + *__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_u.rcbuffer->pybuffer.buf, __pyx_t_75, __pyx_pybuffernd_u.diminfo[0].strides) += __pyx_v_float_tmp; + } + + /* "_forward.pyx":548 + * u_dot_u += 2*u[h]*float_tmp + float_tmp*float_tmp + * u[h] += float_tmp + * b[j] += delta_b_j # <<<<<<<<<<<<<< + * + * #Update u_end + */ + __pyx_t_69 = __pyx_v_j; + *__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_69, __pyx_pybuffernd_b.diminfo[0].strides) += __pyx_v_delta_b_j; + } + + /* "_forward.pyx":551 + * + * #Update u_end + * delta_u_end += delta_b_squared # <<<<<<<<<<<<<< + * u_end += delta_u_end + * + */ + __pyx_v_delta_u_end = (__pyx_v_delta_u_end + __pyx_v_delta_b_squared); + + /* "_forward.pyx":552 + * #Update u_end + * delta_u_end += delta_b_squared + * u_end += delta_u_end # <<<<<<<<<<<<<< + * + * #Update c_end + */ + __pyx_v_u_end = (__pyx_v_u_end + __pyx_v_delta_u_end); + + /* "_forward.pyx":555 + * + * #Update c_end + * c_end += delta_c_end # <<<<<<<<<<<<<< + * + * #Update b_times_parent_cum + */ + __pyx_v_c_end = (__pyx_v_c_end + __pyx_v_delta_c_end); + + /* "_forward.pyx":558 + * + * #Update b_times_parent_cum + * b_times_parent_cum += parent_squared_cum * diff # <<<<<<<<<<<<<< + * + * #Compute the new z_end_squared (this is the quantity we're optimizing) + */ + __pyx_v_b_times_parent_cum = (__pyx_v_b_times_parent_cum + (__pyx_v_parent_squared_cum * __pyx_v_diff)); + + /* "_forward.pyx":561 + * + * #Compute the new z_end_squared (this is the quantity we're optimizing) + * if (u_end - u_dot_u) <= self.zero_tol: # <<<<<<<<<<<<<< + * continue + * z_end_squared = ((c_end - u_dot_c)**2) / (u_end - u_dot_u) + */ + __pyx_t_20 = ((__pyx_v_u_end - __pyx_v_u_dot_u) <= __pyx_v_self->zero_tol); + if (__pyx_t_20) { + + /* "_forward.pyx":562 + * #Compute the new z_end_squared (this is the quantity we're optimizing) + * if (u_end - u_dot_u) <= self.zero_tol: + * continue # <<<<<<<<<<<<<< + * z_end_squared = ((c_end - u_dot_c)**2) / (u_end - u_dot_u) + * #END HYPER-OPTIMIZED + */ + goto __pyx_L13_continue; + goto __pyx_L25; + } + __pyx_L25:; + + /* "_forward.pyx":563 + * if (u_end - u_dot_u) <= self.zero_tol: + * continue + * z_end_squared = ((c_end - u_dot_c)**2) / (u_end - u_dot_u) # <<<<<<<<<<<<<< + * #END HYPER-OPTIMIZED + * + */ + __pyx_v_z_end_squared = (pow((__pyx_v_c_end - __pyx_v_u_dot_c), 2.0) / (__pyx_v_u_end - __pyx_v_u_dot_u)); + + /* "_forward.pyx":567 + * + * #Update the best if necessary + * if z_end_squared > best_z_end_squared: # <<<<<<<<<<<<<< + * best_z_end_squared = z_end_squared + * best_candidate_idx = candidate_idx + */ + __pyx_t_20 = (__pyx_v_z_end_squared > __pyx_v_best_z_end_squared); + if (__pyx_t_20) { + + /* "_forward.pyx":568 + * #Update the best if necessary + * if z_end_squared > best_z_end_squared: + * best_z_end_squared = z_end_squared # <<<<<<<<<<<<<< + * best_candidate_idx = candidate_idx + * best_candidate = candidate + */ + __pyx_v_best_z_end_squared = __pyx_v_z_end_squared; + + /* "_forward.pyx":569 + * if z_end_squared > best_z_end_squared: + * best_z_end_squared = z_end_squared + * best_candidate_idx = candidate_idx # <<<<<<<<<<<<<< + * best_candidate = candidate + * + */ + __pyx_v_best_candidate_idx = __pyx_v_candidate_idx; + + /* "_forward.pyx":570 + * best_z_end_squared = z_end_squared + * best_candidate_idx = candidate_idx + * best_candidate = candidate # <<<<<<<<<<<<<< + * + * #Compute the mse for the best z_end and set return values + */ + __pyx_v_best_candidate = __pyx_v_candidate; + goto __pyx_L26; + } + __pyx_L26:; + __pyx_L13_continue:; + } + + /* "_forward.pyx":573 + * + * #Compute the mse for the best z_end and set return values + * mse[0] = (self.y_squared - self.c_squared - best_z_end_squared)/self.m # <<<<<<<<<<<<<< + * knot[0] = best_candidate + * knot_idx[0] = best_candidate_idx + */ + (__pyx_v_mse[0]) = (((__pyx_v_self->y_squared - __pyx_v_self->c_squared) - __pyx_v_best_z_end_squared) / __pyx_v_self->m); + + /* "_forward.pyx":574 + * #Compute the mse for the best z_end and set return values + * mse[0] = (self.y_squared - self.c_squared - best_z_end_squared)/self.m + * knot[0] = best_candidate # <<<<<<<<<<<<<< + * knot_idx[0] = best_candidate_idx + * + */ + (__pyx_v_knot[0]) = __pyx_v_best_candidate; + + /* "_forward.pyx":575 + * mse[0] = (self.y_squared - self.c_squared - best_z_end_squared)/self.m + * knot[0] = best_candidate + * knot_idx[0] = best_candidate_idx # <<<<<<<<<<<<<< + * + * + */ + (__pyx_v_knot_idx[0]) = __pyx_v_best_candidate_idx; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_23); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_B.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_B_orth.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_B_orth_times_parent_cum.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_b.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_b_parent.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_c.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_candidates.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_order.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_u.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("_forward.ForwardPasser.best_knot", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_B.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_B_orth.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_B_orth_times_parent_cum.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_b.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_b_parent.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_c.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_candidates.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_order.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_u.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_b); + __Pyx_XDECREF((PyObject *)__pyx_v_b_parent); + __Pyx_XDECREF((PyObject *)__pyx_v_u); + __Pyx_XDECREF((PyObject *)__pyx_v_B_orth); + __Pyx_XDECREF((PyObject *)__pyx_v_X); + __Pyx_XDECREF((PyObject *)__pyx_v_y); + __Pyx_XDECREF((PyObject *)__pyx_v_c); + __Pyx_XDECREF((PyObject *)__pyx_v_B_orth_times_parent_cum); + __Pyx_XDECREF((PyObject *)__pyx_v_B); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":194 + * # experimental exception made for __getbuffer__ and __releasebuffer__ + * # -- the details of this may change. + * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< + * # This implementation of getbuffer is geared towards Cython + * # requirements, and does not yet fullfill the PEP. + */ + +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_v_copy_shape; + int __pyx_v_i; + int __pyx_v_ndim; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; + int __pyx_v_t; + char *__pyx_v_f; + PyArray_Descr *__pyx_v_descr = 0; + int __pyx_v_offset; + int __pyx_v_hasfields; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + char *__pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getbuffer__", 0); + if (__pyx_v_info != NULL) { + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + } + + /* "numpy.pxd":200 + * # of flags + * + * if info == NULL: return # <<<<<<<<<<<<<< + * + * cdef int copy_shape, i, ndim + */ + __pyx_t_1 = (__pyx_v_info == NULL); + if (__pyx_t_1) { + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "numpy.pxd":203 + * + * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + */ + __pyx_v_endian_detector = 1; + + /* "numpy.pxd":204 + * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * + * ndim = PyArray_NDIM(self) + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "numpy.pxd":206 + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + */ + __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); + + /* "numpy.pxd":208 + * ndim = PyArray_NDIM(self) + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< + * copy_shape = 1 + * else: + */ + __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_1) { + + /* "numpy.pxd":209 + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * copy_shape = 1 # <<<<<<<<<<<<<< + * else: + * copy_shape = 0 + */ + __pyx_v_copy_shape = 1; + goto __pyx_L4; + } + /*else*/ { + + /* "numpy.pxd":211 + * copy_shape = 1 + * else: + * copy_shape = 0 # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + */ + __pyx_v_copy_shape = 0; + } + __pyx_L4:; + + /* "numpy.pxd":213 + * copy_shape = 0 + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") + */ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); + if (__pyx_t_1) { + + /* "numpy.pxd":214 + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not C contiguous") + * + */ + __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS)); + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + + /* "numpy.pxd":215 + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + */ + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_24), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "numpy.pxd":217 + * raise ValueError(u"ndarray is not C contiguous") + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") + */ + __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); + if (__pyx_t_3) { + + /* "numpy.pxd":218 + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not Fortran contiguous") + * + */ + __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS)); + __pyx_t_2 = __pyx_t_1; + } else { + __pyx_t_2 = __pyx_t_3; + } + if (__pyx_t_2) { + + /* "numpy.pxd":219 + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * + * info.buf = PyArray_DATA(self) + */ + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_26), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "numpy.pxd":221 + * raise ValueError(u"ndarray is not Fortran contiguous") + * + * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< + * info.ndim = ndim + * if copy_shape: + */ + __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); + + /* "numpy.pxd":222 + * + * info.buf = PyArray_DATA(self) + * info.ndim = ndim # <<<<<<<<<<<<<< + * if copy_shape: + * # Allocate new buffer for strides and shape info. + */ + __pyx_v_info->ndim = __pyx_v_ndim; + + /* "numpy.pxd":223 + * info.buf = PyArray_DATA(self) + * info.ndim = ndim + * if copy_shape: # <<<<<<<<<<<<<< + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. + */ + if (__pyx_v_copy_shape) { + + /* "numpy.pxd":226 + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< + * info.shape = info.strides + ndim + * for i in range(ndim): + */ + __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); + + /* "numpy.pxd":227 + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + * info.shape = info.strides + ndim # <<<<<<<<<<<<<< + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] + */ + __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); + + /* "numpy.pxd":228 + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + * info.shape = info.strides + ndim + * for i in range(ndim): # <<<<<<<<<<<<<< + * info.strides[i] = PyArray_STRIDES(self)[i] + * info.shape[i] = PyArray_DIMS(self)[i] + */ + __pyx_t_5 = __pyx_v_ndim; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "numpy.pxd":229 + * info.shape = info.strides + ndim + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< + * info.shape[i] = PyArray_DIMS(self)[i] + * else: + */ + (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); + + /* "numpy.pxd":230 + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] + * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< + * else: + * info.strides = PyArray_STRIDES(self) + */ + (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); + } + goto __pyx_L7; + } + /*else*/ { + + /* "numpy.pxd":232 + * info.shape[i] = PyArray_DIMS(self)[i] + * else: + * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL + */ + __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); + + /* "numpy.pxd":233 + * else: + * info.strides = PyArray_STRIDES(self) + * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) + */ + __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); + } + __pyx_L7:; + + /* "numpy.pxd":234 + * info.strides = PyArray_STRIDES(self) + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL # <<<<<<<<<<<<<< + * info.itemsize = PyArray_ITEMSIZE(self) + * info.readonly = not PyArray_ISWRITEABLE(self) + */ + __pyx_v_info->suboffsets = NULL; + + /* "numpy.pxd":235 + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< + * info.readonly = not PyArray_ISWRITEABLE(self) + * + */ + __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); + + /* "numpy.pxd":236 + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) + * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< + * + * cdef int t + */ + __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self)); + + /* "numpy.pxd":239 + * + * cdef int t + * cdef char* f = NULL # <<<<<<<<<<<<<< + * cdef dtype descr = self.descr + * cdef list stack + */ + __pyx_v_f = NULL; + + /* "numpy.pxd":240 + * cdef int t + * cdef char* f = NULL + * cdef dtype descr = self.descr # <<<<<<<<<<<<<< + * cdef list stack + * cdef int offset + */ + __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); + __Pyx_INCREF(__pyx_t_4); + __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "numpy.pxd":244 + * cdef int offset + * + * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< + * + * if not hasfields and not copy_shape: + */ + __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); + + /* "numpy.pxd":246 + * cdef bint hasfields = PyDataType_HASFIELDS(descr) + * + * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< + * # do not call releasebuffer + * info.obj = None + */ + __pyx_t_2 = (!__pyx_v_hasfields); + if (__pyx_t_2) { + __pyx_t_3 = (!__pyx_v_copy_shape); + __pyx_t_1 = __pyx_t_3; + } else { + __pyx_t_1 = __pyx_t_2; + } + if (__pyx_t_1) { + + /* "numpy.pxd":248 + * if not hasfields and not copy_shape: + * # do not call releasebuffer + * info.obj = None # <<<<<<<<<<<<<< + * else: + * # need to call releasebuffer + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = Py_None; + goto __pyx_L10; + } + /*else*/ { + + /* "numpy.pxd":251 + * else: + * # need to call releasebuffer + * info.obj = self # <<<<<<<<<<<<<< + * + * if not hasfields: + */ + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); + } + __pyx_L10:; + + /* "numpy.pxd":253 + * info.obj = self + * + * if not hasfields: # <<<<<<<<<<<<<< + * t = descr.type_num + * if ((descr.byteorder == c'>' and little_endian) or + */ + __pyx_t_1 = (!__pyx_v_hasfields); + if (__pyx_t_1) { + + /* "numpy.pxd":254 + * + * if not hasfields: + * t = descr.type_num # <<<<<<<<<<<<<< + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): + */ + __pyx_t_5 = __pyx_v_descr->type_num; + __pyx_v_t = __pyx_t_5; + + /* "numpy.pxd":255 + * if not hasfields: + * t = descr.type_num + * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + */ + __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); + if (__pyx_t_1) { + __pyx_t_2 = __pyx_v_little_endian; + } else { + __pyx_t_2 = __pyx_t_1; + } + if (!__pyx_t_2) { + + /* "numpy.pxd":256 + * t = descr.type_num + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" + */ + __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); + if (__pyx_t_1) { + __pyx_t_3 = (!__pyx_v_little_endian); + __pyx_t_7 = __pyx_t_3; + } else { + __pyx_t_7 = __pyx_t_1; + } + __pyx_t_1 = __pyx_t_7; + } else { + __pyx_t_1 = __pyx_t_2; + } + if (__pyx_t_1) { + + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_28), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; + } + __pyx_L12:; + + /* "numpy.pxd":274 + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" + * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + */ + switch (__pyx_v_t) { + + /* "numpy.pxd":258 + * (descr.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" + */ + case NPY_BYTE: + __pyx_v_f = __pyx_k__b; + break; + + /* "numpy.pxd":259 + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" + */ + case NPY_UBYTE: + __pyx_v_f = __pyx_k__B; + break; + + /* "numpy.pxd":260 + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" + */ + case NPY_SHORT: + __pyx_v_f = __pyx_k__h; + break; + + /* "numpy.pxd":261 + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" + */ + case NPY_USHORT: + __pyx_v_f = __pyx_k__H; + break; + + /* "numpy.pxd":262 + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" + */ + case NPY_INT: + __pyx_v_f = __pyx_k__i; + break; + + /* "numpy.pxd":263 + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" + */ + case NPY_UINT: + __pyx_v_f = __pyx_k__I; + break; + + /* "numpy.pxd":264 + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" + */ + case NPY_LONG: + __pyx_v_f = __pyx_k__l; + break; + + /* "numpy.pxd":265 + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" + */ + case NPY_ULONG: + __pyx_v_f = __pyx_k__L; + break; + + /* "numpy.pxd":266 + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" + */ + case NPY_LONGLONG: + __pyx_v_f = __pyx_k__q; + break; + + /* "numpy.pxd":267 + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" + */ + case NPY_ULONGLONG: + __pyx_v_f = __pyx_k__Q; + break; + + /* "numpy.pxd":268 + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" + */ + case NPY_FLOAT: + __pyx_v_f = __pyx_k__f; + break; + + /* "numpy.pxd":269 + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" + */ + case NPY_DOUBLE: + __pyx_v_f = __pyx_k__d; + break; + + /* "numpy.pxd":270 + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" + */ + case NPY_LONGDOUBLE: + __pyx_v_f = __pyx_k__g; + break; + + /* "numpy.pxd":271 + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" + */ + case NPY_CFLOAT: + __pyx_v_f = __pyx_k__Zf; + break; + + /* "numpy.pxd":272 + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< + * elif t == NPY_CLONGDOUBLE: f = "Zg" + * elif t == NPY_OBJECT: f = "O" + */ + case NPY_CDOUBLE: + __pyx_v_f = __pyx_k__Zd; + break; + + /* "numpy.pxd":273 + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< + * elif t == NPY_OBJECT: f = "O" + * else: + */ + case NPY_CLONGDOUBLE: + __pyx_v_f = __pyx_k__Zg; + break; + + /* "numpy.pxd":274 + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" + * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + */ + case NPY_OBJECT: + __pyx_v_f = __pyx_k__O; + break; + default: + + /* "numpy.pxd":276 + * elif t == NPY_OBJECT: f = "O" + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * info.format = f + * return + */ + __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_29), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + + /* "numpy.pxd":277 + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * info.format = f # <<<<<<<<<<<<<< + * return + * else: + */ + __pyx_v_info->format = __pyx_v_f; + + /* "numpy.pxd":278 + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * info.format = f + * return # <<<<<<<<<<<<<< + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L11; + } + /*else*/ { + + /* "numpy.pxd":280 + * return + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< + * info.format[0] = c'^' # Native data types, manual alignment + * offset = 0 + */ + __pyx_v_info->format = ((char *)malloc(255)); + + /* "numpy.pxd":281 + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) + * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * offset = 0 + * f = _util_dtypestring(descr, info.format + 1, + */ + (__pyx_v_info->format[0]) = '^'; + + /* "numpy.pxd":282 + * info.format = stdlib.malloc(_buffer_format_string_len) + * info.format[0] = c'^' # Native data types, manual alignment + * offset = 0 # <<<<<<<<<<<<<< + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + */ + __pyx_v_offset = 0; + + /* "numpy.pxd":285 + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + * &offset) # <<<<<<<<<<<<<< + * f[0] = c'\0' # Terminate format string + * + */ + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_9; + + /* "numpy.pxd":286 + * info.format + _buffer_format_string_len, + * &offset) + * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< + * + * def __releasebuffer__(ndarray self, Py_buffer* info): + */ + (__pyx_v_f[0]) = '\x00'; + } + __pyx_L11:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; + } + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(Py_None); + __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; + } + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_descr); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); + __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":288 + * f[0] = c'\0' # Terminate format string + * + * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + */ + +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("__releasebuffer__", 0); + + /* "numpy.pxd":289 + * + * def __releasebuffer__(ndarray self, Py_buffer* info): + * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + */ + __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self); + if (__pyx_t_1) { + + /* "numpy.pxd":290 + * def __releasebuffer__(ndarray self, Py_buffer* info): + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) # <<<<<<<<<<<<<< + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * stdlib.free(info.strides) + */ + free(__pyx_v_info->format); + goto __pyx_L3; + } + __pyx_L3:; + + /* "numpy.pxd":291 + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< + * stdlib.free(info.strides) + * # info.shape was stored after info.strides in the same block + */ + __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_1) { + + /* "numpy.pxd":292 + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * stdlib.free(info.strides) # <<<<<<<<<<<<<< + * # info.shape was stored after info.strides in the same block + * + */ + free(__pyx_v_info->strides); + goto __pyx_L4; + } + __pyx_L4:; + + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":768 + * ctypedef npy_cdouble complex_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); + + /* "numpy.pxd":769 + * + * cdef inline object PyArray_MultiIterNew1(a): + * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew2(a, b): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":771 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); + + /* "numpy.pxd":772 + * + * cdef inline object PyArray_MultiIterNew2(a, b): + * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":774 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); + + /* "numpy.pxd":775 + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":777 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); + + /* "numpy.pxd":778 + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":780 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); + + /* "numpy.pxd":781 + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":783 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< + * # Recursive utility function used in __getbuffer__ to get format + * # string. The new location in the format string is returned. + */ + +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { + PyArray_Descr *__pyx_v_child = 0; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; + PyObject *__pyx_v_fields = 0; + PyObject *__pyx_v_childname = NULL; + PyObject *__pyx_v_new_offset = NULL; + PyObject *__pyx_v_t = NULL; + char *__pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *(*__pyx_t_6)(PyObject *); + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + long __pyx_t_11; + char *__pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_util_dtypestring", 0); + + /* "numpy.pxd":790 + * cdef int delta_offset + * cdef tuple i + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * cdef tuple fields + */ + __pyx_v_endian_detector = 1; + + /* "numpy.pxd":791 + * cdef tuple i + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * cdef tuple fields + * + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "numpy.pxd":794 + * cdef tuple fields + * + * for childname in descr.names: # <<<<<<<<<<<<<< + * fields = descr.fields[childname] + * child, new_offset = fields + */ + if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; + for (;;) { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + __Pyx_XDECREF(__pyx_v_childname); + __pyx_v_childname = __pyx_t_3; + __pyx_t_3 = 0; + + /* "numpy.pxd":795 + * + * for childname in descr.names: + * fields = descr.fields[childname] # <<<<<<<<<<<<<< + * child, new_offset = fields + * + */ + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); + __pyx_v_fields = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + + /* "numpy.pxd":796 + * for childname in descr.names: + * fields = descr.fields[childname] + * child, new_offset = fields # <<<<<<<<<<<<<< + * + * if (end - f) - (new_offset - offset[0]) < 15: + */ + if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { + PyObject* sequence = ((PyObject *)__pyx_v_fields); + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + #else + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + #endif + } else if (1) { + __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else + { + Py_ssize_t index = -1; + __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_fields)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; + index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = NULL; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L6_unpacking_done; + __pyx_L5_unpacking_failed:; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L6_unpacking_done:; + } + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_child)); + __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); + __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_v_new_offset); + __pyx_v_new_offset = __pyx_t_4; + __pyx_t_4 = 0; + + /* "numpy.pxd":798 + * child, new_offset = fields + * + * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") + * + */ + __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + + /* "numpy.pxd":799 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == c'>' and little_endian) or + */ + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_31), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + /* "numpy.pxd":801 + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") + * + * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (child.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + */ + __pyx_t_7 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_7) { + __pyx_t_8 = __pyx_v_little_endian; + } else { + __pyx_t_8 = __pyx_t_7; + } + if (!__pyx_t_8) { + + /* "numpy.pxd":802 + * + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError(u"Non-native byte order not supported") + * # One could encode it in the format string and have Cython + */ + __pyx_t_7 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_7) { + __pyx_t_9 = (!__pyx_v_little_endian); + __pyx_t_10 = __pyx_t_9; + } else { + __pyx_t_10 = __pyx_t_7; + } + __pyx_t_7 = __pyx_t_10; + } else { + __pyx_t_7 = __pyx_t_8; + } + if (__pyx_t_7) { + + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_32), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + + /* "numpy.pxd":813 + * + * # Output padding bytes + * while offset[0] < new_offset: # <<<<<<<<<<<<<< + * f[0] = 120 # "x"; pad byte + * f += 1 + */ + while (1) { + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!__pyx_t_7) break; + + /* "numpy.pxd":814 + * # Output padding bytes + * while offset[0] < new_offset: + * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< + * f += 1 + * offset[0] += 1 + */ + (__pyx_v_f[0]) = 120; + + /* "numpy.pxd":815 + * while offset[0] < new_offset: + * f[0] = 120 # "x"; pad byte + * f += 1 # <<<<<<<<<<<<<< + * offset[0] += 1 + * + */ + __pyx_v_f = (__pyx_v_f + 1); + + /* "numpy.pxd":816 + * f[0] = 120 # "x"; pad byte + * f += 1 + * offset[0] += 1 # <<<<<<<<<<<<<< + * + * offset[0] += child.itemsize + */ + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1); + } + + /* "numpy.pxd":818 + * offset[0] += 1 + * + * offset[0] += child.itemsize # <<<<<<<<<<<<<< + * + * if not PyDataType_HASFIELDS(child): + */ + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize); + + /* "numpy.pxd":820 + * offset[0] += child.itemsize + * + * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< + * t = child.type_num + * if end - f < 5: + */ + __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_7) { + + /* "numpy.pxd":821 + * + * if not PyDataType_HASFIELDS(child): + * t = child.type_num # <<<<<<<<<<<<<< + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") + */ + __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_v_t); + __pyx_v_t = __pyx_t_3; + __pyx_t_3 = 0; + + /* "numpy.pxd":822 + * if not PyDataType_HASFIELDS(child): + * t = child.type_num + * if end - f < 5: # <<<<<<<<<<<<<< + * raise RuntimeError(u"Format string allocated too short.") + * + */ + __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_7) { + + /* "numpy.pxd":823 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings + */ + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_34), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; + } + __pyx_L12:; + + /* "numpy.pxd":826 + * + * # Until ticket #99 is fixed, use integers to avoid warnings + * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" + */ + __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 98; + goto __pyx_L13; + } + + /* "numpy.pxd":827 + * # Until ticket #99 is fixed, use integers to avoid warnings + * if t == NPY_BYTE: f[0] = 98 #"b" + * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" + */ + __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 66; + goto __pyx_L13; + } + + /* "numpy.pxd":828 + * if t == NPY_BYTE: f[0] = 98 #"b" + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" + */ + __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 104; + goto __pyx_L13; + } + + /* "numpy.pxd":829 + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" + */ + __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 72; + goto __pyx_L13; + } + + /* "numpy.pxd":830 + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" + */ + __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 105; + goto __pyx_L13; + } + + /* "numpy.pxd":831 + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" + */ + __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 73; + goto __pyx_L13; + } + + /* "numpy.pxd":832 + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + */ + __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 108; + goto __pyx_L13; + } + + /* "numpy.pxd":833 + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + */ + __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 76; + goto __pyx_L13; + } + + /* "numpy.pxd":834 + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" + */ + __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 113; + goto __pyx_L13; + } + + /* "numpy.pxd":835 + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + */ + __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 81; + goto __pyx_L13; + } + + /* "numpy.pxd":836 + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + */ + __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 102; + goto __pyx_L13; + } + + /* "numpy.pxd":837 + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + */ + __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 100; + goto __pyx_L13; + } + + /* "numpy.pxd":838 + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + */ + __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 103; + goto __pyx_L13; + } + + /* "numpy.pxd":839 + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + */ + __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 102; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; + } + + /* "numpy.pxd":840 + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + * elif t == NPY_OBJECT: f[0] = 79 #"O" + */ + __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 100; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; + } + + /* "numpy.pxd":841 + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: + */ + __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 103; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; + } + + /* "numpy.pxd":842 + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + */ + __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 79; + goto __pyx_L13; + } + /*else*/ { + + /* "numpy.pxd":844 + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * f += 1 + * else: + */ + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_29), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L13:; + + /* "numpy.pxd":845 + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * f += 1 # <<<<<<<<<<<<<< + * else: + * # Cython ignores struct boundary information ("T{...}"), + */ + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L11; + } + /*else*/ { + + /* "numpy.pxd":849 + * # Cython ignores struct boundary information ("T{...}"), + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< + * return f + * + */ + __pyx_t_12 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_12; + } + __pyx_L11:; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "numpy.pxd":850 + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) + * return f # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_f; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_child); + __Pyx_XDECREF(__pyx_v_fields); + __Pyx_XDECREF(__pyx_v_childname); + __Pyx_XDECREF(__pyx_v_new_offset); + __Pyx_XDECREF(__pyx_v_t); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":965 + * + * + * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< + * cdef PyObject* baseptr + * if base is None: + */ + +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { + PyObject *__pyx_v_baseptr; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("set_array_base", 0); + + /* "numpy.pxd":967 + * cdef inline void set_array_base(ndarray arr, object base): + * cdef PyObject* baseptr + * if base is None: # <<<<<<<<<<<<<< + * baseptr = NULL + * else: + */ + __pyx_t_1 = (__pyx_v_base == Py_None); + if (__pyx_t_1) { + + /* "numpy.pxd":968 + * cdef PyObject* baseptr + * if base is None: + * baseptr = NULL # <<<<<<<<<<<<<< + * else: + * Py_INCREF(base) # important to do this before decref below! + */ + __pyx_v_baseptr = NULL; + goto __pyx_L3; + } + /*else*/ { + + /* "numpy.pxd":970 + * baseptr = NULL + * else: + * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< + * baseptr = base + * Py_XDECREF(arr.base) + */ + Py_INCREF(__pyx_v_base); + + /* "numpy.pxd":971 + * else: + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base # <<<<<<<<<<<<<< + * Py_XDECREF(arr.base) + * arr.base = baseptr + */ + __pyx_v_baseptr = ((PyObject *)__pyx_v_base); + } + __pyx_L3:; + + /* "numpy.pxd":972 + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base + * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< + * arr.base = baseptr + * + */ + Py_XDECREF(__pyx_v_arr->base); + + /* "numpy.pxd":973 + * baseptr = base + * Py_XDECREF(arr.base) + * arr.base = baseptr # <<<<<<<<<<<<<< + * + * cdef inline object get_array_base(ndarray arr): + */ + __pyx_v_arr->base = __pyx_v_baseptr; + + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":975 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("get_array_base", 0); + + /* "numpy.pxd":976 + * + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: # <<<<<<<<<<<<<< + * return None + * else: + */ + __pyx_t_1 = (__pyx_v_arr->base == NULL); + if (__pyx_t_1) { + + /* "numpy.pxd":977 + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: + * return None # <<<<<<<<<<<<<< + * else: + * return arr.base + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "numpy.pxd":979 + * return None + * else: + * return arr.base # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); + __pyx_r = ((PyObject *)__pyx_v_arr->base); + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static struct __pyx_vtabstruct_8_forward_ForwardPasser __pyx_vtable_8_forward_ForwardPasser; + +static PyObject *__pyx_tp_new_8_forward_ForwardPasser(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_8_forward_ForwardPasser *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_8_forward_ForwardPasser *)o); + p->__pyx_vtab = __pyx_vtabptr_8_forward_ForwardPasser; + p->xlabels = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->X = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + p->y = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + p->weights = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + p->B = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + p->B_orth = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + p->c = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + p->norms = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + p->u = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + p->B_orth_times_parent_cum = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + p->sort_tracker = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + p->sorting = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + p->mwork = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + p->linear_variables = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + p->record = ((struct __pyx_obj_7_record_ForwardPassRecord *)Py_None); Py_INCREF(Py_None); + p->basis = ((struct __pyx_obj_6_basis_Basis *)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_8_forward_ForwardPasser(PyObject *o) { + struct __pyx_obj_8_forward_ForwardPasser *p = (struct __pyx_obj_8_forward_ForwardPasser *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->xlabels); + Py_CLEAR(p->X); + Py_CLEAR(p->y); + Py_CLEAR(p->weights); + Py_CLEAR(p->B); + Py_CLEAR(p->B_orth); + Py_CLEAR(p->c); + Py_CLEAR(p->norms); + Py_CLEAR(p->u); + Py_CLEAR(p->B_orth_times_parent_cum); + Py_CLEAR(p->sort_tracker); + Py_CLEAR(p->sorting); + Py_CLEAR(p->mwork); + Py_CLEAR(p->linear_variables); + Py_CLEAR(p->record); + Py_CLEAR(p->basis); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_8_forward_ForwardPasser(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_8_forward_ForwardPasser *p = (struct __pyx_obj_8_forward_ForwardPasser *)o; + if (p->xlabels) { + e = (*v)(p->xlabels, a); if (e) return e; + } + if (p->X) { + e = (*v)(((PyObject*)p->X), a); if (e) return e; + } + if (p->y) { + e = (*v)(((PyObject*)p->y), a); if (e) return e; + } + if (p->weights) { + e = (*v)(((PyObject*)p->weights), a); if (e) return e; + } + if (p->B) { + e = (*v)(((PyObject*)p->B), a); if (e) return e; + } + if (p->B_orth) { + e = (*v)(((PyObject*)p->B_orth), a); if (e) return e; + } + if (p->c) { + e = (*v)(((PyObject*)p->c), a); if (e) return e; + } + if (p->norms) { + e = (*v)(((PyObject*)p->norms), a); if (e) return e; + } + if (p->u) { + e = (*v)(((PyObject*)p->u), a); if (e) return e; + } + if (p->B_orth_times_parent_cum) { + e = (*v)(((PyObject*)p->B_orth_times_parent_cum), a); if (e) return e; + } + if (p->sort_tracker) { + e = (*v)(((PyObject*)p->sort_tracker), a); if (e) return e; + } + if (p->sorting) { + e = (*v)(((PyObject*)p->sorting), a); if (e) return e; + } + if (p->mwork) { + e = (*v)(((PyObject*)p->mwork), a); if (e) return e; + } + if (p->linear_variables) { + e = (*v)(((PyObject*)p->linear_variables), a); if (e) return e; + } + if (p->record) { + e = (*v)(((PyObject*)p->record), a); if (e) return e; + } + if (p->basis) { + e = (*v)(((PyObject*)p->basis), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_8_forward_ForwardPasser(PyObject *o) { + struct __pyx_obj_8_forward_ForwardPasser *p = (struct __pyx_obj_8_forward_ForwardPasser *)o; + PyObject* tmp; + tmp = ((PyObject*)p->xlabels); + p->xlabels = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->X); + p->X = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->y); + p->y = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->weights); + p->weights = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->B); + p->B = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->B_orth); + p->B_orth = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->c); + p->c = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->norms); + p->norms = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->u); + p->u = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->B_orth_times_parent_cum); + p->B_orth_times_parent_cum = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->sort_tracker); + p->sort_tracker = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->sorting); + p->sorting = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->mwork); + p->mwork = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->linear_variables); + p->linear_variables = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->record); + p->record = ((struct __pyx_obj_7_record_ForwardPassRecord *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->basis); + p->basis = ((struct __pyx_obj_6_basis_Basis *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_8_forward_ForwardPasser[] = { + {__Pyx_NAMESTR("get_basis"), (PyCFunction)__pyx_pw_8_forward_13ForwardPasser_3get_basis, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("init_linear_variables"), (PyCFunction)__pyx_pw_8_forward_13ForwardPasser_5init_linear_variables, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_B_orth"), (PyCFunction)__pyx_pw_8_forward_13ForwardPasser_7get_B_orth, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("run"), (PyCFunction)__pyx_pw_8_forward_13ForwardPasser_9run, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("orthonormal_update"), (PyCFunction)__pyx_pw_8_forward_13ForwardPasser_11orthonormal_update, METH_O, __Pyx_DOCSTR(__pyx_doc_8_forward_13ForwardPasser_10orthonormal_update)}, + {__Pyx_NAMESTR("orthonormal_downdate"), (PyCFunction)__pyx_pw_8_forward_13ForwardPasser_13orthonormal_downdate, METH_O, __Pyx_DOCSTR(__pyx_doc_8_forward_13ForwardPasser_12orthonormal_downdate)}, + {__Pyx_NAMESTR("trace"), (PyCFunction)__pyx_pw_8_forward_13ForwardPasser_15trace, METH_NOARGS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_ForwardPasser = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_ForwardPasser = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_ForwardPasser = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_ForwardPasser = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_8_forward_ForwardPasser = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("_forward.ForwardPasser"), /*tp_name*/ + sizeof(struct __pyx_obj_8_forward_ForwardPasser), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_8_forward_ForwardPasser, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_ForwardPasser, /*tp_as_number*/ + &__pyx_tp_as_sequence_ForwardPasser, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_ForwardPasser, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_ForwardPasser, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_8_forward_ForwardPasser, /*tp_traverse*/ + __pyx_tp_clear_8_forward_ForwardPasser, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_8_forward_ForwardPasser, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_8_forward_13ForwardPasser_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_8_forward_ForwardPasser, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + #if PY_VERSION_HEX < 0x03020000 + { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, + #else + PyModuleDef_HEAD_INIT, + #endif + __Pyx_NAMESTR("_forward"), + 0, /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, + {&__pyx_kp_u_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 1, 0, 0}, + {&__pyx_kp_u_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 1, 0, 0}, + {&__pyx_kp_u_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 1, 0, 0}, + {&__pyx_kp_u_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 1, 0, 0}, + {&__pyx_n_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 1}, + {&__pyx_kp_u_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 1, 0, 0}, + {&__pyx_kp_u_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 1, 0, 0}, + {&__pyx_kp_s_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 0, 1, 0}, + {&__pyx_kp_s_36, __pyx_k_36, sizeof(__pyx_k_36), 0, 0, 1, 0}, + {&__pyx_kp_s_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 0, 1, 0}, + {&__pyx_kp_s_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 0, 1, 0}, + {&__pyx_kp_s_39, __pyx_k_39, sizeof(__pyx_k_39), 0, 0, 1, 0}, + {&__pyx_n_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 1}, + {&__pyx_n_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 1}, + {&__pyx_n_s__C, __pyx_k__C, sizeof(__pyx_k__C), 0, 0, 1, 1}, + {&__pyx_n_s__IndexError, __pyx_k__IndexError, sizeof(__pyx_k__IndexError), 0, 0, 1, 1}, + {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, + {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, + {&__pyx_n_s__X, __pyx_k__X, sizeof(__pyx_k__X), 0, 0, 1, 1}, + {&__pyx_n_s____import__, __pyx_k____import__, sizeof(__pyx_k____import__), 0, 0, 1, 1}, + {&__pyx_n_s____len__, __pyx_k____len__, sizeof(__pyx_k____len__), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____pyx_getbuffer, __pyx_k____pyx_getbuffer, sizeof(__pyx_k____pyx_getbuffer), 0, 0, 1, 1}, + {&__pyx_n_s____pyx_releasebuffer, __pyx_k____pyx_releasebuffer, sizeof(__pyx_k____pyx_releasebuffer), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s__argsort, __pyx_k__argsort, sizeof(__pyx_k__argsort), 0, 0, 1, 1}, + {&__pyx_n_s__check_every, __pyx_k__check_every, sizeof(__pyx_k__check_every), 0, 0, 1, 1}, + {&__pyx_n_s__copy, __pyx_k__copy, sizeof(__pyx_k__copy), 0, 0, 1, 1}, + {&__pyx_n_s__dot, __pyx_k__dot, sizeof(__pyx_k__dot), 0, 0, 1, 1}, + {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, + {&__pyx_n_s__empty, __pyx_k__empty, sizeof(__pyx_k__empty), 0, 0, 1, 1}, + {&__pyx_n_s__endspan, __pyx_k__endspan, sizeof(__pyx_k__endspan), 0, 0, 1, 1}, + {&__pyx_n_s__endspan_alpha, __pyx_k__endspan_alpha, sizeof(__pyx_k__endspan_alpha), 0, 0, 1, 1}, + {&__pyx_n_s__float, __pyx_k__float, sizeof(__pyx_k__float), 0, 0, 1, 1}, + {&__pyx_n_s__get_basis, __pyx_k__get_basis, sizeof(__pyx_k__get_basis), 0, 0, 1, 1}, + {&__pyx_n_s__get_size, __pyx_k__get_size, sizeof(__pyx_k__get_size), 0, 0, 1, 1}, + {&__pyx_n_s__index, __pyx_k__index, sizeof(__pyx_k__index), 0, 0, 1, 1}, + {&__pyx_n_s__int, __pyx_k__int, sizeof(__pyx_k__int), 0, 0, 1, 1}, + {&__pyx_n_s__linvars, __pyx_k__linvars, sizeof(__pyx_k__linvars), 0, 0, 1, 1}, + {&__pyx_n_s__max_degree, __pyx_k__max_degree, sizeof(__pyx_k__max_degree), 0, 0, 1, 1}, + {&__pyx_n_s__max_terms, __pyx_k__max_terms, sizeof(__pyx_k__max_terms), 0, 0, 1, 1}, + {&__pyx_n_s__min_search_points, __pyx_k__min_search_points, sizeof(__pyx_k__min_search_points), 0, 0, 1, 1}, + {&__pyx_n_s__minspan, __pyx_k__minspan, sizeof(__pyx_k__minspan), 0, 0, 1, 1}, + {&__pyx_n_s__minspan_alpha, __pyx_k__minspan_alpha, sizeof(__pyx_k__minspan_alpha), 0, 0, 1, 1}, + {&__pyx_n_s__nan, __pyx_k__nan, sizeof(__pyx_k__nan), 0, 0, 1, 1}, + {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, + {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, + {&__pyx_n_s__ones, __pyx_k__ones, sizeof(__pyx_k__ones), 0, 0, 1, 1}, + {&__pyx_n_s__order, __pyx_k__order, sizeof(__pyx_k__order), 0, 0, 1, 1}, + {&__pyx_n_s__orthonormal_update, __pyx_k__orthonormal_update, sizeof(__pyx_k__orthonormal_update), 0, 0, 1, 1}, + {&__pyx_n_s__penalty, __pyx_k__penalty, sizeof(__pyx_k__penalty), 0, 0, 1, 1}, + {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, + {&__pyx_n_s__round, __pyx_k__round, sizeof(__pyx_k__round), 0, 0, 1, 1}, + {&__pyx_n_s__run, __pyx_k__run, sizeof(__pyx_k__run), 0, 0, 1, 1}, + {&__pyx_n_s__set_no_candidates, __pyx_k__set_no_candidates, sizeof(__pyx_k__set_no_candidates), 0, 0, 1, 1}, + {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1}, + {&__pyx_n_s__sqrt, __pyx_k__sqrt, sizeof(__pyx_k__sqrt), 0, 0, 1, 1}, + {&__pyx_n_s__stopping_conditions, __pyx_k__stopping_conditions, sizeof(__pyx_k__stopping_conditions), 0, 0, 1, 1}, + {&__pyx_n_s__sum, __pyx_k__sum, sizeof(__pyx_k__sum), 0, 0, 1, 1}, + {&__pyx_n_s__thresh, __pyx_k__thresh, sizeof(__pyx_k__thresh), 0, 0, 1, 1}, + {&__pyx_n_s__weights, __pyx_k__weights, sizeof(__pyx_k__weights), 0, 0, 1, 1}, + {&__pyx_n_s__x, __pyx_k__x, sizeof(__pyx_k__x), 0, 0, 1, 1}, + {&__pyx_n_s__xlabels, __pyx_k__xlabels, sizeof(__pyx_k__xlabels), 0, 0, 1, 1}, + {&__pyx_n_s__y, __pyx_k__y, sizeof(__pyx_k__y), 0, 0, 1, 1}, + {&__pyx_n_s__zeros, __pyx_k__zeros, sizeof(__pyx_k__zeros), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_round = __Pyx_GetBuiltinName(__pyx_n_s__round); if (!__pyx_builtin_round) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + + /* "_forward.pyx":79 + * self.linear_variables[linvar] = 1 + * else: + * raise IndexError('Unknown variable selected in linvars argument.') # <<<<<<<<<<<<<< + * + * #Initialize B_orth, c, and c_squared (assuming column 0 of B_orth is already filled with 1) + */ + __pyx_k_tuple_2 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_1)); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_2); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); + + /* "_forward.pyx":98 + * cdef ConstantBasisFunction root_basis_function = self.basis[0] + * for variable in range(self.n): + * order = np.argsort(X[:,variable])[::-1] # <<<<<<<<<<<<<< + * if root_basis_function.valid_knots(B[order,0], X[order,variable], + * variable, self.check_every, endspan, + */ + __pyx_k_slice_4 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_4); + __Pyx_GIVEREF(__pyx_k_slice_4); + __pyx_k_slice_5 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_k_slice_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_5); + __Pyx_GIVEREF(__pyx_k_slice_5); + + /* "_forward.pyx":247 + * + * #Sort the data + * sorting[:] = np.argsort(X[:,variable])[::-1] #TODO: eliminate Python call / data copy # <<<<<<<<<<<<<< + * + * #Iterate over parents + */ + __pyx_k_slice_8 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_8); + __Pyx_GIVEREF(__pyx_k_slice_8); + __pyx_k_slice_9 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_k_slice_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_9); + __Pyx_GIVEREF(__pyx_k_slice_9); + __pyx_k_slice_10 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_10); + __Pyx_GIVEREF(__pyx_k_slice_10); + + /* "_forward.pyx":336 + * bf1 = HingeBasisFunction(parent_choice,knot_choice,knot_idx_choice,variable_choice,False,label) + * bf2 = HingeBasisFunction(parent_choice,knot_choice,knot_idx_choice,variable_choice,True,label) + * bf1.apply(X,B[:,k]) # <<<<<<<<<<<<<< + * bf2.apply(X,B[:,k+1]) + * self.basis.append(bf1) + */ + __pyx_k_slice_11 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_11); + __Pyx_GIVEREF(__pyx_k_slice_11); + + /* "_forward.pyx":337 + * bf2 = HingeBasisFunction(parent_choice,knot_choice,knot_idx_choice,variable_choice,True,label) + * bf1.apply(X,B[:,k]) + * bf2.apply(X,B[:,k+1]) # <<<<<<<<<<<<<< + * self.basis.append(bf1) + * self.basis.append(bf2) + */ + __pyx_k_slice_12 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_12); + __Pyx_GIVEREF(__pyx_k_slice_12); + + /* "_forward.pyx":342 + * + * #Orthogonalize the new basis + * B_orth[:,k] = B[:,k] # <<<<<<<<<<<<<< + * if self.orthonormal_update(k) == 1: + * bf1.make_unsplittable() + */ + __pyx_k_slice_13 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_13); + __Pyx_GIVEREF(__pyx_k_slice_13); + __pyx_k_slice_14 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_14); + __Pyx_GIVEREF(__pyx_k_slice_14); + + /* "_forward.pyx":345 + * if self.orthonormal_update(k) == 1: + * bf1.make_unsplittable() + * B_orth[:,k+1] = B[:,k+1] # <<<<<<<<<<<<<< + * if self.orthonormal_update(k+1) == 1: + * bf2.make_unsplittable() + */ + __pyx_k_slice_15 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_15); + __Pyx_GIVEREF(__pyx_k_slice_15); + __pyx_k_slice_16 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_16); + __Pyx_GIVEREF(__pyx_k_slice_16); + + /* "_forward.pyx":351 + * #In this case, only add the linear basis function + * bf1 = LinearBasisFunction(parent_choice,variable_choice,label) + * bf1.apply(X,B[:,k]) # <<<<<<<<<<<<<< + * self.basis.append(bf1) + * + */ + __pyx_k_slice_17 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_17); + __Pyx_GIVEREF(__pyx_k_slice_17); + + /* "_forward.pyx":355 + * + * #Orthogonalize the new basis + * B_orth[:,k] = B[:,k] # <<<<<<<<<<<<<< + * if self.orthonormal_update(k) == 1: + * bf1.make_unsplittable() + */ + __pyx_k_slice_18 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_18); + __Pyx_GIVEREF(__pyx_k_slice_18); + __pyx_k_slice_19 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_19); + __Pyx_GIVEREF(__pyx_k_slice_19); + + /* "_forward.pyx":377 + * ''' + * + * cdef cnp.ndarray[FLOAT_t, ndim=1] b = self.B[:,k+1] # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t, ndim=1] b_parent = self.B[:,parent] + * cdef cnp.ndarray[FLOAT_t, ndim=1] u = self.u + */ + __pyx_k_slice_20 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_20); + __Pyx_GIVEREF(__pyx_k_slice_20); + + /* "_forward.pyx":378 + * + * cdef cnp.ndarray[FLOAT_t, ndim=1] b = self.B[:,k+1] + * cdef cnp.ndarray[FLOAT_t, ndim=1] b_parent = self.B[:,parent] # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t, ndim=1] u = self.u + * cdef cnp.ndarray[FLOAT_t, ndim=2] B_orth = self.B_orth + */ + __pyx_k_slice_21 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_21); + __Pyx_GIVEREF(__pyx_k_slice_21); + + /* "_forward.pyx":434 + * + * #Compute the initial covariance column, u (not including the final element) + * u[0:k+1] = np.dot(b,B_orth[:,0:k+1]) # <<<<<<<<<<<<<< + * + * #Compute the new last elements of c and u + */ + __pyx_k_slice_22 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_22); + __Pyx_GIVEREF(__pyx_k_slice_22); + + /* "numpy.pxd":215 + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + */ + __pyx_k_tuple_24 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_23)); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_24); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24)); + + /* "numpy.pxd":219 + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * + * info.buf = PyArray_DATA(self) + */ + __pyx_k_tuple_26 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_25)); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_26); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26)); + + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_k_tuple_28 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_27)); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_28); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28)); + + /* "numpy.pxd":799 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == c'>' and little_endian) or + */ + __pyx_k_tuple_31 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_30)); if (unlikely(!__pyx_k_tuple_31)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_31); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_31)); + + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_k_tuple_32 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_27)); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_32); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32)); + + /* "numpy.pxd":823 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings + */ + __pyx_k_tuple_34 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_33)); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_34); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_34)); + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_100 = PyInt_FromLong(100); if (unlikely(!__pyx_int_100)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC init_forward(void); /*proto*/ +PyMODINIT_FUNC init_forward(void) +#else +PyMODINIT_FUNC PyInit__forward(void); /*proto*/ +PyMODINIT_FUNC PyInit__forward(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__forward(void)", 0); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __Pyx_CyFunction_USED + if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_forward"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + Py_INCREF(__pyx_d); + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyDict_GetItemString(modules, "_forward")) { + if (unlikely(PyDict_SetItemString(modules, "_forward", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if CYTHON_COMPILING_IN_PYPY + Py_INCREF(__pyx_b); + #endif + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) + if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + if (__pyx_module_is_main__forward) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Global init code ---*/ + /*--- Variable export code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + __pyx_vtabptr_8_forward_ForwardPasser = &__pyx_vtable_8_forward_ForwardPasser; + __pyx_vtable_8_forward_ForwardPasser.get_basis = (struct __pyx_obj_6_basis_Basis *(*)(struct __pyx_obj_8_forward_ForwardPasser *, int __pyx_skip_dispatch))__pyx_f_8_forward_13ForwardPasser_get_basis; + __pyx_vtable_8_forward_ForwardPasser.init_linear_variables = (PyObject *(*)(struct __pyx_obj_8_forward_ForwardPasser *, int __pyx_skip_dispatch))__pyx_f_8_forward_13ForwardPasser_init_linear_variables; + __pyx_vtable_8_forward_ForwardPasser.run = (PyObject *(*)(struct __pyx_obj_8_forward_ForwardPasser *, int __pyx_skip_dispatch))__pyx_f_8_forward_13ForwardPasser_run; + __pyx_vtable_8_forward_ForwardPasser.stop_check = (PyObject *(*)(struct __pyx_obj_8_forward_ForwardPasser *))__pyx_f_8_forward_13ForwardPasser_stop_check; + __pyx_vtable_8_forward_ForwardPasser.orthonormal_update = (int (*)(struct __pyx_obj_8_forward_ForwardPasser *, __pyx_t_8_forward_INDEX_t, int __pyx_skip_dispatch))__pyx_f_8_forward_13ForwardPasser_orthonormal_update; + __pyx_vtable_8_forward_ForwardPasser.orthonormal_downdate = (PyObject *(*)(struct __pyx_obj_8_forward_ForwardPasser *, __pyx_t_8_forward_INDEX_t, int __pyx_skip_dispatch))__pyx_f_8_forward_13ForwardPasser_orthonormal_downdate; + __pyx_vtable_8_forward_ForwardPasser.next_pair = (PyObject *(*)(struct __pyx_obj_8_forward_ForwardPasser *))__pyx_f_8_forward_13ForwardPasser_next_pair; + __pyx_vtable_8_forward_ForwardPasser.best_knot = (PyObject *(*)(struct __pyx_obj_8_forward_ForwardPasser *, __pyx_t_8_forward_INDEX_t, __pyx_t_8_forward_INDEX_t, __pyx_t_8_forward_INDEX_t, PyArrayObject *, PyArrayObject *, __pyx_t_8_forward_FLOAT_t *, __pyx_t_8_forward_FLOAT_t *, __pyx_t_8_forward_INDEX_t *))__pyx_f_8_forward_13ForwardPasser_best_knot; + if (PyType_Ready(&__pyx_type_8_forward_ForwardPasser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_8_forward_ForwardPasser.tp_dict, __pyx_vtabptr_8_forward_ForwardPasser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "ForwardPasser", (PyObject *)&__pyx_type_8_forward_ForwardPasser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_8_forward_ForwardPasser = &__pyx_type_8_forward_ForwardPasser; + /*--- Type import code ---*/ + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", + #if CYTHON_COMPILING_IN_PYPY + sizeof(PyTypeObject), + #else + sizeof(PyHeapTypeObject), + #endif + 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6_basis_BasisFunction = __Pyx_ImportType("_basis", "BasisFunction", sizeof(struct __pyx_obj_6_basis_BasisFunction), 1); if (unlikely(!__pyx_ptype_6_basis_BasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_6_basis_BasisFunction = (struct __pyx_vtabstruct_6_basis_BasisFunction*)__Pyx_GetVtable(__pyx_ptype_6_basis_BasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_6_basis_BasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6_basis_ConstantBasisFunction = __Pyx_ImportType("_basis", "ConstantBasisFunction", sizeof(struct __pyx_obj_6_basis_ConstantBasisFunction), 1); if (unlikely(!__pyx_ptype_6_basis_ConstantBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_6_basis_ConstantBasisFunction = (struct __pyx_vtabstruct_6_basis_ConstantBasisFunction*)__Pyx_GetVtable(__pyx_ptype_6_basis_ConstantBasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_6_basis_ConstantBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6_basis_HingeBasisFunction = __Pyx_ImportType("_basis", "HingeBasisFunction", sizeof(struct __pyx_obj_6_basis_HingeBasisFunction), 1); if (unlikely(!__pyx_ptype_6_basis_HingeBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_6_basis_HingeBasisFunction = (struct __pyx_vtabstruct_6_basis_HingeBasisFunction*)__Pyx_GetVtable(__pyx_ptype_6_basis_HingeBasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_6_basis_HingeBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6_basis_LinearBasisFunction = __Pyx_ImportType("_basis", "LinearBasisFunction", sizeof(struct __pyx_obj_6_basis_LinearBasisFunction), 1); if (unlikely(!__pyx_ptype_6_basis_LinearBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_6_basis_LinearBasisFunction = (struct __pyx_vtabstruct_6_basis_LinearBasisFunction*)__Pyx_GetVtable(__pyx_ptype_6_basis_LinearBasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_6_basis_LinearBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6_basis_Basis = __Pyx_ImportType("_basis", "Basis", sizeof(struct __pyx_obj_6_basis_Basis), 1); if (unlikely(!__pyx_ptype_6_basis_Basis)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_6_basis_Basis = (struct __pyx_vtabstruct_6_basis_Basis*)__Pyx_GetVtable(__pyx_ptype_6_basis_Basis->tp_dict); if (unlikely(!__pyx_vtabptr_6_basis_Basis)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7_record_Record = __Pyx_ImportType("_record", "Record", sizeof(struct __pyx_obj_7_record_Record), 1); if (unlikely(!__pyx_ptype_7_record_Record)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7_record_Record = (struct __pyx_vtabstruct_7_record_Record*)__Pyx_GetVtable(__pyx_ptype_7_record_Record->tp_dict); if (unlikely(!__pyx_vtabptr_7_record_Record)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7_record_PruningPassRecord = __Pyx_ImportType("_record", "PruningPassRecord", sizeof(struct __pyx_obj_7_record_PruningPassRecord), 1); if (unlikely(!__pyx_ptype_7_record_PruningPassRecord)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7_record_PruningPassRecord = (struct __pyx_vtabstruct_7_record_PruningPassRecord*)__Pyx_GetVtable(__pyx_ptype_7_record_PruningPassRecord->tp_dict); if (unlikely(!__pyx_vtabptr_7_record_PruningPassRecord)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7_record_ForwardPassRecord = __Pyx_ImportType("_record", "ForwardPassRecord", sizeof(struct __pyx_obj_7_record_ForwardPassRecord), 1); if (unlikely(!__pyx_ptype_7_record_ForwardPassRecord)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7_record_ForwardPassRecord = (struct __pyx_vtabstruct_7_record_ForwardPassRecord*)__Pyx_GetVtable(__pyx_ptype_7_record_ForwardPassRecord->tp_dict); if (unlikely(!__pyx_vtabptr_7_record_ForwardPassRecord)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7_record_Iteration = __Pyx_ImportType("_record", "Iteration", sizeof(struct __pyx_obj_7_record_Iteration), 1); if (unlikely(!__pyx_ptype_7_record_Iteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7_record_Iteration = (struct __pyx_vtabstruct_7_record_Iteration*)__Pyx_GetVtable(__pyx_ptype_7_record_Iteration->tp_dict); if (unlikely(!__pyx_vtabptr_7_record_Iteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7_record_PruningPassIteration = __Pyx_ImportType("_record", "PruningPassIteration", sizeof(struct __pyx_obj_7_record_PruningPassIteration), 1); if (unlikely(!__pyx_ptype_7_record_PruningPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7_record_PruningPassIteration = (struct __pyx_vtabstruct_7_record_PruningPassIteration*)__Pyx_GetVtable(__pyx_ptype_7_record_PruningPassIteration->tp_dict); if (unlikely(!__pyx_vtabptr_7_record_PruningPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7_record_FirstPruningPassIteration = __Pyx_ImportType("_record", "FirstPruningPassIteration", sizeof(struct __pyx_obj_7_record_FirstPruningPassIteration), 1); if (unlikely(!__pyx_ptype_7_record_FirstPruningPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7_record_FirstPruningPassIteration = (struct __pyx_vtabstruct_7_record_FirstPruningPassIteration*)__Pyx_GetVtable(__pyx_ptype_7_record_FirstPruningPassIteration->tp_dict); if (unlikely(!__pyx_vtabptr_7_record_FirstPruningPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7_record_ForwardPassIteration = __Pyx_ImportType("_record", "ForwardPassIteration", sizeof(struct __pyx_obj_7_record_ForwardPassIteration), 1); if (unlikely(!__pyx_ptype_7_record_ForwardPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7_record_ForwardPassIteration = (struct __pyx_vtabstruct_7_record_ForwardPassIteration*)__Pyx_GetVtable(__pyx_ptype_7_record_ForwardPassIteration->tp_dict); if (unlikely(!__pyx_vtabptr_7_record_ForwardPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7_record_FirstForwardPassIteration = __Pyx_ImportType("_record", "FirstForwardPassIteration", sizeof(struct __pyx_obj_7_record_FirstForwardPassIteration), 1); if (unlikely(!__pyx_ptype_7_record_FirstForwardPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7_record_FirstForwardPassIteration = (struct __pyx_vtabstruct_7_record_FirstForwardPassIteration*)__Pyx_GetVtable(__pyx_ptype_7_record_FirstForwardPassIteration->tp_dict); if (unlikely(!__pyx_vtabptr_7_record_FirstForwardPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Variable import code ---*/ + /*--- Function import code ---*/ + __pyx_t_1 = __Pyx_ImportModule("_util"); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_t_1, "log2", (void (**)(void))&__pyx_f_5_util_log2, "__pyx_t_5_util_FLOAT_t (__pyx_t_5_util_FLOAT_t)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_t_1, "apply_weights_1d", (void (**)(void))&__pyx_f_5_util_apply_weights_1d, "PyObject *(PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_t_1, "gcv_adjust", (void (**)(void))&__pyx_f_5_util_gcv_adjust, "__pyx_t_5_util_FLOAT_t (__pyx_t_5_util_INDEX_t, __pyx_t_5_util_INDEX_t, __pyx_t_5_util_FLOAT_t, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + Py_DECREF(__pyx_t_1); __pyx_t_1 = 0; + /*--- Execution code ---*/ + + /* "_forward.pyx":12 + * + * from libc.math cimport sqrt, abs, log + * import numpy as np # <<<<<<<<<<<<<< + * cnp.import_array() + * + */ + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__np, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "_forward.pyx":13 + * from libc.math cimport sqrt, abs, log + * import numpy as np + * cnp.import_array() # <<<<<<<<<<<<<< + * + * stopping_conditions = { + */ + import_array(); + + /* "_forward.pyx":15 + * cnp.import_array() + * + * stopping_conditions = { # <<<<<<<<<<<<<< + * MAXTERMS:"Reached maximum number of terms", + * MAXRSQ:"Achieved RSQ value within threshold of 1", + */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + + /* "_forward.pyx":16 + * + * stopping_conditions = { + * MAXTERMS:"Reached maximum number of terms", # <<<<<<<<<<<<<< + * MAXRSQ:"Achieved RSQ value within threshold of 1", + * NOIMPRV:"Improvement below threshold", + */ + __pyx_t_3 = PyInt_FromLong(__pyx_e_8_forward_MAXTERMS); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_kp_s_35)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "_forward.pyx":17 + * stopping_conditions = { + * MAXTERMS:"Reached maximum number of terms", + * MAXRSQ:"Achieved RSQ value within threshold of 1", # <<<<<<<<<<<<<< + * NOIMPRV:"Improvement below threshold", + * LOWGRSQ:"GRSQ too low", + */ + __pyx_t_3 = PyInt_FromLong(__pyx_e_8_forward_MAXRSQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_kp_s_36)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "_forward.pyx":18 + * MAXTERMS:"Reached maximum number of terms", + * MAXRSQ:"Achieved RSQ value within threshold of 1", + * NOIMPRV:"Improvement below threshold", # <<<<<<<<<<<<<< + * LOWGRSQ:"GRSQ too low", + * NOCAND:"No remaining candidate knot locations" + */ + __pyx_t_3 = PyInt_FromLong(__pyx_e_8_forward_NOIMPRV); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_kp_s_37)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "_forward.pyx":19 + * MAXRSQ:"Achieved RSQ value within threshold of 1", + * NOIMPRV:"Improvement below threshold", + * LOWGRSQ:"GRSQ too low", # <<<<<<<<<<<<<< + * NOCAND:"No remaining candidate knot locations" + * } + */ + __pyx_t_3 = PyInt_FromLong(__pyx_e_8_forward_LOWGRSQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_kp_s_38)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "_forward.pyx":20 + * NOIMPRV:"Improvement below threshold", + * LOWGRSQ:"GRSQ too low", + * NOCAND:"No remaining candidate knot locations" # <<<<<<<<<<<<<< + * } + * + */ + __pyx_t_3 = PyInt_FromLong(__pyx_e_8_forward_NOCAND); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (PyDict_SetItem(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_kp_s_39)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_d, __pyx_n_s__stopping_conditions, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "_forward.pyx":1 + * # distutils: language = c # <<<<<<<<<<<<<< + * # cython: cdivision = True + * # cython: boundscheck = False + */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + if (PyDict_SetItem(__pyx_d, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "numpy.pxd":975 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None + */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + if (__pyx_m) { + __Pyx_AddTraceback("init _forward", __pyx_clineno, __pyx_lineno, __pyx_filename); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init _forward"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* Runtime support code */ +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif /* CYTHON_REFNANNY */ + +static PyObject *__Pyx_GetBuiltinName(PyObject *name) { + PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); + if (unlikely(!result)) { + PyErr_Format(PyExc_NameError, +#if PY_MAJOR_VERSION >= 3 + "name '%U' is not defined", name); +#else + "name '%s' is not defined", PyString_AS_STRING(name)); +#endif + } + return result; +} + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AsString(kw_name)); + #endif +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; + } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; + } + } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact) +{ + if (!type) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (none_allowed && obj == Py_None) return 1; + else if (exact) { + if (Py_TYPE(obj) == type) return 1; + } + else { + if (PyObject_TypeCheck(obj, type)) return 1; + } + PyErr_Format(PyExc_TypeError, + "Argument '%s' has incorrect type (expected %s, got %s)", + name, type->tp_name, Py_TYPE(obj)->tp_name); + return 0; +} + +static CYTHON_INLINE int __Pyx_IsLittleEndian(void) { + unsigned int n = 1; + return *(unsigned char*)(&n) != 0; +} +static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, + __Pyx_BufFmt_StackElem* stack, + __Pyx_TypeInfo* type) { + stack[0].field = &ctx->root; + stack[0].parent_offset = 0; + ctx->root.type = type; + ctx->root.name = "buffer dtype"; + ctx->root.offset = 0; + ctx->head = stack; + ctx->head->field = &ctx->root; + ctx->fmt_offset = 0; + ctx->head->parent_offset = 0; + ctx->new_packmode = '@'; + ctx->enc_packmode = '@'; + ctx->new_count = 1; + ctx->enc_count = 0; + ctx->enc_type = 0; + ctx->is_complex = 0; + ctx->is_valid_array = 0; + ctx->struct_alignment = 0; + while (type->typegroup == 'S') { + ++ctx->head; + ctx->head->field = type->fields; + ctx->head->parent_offset = 0; + type = type->fields->type; + } +} +static int __Pyx_BufFmt_ParseNumber(const char** ts) { + int count; + const char* t = *ts; + if (*t < '0' || *t > '9') { + return -1; + } else { + count = *t++ - '0'; + while (*t >= '0' && *t < '9') { + count *= 10; + count += *t++ - '0'; + } + } + *ts = t; + return count; +} +static int __Pyx_BufFmt_ExpectNumber(const char **ts) { + int number = __Pyx_BufFmt_ParseNumber(ts); + if (number == -1) /* First char was not a digit */ + PyErr_Format(PyExc_ValueError,\ + "Does not understand character buffer dtype format string ('%c')", **ts); + return number; +} +static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { + PyErr_Format(PyExc_ValueError, + "Unexpected format string character: '%c'", ch); +} +static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { + switch (ch) { + case 'c': return "'char'"; + case 'b': return "'signed char'"; + case 'B': return "'unsigned char'"; + case 'h': return "'short'"; + case 'H': return "'unsigned short'"; + case 'i': return "'int'"; + case 'I': return "'unsigned int'"; + case 'l': return "'long'"; + case 'L': return "'unsigned long'"; + case 'q': return "'long long'"; + case 'Q': return "'unsigned long long'"; + case 'f': return (is_complex ? "'complex float'" : "'float'"); + case 'd': return (is_complex ? "'complex double'" : "'double'"); + case 'g': return (is_complex ? "'complex long double'" : "'long double'"); + case 'T': return "a struct"; + case 'O': return "Python object"; + case 'P': return "a pointer"; + case 's': case 'p': return "a string"; + case 0: return "end"; + default: return "unparseable format string"; + } +} +static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return 2; + case 'i': case 'I': case 'l': case 'L': return 4; + case 'q': case 'Q': return 8; + case 'f': return (is_complex ? 8 : 4); + case 'd': return (is_complex ? 16 : 8); + case 'g': { + PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g').."); + return 0; + } + case 'O': case 'P': return sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} +static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { + switch (ch) { + case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(short); + case 'i': case 'I': return sizeof(int); + case 'l': case 'L': return sizeof(long); + #ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(PY_LONG_LONG); + #endif + case 'f': return sizeof(float) * (is_complex ? 2 : 1); + case 'd': return sizeof(double) * (is_complex ? 2 : 1); + case 'g': return sizeof(long double) * (is_complex ? 2 : 1); + case 'O': case 'P': return sizeof(void*); + default: { + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } + } +} +typedef struct { char c; short x; } __Pyx_st_short; +typedef struct { char c; int x; } __Pyx_st_int; +typedef struct { char c; long x; } __Pyx_st_long; +typedef struct { char c; float x; } __Pyx_st_float; +typedef struct { char c; double x; } __Pyx_st_double; +typedef struct { char c; long double x; } __Pyx_st_longdouble; +typedef struct { char c; void *x; } __Pyx_st_void_p; +#ifdef HAVE_LONG_LONG +typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; +#endif +static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); + case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); + case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); +#ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG); +#endif + case 'f': return sizeof(__Pyx_st_float) - sizeof(float); + case 'd': return sizeof(__Pyx_st_double) - sizeof(double); + case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double); + case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} +/* These are for computing the padding at the end of the struct to align + on the first member of the struct. This will probably the same as above, + but we don't have any guarantees. + */ +typedef struct { short x; char c; } __Pyx_pad_short; +typedef struct { int x; char c; } __Pyx_pad_int; +typedef struct { long x; char c; } __Pyx_pad_long; +typedef struct { float x; char c; } __Pyx_pad_float; +typedef struct { double x; char c; } __Pyx_pad_double; +typedef struct { long double x; char c; } __Pyx_pad_longdouble; +typedef struct { void *x; char c; } __Pyx_pad_void_p; +#ifdef HAVE_LONG_LONG +typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong; +#endif +static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short); + case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int); + case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long); +#ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG); +#endif + case 'f': return sizeof(__Pyx_pad_float) - sizeof(float); + case 'd': return sizeof(__Pyx_pad_double) - sizeof(double); + case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double); + case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} +static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { + switch (ch) { + case 'c': + return 'H'; + case 'b': case 'h': case 'i': + case 'l': case 'q': case 's': case 'p': + return 'I'; + case 'B': case 'H': case 'I': case 'L': case 'Q': + return 'U'; + case 'f': case 'd': case 'g': + return (is_complex ? 'C' : 'R'); + case 'O': + return 'O'; + case 'P': + return 'P'; + default: { + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } + } +} +static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { + if (ctx->head == NULL || ctx->head->field == &ctx->root) { + const char* expected; + const char* quote; + if (ctx->head == NULL) { + expected = "end"; + quote = ""; + } else { + expected = ctx->head->field->type->name; + quote = "'"; + } + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch, expected %s%s%s but got %s", + quote, expected, quote, + __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex)); + } else { + __Pyx_StructField* field = ctx->head->field; + __Pyx_StructField* parent = (ctx->head - 1)->field; + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'", + field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex), + parent->type->name, field->name); + } +} +static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { + char group; + size_t size, offset, arraysize = 1; + if (ctx->enc_type == 0) return 0; + if (ctx->head->field->type->arraysize[0]) { + int i, ndim = 0; + if (ctx->enc_type == 's' || ctx->enc_type == 'p') { + ctx->is_valid_array = ctx->head->field->type->ndim == 1; + ndim = 1; + if (ctx->enc_count != ctx->head->field->type->arraysize[0]) { + PyErr_Format(PyExc_ValueError, + "Expected a dimension of size %zu, got %zu", + ctx->head->field->type->arraysize[0], ctx->enc_count); + return -1; + } + } + if (!ctx->is_valid_array) { + PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d", + ctx->head->field->type->ndim, ndim); + return -1; + } + for (i = 0; i < ctx->head->field->type->ndim; i++) { + arraysize *= ctx->head->field->type->arraysize[i]; + } + ctx->is_valid_array = 0; + ctx->enc_count = 1; + } + group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); + do { + __Pyx_StructField* field = ctx->head->field; + __Pyx_TypeInfo* type = field->type; + if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') { + size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); + } else { + size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); + } + if (ctx->enc_packmode == '@') { + size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); + size_t align_mod_offset; + if (align_at == 0) return -1; + align_mod_offset = ctx->fmt_offset % align_at; + if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; + if (ctx->struct_alignment == 0) + ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type, + ctx->is_complex); + } + if (type->size != size || type->typegroup != group) { + if (type->typegroup == 'C' && type->fields != NULL) { + size_t parent_offset = ctx->head->parent_offset + field->offset; + ++ctx->head; + ctx->head->field = type->fields; + ctx->head->parent_offset = parent_offset; + continue; + } + if ((type->typegroup == 'H' || group == 'H') && type->size == size) { + } else { + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } + } + offset = ctx->head->parent_offset + field->offset; + if (ctx->fmt_offset != offset) { + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected", + (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); + return -1; + } + ctx->fmt_offset += size; + if (arraysize) + ctx->fmt_offset += (arraysize - 1) * size; + --ctx->enc_count; /* Consume from buffer string */ + while (1) { + if (field == &ctx->root) { + ctx->head = NULL; + if (ctx->enc_count != 0) { + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } + break; /* breaks both loops as ctx->enc_count == 0 */ + } + ctx->head->field = ++field; + if (field->type == NULL) { + --ctx->head; + field = ctx->head->field; + continue; + } else if (field->type->typegroup == 'S') { + size_t parent_offset = ctx->head->parent_offset + field->offset; + if (field->type->fields->type == NULL) continue; /* empty struct */ + field = field->type->fields; + ++ctx->head; + ctx->head->field = field; + ctx->head->parent_offset = parent_offset; + break; + } else { + break; + } + } + } while (ctx->enc_count); + ctx->enc_type = 0; + ctx->is_complex = 0; + return 0; +} +static CYTHON_INLINE PyObject * +__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) +{ + const char *ts = *tsp; + int i = 0, number; + int ndim = ctx->head->field->type->ndim; +; + ++ts; + if (ctx->new_count != 1) { + PyErr_SetString(PyExc_ValueError, + "Cannot handle repeated arrays in format string"); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + while (*ts && *ts != ')') { + if (isspace(*ts)) + continue; + number = __Pyx_BufFmt_ExpectNumber(&ts); + if (number == -1) return NULL; + if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) + return PyErr_Format(PyExc_ValueError, + "Expected a dimension of size %zu, got %d", + ctx->head->field->type->arraysize[i], number); + if (*ts != ',' && *ts != ')') + return PyErr_Format(PyExc_ValueError, + "Expected a comma in format string, got '%c'", *ts); + if (*ts == ',') ts++; + i++; + } + if (i != ndim) + return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d", + ctx->head->field->type->ndim, i); + if (!*ts) { + PyErr_SetString(PyExc_ValueError, + "Unexpected end of format string, expected ')'"); + return NULL; + } + ctx->is_valid_array = 1; + ctx->new_count = 1; + *tsp = ++ts; + return Py_None; +} +static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { + int got_Z = 0; + while (1) { + switch(*ts) { + case 0: + if (ctx->enc_type != 0 && ctx->head == NULL) { + __Pyx_BufFmt_RaiseExpected(ctx); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + if (ctx->head != NULL) { + __Pyx_BufFmt_RaiseExpected(ctx); + return NULL; + } + return ts; + case ' ': + case 10: + case 13: + ++ts; + break; + case '<': + if (!__Pyx_IsLittleEndian()) { + PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); + return NULL; + } + ctx->new_packmode = '='; + ++ts; + break; + case '>': + case '!': + if (__Pyx_IsLittleEndian()) { + PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); + return NULL; + } + ctx->new_packmode = '='; + ++ts; + break; + case '=': + case '@': + case '^': + ctx->new_packmode = *ts++; + break; + case 'T': /* substruct */ + { + const char* ts_after_sub; + size_t i, struct_count = ctx->new_count; + size_t struct_alignment = ctx->struct_alignment; + ctx->new_count = 1; + ++ts; + if (*ts != '{') { + PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_type = 0; /* Erase processed last struct element */ + ctx->enc_count = 0; + ctx->struct_alignment = 0; + ++ts; + ts_after_sub = ts; + for (i = 0; i != struct_count; ++i) { + ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); + if (!ts_after_sub) return NULL; + } + ts = ts_after_sub; + if (struct_alignment) ctx->struct_alignment = struct_alignment; + } + break; + case '}': /* end of substruct; either repeat or move on */ + { + size_t alignment = ctx->struct_alignment; + ++ts; + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_type = 0; /* Erase processed last struct element */ + if (alignment && ctx->fmt_offset % alignment) { + ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment); + } + } + return ts; + case 'x': + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->fmt_offset += ctx->new_count; + ctx->new_count = 1; + ctx->enc_count = 0; + ctx->enc_type = 0; + ctx->enc_packmode = ctx->new_packmode; + ++ts; + break; + case 'Z': + got_Z = 1; + ++ts; + if (*ts != 'f' && *ts != 'd' && *ts != 'g') { + __Pyx_BufFmt_RaiseUnexpectedChar('Z'); + return NULL; + } /* fall through */ + case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': + case 'l': case 'L': case 'q': case 'Q': + case 'f': case 'd': case 'g': + case 'O': case 's': case 'p': + if (ctx->enc_type == *ts && got_Z == ctx->is_complex && + ctx->enc_packmode == ctx->new_packmode) { + ctx->enc_count += ctx->new_count; + } else { + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_count = ctx->new_count; + ctx->enc_packmode = ctx->new_packmode; + ctx->enc_type = *ts; + ctx->is_complex = got_Z; + } + ++ts; + ctx->new_count = 1; + got_Z = 0; + break; + case ':': + ++ts; + while(*ts != ':') ++ts; + ++ts; + break; + case '(': + if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL; + break; + default: + { + int number = __Pyx_BufFmt_ExpectNumber(&ts); + if (number == -1) return NULL; + ctx->new_count = (size_t)number; + } + } + } +} +static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { + buf->buf = NULL; + buf->obj = NULL; + buf->strides = __Pyx_zeros; + buf->shape = __Pyx_zeros; + buf->suboffsets = __Pyx_minusones; +} +static CYTHON_INLINE int __Pyx_GetBufferAndValidate( + Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, + int nd, int cast, __Pyx_BufFmt_StackElem* stack) +{ + if (obj == Py_None || obj == NULL) { + __Pyx_ZeroBuffer(buf); + return 0; + } + buf->buf = NULL; + if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail; + if (buf->ndim != nd) { + PyErr_Format(PyExc_ValueError, + "Buffer has wrong number of dimensions (expected %d, got %d)", + nd, buf->ndim); + goto fail; + } + if (!cast) { + __Pyx_BufFmt_Context ctx; + __Pyx_BufFmt_Init(&ctx, stack, dtype); + if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; + } + if ((unsigned)buf->itemsize != dtype->size) { + PyErr_Format(PyExc_ValueError, + "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)", + buf->itemsize, (buf->itemsize > 1) ? "s" : "", + dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : ""); + goto fail; + } + if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; + return 0; +fail:; + __Pyx_ZeroBuffer(buf); + return -1; +} +static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { + if (info->buf == NULL) return; + if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; + __Pyx_ReleaseBuffer(info); +} + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + if (unlikely(!type)) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(PyObject_TypeCheck(obj, type))) + return 1; + PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", + Py_TYPE(obj)->tp_name, type->tp_name); + return 0; +} + +static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { + PyObject *result; +#if CYTHON_COMPILING_IN_CPYTHON + result = PyDict_GetItem(__pyx_d, name); + if (result) { + Py_INCREF(result); + } else { +#else + result = PyObject_GetItem(__pyx_d, name); + if (!result) { + PyErr_Clear(); +#endif + result = __Pyx_GetBuiltinName(name); + } + return result; +} + +static CYTHON_INLINE int __Pyx_SetItemInt_Generic(PyObject *o, PyObject *j, PyObject *v) { + int r; + if (!j) return -1; + r = PyObject_SetItem(o, j, v); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE int __Pyx_SetItemInt_Fast(PyObject *o, Py_ssize_t i, PyObject *v, + int is_list, int wraparound, int boundscheck) { +#if CYTHON_COMPILING_IN_CPYTHON + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = (!wraparound) ? i : ((likely(i >= 0)) ? i : i + PyList_GET_SIZE(o)); + if ((!boundscheck) || likely((n >= 0) & (n < PyList_GET_SIZE(o)))) { + PyObject* old = PyList_GET_ITEM(o, n); + Py_INCREF(v); + PyList_SET_ITEM(o, n, v); + Py_DECREF(old); + return 1; + } + } else { + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_ass_item)) { + if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (PyErr_ExceptionMatches(PyExc_OverflowError)) + PyErr_Clear(); + else + return -1; + } + } + return m->sq_ass_item(o, i, v); + } + } +#else +#if CYTHON_COMPILING_IN_PYPY + if (is_list || (PySequence_Check(o) && !PyDict_Check(o))) { +#else + if (is_list || PySequence_Check(o)) { +#endif + return PySequence_SetItem(o, i, v); + } +#endif + return __Pyx_SetItemInt_Generic(o, PyInt_FromSsize_t(i), v); +} + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_Restore(type, value, tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#else + PyErr_Fetch(type, value, tb); +#endif +} + +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, + CYTHON_UNUSED PyObject *cause) { + Py_XINCREF(type); + if (!value || value == Py_None) + value = NULL; + else + Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + } + #if PY_VERSION_HEX < 0x02050000 + if (PyClass_Check(type)) { + #else + if (PyType_Check(type)) { + #endif +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + value = type; + #if PY_VERSION_HEX < 0x02050000 + if (PyInstance_Check(type)) { + type = (PyObject*) ((PyInstanceObject*)type)->in_class; + Py_INCREF(type); + } else { + type = 0; + PyErr_SetString(PyExc_TypeError, + "raise: exception must be an old-style class or instance"); + goto raise_error; + } + #else + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + #endif + } + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} +#else /* Python 3+ */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (PyExceptionClass_Check(type)) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyEval_CallObject(type, args); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } +#if PY_VERSION_HEX >= 0x03030000 + if (cause) { +#else + if (cause && cause != Py_None) { +#endif + PyObject *fixed_cause; + if (cause == Py_None) { + fixed_cause = NULL; + } else if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); + } + PyErr_SetObject(type, value); + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } +bad: + Py_XDECREF(owned_instance); + return; +} +#endif + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck) { +#if CYTHON_COMPILING_IN_CPYTHON + if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o); + if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck) { +#if CYTHON_COMPILING_IN_CPYTHON + if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, + int is_list, int wraparound, int boundscheck) { +#if CYTHON_COMPILING_IN_CPYTHON + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) { + PyObject *r = PyList_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } + else if (PyTuple_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } else { + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (PyErr_ExceptionMatches(PyExc_OverflowError)) + PyErr_Clear(); + else + return NULL; + } + } + return m->sq_item(o, i); + } + } +#else + if (is_list || PySequence_Check(o)) { + return PySequence_GetItem(o, i); + } +#endif + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + +static void __Pyx_RaiseBufferFallbackError(void) { + PyErr_Format(PyExc_ValueError, + "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!"); +} + +static CYTHON_INLINE int __Pyx_PyObject_SetSlice( + PyObject* obj, PyObject* value, Py_ssize_t cstart, Py_ssize_t cstop, + PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice, + int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) { +#if CYTHON_COMPILING_IN_CPYTHON + PyMappingMethods* mp; +#if PY_MAJOR_VERSION < 3 + PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence; + if (likely(ms && ms->sq_ass_slice)) { + if (!has_cstart) { + if (_py_start && (*_py_start != Py_None)) { + cstart = __Pyx_PyIndex_AsSsize_t(*_py_start); + if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; + } else + cstart = 0; + } + if (!has_cstop) { + if (_py_stop && (*_py_stop != Py_None)) { + cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop); + if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; + } else + cstop = PY_SSIZE_T_MAX; + } + if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) { + Py_ssize_t l = ms->sq_length(obj); + if (likely(l >= 0)) { + if (cstop < 0) { + cstop += l; + if (cstop < 0) cstop = 0; + } + if (cstart < 0) { + cstart += l; + if (cstart < 0) cstart = 0; + } + } else { + if (PyErr_ExceptionMatches(PyExc_OverflowError)) + PyErr_Clear(); + else + goto bad; + } + } + return ms->sq_ass_slice(obj, cstart, cstop, value); + } +#endif + mp = Py_TYPE(obj)->tp_as_mapping; + if (likely(mp && mp->mp_ass_subscript)) +#endif + { + int result; + PyObject *py_slice, *py_start, *py_stop; + if (_py_slice) { + py_slice = *_py_slice; + } else { + PyObject* owned_start = NULL; + PyObject* owned_stop = NULL; + if (_py_start) { + py_start = *_py_start; + } else { + if (has_cstart) { + owned_start = py_start = PyInt_FromSsize_t(cstart); + if (unlikely(!py_start)) goto bad; + } else + py_start = Py_None; + } + if (_py_stop) { + py_stop = *_py_stop; + } else { + if (has_cstop) { + owned_stop = py_stop = PyInt_FromSsize_t(cstop); + if (unlikely(!py_stop)) { + Py_XDECREF(owned_start); + goto bad; + } + } else + py_stop = Py_None; + } + py_slice = PySlice_New(py_start, py_stop, Py_None); + Py_XDECREF(owned_start); + Py_XDECREF(owned_stop); + if (unlikely(!py_slice)) goto bad; + } +#if CYTHON_COMPILING_IN_CPYTHON + result = mp->mp_ass_subscript(obj, py_slice, value); +#else + result = value ? PyObject_SetItem(obj, py_slice, value) : PyObject_DelItem(obj, py_slice); +#endif + if (!_py_slice) { + Py_DECREF(py_slice); + } + return result; + } + PyErr_Format(PyExc_TypeError, + "'%.200s' object does not support slice %s", + Py_TYPE(obj)->tp_name, value ? "assignment" : "deletion"); +bad: + return -1; +} + +static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { + PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); +} + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); +} + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", + index, (index == 1) ? "" : "s"); +} + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +static CYTHON_INLINE int __Pyx_IterFinish(void) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + PyObject* exc_type = tstate->curexc_type; + if (unlikely(exc_type)) { + if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { + PyObject *exc_value, *exc_tb; + exc_value = tstate->curexc_value; + exc_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + Py_DECREF(exc_type); + Py_XDECREF(exc_value); + Py_XDECREF(exc_tb); + return 0; + } else { + return -1; + } + } + return 0; +#else + if (unlikely(PyErr_Occurred())) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { + PyErr_Clear(); + return 0; + } else { + return -1; + } + } + return 0; +#endif +} + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; + } else { + return __Pyx_IterFinish(); + } + return 0; +} + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_import; + py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s____import__); + if (!py_import) + goto bad; + #endif + if (from_list) + list = from_list; + else { + empty_list = PyList_New(0); + if (!empty_list) + goto bad; + list = empty_list; + } + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + #if PY_VERSION_HEX >= 0x02050000 + { + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.')) { + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_level = PyInt_FromLong(1); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, global_dict, empty_dict, list, 1); + #endif + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; /* try absolute import on failure */ + } + #endif + if (!module) { + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, global_dict, empty_dict, list, level); + #endif + } + } + #else + if (level>0) { + PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); + goto bad; + } + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, NULL); + #endif +bad: + #if PY_VERSION_HEX < 0x03030000 + Py_XDECREF(py_import); + #endif + Py_XDECREF(empty_list); + Py_XDECREF(empty_dict); + return module; +} + +#if PY_MAJOR_VERSION < 3 +static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { + #if PY_VERSION_HEX >= 0x02060000 + if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); + #endif + if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags); + #if PY_VERSION_HEX < 0x02060000 + if (obj->ob_type->tp_dict) { + PyObject *getbuffer_cobj = PyObject_GetItem( + obj->ob_type->tp_dict, __pyx_n_s____pyx_getbuffer); + if (getbuffer_cobj) { + getbufferproc func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj); + Py_DECREF(getbuffer_cobj); + if (!func) + goto fail; + return func(obj, view, flags); + } else { + PyErr_Clear(); + } + } + #endif + PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name); +#if PY_VERSION_HEX < 0x02060000 +fail: +#endif + return -1; +} +static void __Pyx_ReleaseBuffer(Py_buffer *view) { + PyObject *obj = view->obj; + if (!obj) return; + #if PY_VERSION_HEX >= 0x02060000 + if (PyObject_CheckBuffer(obj)) { + PyBuffer_Release(view); + return; + } + #endif + if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; } + #if PY_VERSION_HEX < 0x02060000 + if (obj->ob_type->tp_dict) { + PyObject *releasebuffer_cobj = PyObject_GetItem( + obj->ob_type->tp_dict, __pyx_n_s____pyx_releasebuffer); + if (releasebuffer_cobj) { + releasebufferproc func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj); + Py_DECREF(releasebuffer_cobj); + if (!func) + goto fail; + func(obj, view); + return; + } else { + PyErr_Clear(); + } + } + #endif + goto nofail; +#if PY_VERSION_HEX < 0x02060000 +fail: +#endif + PyErr_WriteUnraisable(obj); +nofail: + Py_DECREF(obj); + view->obj = NULL; +} +#endif /* PY_MAJOR_VERSION < 3 */ + + + static CYTHON_INLINE npy_ulonglong __Pyx_PyInt_from_py_npy_ulonglong(PyObject* x) { + const npy_ulonglong neg_one = (npy_ulonglong)-1, const_zero = (npy_ulonglong)0; + const int is_unsigned = const_zero < neg_one; + if (sizeof(npy_ulonglong) == sizeof(char)) { + if (is_unsigned) + return (npy_ulonglong)__Pyx_PyInt_AsUnsignedChar(x); + else + return (npy_ulonglong)__Pyx_PyInt_AsSignedChar(x); + } else if (sizeof(npy_ulonglong) == sizeof(short)) { + if (is_unsigned) + return (npy_ulonglong)__Pyx_PyInt_AsUnsignedShort(x); + else + return (npy_ulonglong)__Pyx_PyInt_AsSignedShort(x); + } else if (sizeof(npy_ulonglong) == sizeof(int)) { + if (is_unsigned) + return (npy_ulonglong)__Pyx_PyInt_AsUnsignedInt(x); + else + return (npy_ulonglong)__Pyx_PyInt_AsSignedInt(x); + } else if (sizeof(npy_ulonglong) == sizeof(long)) { + if (is_unsigned) + return (npy_ulonglong)__Pyx_PyInt_AsUnsignedLong(x); + else + return (npy_ulonglong)__Pyx_PyInt_AsSignedLong(x); + } else if (sizeof(npy_ulonglong) == sizeof(PY_LONG_LONG)) { + if (is_unsigned) + return (npy_ulonglong)__Pyx_PyInt_AsUnsignedLongLong(x); + else + return (npy_ulonglong)__Pyx_PyInt_AsSignedLongLong(x); + } else { + #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); + #else + npy_ulonglong val; + PyObject *v = __Pyx_PyNumber_Int(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } + #endif + return (npy_ulonglong)-1; + } +} + +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_ulonglong(npy_ulonglong val) { + const npy_ulonglong neg_one = (npy_ulonglong)-1, const_zero = (npy_ulonglong)0; + const int is_unsigned = const_zero < neg_one; + if ((sizeof(npy_ulonglong) == sizeof(char)) || + (sizeof(npy_ulonglong) == sizeof(short))) { + return PyInt_FromLong((long)val); + } else if ((sizeof(npy_ulonglong) == sizeof(int)) || + (sizeof(npy_ulonglong) == sizeof(long))) { + if (is_unsigned) + return PyLong_FromUnsignedLong((unsigned long)val); + else + return PyInt_FromLong((long)val); + } else if (sizeof(npy_ulonglong) == sizeof(PY_LONG_LONG)) { + if (is_unsigned) + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); + else + return PyLong_FromLongLong((PY_LONG_LONG)val); + } else { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + return _PyLong_FromByteArray(bytes, sizeof(npy_ulonglong), + little, !is_unsigned); + } +} + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return ::std::complex< float >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return x + y*(__pyx_t_float_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + __pyx_t_float_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +#if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtf(z.real*z.real + z.imag*z.imag); + #else + return hypotf(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + float denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(a, a); + case 3: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, a); + case 4: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_absf(a); + theta = atan2f(a.imag, a.real); + } + lnr = logf(r); + z_r = expf(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosf(z_theta); + z.imag = z_r * sinf(z_theta); + return z; + } + #endif +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return ::std::complex< double >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return x + y*(__pyx_t_double_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + __pyx_t_double_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +#if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrt(z.real*z.real + z.imag*z.imag); + #else + return hypot(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(a, a); + case 3: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, a); + case 4: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_abs(a); + theta = atan2(a.imag, a.real); + } + lnr = log(r); + z_r = exp(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cos(z_theta); + z.imag = z_r * sin(z_theta); + return z; + } + #endif +#endif + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(unsigned long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (unsigned long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)PyLong_AsUnsignedLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(unsigned long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(unsigned long) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(unsigned long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (unsigned long)PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)PyLong_AsUnsignedLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(long) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (long)PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(signed long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (signed long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)PyLong_AsUnsignedLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(signed long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(signed long) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(signed long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (signed long)PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, + CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) { + PyObject *old_exc, *old_val, *old_tb; + PyObject *ctx; + __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); + #if PY_MAJOR_VERSION < 3 + ctx = PyString_FromString(name); + #else + ctx = PyUnicode_FromString(name); + #endif + __Pyx_ErrRestore(old_exc, old_val, old_tb); + if (!ctx) { + PyErr_WriteUnraisable(Py_None); + } else { + PyErr_WriteUnraisable(ctx); + Py_DECREF(ctx); + } +} + +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + +static int __Pyx_SetVtable(PyObject *dict, void *vtable) { +#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) + PyObject *ob = PyCapsule_New(vtable, 0, 0); +#else + PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); +#endif + if (!ob) + goto bad; + if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0) + goto bad; + Py_DECREF(ob); + return 0; +bad: + Py_XDECREF(ob); + return -1; +} + +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + py_name = __Pyx_PyIdentifier_FromString(name); + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + +#ifndef __PYX_HAVE_RT_ImportType +#define __PYX_HAVE_RT_ImportType +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, + size_t size, int strict) +{ + PyObject *py_module = 0; + PyObject *result = 0; + PyObject *py_name = 0; + char warning[200]; + Py_ssize_t basicsize; +#ifdef Py_LIMITED_API + PyObject *py_basicsize; +#endif + py_module = __Pyx_ImportModule(module_name); + if (!py_module) + goto bad; + py_name = __Pyx_PyIdentifier_FromString(class_name); + if (!py_name) + goto bad; + result = PyObject_GetAttr(py_module, py_name); + Py_DECREF(py_name); + py_name = 0; + Py_DECREF(py_module); + py_module = 0; + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%s.%s is not a type object", + module_name, class_name); + goto bad; + } +#ifndef Py_LIMITED_API + basicsize = ((PyTypeObject *)result)->tp_basicsize; +#else + py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); + if (!py_basicsize) + goto bad; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = 0; + if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) + goto bad; +#endif + if (!strict && (size_t)basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility", + module_name, class_name); + #if PY_VERSION_HEX < 0x02050000 + if (PyErr_Warn(NULL, warning) < 0) goto bad; + #else + if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; + #endif + } + else if ((size_t)basicsize != size) { + PyErr_Format(PyExc_ValueError, + "%s.%s has the wrong size, try recompiling", + module_name, class_name); + goto bad; + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(py_module); + Py_XDECREF(result); + return NULL; +} +#endif + +static void* __Pyx_GetVtable(PyObject *dict) { + void* ptr; + PyObject *ob = PyMapping_GetItemString(dict, (char *)"__pyx_vtable__"); + if (!ob) + goto bad; +#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) + ptr = PyCapsule_GetPointer(ob, 0); +#else + ptr = PyCObject_AsVoidPtr(ob); +#endif + if (!ptr && !PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); + Py_DECREF(ob); + return ptr; +bad: + Py_XDECREF(ob); + return NULL; +} + +#ifndef __PYX_HAVE_RT_ImportFunction +#define __PYX_HAVE_RT_ImportFunction +static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { + PyObject *d = 0; + PyObject *cobj = 0; + union { + void (*fp)(void); + void *p; + } tmp; + d = PyObject_GetAttrString(module, (char *)"__pyx_capi__"); + if (!d) + goto bad; + cobj = PyDict_GetItemString(d, funcname); + if (!cobj) { + PyErr_Format(PyExc_ImportError, + "%s does not export expected C function %s", + PyModule_GetName(module), funcname); + goto bad; + } +#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3 && PY_MINOR_VERSION==0) + if (!PyCapsule_IsValid(cobj, sig)) { + PyErr_Format(PyExc_TypeError, + "C function %s.%s has wrong signature (expected %s, got %s)", + PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj)); + goto bad; + } + tmp.p = PyCapsule_GetPointer(cobj, sig); +#else + {const char *desc, *s1, *s2; + desc = (const char *)PyCObject_GetDesc(cobj); + if (!desc) + goto bad; + s1 = desc; s2 = sig; + while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; } + if (*s1 != *s2) { + PyErr_Format(PyExc_TypeError, + "C function %s.%s has wrong signature (expected %s, got %s)", + PyModule_GetName(module), funcname, sig, desc); + goto bad; + } + tmp.p = PyCObject_AsVoidPtr(cobj);} +#endif + *f = tmp.fp; + if (!(*f)) + goto bad; + Py_DECREF(d); + return 0; +bad: + Py_XDECREF(d); + return -1; +} +#endif + +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = (start + end) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); +} + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(filename); + #else + py_srcfile = PyUnicode_FromString(filename); + #endif + if (!py_srcfile) goto bad; + if (c_line) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_code = __Pyx_PyCode_New( + 0, /*int argcount,*/ + 0, /*int kwonlyargcount,*/ + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + py_line, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + Py_DECREF(py_srcfile); + Py_DECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_globals = 0; + PyFrameObject *py_frame = 0; + py_code = __pyx_find_code_object(c_line ? c_line : py_line); + if (!py_code) { + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) goto bad; + __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + } + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = py_line; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char* c_str) { + return __Pyx_PyUnicode_FromStringAndSize(c_str, strlen(c_str)); +} +static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) { + Py_ssize_t ignore; + return __Pyx_PyObject_AsStringAndSize(o, &ignore); +} +static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT + if ( +#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + __Pyx_sys_getdefaultencoding_not_ascii && +#endif + PyUnicode_Check(o)) { +#if PY_VERSION_HEX < 0x03030000 + char* defenc_c; + PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); + if (!defenc) return NULL; + defenc_c = PyBytes_AS_STRING(defenc); +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + { + char* end = defenc_c + PyBytes_GET_SIZE(defenc); + char* c; + for (c = defenc_c; c < end; c++) { + if ((unsigned char) (*c) >= 128) { + PyUnicode_AsASCIIString(o); + return NULL; + } + } + } +#endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/ + *length = PyBytes_GET_SIZE(defenc); + return defenc_c; +#else /* PY_VERSION_HEX < 0x03030000 */ + if (PyUnicode_READY(o) == -1) return NULL; +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + if (PyUnicode_IS_ASCII(o)) { + *length = PyUnicode_GET_DATA_SIZE(o); + return PyUnicode_AsUTF8(o); + } else { + PyUnicode_AsASCIIString(o); + return NULL; + } +#else /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */ + return PyUnicode_AsUTF8AndSize(o, length); +#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */ +#endif /* PY_VERSION_HEX < 0x03030000 */ + } else +#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */ + { + char* result; + int r = PyBytes_AsStringAndSize(o, &result, length); + if (r < 0) { + return NULL; + } else { + return result; + } + } +} +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_MAJOR_VERSION < 3 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_MAJOR_VERSION < 3 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_MAJOR_VERSION < 3 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + if ((val != (unsigned PY_LONG_LONG)-1) || !PyErr_Occurred()) + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff --git a/sklearn/earth/_forward.pxd b/sklearn/earth/_forward.pxd new file mode 100644 index 0000000000000..a17189dc10cec --- /dev/null +++ b/sklearn/earth/_forward.pxd @@ -0,0 +1,80 @@ +cimport numpy as cnp +import numpy as np +ctypedef cnp.float64_t FLOAT_t +ctypedef cnp.intp_t INT_t +ctypedef cnp.ulong_t INDEX_t +ctypedef cnp.uint8_t BOOL_t +from _basis cimport Basis +from _record cimport ForwardPassRecord + +ctypedef enum StoppingCondition: + MAXTERMS=0, + MAXRSQ=1, + NOIMPRV=2, + LOWGRSQ=3, + NOCAND=4 + +cdef class ForwardPasser: + + #User selected parameters + cdef int endspan + cdef int minspan + cdef FLOAT_t endspan_alpha + cdef FLOAT_t minspan_alpha + cdef int max_terms + cdef int max_degree + cdef FLOAT_t thresh + cdef FLOAT_t penalty + cdef int check_every + cdef int min_search_points + cdef list xlabels + cdef FLOAT_t zero_tol + + #Input data + cdef cnp.ndarray X + cdef cnp.ndarray y + cdef cnp.ndarray weights + cdef INDEX_t m + cdef INDEX_t n + cdef FLOAT_t sst + cdef FLOAT_t y_squared + + #Working floating point data + cdef cnp.ndarray B #Data matrix in basis space + cdef cnp.ndarray B_orth #Orthogonalized version of B + cdef cnp.ndarray c + cdef cnp.ndarray norms + cdef cnp.ndarray u + cdef cnp.ndarray B_orth_times_parent_cum + cdef FLOAT_t c_squared + + #Working integer data + cdef cnp.ndarray sort_tracker + cdef cnp.ndarray sorting + cdef cnp.ndarray mwork +# cdef cnp.ndarray x_order + cdef cnp.ndarray linear_variables + + #Object construction + cdef ForwardPassRecord record + cdef Basis basis + + cpdef Basis get_basis(ForwardPasser self) + +# cpdef init_x_order(ForwardPasser self) + + cpdef init_linear_variables(ForwardPasser self) + + cpdef run(ForwardPasser self) + + cdef stop_check(ForwardPasser self) + + cpdef int orthonormal_update(ForwardPasser self, INDEX_t k) + + cpdef orthonormal_downdate(ForwardPasser self, INDEX_t k) + + cdef next_pair(ForwardPasser self) + + cdef best_knot(ForwardPasser self, INDEX_t parent, INDEX_t variable, INDEX_t k, cnp.ndarray[INT_t,ndim=1] candidates, cnp.ndarray[INT_t,ndim=1] order, FLOAT_t * mse, FLOAT_t * knot, INDEX_t * knot_idx) + + \ No newline at end of file diff --git a/sklearn/earth/_forward.pyx b/sklearn/earth/_forward.pyx new file mode 100644 index 0000000000000..fe20f4474cb57 --- /dev/null +++ b/sklearn/earth/_forward.pyx @@ -0,0 +1,577 @@ +# distutils: language = c +# cython: cdivision = True +# cython: boundscheck = False +# cython: wraparound = False +# cython: profile = False + +from _util cimport gcv_adjust, log2, apply_weights_1d +from _basis cimport Basis, BasisFunction, ConstantBasisFunction, HingeBasisFunction, LinearBasisFunction +from _record cimport ForwardPassIteration + +from libc.math cimport sqrt, abs, log +import numpy as np +cnp.import_array() + +stopping_conditions = { + MAXTERMS:"Reached maximum number of terms", + MAXRSQ:"Achieved RSQ value within threshold of 1", + NOIMPRV:"Improvement below threshold", + LOWGRSQ:"GRSQ too low", + NOCAND:"No remaining candidate knot locations" + } + +cdef class ForwardPasser: + + def __init__(ForwardPasser self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] weights, **kwargs): + cdef INDEX_t i + self.X = X + self.y = y.copy() + self.weights = weights + apply_weights_1d(self.y, self.weights) + self.m = self.X.shape[0] + self.n = self.X.shape[1] + self.endspan = kwargs['endspan'] if 'endspan' in kwargs else -1 + self.minspan = kwargs['minspan'] if 'minspan' in kwargs else -1 + self.endspan_alpha = kwargs['endspan_alpha'] if 'endspan_alpha' in kwargs else .05 + self.minspan_alpha = kwargs['minspan_alpha'] if 'minspan_alpha' in kwargs else .05 + self.max_terms = kwargs['max_terms'] if 'max_terms' in kwargs else 2*self.n + 10 + self.max_degree = kwargs['max_degree'] if 'max_degree' in kwargs else 1 + self.thresh = kwargs['thresh'] if 'thresh' in kwargs else 0.001 + self.penalty = kwargs['penalty'] if 'penalty' in kwargs else 3.0 + self.check_every = kwargs['check_every'] if 'check_every' in kwargs else -1 + self.min_search_points = kwargs['min_search_points'] if 'min_search_points' in kwargs else 100 + self.xlabels = kwargs['xlabels'] if 'xlabels' in kwargs else ['x'+str(i) for i in range(self.n)] + if self.check_every < 0: + self.check_every = (self.m / self.min_search_points) if self.m > self.min_search_points else 1 + self.sst = (np.dot(self.y,self.y) - (np.dot(np.sqrt(self.weights),self.y) / np.sqrt(np.sum(self.weights)))**2) / self.m + self.y_squared = np.dot(self.y,self.y) + self.record = ForwardPassRecord(self.m,self.n,self.penalty,self.sst) + self.basis = Basis() + self.basis.append(ConstantBasisFunction()) + + self.sorting = np.empty(shape=self.m, dtype=np.int) + self.mwork = np.empty(shape=self.m, dtype=np.int) + self.u = np.empty(shape=self.max_terms, dtype=float) + self.B_orth_times_parent_cum = np.empty(shape=self.max_terms,dtype=np.float) + self.B = np.ones(shape=(self.m,self.max_terms), order='C',dtype=np.float) + self.basis.weighted_transform(self.X,self.B,self.weights) + self.B_orth = self.B.copy() #An orthogonal matrix with the same column space as B + self.u = np.empty(shape=self.max_terms, dtype=np.float) + self.c = np.empty(shape=self.max_terms, dtype=np.float) + self.norms = np.empty(shape=self.max_terms, dtype=np.float) + self.c_squared = 0.0 + self.sort_tracker = np.empty(shape=self.m, dtype=np.int) + for i in range(self.m): + self.sort_tracker[i] = i + self.zero_tol = 1e-6 + + self.linear_variables = np.zeros(shape=self.n,dtype=np.int) + self.init_linear_variables() + + #Add in user selected linear variables + if 'linvars' in kwargs: + for linvar in kwargs['linvars']: + if linvar in self.xlabels: + self.linear_variables[self.xlabels.index(linvar)] = 1 + elif linvar in range(self.n): + self.linear_variables[linvar] = 1 + else: + raise IndexError('Unknown variable selected in linvars argument.') + + #Initialize B_orth, c, and c_squared (assuming column 0 of B_orth is already filled with 1) + self.orthonormal_update(0) + + cpdef Basis get_basis(ForwardPasser self): + return self.basis + + cpdef init_linear_variables(ForwardPasser self): + cdef INDEX_t variable + cdef INDEX_t endspan + cdef cnp.ndarray[INT_t, ndim=1] order + cdef cnp.ndarray[INT_t, ndim=1] linear_variables = self.linear_variables + cdef cnp.ndarray[FLOAT_t, ndim=2] B = self.B + cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X + if self.endspan < 0: + endspan = round(3 - log2(self.endspan_alpha/self.n)) + cdef ConstantBasisFunction root_basis_function = self.basis[0] + for variable in range(self.n): + order = np.argsort(X[:,variable])[::-1] + if root_basis_function.valid_knots(B[order,0], X[order,variable], + variable, self.check_every, endspan, + self.minspan, self.minspan_alpha, + self.n, self.mwork).shape[0] == 0: + linear_variables[variable] = 1 + else: + linear_variables[variable] = 0 + + def get_B_orth(ForwardPasser self): + return self.B_orth + + cpdef run(ForwardPasser self): + cdef INDEX_t i + while True: + self.next_pair() + if self.stop_check(): + break + + cdef stop_check(ForwardPasser self): + last = self.record.__len__() - 1 + if self.record.iterations[last].get_size() + 2 > self.max_terms: + self.record.stopping_condition = MAXTERMS + return True + rsq = self.record.rsq(last) + if rsq > 1 - self.thresh: + self.record.stopping_condition = MAXRSQ + return True + previous_rsq = self.record.rsq(last - 1) + if rsq - previous_rsq < self.thresh: + self.record.stopping_condition = NOIMPRV + return True + if self.record.grsq(last) < -10: + self.record.stopping_condition = LOWGRSQ + return True + if self.record.iterations[last].no_further_candidates(): + self.record.stopping_condition = NOCAND + return True + return False + + cpdef int orthonormal_update(ForwardPasser self, INDEX_t k): + '''Orthogonalize and normalize column k of B_orth against all previous columns of B_orth.''' + #Currently implemented using modified Gram-Schmidt process + #TODO: Optimize - replace some for loops with calls to blas + + cdef cnp.ndarray[FLOAT_t, ndim=2] B_orth = self.B_orth + cdef cnp.ndarray[FLOAT_t, ndim=1] c = self.c + cdef cnp.ndarray[FLOAT_t, ndim=1] y = self.y + cdef cnp.ndarray[FLOAT_t, ndim=1] norms = self.norms + + cdef INDEX_t i + cdef INDEX_t j + cdef FLOAT_t nrm + cdef FLOAT_t nrm0 + cdef FLOAT_t dot_prod + + #Get the original norm + nrm0 = 0.0 + for i in range(self.m): + nrm0 += B_orth[i,k]*B_orth[i,k] + nrm0 = sqrt(nrm0) + + #Orthogonalize + if k > 0: + for i in range(k): + dot_prod = 0.0 + for j in range(self.m): + dot_prod += B_orth[j,k]*B_orth[j,i] + for j in range(self.m): + B_orth[j,k] -= B_orth[j,i] * dot_prod + + #Normalize + nrm = 0.0 + for i in range(self.m): + nrm += B_orth[i,k]*B_orth[i,k] + nrm = sqrt(nrm) + norms[k] = nrm + + if nrm0 <= self.zero_tol or nrm/nrm0 <= self.zero_tol: + for i in range(self.m): + B_orth[i,k] = 0.0 + c[k] = 0.0 + return 1 #The new column is in the column space of the previous columns + for i in range(self.m): + B_orth[i,k] /= nrm + + #Update c + c[k] = 0.0 + for i in range(self.m): + c[k] += B_orth[i,k]*y[i] + self.c_squared += c[k]**2 + + return 0 #No problems + + cpdef orthonormal_downdate(ForwardPasser self, INDEX_t k): + ''' + Undo the effects of the last orthonormal update. You can only undo the last orthonormal update this way. + There will be no warning of any kind if you mess this up. You'll just get wrong answers. + In reality, all this does is downdate c_squared (the elements of c and B_orth are left alone, since they + can simply be ignored until they are overwritten). + ''' + self.c_squared -= self.c[k]**2 + + def trace(self): + return self.record + + cdef next_pair(ForwardPasser self): + cdef INDEX_t variable + cdef INDEX_t parent_idx + cdef INDEX_t parent_degree + cdef INDEX_t nonzero_count + cdef BasisFunction parent + cdef cnp.ndarray[INT_t,ndim=1] candidates_idx + cdef FLOAT_t knot + cdef FLOAT_t mse + cdef INDEX_t knot_idx + cdef FLOAT_t knot_choice + cdef FLOAT_t mse_choice + cdef int knot_idx_choice + cdef INDEX_t parent_idx_choice + cdef BasisFunction parent_choice + cdef INDEX_t variable_choice + cdef bint first = True + cdef BasisFunction bf1 + cdef BasisFunction bf2 + cdef INDEX_t k = len(self.basis) + cdef INDEX_t endspan + cdef bint linear_dependence + cdef bint dependent + cdef FLOAT_t gcv_factor_k_plus_1 = gcv_adjust(k+1,self.m,self.penalty) + cdef FLOAT_t gcv_factor_k_plus_2 = gcv_adjust(k+2,self.m,self.penalty) + cdef FLOAT_t gcv_ + cdef FLOAT_t mse_ + cdef INDEX_t i + + cdef cnp.ndarray[FLOAT_t,ndim=2] X = self.X + cdef cnp.ndarray[FLOAT_t,ndim=2] B = self.B + cdef cnp.ndarray[FLOAT_t,ndim=2] B_orth = self.B_orth + cdef cnp.ndarray[FLOAT_t,ndim=1] y = self.y + cdef cnp.ndarray[INT_t,ndim=1] linear_variables = self.linear_variables + cdef cnp.ndarray[INT_t,ndim=1] sorting = self.sorting + + if self.endspan < 0: + endspan = round(3 - log2(self.endspan_alpha/self.n)) + + #Iterate over variables + for variable in range(self.n): + + #Sort the data + sorting[:] = np.argsort(X[:,variable])[::-1] #TODO: eliminate Python call / data copy + + #Iterate over parents + for parent_idx in range(k): + linear_dependence = False + + parent = self.basis.get(parent_idx) + if self.max_degree >= 0: + parent_degree = parent.degree() + if parent_degree >= self.max_degree: + continue + if not parent.is_splittable(): + continue + + #Add the linear term to B + for i in range(self.m): + B[i,k] = B[i,parent_idx]*X[i,variable] + + #Orthonormalize + for i in range(self.m): + B_orth[i,k] = B[i,k] + linear_dependence = self.orthonormal_update(k) + + #If a new hinge function does not improve the gcv over the linear term + #then just the linear term will be retained. Calculate the gcv with + #just the linear term in order to compare later. Note that the mse with + #another term never increases, but the gcv may because it penalizes additional + #terms. + mse_ = (self.y_squared - self.c_squared) / self.m + gcv_ = gcv_factor_k_plus_1*(self.y_squared - self.c_squared) / self.m + + if linear_variables[variable]: + mse = mse_ + knot_idx = -1 + else: + + #Find the valid knot candidates + candidates_idx = parent.valid_knots(B[sorting,parent_idx], X[sorting,variable], variable, self.check_every, endspan, self.minspan, self.minspan_alpha, self.n, self.mwork) + + if len(candidates_idx) > 0: + #Choose the best candidate (if no candidate is an improvement on the linear term in terms of gcv, knot_idx is set to -1 + + #Find the best knot location for this parent and variable combination + self.best_knot(parent_idx,variable,k,candidates_idx,sorting,&mse,&knot,&knot_idx) + + #If the hinge function does not decrease the gcv then just keep the linear term + if gcv_factor_k_plus_2*mse >= gcv_: + mse = mse_ + knot_idx = -1 + + else: + #Do an orthonormal downdate and skip to the next iteration + self.orthonormal_downdate(k) + continue + + #Do an orthonormal downdate + self.orthonormal_downdate(k) + + #Update the choices + if first: + knot_choice = knot + mse_choice = mse + knot_idx_choice = knot_idx + parent_idx_choice = parent_idx + parent_choice = parent + variable_choice = variable + first = False + dependent = linear_dependence + if mse < mse_choice: + knot_choice = knot + mse_choice = mse + knot_idx_choice = knot_idx + parent_idx_choice = parent_idx + parent_choice = parent + variable_choice = variable + dependent = linear_dependence + + #Make sure at least one candidate was checked + if first: + self.record[-1].set_no_candidates(True) + return + + #Add the new basis functions + parent = self.basis.get(parent_idx) + label = self.xlabels[variable_choice] + if knot_idx_choice != -1: + #Add the new basis functions + bf1 = HingeBasisFunction(parent_choice,knot_choice,knot_idx_choice,variable_choice,False,label) + bf2 = HingeBasisFunction(parent_choice,knot_choice,knot_idx_choice,variable_choice,True,label) + bf1.apply(X,B[:,k]) + bf2.apply(X,B[:,k+1]) + self.basis.append(bf1) + self.basis.append(bf2) + + #Orthogonalize the new basis + B_orth[:,k] = B[:,k] + if self.orthonormal_update(k) == 1: + bf1.make_unsplittable() + B_orth[:,k+1] = B[:,k+1] + if self.orthonormal_update(k+1) == 1: + bf2.make_unsplittable() + elif not dependent and knot_idx_choice == -1: + #In this case, only add the linear basis function + bf1 = LinearBasisFunction(parent_choice,variable_choice,label) + bf1.apply(X,B[:,k]) + self.basis.append(bf1) + + #Orthogonalize the new basis + B_orth[:,k] = B[:,k] + if self.orthonormal_update(k) == 1: + bf1.make_unsplittable() + else:#dependent and knot_idx_choice == -1 + #In this case there were no acceptable choices remaining, so end the forward pass + self.record[-1].set_no_candidates(True) + return + + #Update the build record + self.record.append(ForwardPassIteration(parent_idx_choice,variable_choice,knot_idx_choice,mse_choice,len(self.basis))) + + cdef best_knot(ForwardPasser self, INDEX_t parent, INDEX_t variable, INDEX_t k, cnp.ndarray[INT_t,ndim=1] candidates, cnp.ndarray[INT_t,ndim=1] order, FLOAT_t * mse, FLOAT_t * knot, INDEX_t * knot_idx): + ''' + Find the best knot location (in terms of squared error). + + Assumes: + B[:,k] is the linear term for variable + X[:,variable] is in decreasing order + candidates is in increasing order (it is an array of indices into X[:,variable] + mse is a pointer to the mean squared error of including just the linear term in B[:,k] + ''' + + cdef cnp.ndarray[FLOAT_t, ndim=1] b = self.B[:,k+1] + cdef cnp.ndarray[FLOAT_t, ndim=1] b_parent = self.B[:,parent] + cdef cnp.ndarray[FLOAT_t, ndim=1] u = self.u + cdef cnp.ndarray[FLOAT_t, ndim=2] B_orth = self.B_orth + cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X + cdef cnp.ndarray[FLOAT_t, ndim=1] y = self.y + cdef cnp.ndarray[FLOAT_t, ndim=1] c = self.c + cdef cnp.ndarray[FLOAT_t, ndim=1] B_orth_times_parent_cum = self.B_orth_times_parent_cum + cdef cnp.ndarray[FLOAT_t, ndim=2] B = self.B + + cdef INDEX_t num_candidates = candidates.shape[0] + + cdef INDEX_t h + cdef INDEX_t i + cdef INDEX_t j + cdef INDEX_t h_ + cdef INDEX_t i_ + cdef INDEX_t j_ + cdef FLOAT_t u_end + cdef FLOAT_t c_end + cdef FLOAT_t z_end_squared + cdef INDEX_t candidate_idx + cdef INDEX_t last_candidate_idx + cdef INDEX_t last_last_candidate_idx + cdef INDEX_t best_candidate_idx + cdef FLOAT_t candidate + cdef FLOAT_t last_candidate + cdef FLOAT_t best_candidate + cdef FLOAT_t best_z_end_squared + cdef FLOAT_t y_cum + cdef FLOAT_t b_times_parent_cum + cdef FLOAT_t diff + cdef FLOAT_t delta_b_squared + cdef FLOAT_t delta_c_end + cdef FLOAT_t delta_u_end + cdef FLOAT_t parent_squared_cum + cdef FLOAT_t parent_times_y_cum + cdef FLOAT_t u_dot_c + cdef FLOAT_t u_dot_u + cdef FLOAT_t float_tmp + cdef FLOAT_t delta_b_j + cdef FLOAT_t z_denom + + #Compute the initial basis function + candidate_idx = candidates[0] + candidate = X[order[candidate_idx],variable] + for i in range(self.m):#TODO: Vectorize? + b[i] = 0 + for i_ in range(self.m): + i = order[i_] + float_tmp = X[i,variable] - candidate + if float_tmp > 0: + b[i] = b_parent[i]*float_tmp + else: + break + + #Compute the initial covariance column, u (not including the final element) + u[0:k+1] = np.dot(b,B_orth[:,0:k+1]) + + #Compute the new last elements of c and u + c_end = 0.0 + u_end = 0.0 + for i in range(self.m): + u_end += b[i]*b[i] + c_end += b[i]*y[i] + + #Compute the last element of z (the others are identical to c) + u_dot_c = 0.0 + u_dot_u = 0.0 + for i in range(k+1): + u_dot_u += u[i]*u[i] + u_dot_c += u[i]*c[i] + z_denom = u_end - u_dot_u + if z_denom <= self.zero_tol: + z_end_squared = np.nan + else: + z_end_squared = ((c_end - u_dot_c)**2) / z_denom + + #Minimizing the norm is actually equivalent to maximizing z_end_squared + #Store z_end_squared and the current candidate as the best knot choice + best_z_end_squared = z_end_squared + best_candidate_idx = candidate_idx + best_candidate = candidate + + #Initialize the accumulators + i = order[0] + last_candidate_idx = 0 + y_cum = y[i] + B_orth_times_parent_cum[0:k+1] = B_orth[i,0:k+1] * b_parent[i] + b_times_parent_cum = b[i] * b_parent[i] + parent_squared_cum = b_parent[i] ** 2 + parent_times_y_cum = b_parent[i] * y[i] + + #Now loop over the remaining candidates and update z_end_squared for each, looking for the greatest value + for i_ in range(1,num_candidates): + i = order[i_] + + #Update the candidate + last_last_candidate_idx = last_candidate_idx + last_candidate_idx = candidate_idx + last_candidate = candidate + candidate_idx = candidates[i_] + candidate = X[order[candidate_idx],variable] + + #Update the accumulators and compute delta_b + diff = last_candidate - candidate + delta_c_end = 0.0 + + #What follows is a section of code that has been optimized for speed at the expense of + #some readability. To make it easier to understand this code in the future, I have included a + #"simple" block that implements the same math in a more straightforward (but much less efficient) + #way. The (commented out) code between "BEGIN SIMPLE" and "END SIMPLE" should produce the same + #output as the code between "BEGIN HYPER-OPTIMIZED" and "END HYPER-OPTIMIZED". + + #BEGIN SIMPLE +# #Calculate delta_b +# for j in range(0,last_candidate_idx+1): +# delta_b[j] = diff +# for j in range(last_candidate_idx+1,candidate_idx): +# float_tmp = (X[j,variable] - candidate) * b_parent[j] +# delta_b[j] = float_tmp +# +# #Update u and z_end_squared +# u[0:k+1] += np.dot(delta_b,B_orth[:,0:k+1]) +# u_end += 2*np.dot(delta_b,b) + np.dot(delta_b, delta_b) +# +# #Update c_end +# c_end += np.dot(delta_b,y) +# +# #Update z_end_squared +# z_end_squared = ((c_end - np.dot(u[0:k+1],c[0:k+1]))**2) / (u_end) +# +# #Update b +# b += delta_b + #END SIMPLE + + #BEGIN HYPER-OPTIMIZED + delta_b_squared = 0.0 + delta_c_end = 0.0 + delta_u_end = 0.0 + + #Update the accumulators + for j_ in range(last_last_candidate_idx+1,last_candidate_idx+1): + j = order[j_] + y_cum += y[j] + for h in range(k+1):#TODO: BLAS + B_orth_times_parent_cum[h] += B_orth[j,h]*b_parent[j] + b_times_parent_cum += b[j]*b_parent[j] + parent_squared_cum += b_parent[j] ** 2 + parent_times_y_cum += b_parent[j] * y[j] + delta_c_end += diff * parent_times_y_cum + delta_u_end += 2*diff * b_times_parent_cum + delta_b_squared = (diff**2)*parent_squared_cum + + #Update u and a bunch of other stuff + for j in range(k+1): + float_tmp = diff*B_orth_times_parent_cum[j] + u_dot_c += float_tmp * c[j] + u_dot_u += 2*u[j]*float_tmp + float_tmp*float_tmp + u[j] += float_tmp + for j_ in range(last_candidate_idx+1,candidate_idx): + j = order[j_] + delta_b_j = (X[j,variable] - candidate) * b_parent[j] + delta_b_squared += delta_b_j**2 + delta_c_end += delta_b_j * y[j] + delta_u_end += 2*delta_b_j*b[j] + for h in range(k+1): + float_tmp = delta_b_j * B_orth[j,h] + u_dot_c += float_tmp * c[h] + u_dot_u += 2*u[h]*float_tmp + float_tmp*float_tmp + u[h] += float_tmp + b[j] += delta_b_j + + #Update u_end + delta_u_end += delta_b_squared + u_end += delta_u_end + + #Update c_end + c_end += delta_c_end + + #Update b_times_parent_cum + b_times_parent_cum += parent_squared_cum * diff + + #Compute the new z_end_squared (this is the quantity we're optimizing) + if (u_end - u_dot_u) <= self.zero_tol: + continue + z_end_squared = ((c_end - u_dot_c)**2) / (u_end - u_dot_u) + #END HYPER-OPTIMIZED + + #Update the best if necessary + if z_end_squared > best_z_end_squared: + best_z_end_squared = z_end_squared + best_candidate_idx = candidate_idx + best_candidate = candidate + + #Compute the mse for the best z_end and set return values + mse[0] = (self.y_squared - self.c_squared - best_z_end_squared)/self.m + knot[0] = best_candidate + knot_idx[0] = best_candidate_idx + + \ No newline at end of file diff --git a/sklearn/earth/_forward.pyxdep b/sklearn/earth/_forward.pyxdep new file mode 100644 index 0000000000000..682c8a581bbf2 --- /dev/null +++ b/sklearn/earth/_forward.pyxdep @@ -0,0 +1,3 @@ +_basis +_util +_record diff --git a/sklearn/earth/_pruning.c b/sklearn/earth/_pruning.c new file mode 100644 index 0000000000000..e35e7126debbe --- /dev/null +++ b/sklearn/earth/_pruning.c @@ -0,0 +1,8905 @@ +/* Generated by Cython 0.19 on Sat Jul 20 23:46:45 2013 */ + +#define PY_SSIZE_T_CLEAN +#ifndef CYTHON_USE_PYLONG_INTERNALS +#ifdef PYLONG_BITS_IN_DIGIT +#define CYTHON_USE_PYLONG_INTERNALS 0 +#else +#include "pyconfig.h" +#ifdef PYLONG_BITS_IN_DIGIT +#define CYTHON_USE_PYLONG_INTERNALS 1 +#else +#define CYTHON_USE_PYLONG_INTERNALS 0 +#endif +#endif +#endif +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x02040000 + #error Cython requires Python 2.4+. +#else +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#ifdef PYPY_VERSION +#define CYTHON_COMPILING_IN_PYPY 1 +#define CYTHON_COMPILING_IN_CPYTHON 0 +#else +#define CYTHON_COMPILING_IN_PYPY 0 +#define CYTHON_COMPILING_IN_CPYTHON 1 +#endif +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define CYTHON_FORMAT_SSIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \ + (PyErr_Format(PyExc_TypeError, \ + "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ + (PyObject*)0)) + #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) + #define __PYX_BUILD_PY_SSIZE_T "i" +#else + #define __PYX_BUILD_PY_SSIZE_T "n" + #define CYTHON_FORMAT_SSIZE_T "z" + #define __Pyx_PyIndex_Check PyIndex_Check +#endif +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) + #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) + typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); + typedef void (*releasebufferproc)(PyObject *, Py_buffer *); +#endif +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#endif +#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 + #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") +#endif +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif +#if PY_VERSION_HEX < 0x02060000 + #define Py_TPFLAGS_HAVE_VERSION_TAG 0 +#endif +#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) + #define CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) +#else + #define CYTHON_PEP393_ENABLED 0 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) + #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#endif +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject + #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check + #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel +#endif +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) + #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) +#else + #define __Pyx_PyBaseString_Check(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || \ + PyString_Check(obj) || PyUnicode_Check(obj)) + #define __Pyx_PyBaseString_CheckExact(obj) (Py_TYPE(obj) == &PyBaseString_Type) +#endif +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) +#endif +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif +#ifdef NAN +#define __PYX_NAN() ((float) NAN) +#else +static CYTHON_INLINE float __PYX_NAN() { + /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and + a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is + a quiet NaN. */ + float value; + memset(&value, 0xFF, sizeof(value)); + return value; +} +#endif + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES +#endif +#include +#define __PYX_HAVE___pruning +#define __PYX_HAVE_API___pruning +#include "string.h" +#include "stdio.h" +#include "stdlib.h" +#include "numpy/arrayobject.h" +#include "numpy/ufuncobject.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif +typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding; + const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + +#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 +#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0 +#define __PYX_DEFAULT_STRING_ENCODING "" +#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString +#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); +static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); +#define __Pyx_PyBytes_FromString PyBytes_FromString +#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*); +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString + #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +#else + #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString + #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize +#endif +#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_FromUString(s) __Pyx_PyObject_FromString((char*)s) +#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s) +#define __Pyx_PyStr_FromUString(s) __Pyx_PyStr_FromString((char*)s) +#define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((char*)s) +#if PY_MAJOR_VERSION < 3 +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) +{ + const Py_UNICODE *u_end = u; + while (*u_end++) ; + return u_end - u - 1; +} +#else +#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen +#endif +#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) +#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode +#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); +#if CYTHON_COMPILING_IN_CPYTHON +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) +#else +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) +#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII +static int __Pyx_sys_getdefaultencoding_not_ascii; +static int __Pyx_init_sys_getdefaultencoding_params() { + PyObject* sys = NULL; + PyObject* default_encoding = NULL; + PyObject* ascii_chars_u = NULL; + PyObject* ascii_chars_b = NULL; + sys = PyImport_ImportModule("sys"); + if (sys == NULL) goto bad; + default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); + if (default_encoding == NULL) goto bad; + if (strcmp(PyBytes_AsString(default_encoding), "ascii") == 0) { + __Pyx_sys_getdefaultencoding_not_ascii = 0; + } else { + const char* default_encoding_c = PyBytes_AS_STRING(default_encoding); + char ascii_chars[128]; + int c; + for (c = 0; c < 128; c++) { + ascii_chars[c] = c; + } + __Pyx_sys_getdefaultencoding_not_ascii = 1; + ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); + if (ascii_chars_u == NULL) goto bad; + ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); + if (ascii_chars_b == NULL || strncmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { + PyErr_Format( + PyExc_ValueError, + "This module compiled with c_string_encoding=ascii, but default encoding '%s' is not a superset of ascii.", + default_encoding_c); + goto bad; + } + } + Py_XDECREF(sys); + Py_XDECREF(default_encoding); + Py_XDECREF(ascii_chars_u); + Py_XDECREF(ascii_chars_b); + return 0; +bad: + Py_XDECREF(sys); + Py_XDECREF(default_encoding); + Py_XDECREF(ascii_chars_u); + Py_XDECREF(ascii_chars_b); + return -1; +} +#endif +#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 +#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) +#else +#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) +#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT +static char* __PYX_DEFAULT_STRING_ENCODING; +static int __Pyx_init_sys_getdefaultencoding_params() { + PyObject* sys = NULL; + PyObject* default_encoding = NULL; + char* default_encoding_c; + sys = PyImport_ImportModule("sys"); + if (sys == NULL) goto bad; + default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); + if (default_encoding == NULL) goto bad; + default_encoding_c = PyBytes_AS_STRING(default_encoding); + __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); + strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); + Py_DECREF(sys); + Py_DECREF(default_encoding); + return 0; +bad: + Py_XDECREF(sys); + Py_XDECREF(default_encoding); + return -1; +} +#endif +#endif + + +#ifdef __GNUC__ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_d; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + +#if !defined(CYTHON_CCOMPLEX) + #if defined(__cplusplus) + #define CYTHON_CCOMPLEX 1 + #elif defined(_Complex_I) + #define CYTHON_CCOMPLEX 1 + #else + #define CYTHON_CCOMPLEX 0 + #endif +#endif +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #include + #else + #include + #endif +#endif +#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) + #undef _Complex_I + #define _Complex_I 1.0fj +#endif + + +static const char *__pyx_f[] = { + "_pruning.pyx", + "numpy.pxd", + "type.pxd", + "_basis.pxd", + "_record.pxd", +}; +#define IS_UNSIGNED(type) (((type) -1) > 0) +struct __Pyx_StructField_; +#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) +typedef struct { + const char* name; /* for error messages only */ + struct __Pyx_StructField_* fields; + size_t size; /* sizeof(type) */ + size_t arraysize[8]; /* length of array in each dimension */ + int ndim; + char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject, c_H_ar */ + char is_unsigned; + int flags; +} __Pyx_TypeInfo; +typedef struct __Pyx_StructField_ { + __Pyx_TypeInfo* type; + const char* name; + size_t offset; +} __Pyx_StructField; +typedef struct { + __Pyx_StructField* field; + size_t parent_offset; +} __Pyx_BufFmt_StackElem; +typedef struct { + __Pyx_StructField root; + __Pyx_BufFmt_StackElem* head; + size_t fmt_offset; + size_t new_count, enc_count; + size_t struct_alignment; + int is_complex; + char enc_type; + char new_packmode; + char enc_packmode; + char is_valid_array; +} __Pyx_BufFmt_Context; + + +/* "numpy.pxd":723 + * # in Cython to enable them only on the right systems. + * + * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + */ +typedef npy_int8 __pyx_t_5numpy_int8_t; + +/* "numpy.pxd":724 + * + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t + */ +typedef npy_int16 __pyx_t_5numpy_int16_t; + +/* "numpy.pxd":725 + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< + * ctypedef npy_int64 int64_t + * #ctypedef npy_int96 int96_t + */ +typedef npy_int32 __pyx_t_5numpy_int32_t; + +/* "numpy.pxd":726 + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< + * #ctypedef npy_int96 int96_t + * #ctypedef npy_int128 int128_t + */ +typedef npy_int64 __pyx_t_5numpy_int64_t; + +/* "numpy.pxd":730 + * #ctypedef npy_int128 int128_t + * + * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + */ +typedef npy_uint8 __pyx_t_5numpy_uint8_t; + +/* "numpy.pxd":731 + * + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t + */ +typedef npy_uint16 __pyx_t_5numpy_uint16_t; + +/* "numpy.pxd":732 + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< + * ctypedef npy_uint64 uint64_t + * #ctypedef npy_uint96 uint96_t + */ +typedef npy_uint32 __pyx_t_5numpy_uint32_t; + +/* "numpy.pxd":733 + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< + * #ctypedef npy_uint96 uint96_t + * #ctypedef npy_uint128 uint128_t + */ +typedef npy_uint64 __pyx_t_5numpy_uint64_t; + +/* "numpy.pxd":737 + * #ctypedef npy_uint128 uint128_t + * + * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< + * ctypedef npy_float64 float64_t + * #ctypedef npy_float80 float80_t + */ +typedef npy_float32 __pyx_t_5numpy_float32_t; + +/* "numpy.pxd":738 + * + * ctypedef npy_float32 float32_t + * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< + * #ctypedef npy_float80 float80_t + * #ctypedef npy_float128 float128_t + */ +typedef npy_float64 __pyx_t_5numpy_float64_t; + +/* "numpy.pxd":747 + * # The int types are mapped a bit surprising -- + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t + */ +typedef npy_long __pyx_t_5numpy_int_t; + +/* "numpy.pxd":748 + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong longlong_t + * + */ +typedef npy_longlong __pyx_t_5numpy_long_t; + +/* "numpy.pxd":749 + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_ulong uint_t + */ +typedef npy_longlong __pyx_t_5numpy_longlong_t; + +/* "numpy.pxd":751 + * ctypedef npy_longlong longlong_t + * + * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t + */ +typedef npy_ulong __pyx_t_5numpy_uint_t; + +/* "numpy.pxd":752 + * + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulonglong_t + * + */ +typedef npy_ulonglong __pyx_t_5numpy_ulong_t; + +/* "numpy.pxd":753 + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_intp intp_t + */ +typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; + +/* "numpy.pxd":755 + * ctypedef npy_ulonglong ulonglong_t + * + * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< + * ctypedef npy_uintp uintp_t + * + */ +typedef npy_intp __pyx_t_5numpy_intp_t; + +/* "numpy.pxd":756 + * + * ctypedef npy_intp intp_t + * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< + * + * ctypedef npy_double float_t + */ +typedef npy_uintp __pyx_t_5numpy_uintp_t; + +/* "numpy.pxd":758 + * ctypedef npy_uintp uintp_t + * + * ctypedef npy_double float_t # <<<<<<<<<<<<<< + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t + */ +typedef npy_double __pyx_t_5numpy_float_t; + +/* "numpy.pxd":759 + * + * ctypedef npy_double float_t + * ctypedef npy_double double_t # <<<<<<<<<<<<<< + * ctypedef npy_longdouble longdouble_t + * + */ +typedef npy_double __pyx_t_5numpy_double_t; + +/* "numpy.pxd":760 + * ctypedef npy_double float_t + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cfloat cfloat_t + */ +typedef npy_longdouble __pyx_t_5numpy_longdouble_t; + +/* "_basis.pxd":2 + * cimport numpy as cnp + * ctypedef cnp.float64_t FLOAT_t # <<<<<<<<<<<<<< + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t + */ +typedef __pyx_t_5numpy_float64_t __pyx_t_6_basis_FLOAT_t; + +/* "_basis.pxd":3 + * cimport numpy as cnp + * ctypedef cnp.float64_t FLOAT_t + * ctypedef cnp.intp_t INT_t # <<<<<<<<<<<<<< + * ctypedef cnp.ulong_t INDEX_t + * ctypedef cnp.uint8_t BOOL_t + */ +typedef __pyx_t_5numpy_intp_t __pyx_t_6_basis_INT_t; + +/* "_basis.pxd":4 + * ctypedef cnp.float64_t FLOAT_t + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t # <<<<<<<<<<<<<< + * ctypedef cnp.uint8_t BOOL_t + * + */ +typedef __pyx_t_5numpy_ulong_t __pyx_t_6_basis_INDEX_t; + +/* "_basis.pxd":5 + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t + * ctypedef cnp.uint8_t BOOL_t # <<<<<<<<<<<<<< + * + * cdef class BasisFunction: + */ +typedef __pyx_t_5numpy_uint8_t __pyx_t_6_basis_BOOL_t; + +/* "_record.pxd":2 + * cimport numpy as cnp + * ctypedef cnp.float64_t FLOAT_t # <<<<<<<<<<<<<< + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t + */ +typedef __pyx_t_5numpy_float64_t __pyx_t_7_record_FLOAT_t; + +/* "_record.pxd":3 + * cimport numpy as cnp + * ctypedef cnp.float64_t FLOAT_t + * ctypedef cnp.intp_t INT_t # <<<<<<<<<<<<<< + * ctypedef cnp.ulong_t INDEX_t + * ctypedef cnp.uint8_t BOOL_t + */ +typedef __pyx_t_5numpy_intp_t __pyx_t_7_record_INT_t; + +/* "_record.pxd":4 + * ctypedef cnp.float64_t FLOAT_t + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t # <<<<<<<<<<<<<< + * ctypedef cnp.uint8_t BOOL_t + * from _basis cimport Basis + */ +typedef __pyx_t_5numpy_ulong_t __pyx_t_7_record_INDEX_t; + +/* "_record.pxd":5 + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t + * ctypedef cnp.uint8_t BOOL_t # <<<<<<<<<<<<<< + * from _basis cimport Basis + * + */ +typedef __pyx_t_5numpy_uint8_t __pyx_t_7_record_BOOL_t; + +/* "_util.pxd":2 + * cimport numpy as cnp + * ctypedef cnp.float64_t FLOAT_t # <<<<<<<<<<<<<< + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t + */ +typedef __pyx_t_5numpy_float64_t __pyx_t_5_util_FLOAT_t; + +/* "_util.pxd":3 + * cimport numpy as cnp + * ctypedef cnp.float64_t FLOAT_t + * ctypedef cnp.intp_t INT_t # <<<<<<<<<<<<<< + * ctypedef cnp.ulong_t INDEX_t + * ctypedef cnp.uint8_t BOOL_t + */ +typedef __pyx_t_5numpy_intp_t __pyx_t_5_util_INT_t; + +/* "_util.pxd":4 + * ctypedef cnp.float64_t FLOAT_t + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t # <<<<<<<<<<<<<< + * ctypedef cnp.uint8_t BOOL_t + * + */ +typedef __pyx_t_5numpy_ulong_t __pyx_t_5_util_INDEX_t; + +/* "_util.pxd":5 + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t + * ctypedef cnp.uint8_t BOOL_t # <<<<<<<<<<<<<< + * + * cdef FLOAT_t log2(FLOAT_t x) + */ +typedef __pyx_t_5numpy_uint8_t __pyx_t_5_util_BOOL_t; + +/* "_pruning.pxd":2 + * cimport numpy as cnp + * ctypedef cnp.float64_t FLOAT_t # <<<<<<<<<<<<<< + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t + */ +typedef __pyx_t_5numpy_float64_t __pyx_t_8_pruning_FLOAT_t; + +/* "_pruning.pxd":3 + * cimport numpy as cnp + * ctypedef cnp.float64_t FLOAT_t + * ctypedef cnp.intp_t INT_t # <<<<<<<<<<<<<< + * ctypedef cnp.ulong_t INDEX_t + * ctypedef cnp.uint8_t BOOL_t + */ +typedef __pyx_t_5numpy_intp_t __pyx_t_8_pruning_INT_t; + +/* "_pruning.pxd":4 + * ctypedef cnp.float64_t FLOAT_t + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t # <<<<<<<<<<<<<< + * ctypedef cnp.uint8_t BOOL_t + * from _basis cimport Basis + */ +typedef __pyx_t_5numpy_ulong_t __pyx_t_8_pruning_INDEX_t; + +/* "_pruning.pxd":5 + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t + * ctypedef cnp.uint8_t BOOL_t # <<<<<<<<<<<<<< + * from _basis cimport Basis + * from _record cimport PruningPassRecord + */ +typedef __pyx_t_5numpy_uint8_t __pyx_t_8_pruning_BOOL_t; +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< float > __pyx_t_float_complex; + #else + typedef float _Complex __pyx_t_float_complex; + #endif +#else + typedef struct { float real, imag; } __pyx_t_float_complex; +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< double > __pyx_t_double_complex; + #else + typedef double _Complex __pyx_t_double_complex; + #endif +#else + typedef struct { double real, imag; } __pyx_t_double_complex; +#endif + + +/*--- Type declarations ---*/ +struct __pyx_obj_7_record_Record; +struct __pyx_obj_7_record_PruningPassRecord; +struct __pyx_obj_7_record_Iteration; +struct __pyx_obj_7_record_ForwardPassIteration; +struct __pyx_obj_7_record_FirstForwardPassIteration; +struct __pyx_obj_6_basis_Basis; +struct __pyx_obj_6_basis_BasisFunction; +struct __pyx_obj_6_basis_LinearBasisFunction; +struct __pyx_obj_7_record_PruningPassIteration; +struct __pyx_obj_7_record_FirstPruningPassIteration; +struct __pyx_obj_8_pruning_PruningPasser; +struct __pyx_obj_6_basis_HingeBasisFunction; +struct __pyx_obj_7_record_ForwardPassRecord; +struct __pyx_obj_6_basis_ConstantBasisFunction; + +/* "numpy.pxd":762 + * ctypedef npy_longdouble longdouble_t + * + * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t + */ +typedef npy_cfloat __pyx_t_5numpy_cfloat_t; + +/* "numpy.pxd":763 + * + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< + * ctypedef npy_clongdouble clongdouble_t + * + */ +typedef npy_cdouble __pyx_t_5numpy_cdouble_t; + +/* "numpy.pxd":764 + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cdouble complex_t + */ +typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; + +/* "numpy.pxd":766 + * ctypedef npy_clongdouble clongdouble_t + * + * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew1(a): + */ +typedef npy_cdouble __pyx_t_5numpy_complex_t; +struct __pyx_opt_args_6_basis_13BasisFunction_apply; +struct __pyx_opt_args_6_basis_21ConstantBasisFunction_apply; +struct __pyx_opt_args_6_basis_18HingeBasisFunction_apply; +struct __pyx_opt_args_6_basis_19LinearBasisFunction_apply; + +/* "_basis.pxd":45 + * cpdef INDEX_t degree(BasisFunction self) + * + * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) # <<<<<<<<<<<<<< + * + * cpdef cnp.ndarray[INT_t, ndim=1] valid_knots(BasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] values, cnp.ndarray[FLOAT_t,ndim=1] variable, int variable_idx, INDEX_t check_every, int endspan, int minspan, FLOAT_t minspan_alpha, INDEX_t n, cnp.ndarray[INT_t,ndim=1] workspace) + */ +struct __pyx_opt_args_6_basis_13BasisFunction_apply { + int __pyx_n; + int recurse; +}; + +/* "_basis.pxd":62 + * cpdef BasisFunction get_parent(self) + * + * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) # <<<<<<<<<<<<<< + * + * + */ +struct __pyx_opt_args_6_basis_21ConstantBasisFunction_apply { + int __pyx_n; + int recurse; +}; + +/* "_basis.pxd":86 + * cpdef INDEX_t get_knot_idx(self) + * + * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) # <<<<<<<<<<<<<< + * + * cdef class LinearBasisFunction(BasisFunction): + */ +struct __pyx_opt_args_6_basis_18HingeBasisFunction_apply { + int __pyx_n; + int recurse; +}; + +/* "_basis.pxd":98 + * cpdef INDEX_t get_variable(self) + * + * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) # <<<<<<<<<<<<<< + * + * + */ +struct __pyx_opt_args_6_basis_19LinearBasisFunction_apply { + int __pyx_n; + int recurse; +}; + +/* "_record.pxd":8 + * from _basis cimport Basis + * + * cdef class Record: # <<<<<<<<<<<<<< + * cdef list iterations + * cdef int num_samples + */ +struct __pyx_obj_7_record_Record { + PyObject_HEAD + struct __pyx_vtabstruct_7_record_Record *__pyx_vtab; + PyObject *iterations; + int num_samples; + int num_variables; + __pyx_t_7_record_FLOAT_t penalty; + __pyx_t_7_record_FLOAT_t sst; +}; + + +/* "_record.pxd":25 + * cpdef FLOAT_t grsq(Record self, INDEX_t iteration) + * + * cdef class PruningPassRecord(Record): # <<<<<<<<<<<<<< + * cdef INDEX_t selected + * + */ +struct __pyx_obj_7_record_PruningPassRecord { + struct __pyx_obj_7_record_Record __pyx_base; + __pyx_t_7_record_INDEX_t selected; +}; + + +/* "_record.pxd":39 + * cpdef set_stopping_condition(ForwardPassRecord self, int stopping_condition) + * + * cdef class Iteration: # <<<<<<<<<<<<<< + * cdef FLOAT_t mse + * cdef INDEX_t size + */ +struct __pyx_obj_7_record_Iteration { + PyObject_HEAD + struct __pyx_vtabstruct_7_record_Iteration *__pyx_vtab; + __pyx_t_7_record_FLOAT_t mse; + __pyx_t_7_record_INDEX_t size; +}; + + +/* "_record.pxd":55 + * pass + * + * cdef class ForwardPassIteration(Iteration): # <<<<<<<<<<<<<< + * cdef INDEX_t parent + * cdef INDEX_t variable + */ +struct __pyx_obj_7_record_ForwardPassIteration { + struct __pyx_obj_7_record_Iteration __pyx_base; + __pyx_t_7_record_INDEX_t parent; + __pyx_t_7_record_INDEX_t variable; + __pyx_t_7_record_FLOAT_t knot; + int code; + int no_candidates; +}; + + +/* "_record.pxd":66 + * cpdef no_further_candidates(ForwardPassIteration self) + * + * cdef class FirstForwardPassIteration(ForwardPassIteration): # <<<<<<<<<<<<<< + * cpdef INDEX_t get_size(FirstForwardPassIteration self) + */ +struct __pyx_obj_7_record_FirstForwardPassIteration { + struct __pyx_obj_7_record_ForwardPassIteration __pyx_base; +}; + + +/* "_basis.pxd":102 + * + * + * cdef class Basis: # <<<<<<<<<<<<<< + * '''A wrapper that provides functionality related to a set of BasisFunctions with a + * common ConstantBasisFunction ancestor. Retains the order in which BasisFunctions are + */ +struct __pyx_obj_6_basis_Basis { + PyObject_HEAD + struct __pyx_vtabstruct_6_basis_Basis *__pyx_vtab; + PyObject *order; +}; + + +/* "_basis.pxd":7 + * ctypedef cnp.uint8_t BOOL_t + * + * cdef class BasisFunction: # <<<<<<<<<<<<<< + * '''Abstract. Subclasses must implement the apply, translate, scale, and __init__ methods.''' + * + */ +struct __pyx_obj_6_basis_BasisFunction { + PyObject_HEAD + struct __pyx_vtabstruct_6_basis_BasisFunction *__pyx_vtab; + struct __pyx_obj_6_basis_BasisFunction *parent; + PyObject *child_map; + PyObject *children; + int pruned; + int prunable; + int splittable; +}; + + +/* "_basis.pxd":88 + * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) + * + * cdef class LinearBasisFunction(BasisFunction): # <<<<<<<<<<<<<< + * cdef INDEX_t variable + * cdef str label + */ +struct __pyx_obj_6_basis_LinearBasisFunction { + struct __pyx_obj_6_basis_BasisFunction __pyx_base; + __pyx_t_6_basis_INDEX_t variable; + PyObject *label; +}; + + +/* "_record.pxd":47 + * cpdef INDEX_t get_size(Iteration self) + * + * cdef class PruningPassIteration(Iteration): # <<<<<<<<<<<<<< + * cdef INDEX_t pruned + * + */ +struct __pyx_obj_7_record_PruningPassIteration { + struct __pyx_obj_7_record_Iteration __pyx_base; + __pyx_t_7_record_INDEX_t pruned; +}; + + +/* "_record.pxd":52 + * cpdef INDEX_t get_pruned(PruningPassIteration self) + * + * cdef class FirstPruningPassIteration(PruningPassIteration): # <<<<<<<<<<<<<< + * pass + * + */ +struct __pyx_obj_7_record_FirstPruningPassIteration { + struct __pyx_obj_7_record_PruningPassIteration __pyx_base; +}; + + +/* "_pruning.pxd":9 + * from _record cimport PruningPassRecord + * + * cdef class PruningPasser: # <<<<<<<<<<<<<< + * cdef cnp.ndarray X + * cdef cnp.ndarray B + */ +struct __pyx_obj_8_pruning_PruningPasser { + PyObject_HEAD + struct __pyx_vtabstruct_8_pruning_PruningPasser *__pyx_vtab; + PyArrayObject *X; + PyArrayObject *B; + PyArrayObject *y; + PyArrayObject *weights; + __pyx_t_8_pruning_INDEX_t m; + __pyx_t_8_pruning_INDEX_t n; + struct __pyx_obj_6_basis_Basis *basis; + __pyx_t_8_pruning_FLOAT_t penalty; + __pyx_t_8_pruning_FLOAT_t sst; + struct __pyx_obj_7_record_PruningPassRecord *record; +}; + + +/* "_basis.pxd":65 + * + * + * cdef class HingeBasisFunction(BasisFunction): # <<<<<<<<<<<<<< + * cdef FLOAT_t knot + * cdef INDEX_t knot_idx + */ +struct __pyx_obj_6_basis_HingeBasisFunction { + struct __pyx_obj_6_basis_BasisFunction __pyx_base; + __pyx_t_6_basis_FLOAT_t knot; + __pyx_t_6_basis_INDEX_t knot_idx; + __pyx_t_6_basis_INDEX_t variable; + int reverse; + PyObject *label; +}; + + +/* "_record.pxd":34 + * cpdef roll_back(PruningPassRecord self, Basis basis) + * + * cdef class ForwardPassRecord(Record): # <<<<<<<<<<<<<< + * cdef int stopping_condition + * + */ +struct __pyx_obj_7_record_ForwardPassRecord { + struct __pyx_obj_7_record_Record __pyx_base; + int stopping_condition; +}; + + +/* "_basis.pxd":50 + * + * + * cdef class ConstantBasisFunction(BasisFunction): # <<<<<<<<<<<<<< + * + * cpdef INDEX_t degree(ConstantBasisFunction self) + */ +struct __pyx_obj_6_basis_ConstantBasisFunction { + struct __pyx_obj_6_basis_BasisFunction __pyx_base; +}; + + + +/* "_basis.pxd":102 + * + * + * cdef class Basis: # <<<<<<<<<<<<<< + * '''A wrapper that provides functionality related to a set of BasisFunctions with a + * common ConstantBasisFunction ancestor. Retains the order in which BasisFunctions are + */ + +struct __pyx_vtabstruct_6_basis_Basis { + PyObject *(*translate)(struct __pyx_obj_6_basis_Basis *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); + PyObject *(*scale)(struct __pyx_obj_6_basis_Basis *, PyArrayObject *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); + struct __pyx_obj_6_basis_BasisFunction *(*get_root)(struct __pyx_obj_6_basis_Basis *, int __pyx_skip_dispatch); + PyObject *(*append)(struct __pyx_obj_6_basis_Basis *, struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + __pyx_t_6_basis_INDEX_t (*plen)(struct __pyx_obj_6_basis_Basis *, int __pyx_skip_dispatch); + struct __pyx_obj_6_basis_BasisFunction *(*get)(struct __pyx_obj_6_basis_Basis *, __pyx_t_6_basis_INDEX_t, int __pyx_skip_dispatch); + PyObject *(*transform)(struct __pyx_obj_6_basis_Basis *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); + PyObject *(*weighted_transform)(struct __pyx_obj_6_basis_Basis *, PyArrayObject *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_6_basis_Basis *__pyx_vtabptr_6_basis_Basis; + + +/* "_basis.pxd":7 + * ctypedef cnp.uint8_t BOOL_t + * + * cdef class BasisFunction: # <<<<<<<<<<<<<< + * '''Abstract. Subclasses must implement the apply, translate, scale, and __init__ methods.''' + * + */ + +struct __pyx_vtabstruct_6_basis_BasisFunction { + int (*has_knot)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + int (*is_prunable)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + int (*is_pruned)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + int (*is_splittable)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + int (*make_splittable)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + int (*make_unsplittable)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*get_children)(struct __pyx_obj_6_basis_BasisFunction *); + PyObject *(*_set_parent)(struct __pyx_obj_6_basis_BasisFunction *, struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*_add_child)(struct __pyx_obj_6_basis_BasisFunction *, struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + struct __pyx_obj_6_basis_BasisFunction *(*get_parent)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*prune)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*unprune)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*knots)(struct __pyx_obj_6_basis_BasisFunction *, __pyx_t_6_basis_INDEX_t, int __pyx_skip_dispatch); + __pyx_t_6_basis_INDEX_t (*degree)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*apply)(struct __pyx_obj_6_basis_BasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_6_basis_13BasisFunction_apply *__pyx_optional_args); + PyArrayObject *(*valid_knots)(struct __pyx_obj_6_basis_BasisFunction *, PyArrayObject *, PyArrayObject *, int, __pyx_t_6_basis_INDEX_t, int, int, __pyx_t_6_basis_FLOAT_t, __pyx_t_6_basis_INDEX_t, PyArrayObject *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_6_basis_BasisFunction *__pyx_vtabptr_6_basis_BasisFunction; + + +/* "_basis.pxd":88 + * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) + * + * cdef class LinearBasisFunction(BasisFunction): # <<<<<<<<<<<<<< + * cdef INDEX_t variable + * cdef str label + */ + +struct __pyx_vtabstruct_6_basis_LinearBasisFunction { + struct __pyx_vtabstruct_6_basis_BasisFunction __pyx_base; + PyObject *(*translate)(struct __pyx_obj_6_basis_LinearBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch); + __pyx_t_6_basis_FLOAT_t (*scale)(struct __pyx_obj_6_basis_LinearBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); + __pyx_t_6_basis_INDEX_t (*get_variable)(struct __pyx_obj_6_basis_LinearBasisFunction *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_6_basis_LinearBasisFunction *__pyx_vtabptr_6_basis_LinearBasisFunction; + + +/* "_record.pxd":39 + * cpdef set_stopping_condition(ForwardPassRecord self, int stopping_condition) + * + * cdef class Iteration: # <<<<<<<<<<<<<< + * cdef FLOAT_t mse + * cdef INDEX_t size + */ + +struct __pyx_vtabstruct_7_record_Iteration { + __pyx_t_7_record_FLOAT_t (*get_mse)(struct __pyx_obj_7_record_Iteration *, int __pyx_skip_dispatch); + __pyx_t_7_record_INDEX_t (*get_size)(struct __pyx_obj_7_record_Iteration *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_7_record_Iteration *__pyx_vtabptr_7_record_Iteration; + + +/* "_record.pxd":55 + * pass + * + * cdef class ForwardPassIteration(Iteration): # <<<<<<<<<<<<<< + * cdef INDEX_t parent + * cdef INDEX_t variable + */ + +struct __pyx_vtabstruct_7_record_ForwardPassIteration { + struct __pyx_vtabstruct_7_record_Iteration __pyx_base; + PyObject *(*set_no_candidates)(struct __pyx_obj_7_record_ForwardPassIteration *, int, int __pyx_skip_dispatch); + PyObject *(*no_further_candidates)(struct __pyx_obj_7_record_ForwardPassIteration *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_7_record_ForwardPassIteration *__pyx_vtabptr_7_record_ForwardPassIteration; + + +/* "_record.pxd":66 + * cpdef no_further_candidates(ForwardPassIteration self) + * + * cdef class FirstForwardPassIteration(ForwardPassIteration): # <<<<<<<<<<<<<< + * cpdef INDEX_t get_size(FirstForwardPassIteration self) + */ + +struct __pyx_vtabstruct_7_record_FirstForwardPassIteration { + struct __pyx_vtabstruct_7_record_ForwardPassIteration __pyx_base; +}; +static struct __pyx_vtabstruct_7_record_FirstForwardPassIteration *__pyx_vtabptr_7_record_FirstForwardPassIteration; + + +/* "_record.pxd":47 + * cpdef INDEX_t get_size(Iteration self) + * + * cdef class PruningPassIteration(Iteration): # <<<<<<<<<<<<<< + * cdef INDEX_t pruned + * + */ + +struct __pyx_vtabstruct_7_record_PruningPassIteration { + struct __pyx_vtabstruct_7_record_Iteration __pyx_base; + __pyx_t_7_record_INDEX_t (*get_pruned)(struct __pyx_obj_7_record_PruningPassIteration *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_7_record_PruningPassIteration *__pyx_vtabptr_7_record_PruningPassIteration; + + +/* "_basis.pxd":50 + * + * + * cdef class ConstantBasisFunction(BasisFunction): # <<<<<<<<<<<<<< + * + * cpdef INDEX_t degree(ConstantBasisFunction self) + */ + +struct __pyx_vtabstruct_6_basis_ConstantBasisFunction { + struct __pyx_vtabstruct_6_basis_BasisFunction __pyx_base; + PyObject *(*translate)(struct __pyx_obj_6_basis_ConstantBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch); + __pyx_t_6_basis_FLOAT_t (*scale)(struct __pyx_obj_6_basis_ConstantBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_6_basis_ConstantBasisFunction *__pyx_vtabptr_6_basis_ConstantBasisFunction; + + +/* "_pruning.pyx":11 + * import numpy as np + * + * cdef class PruningPasser: # <<<<<<<<<<<<<< + * '''Implements the generic pruning pass as described by Friedman, 1991.''' + * def __init__(PruningPasser self, Basis basis, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] weights, **kwargs): + */ + +struct __pyx_vtabstruct_8_pruning_PruningPasser { + PyObject *(*run)(struct __pyx_obj_8_pruning_PruningPasser *, int __pyx_skip_dispatch); + struct __pyx_obj_7_record_PruningPassRecord *(*trace)(struct __pyx_obj_8_pruning_PruningPasser *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_8_pruning_PruningPasser *__pyx_vtabptr_8_pruning_PruningPasser; + + +/* "_record.pxd":8 + * from _basis cimport Basis + * + * cdef class Record: # <<<<<<<<<<<<<< + * cdef list iterations + * cdef int num_samples + */ + +struct __pyx_vtabstruct_7_record_Record { + PyObject *(*append)(struct __pyx_obj_7_record_Record *, struct __pyx_obj_7_record_Iteration *, int __pyx_skip_dispatch); + __pyx_t_7_record_FLOAT_t (*mse)(struct __pyx_obj_7_record_Record *, __pyx_t_7_record_INDEX_t, int __pyx_skip_dispatch); + __pyx_t_7_record_FLOAT_t (*rsq)(struct __pyx_obj_7_record_Record *, __pyx_t_7_record_INDEX_t, int __pyx_skip_dispatch); + __pyx_t_7_record_FLOAT_t (*gcv)(struct __pyx_obj_7_record_Record *, __pyx_t_7_record_INDEX_t, int __pyx_skip_dispatch); + __pyx_t_7_record_FLOAT_t (*grsq)(struct __pyx_obj_7_record_Record *, __pyx_t_7_record_INDEX_t, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_7_record_Record *__pyx_vtabptr_7_record_Record; + + +/* "_record.pxd":25 + * cpdef FLOAT_t grsq(Record self, INDEX_t iteration) + * + * cdef class PruningPassRecord(Record): # <<<<<<<<<<<<<< + * cdef INDEX_t selected + * + */ + +struct __pyx_vtabstruct_7_record_PruningPassRecord { + struct __pyx_vtabstruct_7_record_Record __pyx_base; + PyObject *(*set_selected)(struct __pyx_obj_7_record_PruningPassRecord *, __pyx_t_7_record_INDEX_t, int __pyx_skip_dispatch); + __pyx_t_7_record_INDEX_t (*get_selected)(struct __pyx_obj_7_record_PruningPassRecord *, int __pyx_skip_dispatch); + PyObject *(*roll_back)(struct __pyx_obj_7_record_PruningPassRecord *, struct __pyx_obj_6_basis_Basis *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_7_record_PruningPassRecord *__pyx_vtabptr_7_record_PruningPassRecord; + + +/* "_record.pxd":34 + * cpdef roll_back(PruningPassRecord self, Basis basis) + * + * cdef class ForwardPassRecord(Record): # <<<<<<<<<<<<<< + * cdef int stopping_condition + * + */ + +struct __pyx_vtabstruct_7_record_ForwardPassRecord { + struct __pyx_vtabstruct_7_record_Record __pyx_base; + PyObject *(*set_stopping_condition)(struct __pyx_obj_7_record_ForwardPassRecord *, int, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_7_record_ForwardPassRecord *__pyx_vtabptr_7_record_ForwardPassRecord; + + +/* "_basis.pxd":65 + * + * + * cdef class HingeBasisFunction(BasisFunction): # <<<<<<<<<<<<<< + * cdef FLOAT_t knot + * cdef INDEX_t knot_idx + */ + +struct __pyx_vtabstruct_6_basis_HingeBasisFunction { + struct __pyx_vtabstruct_6_basis_BasisFunction __pyx_base; + PyObject *(*translate)(struct __pyx_obj_6_basis_HingeBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch); + __pyx_t_6_basis_FLOAT_t (*scale)(struct __pyx_obj_6_basis_HingeBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); + __pyx_t_6_basis_INDEX_t (*get_variable)(struct __pyx_obj_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); + __pyx_t_6_basis_FLOAT_t (*get_knot)(struct __pyx_obj_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); + int (*get_reverse)(struct __pyx_obj_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); + __pyx_t_6_basis_INDEX_t (*get_knot_idx)(struct __pyx_obj_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_6_basis_HingeBasisFunction *__pyx_vtabptr_6_basis_HingeBasisFunction; + + +/* "_record.pxd":52 + * cpdef INDEX_t get_pruned(PruningPassIteration self) + * + * cdef class FirstPruningPassIteration(PruningPassIteration): # <<<<<<<<<<<<<< + * pass + * + */ + +struct __pyx_vtabstruct_7_record_FirstPruningPassIteration { + struct __pyx_vtabstruct_7_record_PruningPassIteration __pyx_base; +}; +static struct __pyx_vtabstruct_7_record_FirstPruningPassIteration *__pyx_vtabptr_7_record_FirstPruningPassIteration; +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; +#ifdef WITH_THREAD + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + if (acquire_gil) { \ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + PyGILState_Release(__pyx_gilstate_save); \ + } else { \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) +#endif + #define __Pyx_RefNannyFinishContext() \ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name, acquire_gil) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif /* CYTHON_REFNANNY */ +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) + +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_getattr)) + return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); +#endif + return PyObject_GetAttr(obj, attr_name); +} +#else +#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#endif + +static PyObject *__Pyx_GetBuiltinName(PyObject *name); /*proto*/ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ + const char* function_name); /*proto*/ + +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact); /*proto*/ + +static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, + __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); +static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); + +static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /*proto*/ + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ + +static CYTHON_INLINE int __Pyx_PyDict_Contains(PyObject* item, PyObject* dict, int eq) { + int result = PyDict_Contains(dict, item); + return unlikely(result < 0) ? result : (result == (eq == Py_EQ)); +} + +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { + PyObject *value; + value = PyDict_GetItemWithError(d, key); + if (unlikely(!value)) { + if (!PyErr_Occurred()) { + PyObject* args = PyTuple_Pack(1, key); + if (likely(args)) + PyErr_SetObject(PyExc_KeyError, args); + Py_XDECREF(args); + } + return NULL; + } + Py_INCREF(value); + return value; +} +#else + #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) +#endif + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice( + PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop, + PyObject** py_start, PyObject** py_stop, PyObject** py_slice, + int has_cstart, int has_cstop, int wraparound); + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ + +#define __Pyx_GetItemInt(o, i, size, to_py_func, is_list, wraparound, boundscheck) \ + (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Fast(o, i, is_list, wraparound, boundscheck) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) +#define __Pyx_GetItemInt_List(o, i, size, to_py_func, is_list, wraparound, boundscheck) \ + (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_List_Fast(o, i, wraparound, boundscheck) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck); +#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func, is_list, wraparound, boundscheck) \ + (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Tuple_Fast(o, i, wraparound, boundscheck) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck); +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, + int is_list, int wraparound, int boundscheck); + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); + +typedef struct { + Py_ssize_t shape, strides, suboffsets; +} __Pyx_Buf_DimInfo; +typedef struct { + size_t refcount; + Py_buffer pybuffer; +} __Pyx_Buffer; +typedef struct { + __Pyx_Buffer *rcbuffer; + char *data; + __Pyx_Buf_DimInfo diminfo[8]; +} __Pyx_LocalBuf_ND; + +#if PY_MAJOR_VERSION < 3 + static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); + static void __Pyx_ReleaseBuffer(Py_buffer *view); +#else + #define __Pyx_GetBuffer PyObject_GetBuffer + #define __Pyx_ReleaseBuffer PyBuffer_Release +#endif + + +static Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0}; +static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1}; + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/ + +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_ulonglong(npy_ulonglong); + +static CYTHON_INLINE npy_ulonglong __Pyx_PyInt_from_py_npy_ulonglong(PyObject *); + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #define __Pyx_CREAL(z) ((z).real()) + #define __Pyx_CIMAG(z) ((z).imag()) + #else + #define __Pyx_CREAL(z) (__real__(z)) + #define __Pyx_CIMAG(z) (__imag__(z)) + #endif +#else + #define __Pyx_CREAL(z) ((z).real) + #define __Pyx_CIMAG(z) ((z).imag) +#endif +#if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX + #define __Pyx_SET_CREAL(z,x) ((z).real(x)) + #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) +#else + #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) + #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) +#endif + +static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); + +#if CYTHON_CCOMPLEX + #define __Pyx_c_eqf(a, b) ((a)==(b)) + #define __Pyx_c_sumf(a, b) ((a)+(b)) + #define __Pyx_c_difff(a, b) ((a)-(b)) + #define __Pyx_c_prodf(a, b) ((a)*(b)) + #define __Pyx_c_quotf(a, b) ((a)/(b)) + #define __Pyx_c_negf(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zerof(z) ((z)==(float)0) + #define __Pyx_c_conjf(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_absf(z) (::std::abs(z)) + #define __Pyx_c_powf(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zerof(z) ((z)==0) + #define __Pyx_c_conjf(z) (conjf(z)) + #if 1 + #define __Pyx_c_absf(z) (cabsf(z)) + #define __Pyx_c_powf(a, b) (cpowf(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex); + #endif +#endif + +static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); + +#if CYTHON_CCOMPLEX + #define __Pyx_c_eq(a, b) ((a)==(b)) + #define __Pyx_c_sum(a, b) ((a)+(b)) + #define __Pyx_c_diff(a, b) ((a)-(b)) + #define __Pyx_c_prod(a, b) ((a)*(b)) + #define __Pyx_c_quot(a, b) ((a)/(b)) + #define __Pyx_c_neg(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero(z) ((z)==(double)0) + #define __Pyx_c_conj(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs(z) (::std::abs(z)) + #define __Pyx_c_pow(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero(z) ((z)==0) + #define __Pyx_c_conj(z) (conj(z)) + #if 1 + #define __Pyx_c_abs(z) (cabs(z)) + #define __Pyx_c_pow(a, b) (cpow(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex); + #endif +#endif + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static int __Pyx_check_binary_version(void); + +static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ + +#if !defined(__Pyx_PyIdentifier_FromString) +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) +#else + #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) +#endif +#endif + +static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ + +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ + +static void* __Pyx_GetVtable(PyObject *dict); /*proto*/ + +static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig); /*proto*/ + +typedef struct { + int code_line; + PyCodeObject* code_object; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); + +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + + +/* Module declarations from 'cpython.buffer' */ + +/* Module declarations from 'cpython.ref' */ + +/* Module declarations from 'libc.string' */ + +/* Module declarations from 'libc.stdio' */ + +/* Module declarations from 'cpython.object' */ + +/* Module declarations from '__builtin__' */ + +/* Module declarations from 'cpython.type' */ +static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; + +/* Module declarations from 'libc.stdlib' */ + +/* Module declarations from 'numpy' */ + +/* Module declarations from 'numpy' */ +static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; +static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; +static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; +static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; +static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ + +/* Module declarations from '_basis' */ +static PyTypeObject *__pyx_ptype_6_basis_BasisFunction = 0; +static PyTypeObject *__pyx_ptype_6_basis_ConstantBasisFunction = 0; +static PyTypeObject *__pyx_ptype_6_basis_HingeBasisFunction = 0; +static PyTypeObject *__pyx_ptype_6_basis_LinearBasisFunction = 0; +static PyTypeObject *__pyx_ptype_6_basis_Basis = 0; + +/* Module declarations from '_record' */ +static PyTypeObject *__pyx_ptype_7_record_Record = 0; +static PyTypeObject *__pyx_ptype_7_record_PruningPassRecord = 0; +static PyTypeObject *__pyx_ptype_7_record_ForwardPassRecord = 0; +static PyTypeObject *__pyx_ptype_7_record_Iteration = 0; +static PyTypeObject *__pyx_ptype_7_record_PruningPassIteration = 0; +static PyTypeObject *__pyx_ptype_7_record_FirstPruningPassIteration = 0; +static PyTypeObject *__pyx_ptype_7_record_ForwardPassIteration = 0; +static PyTypeObject *__pyx_ptype_7_record_FirstForwardPassIteration = 0; + +/* Module declarations from '_util' */ +static PyObject *(*__pyx_f_5_util_apply_weights_1d)(PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); /*proto*/ +static __pyx_t_5_util_FLOAT_t (*__pyx_f_5_util_gcv)(__pyx_t_5_util_FLOAT_t, __pyx_t_5_util_INDEX_t, __pyx_t_5_util_INDEX_t, __pyx_t_5_util_FLOAT_t, int __pyx_skip_dispatch); /*proto*/ + +/* Module declarations from '_pruning' */ +static PyTypeObject *__pyx_ptype_8_pruning_PruningPasser = 0; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_8_pruning_FLOAT_t = { "FLOAT_t", NULL, sizeof(__pyx_t_8_pruning_FLOAT_t), { 0 }, 0, 'R', 0, 0 }; +#define __Pyx_MODULE_NAME "_pruning" +int __pyx_module_is_main__pruning = 0; + +/* Implementation of '_pruning' */ +static PyObject *__pyx_builtin_range; +static PyObject *__pyx_builtin_ValueError; +static PyObject *__pyx_builtin_RuntimeError; +static int __pyx_pf_8_pruning_13PruningPasser___init__(struct __pyx_obj_8_pruning_PruningPasser *__pyx_v_self, struct __pyx_obj_6_basis_Basis *__pyx_v_basis, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_y, PyArrayObject *__pyx_v_weights, PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_8_pruning_13PruningPasser_2run(struct __pyx_obj_8_pruning_PruningPasser *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_8_pruning_13PruningPasser_4trace(struct __pyx_obj_8_pruning_PruningPasser *__pyx_v_self); /* proto */ +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ +static PyObject *__pyx_tp_new_8_pruning_PruningPasser(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static char __pyx_k_7[] = "ndarray is not C contiguous"; +static char __pyx_k_9[] = "ndarray is not Fortran contiguous"; +static char __pyx_k_11[] = "Non-native byte order not supported"; +static char __pyx_k_13[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_14[] = "Format string allocated too short, see comment in numpy.pxd"; +static char __pyx_k_17[] = "Format string allocated too short."; +static char __pyx_k__B[] = "B"; +static char __pyx_k__H[] = "H"; +static char __pyx_k__I[] = "I"; +static char __pyx_k__L[] = "L"; +static char __pyx_k__O[] = "O"; +static char __pyx_k__Q[] = "Q"; +static char __pyx_k__X[] = "X"; +static char __pyx_k__b[] = "b"; +static char __pyx_k__d[] = "d"; +static char __pyx_k__f[] = "f"; +static char __pyx_k__g[] = "g"; +static char __pyx_k__h[] = "h"; +static char __pyx_k__i[] = "i"; +static char __pyx_k__l[] = "l"; +static char __pyx_k__q[] = "q"; +static char __pyx_k__y[] = "y"; +static char __pyx_k__Zd[] = "Zd"; +static char __pyx_k__Zf[] = "Zf"; +static char __pyx_k__Zg[] = "Zg"; +static char __pyx_k__np[] = "np"; +static char __pyx_k__dot[] = "dot"; +static char __pyx_k__run[] = "run"; +static char __pyx_k__sum[] = "sum"; +static char __pyx_k__copy[] = "copy"; +static char __pyx_k__basis[] = "basis"; +static char __pyx_k__dtype[] = "dtype"; +static char __pyx_k__empty[] = "empty"; +static char __pyx_k__float[] = "float"; +static char __pyx_k__lstsq[] = "lstsq"; +static char __pyx_k__numpy[] = "numpy"; +static char __pyx_k__prune[] = "prune"; +static char __pyx_k__range[] = "range"; +static char __pyx_k__shape[] = "shape"; +static char __pyx_k__trace[] = "trace"; +static char __pyx_k__linalg[] = "linalg"; +static char __pyx_k__average[] = "average"; +static char __pyx_k__penalty[] = "penalty"; +static char __pyx_k__unprune[] = "unprune"; +static char __pyx_k__weights[] = "weights"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__is_pruned[] = "is_pruned"; +static char __pyx_k__ValueError[] = "ValueError"; +static char __pyx_k____import__[] = "__import__"; +static char __pyx_k__is_prunable[] = "is_prunable"; +static char __pyx_k__RuntimeError[] = "RuntimeError"; +static char __pyx_k____pyx_getbuffer[] = "__pyx_getbuffer"; +static char __pyx_k____pyx_releasebuffer[] = "__pyx_releasebuffer"; +static PyObject *__pyx_kp_u_11; +static PyObject *__pyx_kp_u_13; +static PyObject *__pyx_kp_u_14; +static PyObject *__pyx_kp_u_17; +static PyObject *__pyx_kp_u_7; +static PyObject *__pyx_kp_u_9; +static PyObject *__pyx_n_s__RuntimeError; +static PyObject *__pyx_n_s__ValueError; +static PyObject *__pyx_n_s__X; +static PyObject *__pyx_n_s____import__; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____pyx_getbuffer; +static PyObject *__pyx_n_s____pyx_releasebuffer; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s__average; +static PyObject *__pyx_n_s__basis; +static PyObject *__pyx_n_s__copy; +static PyObject *__pyx_n_s__dot; +static PyObject *__pyx_n_s__dtype; +static PyObject *__pyx_n_s__empty; +static PyObject *__pyx_n_s__float; +static PyObject *__pyx_n_s__is_prunable; +static PyObject *__pyx_n_s__is_pruned; +static PyObject *__pyx_n_s__linalg; +static PyObject *__pyx_n_s__lstsq; +static PyObject *__pyx_n_s__np; +static PyObject *__pyx_n_s__numpy; +static PyObject *__pyx_n_s__penalty; +static PyObject *__pyx_n_s__prune; +static PyObject *__pyx_n_s__range; +static PyObject *__pyx_n_s__run; +static PyObject *__pyx_n_s__shape; +static PyObject *__pyx_n_s__sum; +static PyObject *__pyx_n_s__trace; +static PyObject *__pyx_n_s__unprune; +static PyObject *__pyx_n_s__weights; +static PyObject *__pyx_n_s__y; +static PyObject *__pyx_int_0; +static PyObject *__pyx_int_2; +static PyObject *__pyx_int_15; +static PyObject *__pyx_k_slice_1; +static PyObject *__pyx_k_slice_2; +static PyObject *__pyx_k_slice_3; +static PyObject *__pyx_k_slice_4; +static PyObject *__pyx_k_slice_5; +static PyObject *__pyx_k_slice_6; +static PyObject *__pyx_k_tuple_8; +static PyObject *__pyx_k_tuple_10; +static PyObject *__pyx_k_tuple_12; +static PyObject *__pyx_k_tuple_15; +static PyObject *__pyx_k_tuple_16; +static PyObject *__pyx_k_tuple_18; + +/* Python wrapper */ +static int __pyx_pw_8_pruning_13PruningPasser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_8_pruning_13PruningPasser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_6_basis_Basis *__pyx_v_basis = 0; + PyArrayObject *__pyx_v_X = 0; + PyArrayObject *__pyx_v_y = 0; + PyArrayObject *__pyx_v_weights = 0; + PyObject *__pyx_v_kwargs = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1; + __Pyx_GOTREF(__pyx_v_kwargs); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__basis,&__pyx_n_s__X,&__pyx_n_s__y,&__pyx_n_s__weights,0}; + PyObject* values[4] = {0,0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__basis)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__X)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weights)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, __pyx_v_kwargs, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + } + __pyx_v_basis = ((struct __pyx_obj_6_basis_Basis *)values[0]); + __pyx_v_X = ((PyArrayObject *)values[1]); + __pyx_v_y = ((PyArrayObject *)values[2]); + __pyx_v_weights = ((PyArrayObject *)values[3]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; + __Pyx_AddTraceback("_pruning.PruningPasser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_basis), __pyx_ptype_6_basis_Basis, 1, "basis", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weights), __pyx_ptype_5numpy_ndarray, 1, "weights", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_8_pruning_13PruningPasser___init__(((struct __pyx_obj_8_pruning_PruningPasser *)__pyx_v_self), __pyx_v_basis, __pyx_v_X, __pyx_v_y, __pyx_v_weights, __pyx_v_kwargs); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_kwargs); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_pruning.pyx":13 + * cdef class PruningPasser: + * '''Implements the generic pruning pass as described by Friedman, 1991.''' + * def __init__(PruningPasser self, Basis basis, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] weights, **kwargs): # <<<<<<<<<<<<<< + * self.X = X + * self.m = self.X.shape[0] + */ + +static int __pyx_pf_8_pruning_13PruningPasser___init__(struct __pyx_obj_8_pruning_PruningPasser *__pyx_v_self, struct __pyx_obj_6_basis_Basis *__pyx_v_basis, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_y, PyArrayObject *__pyx_v_weights, PyObject *__pyx_v_kwargs) { + __Pyx_LocalBuf_ND __pyx_pybuffernd_X; + __Pyx_Buffer __pyx_pybuffer_X; + __Pyx_LocalBuf_ND __pyx_pybuffernd_weights; + __Pyx_Buffer __pyx_pybuffer_weights; + __Pyx_LocalBuf_ND __pyx_pybuffernd_y; + __Pyx_Buffer __pyx_pybuffer_y; + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + Py_ssize_t __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + int __pyx_t_7; + __pyx_t_8_pruning_FLOAT_t __pyx_t_8; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + __pyx_pybuffer_X.pybuffer.buf = NULL; + __pyx_pybuffer_X.refcount = 0; + __pyx_pybuffernd_X.data = NULL; + __pyx_pybuffernd_X.rcbuffer = &__pyx_pybuffer_X; + __pyx_pybuffer_y.pybuffer.buf = NULL; + __pyx_pybuffer_y.refcount = 0; + __pyx_pybuffernd_y.data = NULL; + __pyx_pybuffernd_y.rcbuffer = &__pyx_pybuffer_y; + __pyx_pybuffer_weights.pybuffer.buf = NULL; + __pyx_pybuffer_weights.refcount = 0; + __pyx_pybuffernd_weights.data = NULL; + __pyx_pybuffernd_weights.rcbuffer = &__pyx_pybuffer_weights; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_8_pruning_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_8_pruning_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_y.diminfo[0].strides = __pyx_pybuffernd_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y.diminfo[0].shape = __pyx_pybuffernd_y.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_8_pruning_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_weights.diminfo[0].strides = __pyx_pybuffernd_weights.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weights.diminfo[0].shape = __pyx_pybuffernd_weights.rcbuffer->pybuffer.shape[0]; + + /* "_pruning.pyx":14 + * '''Implements the generic pruning pass as described by Friedman, 1991.''' + * def __init__(PruningPasser self, Basis basis, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] weights, **kwargs): + * self.X = X # <<<<<<<<<<<<<< + * self.m = self.X.shape[0] + * self.n = self.X.shape[1] + */ + __Pyx_INCREF(((PyObject *)__pyx_v_X)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_X)); + __Pyx_GOTREF(__pyx_v_self->X); + __Pyx_DECREF(((PyObject *)__pyx_v_self->X)); + __pyx_v_self->X = ((PyArrayObject *)__pyx_v_X); + + /* "_pruning.pyx":15 + * def __init__(PruningPasser self, Basis basis, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] weights, **kwargs): + * self.X = X + * self.m = self.X.shape[0] # <<<<<<<<<<<<<< + * self.n = self.X.shape[1] + * self.y = y + */ + __pyx_v_self->m = (__pyx_v_self->X->dimensions[0]); + + /* "_pruning.pyx":16 + * self.X = X + * self.m = self.X.shape[0] + * self.n = self.X.shape[1] # <<<<<<<<<<<<<< + * self.y = y + * self.weights = weights + */ + __pyx_v_self->n = (__pyx_v_self->X->dimensions[1]); + + /* "_pruning.pyx":17 + * self.m = self.X.shape[0] + * self.n = self.X.shape[1] + * self.y = y # <<<<<<<<<<<<<< + * self.weights = weights + * self.basis = basis + */ + __Pyx_INCREF(((PyObject *)__pyx_v_y)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_y)); + __Pyx_GOTREF(__pyx_v_self->y); + __Pyx_DECREF(((PyObject *)__pyx_v_self->y)); + __pyx_v_self->y = ((PyArrayObject *)__pyx_v_y); + + /* "_pruning.pyx":18 + * self.n = self.X.shape[1] + * self.y = y + * self.weights = weights # <<<<<<<<<<<<<< + * self.basis = basis + * self.B = np.empty(shape=(self.m,len(self.basis)+1),dtype=np.float) + */ + __Pyx_INCREF(((PyObject *)__pyx_v_weights)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_weights)); + __Pyx_GOTREF(__pyx_v_self->weights); + __Pyx_DECREF(((PyObject *)__pyx_v_self->weights)); + __pyx_v_self->weights = ((PyArrayObject *)__pyx_v_weights); + + /* "_pruning.pyx":19 + * self.y = y + * self.weights = weights + * self.basis = basis # <<<<<<<<<<<<<< + * self.B = np.empty(shape=(self.m,len(self.basis)+1),dtype=np.float) + * self.penalty = kwargs['penalty'] if 'penalty' in kwargs else 3.0 + */ + __Pyx_INCREF(((PyObject *)__pyx_v_basis)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_basis)); + __Pyx_GOTREF(__pyx_v_self->basis); + __Pyx_DECREF(((PyObject *)__pyx_v_self->basis)); + __pyx_v_self->basis = __pyx_v_basis; + + /* "_pruning.pyx":20 + * self.weights = weights + * self.basis = basis + * self.B = np.empty(shape=(self.m,len(self.basis)+1),dtype=np.float) # <<<<<<<<<<<<<< + * self.penalty = kwargs['penalty'] if 'penalty' in kwargs else 3.0 + * self.sst = np.sum(self.weights*(self.y - np.average(self.y,weights=self.weights))**2) / self.m + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_3 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = ((PyObject *)__pyx_v_self->basis); + __Pyx_INCREF(__pyx_t_4); + __pyx_t_5 = PyObject_Length(__pyx_t_4); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyInt_FromSsize_t((__pyx_t_5 + 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_3 = 0; + __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__shape), ((PyObject *)__pyx_t_6)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__float); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(__pyx_v_self->B); + __Pyx_DECREF(((PyObject *)__pyx_v_self->B)); + __pyx_v_self->B = ((PyArrayObject *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "_pruning.pyx":21 + * self.basis = basis + * self.B = np.empty(shape=(self.m,len(self.basis)+1),dtype=np.float) + * self.penalty = kwargs['penalty'] if 'penalty' in kwargs else 3.0 # <<<<<<<<<<<<<< + * self.sst = np.sum(self.weights*(self.y - np.average(self.y,weights=self.weights))**2) / self.m + * + */ + __pyx_t_7 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__penalty), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_7) { + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__penalty)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __pyx_t_1; + __pyx_t_1 = 0; + } else { + __pyx_t_1 = PyFloat_FromDouble(3.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __pyx_t_1; + __pyx_t_1 = 0; + } + __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_8 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_v_self->penalty = __pyx_t_8; + + /* "_pruning.pyx":22 + * self.B = np.empty(shape=(self.m,len(self.basis)+1),dtype=np.float) + * self.penalty = kwargs['penalty'] if 'penalty' in kwargs else 3.0 + * self.sst = np.sum(self.weights*(self.y - np.average(self.y,weights=self.weights))**2) / self.m # <<<<<<<<<<<<<< + * + * cpdef run(PruningPasser self): + */ + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__sum); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__average); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_v_self->y)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_self->y)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->y)); + __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__weights), ((PyObject *)__pyx_v_self->weights)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_t_6 = PyNumber_Subtract(((PyObject *)__pyx_v_self->y), __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Power(__pyx_t_6, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyNumber_Multiply(((PyObject *)__pyx_v_self->weights), __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_6 = 0; + __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_8 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->sst = __pyx_t_8; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("_pruning.PruningPasser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_pruning.pyx":24 + * self.sst = np.sum(self.weights*(self.y - np.average(self.y,weights=self.weights))**2) / self.m + * + * cpdef run(PruningPasser self): # <<<<<<<<<<<<<< + * #This is a totally naive implementation and could potentially be made faster + * #through the use of updating algorithms. It is not clear that such + */ + +static PyObject *__pyx_pw_8_pruning_13PruningPasser_3run(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_pruning_PruningPasser *__pyx_v_self, int __pyx_skip_dispatch) { + __pyx_t_8_pruning_INDEX_t __pyx_v_i; + __pyx_t_8_pruning_INDEX_t __pyx_v_j; + __pyx_t_8_pruning_INDEX_t __pyx_v_basis_size; + __pyx_t_8_pruning_INDEX_t __pyx_v_pruned_basis_size; + __pyx_t_8_pruning_FLOAT_t __pyx_v_gcv_; + __pyx_t_8_pruning_INDEX_t __pyx_v_best_iteration; + __pyx_t_8_pruning_INDEX_t __pyx_v_best_bf_to_prune; + __pyx_t_8_pruning_FLOAT_t __pyx_v_best_gcv; + __pyx_t_8_pruning_FLOAT_t __pyx_v_best_iteration_gcv; + __pyx_t_8_pruning_FLOAT_t __pyx_v_best_iteration_mse; + PyArrayObject *__pyx_v_B = 0; + PyArrayObject *__pyx_v_X = 0; + PyArrayObject *__pyx_v_y = 0; + PyArrayObject *__pyx_v_weights = 0; + PyArrayObject *__pyx_v_weighted_y = 0; + PyObject *__pyx_v_beta = NULL; + PyObject *__pyx_v_mse = NULL; + int __pyx_v_first; + PyObject *__pyx_v_bf = NULL; + __Pyx_LocalBuf_ND __pyx_pybuffernd_B; + __Pyx_Buffer __pyx_pybuffer_B; + __Pyx_LocalBuf_ND __pyx_pybuffernd_X; + __Pyx_Buffer __pyx_pybuffer_X; + __Pyx_LocalBuf_ND __pyx_pybuffernd_weighted_y; + __Pyx_Buffer __pyx_pybuffer_weighted_y; + __Pyx_LocalBuf_ND __pyx_pybuffernd_weights; + __Pyx_Buffer __pyx_pybuffer_weights; + __Pyx_LocalBuf_ND __pyx_pybuffernd_y; + __Pyx_Buffer __pyx_pybuffer_y; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyArrayObject *__pyx_t_4 = NULL; + PyArrayObject *__pyx_t_5 = NULL; + PyArrayObject *__pyx_t_6 = NULL; + PyArrayObject *__pyx_t_7 = NULL; + PyArrayObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *(*__pyx_t_11)(PyObject *); + int __pyx_t_12; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + __pyx_t_8_pruning_INDEX_t __pyx_t_15; + __pyx_t_8_pruning_INDEX_t __pyx_t_16; + __pyx_t_8_pruning_INDEX_t __pyx_t_17; + __pyx_t_8_pruning_INDEX_t __pyx_t_18; + int __pyx_t_19; + __pyx_t_5_util_FLOAT_t __pyx_t_20; + __pyx_t_8_pruning_FLOAT_t __pyx_t_21; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("run", 0); + __pyx_pybuffer_B.pybuffer.buf = NULL; + __pyx_pybuffer_B.refcount = 0; + __pyx_pybuffernd_B.data = NULL; + __pyx_pybuffernd_B.rcbuffer = &__pyx_pybuffer_B; + __pyx_pybuffer_X.pybuffer.buf = NULL; + __pyx_pybuffer_X.refcount = 0; + __pyx_pybuffernd_X.data = NULL; + __pyx_pybuffernd_X.rcbuffer = &__pyx_pybuffer_X; + __pyx_pybuffer_y.pybuffer.buf = NULL; + __pyx_pybuffer_y.refcount = 0; + __pyx_pybuffernd_y.data = NULL; + __pyx_pybuffernd_y.rcbuffer = &__pyx_pybuffer_y; + __pyx_pybuffer_weights.pybuffer.buf = NULL; + __pyx_pybuffer_weights.refcount = 0; + __pyx_pybuffernd_weights.data = NULL; + __pyx_pybuffernd_weights.rcbuffer = &__pyx_pybuffer_weights; + __pyx_pybuffer_weighted_y.pybuffer.buf = NULL; + __pyx_pybuffer_weighted_y.refcount = 0; + __pyx_pybuffernd_weighted_y.data = NULL; + __pyx_pybuffernd_weighted_y.rcbuffer = &__pyx_pybuffer_weighted_y; + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__run); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8_pruning_13PruningPasser_3run)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_pruning.pyx":31 + * cdef INDEX_t i + * cdef INDEX_t j + * cdef INDEX_t basis_size = len(self.basis) # <<<<<<<<<<<<<< + * cdef INDEX_t pruned_basis_size = self.basis.plen() + * cdef FLOAT_t gcv_ + */ + __pyx_t_1 = ((PyObject *)__pyx_v_self->basis); + __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_basis_size = __pyx_t_3; + + /* "_pruning.pyx":32 + * cdef INDEX_t j + * cdef INDEX_t basis_size = len(self.basis) + * cdef INDEX_t pruned_basis_size = self.basis.plen() # <<<<<<<<<<<<<< + * cdef FLOAT_t gcv_ + * cdef INDEX_t best_iteration + */ + __pyx_v_pruned_basis_size = ((struct __pyx_vtabstruct_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->plen(__pyx_v_self->basis, 0); + + /* "_pruning.pyx":40 + * cdef FLOAT_t best_iteration_mse + * + * cdef cnp.ndarray[FLOAT_t, ndim=2] B = self.B # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X + * cdef cnp.ndarray[FLOAT_t, ndim=1] y = self.y + */ + __pyx_t_4 = ((PyArrayObject *)__pyx_v_self->B); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_8_pruning_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + __pyx_v_B = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_B.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_B.diminfo[0].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B.diminfo[0].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B.diminfo[1].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B.diminfo[1].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_4 = 0; + __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->B))); + __pyx_v_B = ((PyArrayObject *)__pyx_v_self->B); + + /* "_pruning.pyx":41 + * + * cdef cnp.ndarray[FLOAT_t, ndim=2] B = self.B + * cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t, ndim=1] y = self.y + * cdef cnp.ndarray[FLOAT_t, ndim=1] weights = self.weights + */ + __pyx_t_5 = ((PyArrayObject *)__pyx_v_self->X); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_8_pruning_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + __pyx_v_X = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; + } + } + __pyx_t_5 = 0; + __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->X))); + __pyx_v_X = ((PyArrayObject *)__pyx_v_self->X); + + /* "_pruning.pyx":42 + * cdef cnp.ndarray[FLOAT_t, ndim=2] B = self.B + * cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X + * cdef cnp.ndarray[FLOAT_t, ndim=1] y = self.y # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t, ndim=1] weights = self.weights + * cdef cnp.ndarray[FLOAT_t, ndim=1] weighted_y = y.copy() + */ + __pyx_t_6 = ((PyArrayObject *)__pyx_v_self->y); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_8_pruning_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_y = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_y.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_y.diminfo[0].strides = __pyx_pybuffernd_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y.diminfo[0].shape = __pyx_pybuffernd_y.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_6 = 0; + __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->y))); + __pyx_v_y = ((PyArrayObject *)__pyx_v_self->y); + + /* "_pruning.pyx":43 + * cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X + * cdef cnp.ndarray[FLOAT_t, ndim=1] y = self.y + * cdef cnp.ndarray[FLOAT_t, ndim=1] weights = self.weights # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t, ndim=1] weighted_y = y.copy() + * + */ + __pyx_t_7 = ((PyArrayObject *)__pyx_v_self->weights); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_8_pruning_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_weights = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_weights.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_weights.diminfo[0].strides = __pyx_pybuffernd_weights.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weights.diminfo[0].shape = __pyx_pybuffernd_weights.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_7 = 0; + __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->weights))); + __pyx_v_weights = ((PyArrayObject *)__pyx_v_self->weights); + + /* "_pruning.pyx":44 + * cdef cnp.ndarray[FLOAT_t, ndim=1] y = self.y + * cdef cnp.ndarray[FLOAT_t, ndim=1] weights = self.weights + * cdef cnp.ndarray[FLOAT_t, ndim=1] weighted_y = y.copy() # <<<<<<<<<<<<<< + * + * #Initial solution + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_y), __pyx_n_s__copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = ((PyArrayObject *)__pyx_t_2); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weighted_y.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_8_pruning_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_weighted_y = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_weighted_y.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_weighted_y.diminfo[0].strides = __pyx_pybuffernd_weighted_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weighted_y.diminfo[0].shape = __pyx_pybuffernd_weighted_y.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_8 = 0; + __pyx_v_weighted_y = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "_pruning.pyx":47 + * + * #Initial solution + * apply_weights_1d(weighted_y,weights) # <<<<<<<<<<<<<< + * self.basis.weighted_transform(X,B,weights) + * beta, mse = np.linalg.lstsq(B[:,0:(basis_size)],weighted_y)[0:2] + */ + __pyx_t_2 = __pyx_f_5_util_apply_weights_1d(((PyArrayObject *)__pyx_v_weighted_y), ((PyArrayObject *)__pyx_v_weights), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "_pruning.pyx":48 + * #Initial solution + * apply_weights_1d(weighted_y,weights) + * self.basis.weighted_transform(X,B,weights) # <<<<<<<<<<<<<< + * beta, mse = np.linalg.lstsq(B[:,0:(basis_size)],weighted_y)[0:2] + * if mse: + */ + __pyx_t_2 = ((struct __pyx_vtabstruct_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->weighted_transform(__pyx_v_self->basis, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_B), ((PyArrayObject *)__pyx_v_weights), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "_pruning.pyx":49 + * apply_weights_1d(weighted_y,weights) + * self.basis.weighted_transform(X,B,weights) + * beta, mse = np.linalg.lstsq(B[:,0:(basis_size)],weighted_y)[0:2] # <<<<<<<<<<<<<< + * if mse: + * mse /= self.m + */ + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__linalg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__lstsq); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_basis_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = PySlice_New(__pyx_int_0, __pyx_t_1, Py_None); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_k_slice_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_k_slice_1); + __Pyx_GIVEREF(__pyx_k_slice_1); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_9 = 0; + __pyx_t_9 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_1)); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __Pyx_INCREF(((PyObject *)__pyx_v_weighted_y)); + PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_weighted_y)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_weighted_y)); + __pyx_t_9 = 0; + __pyx_t_9 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_9, 0, 2, NULL, NULL, &__pyx_k_slice_2, 1, 1, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { + PyObject* sequence = __pyx_t_1; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_2 = PyTuple_GET_ITEM(sequence, 1); + } else { + __pyx_t_9 = PyList_GET_ITEM(sequence, 0); + __pyx_t_2 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(__pyx_t_2); + #else + __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + #endif + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } else + { + Py_ssize_t index = -1; + __pyx_t_10 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext; + index = 0; __pyx_t_9 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_9)) goto __pyx_L3_unpacking_failed; + __Pyx_GOTREF(__pyx_t_9); + index = 1; __pyx_t_2 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed; + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = NULL; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + goto __pyx_L4_unpacking_done; + __pyx_L3_unpacking_failed:; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_11 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L4_unpacking_done:; + } + __pyx_v_beta = __pyx_t_9; + __pyx_t_9 = 0; + __pyx_v_mse = __pyx_t_2; + __pyx_t_2 = 0; + + /* "_pruning.pyx":50 + * self.basis.weighted_transform(X,B,weights) + * beta, mse = np.linalg.lstsq(B[:,0:(basis_size)],weighted_y)[0:2] + * if mse: # <<<<<<<<<<<<<< + * mse /= self.m + * else: + */ + __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_mse); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_12) { + + /* "_pruning.pyx":51 + * beta, mse = np.linalg.lstsq(B[:,0:(basis_size)],weighted_y)[0:2] + * if mse: + * mse /= self.m # <<<<<<<<<<<<<< + * else: + * mse = (1.0/self.m)*np.sum((np.dot(B[:,0:basis_size],beta) - weighted_y)**2) + */ + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyNumber_InPlaceDivide(__pyx_v_mse, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_mse); + __pyx_v_mse = __pyx_t_2; + __pyx_t_2 = 0; + goto __pyx_L5; + } + /*else*/ { + + /* "_pruning.pyx":53 + * mse /= self.m + * else: + * mse = (1.0/self.m)*np.sum((np.dot(B[:,0:basis_size],beta) - weighted_y)**2) # <<<<<<<<<<<<<< + * + * #Create the record object + */ + __pyx_t_2 = PyFloat_FromDouble((1.0 / __pyx_v_self->m)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__sum); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__dot); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_basis_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_13 = PySlice_New(__pyx_int_0, __pyx_t_1, Py_None); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_k_slice_3); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_k_slice_3); + __Pyx_GIVEREF(__pyx_k_slice_3); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_13); + __Pyx_GIVEREF(__pyx_t_13); + __pyx_t_13 = 0; + __pyx_t_13 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_1)); if (!__pyx_t_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_13); + __Pyx_GIVEREF(__pyx_t_13); + __Pyx_INCREF(__pyx_v_beta); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_beta); + __Pyx_GIVEREF(__pyx_v_beta); + __pyx_t_13 = 0; + __pyx_t_13 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Subtract(__pyx_t_13, ((PyObject *)__pyx_v_weighted_y)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = PyNumber_Power(__pyx_t_1, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_13); + __Pyx_GIVEREF(__pyx_t_13); + __pyx_t_13 = 0; + __pyx_t_13 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_t_13); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_v_mse); + __pyx_v_mse = __pyx_t_1; + __pyx_t_1 = 0; + } + __pyx_L5:; + + /* "_pruning.pyx":56 + * + * #Create the record object + * self.record = PruningPassRecord(self.m,self.n,self.penalty,self.sst,pruned_basis_size,mse) # <<<<<<<<<<<<<< + * gcv_ = self.record.gcv(0) + * best_gcv = gcv_ + */ + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_13 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->n); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->penalty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_9 = PyFloat_FromDouble(__pyx_v_self->sst); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_pruned_basis_size); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_14 = PyTuple_New(6); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_14, 1, __pyx_t_13); + __Pyx_GIVEREF(__pyx_t_13); + PyTuple_SET_ITEM(__pyx_t_14, 2, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_14, 3, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_14, 4, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + __Pyx_INCREF(__pyx_v_mse); + PyTuple_SET_ITEM(__pyx_t_14, 5, __pyx_v_mse); + __Pyx_GIVEREF(__pyx_v_mse); + __pyx_t_1 = 0; + __pyx_t_13 = 0; + __pyx_t_2 = 0; + __pyx_t_9 = 0; + __pyx_t_10 = 0; + __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7_record_PruningPassRecord)), ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0; + __Pyx_GIVEREF(__pyx_t_10); + __Pyx_GOTREF(__pyx_v_self->record); + __Pyx_DECREF(((PyObject *)__pyx_v_self->record)); + __pyx_v_self->record = ((struct __pyx_obj_7_record_PruningPassRecord *)__pyx_t_10); + __pyx_t_10 = 0; + + /* "_pruning.pyx":57 + * #Create the record object + * self.record = PruningPassRecord(self.m,self.n,self.penalty,self.sst,pruned_basis_size,mse) + * gcv_ = self.record.gcv(0) # <<<<<<<<<<<<<< + * best_gcv = gcv_ + * best_iteration = 0 + */ + __pyx_v_gcv_ = ((struct __pyx_vtabstruct_7_record_PruningPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->__pyx_base.gcv(((struct __pyx_obj_7_record_Record *)__pyx_v_self->record), 0, 0); + + /* "_pruning.pyx":58 + * self.record = PruningPassRecord(self.m,self.n,self.penalty,self.sst,pruned_basis_size,mse) + * gcv_ = self.record.gcv(0) + * best_gcv = gcv_ # <<<<<<<<<<<<<< + * best_iteration = 0 + * + */ + __pyx_v_best_gcv = __pyx_v_gcv_; + + /* "_pruning.pyx":59 + * gcv_ = self.record.gcv(0) + * best_gcv = gcv_ + * best_iteration = 0 # <<<<<<<<<<<<<< + * + * #Prune basis functions sequentially + */ + __pyx_v_best_iteration = 0; + + /* "_pruning.pyx":62 + * + * #Prune basis functions sequentially + * for i in range(1,pruned_basis_size): # <<<<<<<<<<<<<< + * first = True + * pruned_basis_size -= 1 + */ + __pyx_t_15 = __pyx_v_pruned_basis_size; + for (__pyx_t_16 = 1; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { + __pyx_v_i = __pyx_t_16; + + /* "_pruning.pyx":63 + * #Prune basis functions sequentially + * for i in range(1,pruned_basis_size): + * first = True # <<<<<<<<<<<<<< + * pruned_basis_size -= 1 + * + */ + __pyx_v_first = 1; + + /* "_pruning.pyx":64 + * for i in range(1,pruned_basis_size): + * first = True + * pruned_basis_size -= 1 # <<<<<<<<<<<<<< + * + * #Find the best basis function to prune + */ + __pyx_v_pruned_basis_size = (__pyx_v_pruned_basis_size - 1); + + /* "_pruning.pyx":67 + * + * #Find the best basis function to prune + * for j in range(basis_size): # <<<<<<<<<<<<<< + * bf = self.basis[j] + * if bf.is_pruned(): + */ + __pyx_t_17 = __pyx_v_basis_size; + for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { + __pyx_v_j = __pyx_t_18; + + /* "_pruning.pyx":68 + * #Find the best basis function to prune + * for j in range(basis_size): + * bf = self.basis[j] # <<<<<<<<<<<<<< + * if bf.is_pruned(): + * continue + */ + __pyx_t_10 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->basis), __pyx_v_j, sizeof(__pyx_t_8_pruning_INDEX_t)+1, __Pyx_PyInt_to_py_npy_ulonglong, 0, 0, 0); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_v_bf); + __pyx_v_bf = __pyx_t_10; + __pyx_t_10 = 0; + + /* "_pruning.pyx":69 + * for j in range(basis_size): + * bf = self.basis[j] + * if bf.is_pruned(): # <<<<<<<<<<<<<< + * continue + * if not bf.is_prunable(): + */ + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_bf, __pyx_n_s__is_pruned); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_14 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + if (__pyx_t_12) { + + /* "_pruning.pyx":70 + * bf = self.basis[j] + * if bf.is_pruned(): + * continue # <<<<<<<<<<<<<< + * if not bf.is_prunable(): + * continue + */ + goto __pyx_L8_continue; + goto __pyx_L10; + } + __pyx_L10:; + + /* "_pruning.pyx":71 + * if bf.is_pruned(): + * continue + * if not bf.is_prunable(): # <<<<<<<<<<<<<< + * continue + * bf.prune() + */ + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_bf, __pyx_n_s__is_prunable); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_10 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_19 = (!__pyx_t_12); + if (__pyx_t_19) { + + /* "_pruning.pyx":72 + * continue + * if not bf.is_prunable(): + * continue # <<<<<<<<<<<<<< + * bf.prune() + * self.basis.weighted_transform(X, B, weights) + */ + goto __pyx_L8_continue; + goto __pyx_L11; + } + __pyx_L11:; + + /* "_pruning.pyx":73 + * if not bf.is_prunable(): + * continue + * bf.prune() # <<<<<<<<<<<<<< + * self.basis.weighted_transform(X, B, weights) + * beta, mse = np.linalg.lstsq(B[:,0:pruned_basis_size],weighted_y)[0:2] + */ + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_bf, __pyx_n_s__prune); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_14 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + + /* "_pruning.pyx":74 + * continue + * bf.prune() + * self.basis.weighted_transform(X, B, weights) # <<<<<<<<<<<<<< + * beta, mse = np.linalg.lstsq(B[:,0:pruned_basis_size],weighted_y)[0:2] + * if mse: + */ + __pyx_t_14 = ((struct __pyx_vtabstruct_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->weighted_transform(__pyx_v_self->basis, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_B), ((PyArrayObject *)__pyx_v_weights), 0); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + + /* "_pruning.pyx":75 + * bf.prune() + * self.basis.weighted_transform(X, B, weights) + * beta, mse = np.linalg.lstsq(B[:,0:pruned_basis_size],weighted_y)[0:2] # <<<<<<<<<<<<<< + * if mse: + * mse /= self.m + */ + __pyx_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s__linalg); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__lstsq); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_pruned_basis_size); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_9 = PySlice_New(__pyx_int_0, __pyx_t_10, Py_None); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_INCREF(__pyx_k_slice_4); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_k_slice_4); + __Pyx_GIVEREF(__pyx_k_slice_4); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_9 = 0; + __pyx_t_9 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_10)); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __Pyx_INCREF(((PyObject *)__pyx_v_weighted_y)); + PyTuple_SET_ITEM(__pyx_t_10, 1, ((PyObject *)__pyx_v_weighted_y)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_weighted_y)); + __pyx_t_9 = 0; + __pyx_t_9 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_PyObject_GetSlice(__pyx_t_9, 0, 2, NULL, NULL, &__pyx_k_slice_5, 1, 1, 0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if ((likely(PyTuple_CheckExact(__pyx_t_10))) || (PyList_CheckExact(__pyx_t_10))) { + PyObject* sequence = __pyx_t_10; + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + if (likely(PyTuple_CheckExact(sequence))) { + __pyx_t_9 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_14 = PyTuple_GET_ITEM(sequence, 1); + } else { + __pyx_t_9 = PyList_GET_ITEM(sequence, 0); + __pyx_t_14 = PyList_GET_ITEM(sequence, 1); + } + __Pyx_INCREF(__pyx_t_9); + __Pyx_INCREF(__pyx_t_14); + #else + __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_14 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + #endif + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + } else + { + Py_ssize_t index = -1; + __pyx_t_2 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_11 = Py_TYPE(__pyx_t_2)->tp_iternext; + index = 0; __pyx_t_9 = __pyx_t_11(__pyx_t_2); if (unlikely(!__pyx_t_9)) goto __pyx_L12_unpacking_failed; + __Pyx_GOTREF(__pyx_t_9); + index = 1; __pyx_t_14 = __pyx_t_11(__pyx_t_2); if (unlikely(!__pyx_t_14)) goto __pyx_L12_unpacking_failed; + __Pyx_GOTREF(__pyx_t_14); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_2), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = NULL; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L13_unpacking_done; + __pyx_L12_unpacking_failed:; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_11 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L13_unpacking_done:; + } + __Pyx_DECREF(__pyx_v_beta); + __pyx_v_beta = __pyx_t_9; + __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_v_mse); + __pyx_v_mse = __pyx_t_14; + __pyx_t_14 = 0; + + /* "_pruning.pyx":76 + * self.basis.weighted_transform(X, B, weights) + * beta, mse = np.linalg.lstsq(B[:,0:pruned_basis_size],weighted_y)[0:2] + * if mse: # <<<<<<<<<<<<<< + * mse /= self.m + * else: + */ + __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_v_mse); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_19) { + + /* "_pruning.pyx":77 + * beta, mse = np.linalg.lstsq(B[:,0:pruned_basis_size],weighted_y)[0:2] + * if mse: + * mse /= self.m # <<<<<<<<<<<<<< + * else: + * mse = (1/float(self.m))*np.sum((np.dot(B[:,0:pruned_basis_size],beta) - weighted_y)**2) + */ + __pyx_t_10 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_14 = __Pyx_PyNumber_InPlaceDivide(__pyx_v_mse, __pyx_t_10); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_v_mse); + __pyx_v_mse = __pyx_t_14; + __pyx_t_14 = 0; + goto __pyx_L14; + } + /*else*/ { + + /* "_pruning.pyx":79 + * mse /= self.m + * else: + * mse = (1/float(self.m))*np.sum((np.dot(B[:,0:pruned_basis_size],beta) - weighted_y)**2) # <<<<<<<<<<<<<< + * gcv_ = gcv(mse,pruned_basis_size,self.m,self.penalty) + * + */ + __pyx_t_14 = PyFloat_FromDouble((1.0 / ((double)__pyx_v_self->m))); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__sum); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_pruned_basis_size); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_13 = PySlice_New(__pyx_int_0, __pyx_t_10, Py_None); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_INCREF(__pyx_k_slice_6); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_k_slice_6); + __Pyx_GIVEREF(__pyx_k_slice_6); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_13); + __Pyx_GIVEREF(__pyx_t_13); + __pyx_t_13 = 0; + __pyx_t_13 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_10)); if (!__pyx_t_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_13); + __Pyx_GIVEREF(__pyx_t_13); + __Pyx_INCREF(__pyx_v_beta); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_beta); + __Pyx_GIVEREF(__pyx_v_beta); + __pyx_t_13 = 0; + __pyx_t_13 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __pyx_t_10 = PyNumber_Subtract(__pyx_t_13, ((PyObject *)__pyx_v_weighted_y)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = PyNumber_Power(__pyx_t_10, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_13); + __Pyx_GIVEREF(__pyx_t_13); + __pyx_t_13 = 0; + __pyx_t_13 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __pyx_t_10 = PyNumber_Multiply(__pyx_t_14, __pyx_t_13); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(__pyx_v_mse); + __pyx_v_mse = __pyx_t_10; + __pyx_t_10 = 0; + } + __pyx_L14:; + + /* "_pruning.pyx":80 + * else: + * mse = (1/float(self.m))*np.sum((np.dot(B[:,0:pruned_basis_size],beta) - weighted_y)**2) + * gcv_ = gcv(mse,pruned_basis_size,self.m,self.penalty) # <<<<<<<<<<<<<< + * + * if gcv_ <= best_iteration_gcv or first: + */ + __pyx_t_20 = __pyx_PyFloat_AsDouble(__pyx_v_mse); if (unlikely((__pyx_t_20 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_gcv_ = __pyx_f_5_util_gcv(__pyx_t_20, __pyx_v_pruned_basis_size, __pyx_v_self->m, __pyx_v_self->penalty, 0); + + /* "_pruning.pyx":82 + * gcv_ = gcv(mse,pruned_basis_size,self.m,self.penalty) + * + * if gcv_ <= best_iteration_gcv or first: # <<<<<<<<<<<<<< + * best_iteration_gcv = gcv_ + * best_iteration_mse = mse + */ + __pyx_t_19 = (__pyx_v_gcv_ <= __pyx_v_best_iteration_gcv); + if (!__pyx_t_19) { + __pyx_t_12 = __pyx_v_first; + } else { + __pyx_t_12 = __pyx_t_19; + } + if (__pyx_t_12) { + + /* "_pruning.pyx":83 + * + * if gcv_ <= best_iteration_gcv or first: + * best_iteration_gcv = gcv_ # <<<<<<<<<<<<<< + * best_iteration_mse = mse + * best_bf_to_prune = j + */ + __pyx_v_best_iteration_gcv = __pyx_v_gcv_; + + /* "_pruning.pyx":84 + * if gcv_ <= best_iteration_gcv or first: + * best_iteration_gcv = gcv_ + * best_iteration_mse = mse # <<<<<<<<<<<<<< + * best_bf_to_prune = j + * first = False + */ + __pyx_t_21 = __pyx_PyFloat_AsDouble(__pyx_v_mse); if (unlikely((__pyx_t_21 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_best_iteration_mse = __pyx_t_21; + + /* "_pruning.pyx":85 + * best_iteration_gcv = gcv_ + * best_iteration_mse = mse + * best_bf_to_prune = j # <<<<<<<<<<<<<< + * first = False + * bf.unprune() + */ + __pyx_v_best_bf_to_prune = __pyx_v_j; + + /* "_pruning.pyx":86 + * best_iteration_mse = mse + * best_bf_to_prune = j + * first = False # <<<<<<<<<<<<<< + * bf.unprune() + * + */ + __pyx_v_first = 0; + goto __pyx_L15; + } + __pyx_L15:; + + /* "_pruning.pyx":87 + * best_bf_to_prune = j + * first = False + * bf.unprune() # <<<<<<<<<<<<<< + * + * #The inner loop found the best basis function to remove for this iteration. + */ + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_bf, __pyx_n_s__unprune); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_13 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_L8_continue:; + } + + /* "_pruning.pyx":91 + * #The inner loop found the best basis function to remove for this iteration. + * #Now check whether this iteration is better than all the previous ones. + * if best_iteration_gcv <= best_gcv: # <<<<<<<<<<<<<< + * best_gcv = best_iteration_gcv + * best_iteration = i + */ + __pyx_t_12 = (__pyx_v_best_iteration_gcv <= __pyx_v_best_gcv); + if (__pyx_t_12) { + + /* "_pruning.pyx":92 + * #Now check whether this iteration is better than all the previous ones. + * if best_iteration_gcv <= best_gcv: + * best_gcv = best_iteration_gcv # <<<<<<<<<<<<<< + * best_iteration = i + * + */ + __pyx_v_best_gcv = __pyx_v_best_iteration_gcv; + + /* "_pruning.pyx":93 + * if best_iteration_gcv <= best_gcv: + * best_gcv = best_iteration_gcv + * best_iteration = i # <<<<<<<<<<<<<< + * + * #Update the record and prune the selected basis function + */ + __pyx_v_best_iteration = __pyx_v_i; + goto __pyx_L16; + } + __pyx_L16:; + + /* "_pruning.pyx":96 + * + * #Update the record and prune the selected basis function + * self.record.append(PruningPassIteration(best_bf_to_prune,pruned_basis_size,best_iteration_mse)) # <<<<<<<<<<<<<< + * self.basis[best_bf_to_prune].prune() + * + */ + __pyx_t_13 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_best_bf_to_prune); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_10 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_pruned_basis_size); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_14 = PyFloat_FromDouble(__pyx_v_best_iteration_mse); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_13); + __Pyx_GIVEREF(__pyx_t_13); + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_14); + __Pyx_GIVEREF(__pyx_t_14); + __pyx_t_13 = 0; + __pyx_t_10 = 0; + __pyx_t_14 = 0; + __pyx_t_14 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7_record_PruningPassIteration)), ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + __pyx_t_9 = ((struct __pyx_vtabstruct_7_record_PruningPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->__pyx_base.append(((struct __pyx_obj_7_record_Record *)__pyx_v_self->record), ((struct __pyx_obj_7_record_Iteration *)__pyx_t_14), 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "_pruning.pyx":97 + * #Update the record and prune the selected basis function + * self.record.append(PruningPassIteration(best_bf_to_prune,pruned_basis_size,best_iteration_mse)) + * self.basis[best_bf_to_prune].prune() # <<<<<<<<<<<<<< + * + * #Unprune the basis functions pruned after the best iteration + */ + __pyx_t_9 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->basis), __pyx_v_best_bf_to_prune, sizeof(__pyx_t_8_pruning_INDEX_t)+1, __Pyx_PyInt_to_py_npy_ulonglong, 0, 0, 0); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__prune); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + + /* "_pruning.pyx":100 + * + * #Unprune the basis functions pruned after the best iteration + * self.record.set_selected(best_iteration) # <<<<<<<<<<<<<< + * self.record.roll_back(self.basis) + * + */ + __pyx_t_9 = ((struct __pyx_vtabstruct_7_record_PruningPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->set_selected(__pyx_v_self->record, __pyx_v_best_iteration, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + + /* "_pruning.pyx":101 + * #Unprune the basis functions pruned after the best iteration + * self.record.set_selected(best_iteration) + * self.record.roll_back(self.basis) # <<<<<<<<<<<<<< + * + * cpdef PruningPassRecord trace(PruningPasser self): + */ + __pyx_t_9 = ((PyObject *)__pyx_v_self->basis); + __Pyx_INCREF(__pyx_t_9); + __pyx_t_14 = ((struct __pyx_vtabstruct_7_record_PruningPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->roll_back(__pyx_v_self->record, ((struct __pyx_obj_6_basis_Basis *)__pyx_t_9), 0); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_14); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_13); + __Pyx_XDECREF(__pyx_t_14); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_B.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weighted_y.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("_pruning.PruningPasser.run", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_B.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weighted_y.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_B); + __Pyx_XDECREF((PyObject *)__pyx_v_X); + __Pyx_XDECREF((PyObject *)__pyx_v_y); + __Pyx_XDECREF((PyObject *)__pyx_v_weights); + __Pyx_XDECREF((PyObject *)__pyx_v_weighted_y); + __Pyx_XDECREF(__pyx_v_beta); + __Pyx_XDECREF(__pyx_v_mse); + __Pyx_XDECREF(__pyx_v_bf); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_8_pruning_13PruningPasser_3run(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_8_pruning_13PruningPasser_3run(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("run (wrapper)", 0); + __pyx_r = __pyx_pf_8_pruning_13PruningPasser_2run(((struct __pyx_obj_8_pruning_PruningPasser *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_pruning.pyx":24 + * self.sst = np.sum(self.weights*(self.y - np.average(self.y,weights=self.weights))**2) / self.m + * + * cpdef run(PruningPasser self): # <<<<<<<<<<<<<< + * #This is a totally naive implementation and could potentially be made faster + * #through the use of updating algorithms. It is not clear that such + */ + +static PyObject *__pyx_pf_8_pruning_13PruningPasser_2run(struct __pyx_obj_8_pruning_PruningPasser *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("run", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_8_pruning_PruningPasser *)__pyx_v_self->__pyx_vtab)->run(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_pruning.PruningPasser.run", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_pruning.pyx":103 + * self.record.roll_back(self.basis) + * + * cpdef PruningPassRecord trace(PruningPasser self): # <<<<<<<<<<<<<< + * return self.record + * + */ + +static PyObject *__pyx_pw_8_pruning_13PruningPasser_5trace(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static struct __pyx_obj_7_record_PruningPassRecord *__pyx_f_8_pruning_13PruningPasser_trace(struct __pyx_obj_8_pruning_PruningPasser *__pyx_v_self, int __pyx_skip_dispatch) { + struct __pyx_obj_7_record_PruningPassRecord *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("trace", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__trace); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8_pruning_13PruningPasser_5trace)) { + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7_record_PruningPassRecord))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((struct __pyx_obj_7_record_PruningPassRecord *)__pyx_t_2); + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_pruning.pyx":104 + * + * cpdef PruningPassRecord trace(PruningPasser self): + * return self.record # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __Pyx_INCREF(((PyObject *)__pyx_v_self->record)); + __pyx_r = __pyx_v_self->record; + goto __pyx_L0; + + __pyx_r = ((struct __pyx_obj_7_record_PruningPassRecord *)Py_None); __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("_pruning.PruningPasser.trace", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF((PyObject *)__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_8_pruning_13PruningPasser_5trace(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_8_pruning_13PruningPasser_5trace(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("trace (wrapper)", 0); + __pyx_r = __pyx_pf_8_pruning_13PruningPasser_4trace(((struct __pyx_obj_8_pruning_PruningPasser *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_pruning.pyx":103 + * self.record.roll_back(self.basis) + * + * cpdef PruningPassRecord trace(PruningPasser self): # <<<<<<<<<<<<<< + * return self.record + * + */ + +static PyObject *__pyx_pf_8_pruning_13PruningPasser_4trace(struct __pyx_obj_8_pruning_PruningPasser *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("trace", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8_pruning_PruningPasser *)__pyx_v_self->__pyx_vtab)->trace(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_pruning.PruningPasser.trace", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":194 + * # experimental exception made for __getbuffer__ and __releasebuffer__ + * # -- the details of this may change. + * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< + * # This implementation of getbuffer is geared towards Cython + * # requirements, and does not yet fullfill the PEP. + */ + +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_v_copy_shape; + int __pyx_v_i; + int __pyx_v_ndim; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; + int __pyx_v_t; + char *__pyx_v_f; + PyArray_Descr *__pyx_v_descr = 0; + int __pyx_v_offset; + int __pyx_v_hasfields; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + char *__pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getbuffer__", 0); + if (__pyx_v_info != NULL) { + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + } + + /* "numpy.pxd":200 + * # of flags + * + * if info == NULL: return # <<<<<<<<<<<<<< + * + * cdef int copy_shape, i, ndim + */ + __pyx_t_1 = (__pyx_v_info == NULL); + if (__pyx_t_1) { + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "numpy.pxd":203 + * + * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + */ + __pyx_v_endian_detector = 1; + + /* "numpy.pxd":204 + * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * + * ndim = PyArray_NDIM(self) + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "numpy.pxd":206 + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + */ + __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); + + /* "numpy.pxd":208 + * ndim = PyArray_NDIM(self) + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< + * copy_shape = 1 + * else: + */ + __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_1) { + + /* "numpy.pxd":209 + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * copy_shape = 1 # <<<<<<<<<<<<<< + * else: + * copy_shape = 0 + */ + __pyx_v_copy_shape = 1; + goto __pyx_L4; + } + /*else*/ { + + /* "numpy.pxd":211 + * copy_shape = 1 + * else: + * copy_shape = 0 # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + */ + __pyx_v_copy_shape = 0; + } + __pyx_L4:; + + /* "numpy.pxd":213 + * copy_shape = 0 + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") + */ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); + if (__pyx_t_1) { + + /* "numpy.pxd":214 + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not C contiguous") + * + */ + __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS)); + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + + /* "numpy.pxd":215 + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + */ + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "numpy.pxd":217 + * raise ValueError(u"ndarray is not C contiguous") + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") + */ + __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); + if (__pyx_t_3) { + + /* "numpy.pxd":218 + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not Fortran contiguous") + * + */ + __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS)); + __pyx_t_2 = __pyx_t_1; + } else { + __pyx_t_2 = __pyx_t_3; + } + if (__pyx_t_2) { + + /* "numpy.pxd":219 + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * + * info.buf = PyArray_DATA(self) + */ + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "numpy.pxd":221 + * raise ValueError(u"ndarray is not Fortran contiguous") + * + * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< + * info.ndim = ndim + * if copy_shape: + */ + __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); + + /* "numpy.pxd":222 + * + * info.buf = PyArray_DATA(self) + * info.ndim = ndim # <<<<<<<<<<<<<< + * if copy_shape: + * # Allocate new buffer for strides and shape info. + */ + __pyx_v_info->ndim = __pyx_v_ndim; + + /* "numpy.pxd":223 + * info.buf = PyArray_DATA(self) + * info.ndim = ndim + * if copy_shape: # <<<<<<<<<<<<<< + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. + */ + if (__pyx_v_copy_shape) { + + /* "numpy.pxd":226 + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< + * info.shape = info.strides + ndim + * for i in range(ndim): + */ + __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); + + /* "numpy.pxd":227 + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + * info.shape = info.strides + ndim # <<<<<<<<<<<<<< + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] + */ + __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); + + /* "numpy.pxd":228 + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + * info.shape = info.strides + ndim + * for i in range(ndim): # <<<<<<<<<<<<<< + * info.strides[i] = PyArray_STRIDES(self)[i] + * info.shape[i] = PyArray_DIMS(self)[i] + */ + __pyx_t_5 = __pyx_v_ndim; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "numpy.pxd":229 + * info.shape = info.strides + ndim + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< + * info.shape[i] = PyArray_DIMS(self)[i] + * else: + */ + (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); + + /* "numpy.pxd":230 + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] + * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< + * else: + * info.strides = PyArray_STRIDES(self) + */ + (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); + } + goto __pyx_L7; + } + /*else*/ { + + /* "numpy.pxd":232 + * info.shape[i] = PyArray_DIMS(self)[i] + * else: + * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL + */ + __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); + + /* "numpy.pxd":233 + * else: + * info.strides = PyArray_STRIDES(self) + * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) + */ + __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); + } + __pyx_L7:; + + /* "numpy.pxd":234 + * info.strides = PyArray_STRIDES(self) + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL # <<<<<<<<<<<<<< + * info.itemsize = PyArray_ITEMSIZE(self) + * info.readonly = not PyArray_ISWRITEABLE(self) + */ + __pyx_v_info->suboffsets = NULL; + + /* "numpy.pxd":235 + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< + * info.readonly = not PyArray_ISWRITEABLE(self) + * + */ + __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); + + /* "numpy.pxd":236 + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) + * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< + * + * cdef int t + */ + __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self)); + + /* "numpy.pxd":239 + * + * cdef int t + * cdef char* f = NULL # <<<<<<<<<<<<<< + * cdef dtype descr = self.descr + * cdef list stack + */ + __pyx_v_f = NULL; + + /* "numpy.pxd":240 + * cdef int t + * cdef char* f = NULL + * cdef dtype descr = self.descr # <<<<<<<<<<<<<< + * cdef list stack + * cdef int offset + */ + __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); + __Pyx_INCREF(__pyx_t_4); + __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "numpy.pxd":244 + * cdef int offset + * + * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< + * + * if not hasfields and not copy_shape: + */ + __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); + + /* "numpy.pxd":246 + * cdef bint hasfields = PyDataType_HASFIELDS(descr) + * + * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< + * # do not call releasebuffer + * info.obj = None + */ + __pyx_t_2 = (!__pyx_v_hasfields); + if (__pyx_t_2) { + __pyx_t_3 = (!__pyx_v_copy_shape); + __pyx_t_1 = __pyx_t_3; + } else { + __pyx_t_1 = __pyx_t_2; + } + if (__pyx_t_1) { + + /* "numpy.pxd":248 + * if not hasfields and not copy_shape: + * # do not call releasebuffer + * info.obj = None # <<<<<<<<<<<<<< + * else: + * # need to call releasebuffer + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = Py_None; + goto __pyx_L10; + } + /*else*/ { + + /* "numpy.pxd":251 + * else: + * # need to call releasebuffer + * info.obj = self # <<<<<<<<<<<<<< + * + * if not hasfields: + */ + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); + } + __pyx_L10:; + + /* "numpy.pxd":253 + * info.obj = self + * + * if not hasfields: # <<<<<<<<<<<<<< + * t = descr.type_num + * if ((descr.byteorder == c'>' and little_endian) or + */ + __pyx_t_1 = (!__pyx_v_hasfields); + if (__pyx_t_1) { + + /* "numpy.pxd":254 + * + * if not hasfields: + * t = descr.type_num # <<<<<<<<<<<<<< + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): + */ + __pyx_t_5 = __pyx_v_descr->type_num; + __pyx_v_t = __pyx_t_5; + + /* "numpy.pxd":255 + * if not hasfields: + * t = descr.type_num + * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + */ + __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); + if (__pyx_t_1) { + __pyx_t_2 = __pyx_v_little_endian; + } else { + __pyx_t_2 = __pyx_t_1; + } + if (!__pyx_t_2) { + + /* "numpy.pxd":256 + * t = descr.type_num + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" + */ + __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); + if (__pyx_t_1) { + __pyx_t_3 = (!__pyx_v_little_endian); + __pyx_t_7 = __pyx_t_3; + } else { + __pyx_t_7 = __pyx_t_1; + } + __pyx_t_1 = __pyx_t_7; + } else { + __pyx_t_1 = __pyx_t_2; + } + if (__pyx_t_1) { + + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_12), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; + } + __pyx_L12:; + + /* "numpy.pxd":274 + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" + * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + */ + switch (__pyx_v_t) { + + /* "numpy.pxd":258 + * (descr.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" + */ + case NPY_BYTE: + __pyx_v_f = __pyx_k__b; + break; + + /* "numpy.pxd":259 + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" + */ + case NPY_UBYTE: + __pyx_v_f = __pyx_k__B; + break; + + /* "numpy.pxd":260 + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" + */ + case NPY_SHORT: + __pyx_v_f = __pyx_k__h; + break; + + /* "numpy.pxd":261 + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" + */ + case NPY_USHORT: + __pyx_v_f = __pyx_k__H; + break; + + /* "numpy.pxd":262 + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" + */ + case NPY_INT: + __pyx_v_f = __pyx_k__i; + break; + + /* "numpy.pxd":263 + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" + */ + case NPY_UINT: + __pyx_v_f = __pyx_k__I; + break; + + /* "numpy.pxd":264 + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" + */ + case NPY_LONG: + __pyx_v_f = __pyx_k__l; + break; + + /* "numpy.pxd":265 + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" + */ + case NPY_ULONG: + __pyx_v_f = __pyx_k__L; + break; + + /* "numpy.pxd":266 + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" + */ + case NPY_LONGLONG: + __pyx_v_f = __pyx_k__q; + break; + + /* "numpy.pxd":267 + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" + */ + case NPY_ULONGLONG: + __pyx_v_f = __pyx_k__Q; + break; + + /* "numpy.pxd":268 + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" + */ + case NPY_FLOAT: + __pyx_v_f = __pyx_k__f; + break; + + /* "numpy.pxd":269 + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" + */ + case NPY_DOUBLE: + __pyx_v_f = __pyx_k__d; + break; + + /* "numpy.pxd":270 + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" + */ + case NPY_LONGDOUBLE: + __pyx_v_f = __pyx_k__g; + break; + + /* "numpy.pxd":271 + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" + */ + case NPY_CFLOAT: + __pyx_v_f = __pyx_k__Zf; + break; + + /* "numpy.pxd":272 + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< + * elif t == NPY_CLONGDOUBLE: f = "Zg" + * elif t == NPY_OBJECT: f = "O" + */ + case NPY_CDOUBLE: + __pyx_v_f = __pyx_k__Zd; + break; + + /* "numpy.pxd":273 + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< + * elif t == NPY_OBJECT: f = "O" + * else: + */ + case NPY_CLONGDOUBLE: + __pyx_v_f = __pyx_k__Zg; + break; + + /* "numpy.pxd":274 + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" + * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + */ + case NPY_OBJECT: + __pyx_v_f = __pyx_k__O; + break; + default: + + /* "numpy.pxd":276 + * elif t == NPY_OBJECT: f = "O" + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * info.format = f + * return + */ + __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_13), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + + /* "numpy.pxd":277 + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * info.format = f # <<<<<<<<<<<<<< + * return + * else: + */ + __pyx_v_info->format = __pyx_v_f; + + /* "numpy.pxd":278 + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * info.format = f + * return # <<<<<<<<<<<<<< + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L11; + } + /*else*/ { + + /* "numpy.pxd":280 + * return + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< + * info.format[0] = c'^' # Native data types, manual alignment + * offset = 0 + */ + __pyx_v_info->format = ((char *)malloc(255)); + + /* "numpy.pxd":281 + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) + * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * offset = 0 + * f = _util_dtypestring(descr, info.format + 1, + */ + (__pyx_v_info->format[0]) = '^'; + + /* "numpy.pxd":282 + * info.format = stdlib.malloc(_buffer_format_string_len) + * info.format[0] = c'^' # Native data types, manual alignment + * offset = 0 # <<<<<<<<<<<<<< + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + */ + __pyx_v_offset = 0; + + /* "numpy.pxd":285 + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + * &offset) # <<<<<<<<<<<<<< + * f[0] = c'\0' # Terminate format string + * + */ + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_9; + + /* "numpy.pxd":286 + * info.format + _buffer_format_string_len, + * &offset) + * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< + * + * def __releasebuffer__(ndarray self, Py_buffer* info): + */ + (__pyx_v_f[0]) = '\x00'; + } + __pyx_L11:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; + } + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(Py_None); + __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; + } + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_descr); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); + __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":288 + * f[0] = c'\0' # Terminate format string + * + * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + */ + +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("__releasebuffer__", 0); + + /* "numpy.pxd":289 + * + * def __releasebuffer__(ndarray self, Py_buffer* info): + * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + */ + __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self); + if (__pyx_t_1) { + + /* "numpy.pxd":290 + * def __releasebuffer__(ndarray self, Py_buffer* info): + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) # <<<<<<<<<<<<<< + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * stdlib.free(info.strides) + */ + free(__pyx_v_info->format); + goto __pyx_L3; + } + __pyx_L3:; + + /* "numpy.pxd":291 + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< + * stdlib.free(info.strides) + * # info.shape was stored after info.strides in the same block + */ + __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_1) { + + /* "numpy.pxd":292 + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * stdlib.free(info.strides) # <<<<<<<<<<<<<< + * # info.shape was stored after info.strides in the same block + * + */ + free(__pyx_v_info->strides); + goto __pyx_L4; + } + __pyx_L4:; + + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":768 + * ctypedef npy_cdouble complex_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); + + /* "numpy.pxd":769 + * + * cdef inline object PyArray_MultiIterNew1(a): + * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew2(a, b): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":771 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); + + /* "numpy.pxd":772 + * + * cdef inline object PyArray_MultiIterNew2(a, b): + * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":774 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); + + /* "numpy.pxd":775 + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":777 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); + + /* "numpy.pxd":778 + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":780 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); + + /* "numpy.pxd":781 + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":783 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< + * # Recursive utility function used in __getbuffer__ to get format + * # string. The new location in the format string is returned. + */ + +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { + PyArray_Descr *__pyx_v_child = 0; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; + PyObject *__pyx_v_fields = 0; + PyObject *__pyx_v_childname = NULL; + PyObject *__pyx_v_new_offset = NULL; + PyObject *__pyx_v_t = NULL; + char *__pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *(*__pyx_t_6)(PyObject *); + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + long __pyx_t_11; + char *__pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_util_dtypestring", 0); + + /* "numpy.pxd":790 + * cdef int delta_offset + * cdef tuple i + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * cdef tuple fields + */ + __pyx_v_endian_detector = 1; + + /* "numpy.pxd":791 + * cdef tuple i + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * cdef tuple fields + * + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "numpy.pxd":794 + * cdef tuple fields + * + * for childname in descr.names: # <<<<<<<<<<<<<< + * fields = descr.fields[childname] + * child, new_offset = fields + */ + if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; + for (;;) { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + __Pyx_XDECREF(__pyx_v_childname); + __pyx_v_childname = __pyx_t_3; + __pyx_t_3 = 0; + + /* "numpy.pxd":795 + * + * for childname in descr.names: + * fields = descr.fields[childname] # <<<<<<<<<<<<<< + * child, new_offset = fields + * + */ + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); + __pyx_v_fields = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + + /* "numpy.pxd":796 + * for childname in descr.names: + * fields = descr.fields[childname] + * child, new_offset = fields # <<<<<<<<<<<<<< + * + * if (end - f) - (new_offset - offset[0]) < 15: + */ + if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { + PyObject* sequence = ((PyObject *)__pyx_v_fields); + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + #else + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + #endif + } else if (1) { + __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else + { + Py_ssize_t index = -1; + __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_fields)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; + index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = NULL; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L6_unpacking_done; + __pyx_L5_unpacking_failed:; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L6_unpacking_done:; + } + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_child)); + __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); + __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_v_new_offset); + __pyx_v_new_offset = __pyx_t_4; + __pyx_t_4 = 0; + + /* "numpy.pxd":798 + * child, new_offset = fields + * + * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") + * + */ + __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + + /* "numpy.pxd":799 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == c'>' and little_endian) or + */ + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_15), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + /* "numpy.pxd":801 + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") + * + * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (child.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + */ + __pyx_t_7 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_7) { + __pyx_t_8 = __pyx_v_little_endian; + } else { + __pyx_t_8 = __pyx_t_7; + } + if (!__pyx_t_8) { + + /* "numpy.pxd":802 + * + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError(u"Non-native byte order not supported") + * # One could encode it in the format string and have Cython + */ + __pyx_t_7 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_7) { + __pyx_t_9 = (!__pyx_v_little_endian); + __pyx_t_10 = __pyx_t_9; + } else { + __pyx_t_10 = __pyx_t_7; + } + __pyx_t_7 = __pyx_t_10; + } else { + __pyx_t_7 = __pyx_t_8; + } + if (__pyx_t_7) { + + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + + /* "numpy.pxd":813 + * + * # Output padding bytes + * while offset[0] < new_offset: # <<<<<<<<<<<<<< + * f[0] = 120 # "x"; pad byte + * f += 1 + */ + while (1) { + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!__pyx_t_7) break; + + /* "numpy.pxd":814 + * # Output padding bytes + * while offset[0] < new_offset: + * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< + * f += 1 + * offset[0] += 1 + */ + (__pyx_v_f[0]) = 120; + + /* "numpy.pxd":815 + * while offset[0] < new_offset: + * f[0] = 120 # "x"; pad byte + * f += 1 # <<<<<<<<<<<<<< + * offset[0] += 1 + * + */ + __pyx_v_f = (__pyx_v_f + 1); + + /* "numpy.pxd":816 + * f[0] = 120 # "x"; pad byte + * f += 1 + * offset[0] += 1 # <<<<<<<<<<<<<< + * + * offset[0] += child.itemsize + */ + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1); + } + + /* "numpy.pxd":818 + * offset[0] += 1 + * + * offset[0] += child.itemsize # <<<<<<<<<<<<<< + * + * if not PyDataType_HASFIELDS(child): + */ + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize); + + /* "numpy.pxd":820 + * offset[0] += child.itemsize + * + * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< + * t = child.type_num + * if end - f < 5: + */ + __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_7) { + + /* "numpy.pxd":821 + * + * if not PyDataType_HASFIELDS(child): + * t = child.type_num # <<<<<<<<<<<<<< + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") + */ + __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_v_t); + __pyx_v_t = __pyx_t_3; + __pyx_t_3 = 0; + + /* "numpy.pxd":822 + * if not PyDataType_HASFIELDS(child): + * t = child.type_num + * if end - f < 5: # <<<<<<<<<<<<<< + * raise RuntimeError(u"Format string allocated too short.") + * + */ + __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_7) { + + /* "numpy.pxd":823 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings + */ + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; + } + __pyx_L12:; + + /* "numpy.pxd":826 + * + * # Until ticket #99 is fixed, use integers to avoid warnings + * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" + */ + __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 98; + goto __pyx_L13; + } + + /* "numpy.pxd":827 + * # Until ticket #99 is fixed, use integers to avoid warnings + * if t == NPY_BYTE: f[0] = 98 #"b" + * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" + */ + __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 66; + goto __pyx_L13; + } + + /* "numpy.pxd":828 + * if t == NPY_BYTE: f[0] = 98 #"b" + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" + */ + __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 104; + goto __pyx_L13; + } + + /* "numpy.pxd":829 + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" + */ + __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 72; + goto __pyx_L13; + } + + /* "numpy.pxd":830 + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" + */ + __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 105; + goto __pyx_L13; + } + + /* "numpy.pxd":831 + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" + */ + __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 73; + goto __pyx_L13; + } + + /* "numpy.pxd":832 + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + */ + __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 108; + goto __pyx_L13; + } + + /* "numpy.pxd":833 + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + */ + __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 76; + goto __pyx_L13; + } + + /* "numpy.pxd":834 + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" + */ + __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 113; + goto __pyx_L13; + } + + /* "numpy.pxd":835 + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + */ + __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 81; + goto __pyx_L13; + } + + /* "numpy.pxd":836 + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + */ + __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 102; + goto __pyx_L13; + } + + /* "numpy.pxd":837 + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + */ + __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 100; + goto __pyx_L13; + } + + /* "numpy.pxd":838 + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + */ + __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 103; + goto __pyx_L13; + } + + /* "numpy.pxd":839 + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + */ + __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 102; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; + } + + /* "numpy.pxd":840 + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + * elif t == NPY_OBJECT: f[0] = 79 #"O" + */ + __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 100; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; + } + + /* "numpy.pxd":841 + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: + */ + __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 103; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; + } + + /* "numpy.pxd":842 + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + */ + __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 79; + goto __pyx_L13; + } + /*else*/ { + + /* "numpy.pxd":844 + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * f += 1 + * else: + */ + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_13), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L13:; + + /* "numpy.pxd":845 + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * f += 1 # <<<<<<<<<<<<<< + * else: + * # Cython ignores struct boundary information ("T{...}"), + */ + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L11; + } + /*else*/ { + + /* "numpy.pxd":849 + * # Cython ignores struct boundary information ("T{...}"), + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< + * return f + * + */ + __pyx_t_12 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_12; + } + __pyx_L11:; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "numpy.pxd":850 + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) + * return f # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_f; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_child); + __Pyx_XDECREF(__pyx_v_fields); + __Pyx_XDECREF(__pyx_v_childname); + __Pyx_XDECREF(__pyx_v_new_offset); + __Pyx_XDECREF(__pyx_v_t); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":965 + * + * + * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< + * cdef PyObject* baseptr + * if base is None: + */ + +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { + PyObject *__pyx_v_baseptr; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("set_array_base", 0); + + /* "numpy.pxd":967 + * cdef inline void set_array_base(ndarray arr, object base): + * cdef PyObject* baseptr + * if base is None: # <<<<<<<<<<<<<< + * baseptr = NULL + * else: + */ + __pyx_t_1 = (__pyx_v_base == Py_None); + if (__pyx_t_1) { + + /* "numpy.pxd":968 + * cdef PyObject* baseptr + * if base is None: + * baseptr = NULL # <<<<<<<<<<<<<< + * else: + * Py_INCREF(base) # important to do this before decref below! + */ + __pyx_v_baseptr = NULL; + goto __pyx_L3; + } + /*else*/ { + + /* "numpy.pxd":970 + * baseptr = NULL + * else: + * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< + * baseptr = base + * Py_XDECREF(arr.base) + */ + Py_INCREF(__pyx_v_base); + + /* "numpy.pxd":971 + * else: + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base # <<<<<<<<<<<<<< + * Py_XDECREF(arr.base) + * arr.base = baseptr + */ + __pyx_v_baseptr = ((PyObject *)__pyx_v_base); + } + __pyx_L3:; + + /* "numpy.pxd":972 + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base + * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< + * arr.base = baseptr + * + */ + Py_XDECREF(__pyx_v_arr->base); + + /* "numpy.pxd":973 + * baseptr = base + * Py_XDECREF(arr.base) + * arr.base = baseptr # <<<<<<<<<<<<<< + * + * cdef inline object get_array_base(ndarray arr): + */ + __pyx_v_arr->base = __pyx_v_baseptr; + + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":975 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("get_array_base", 0); + + /* "numpy.pxd":976 + * + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: # <<<<<<<<<<<<<< + * return None + * else: + */ + __pyx_t_1 = (__pyx_v_arr->base == NULL); + if (__pyx_t_1) { + + /* "numpy.pxd":977 + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: + * return None # <<<<<<<<<<<<<< + * else: + * return arr.base + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "numpy.pxd":979 + * return None + * else: + * return arr.base # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); + __pyx_r = ((PyObject *)__pyx_v_arr->base); + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static struct __pyx_vtabstruct_8_pruning_PruningPasser __pyx_vtable_8_pruning_PruningPasser; + +static PyObject *__pyx_tp_new_8_pruning_PruningPasser(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_8_pruning_PruningPasser *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_8_pruning_PruningPasser *)o); + p->__pyx_vtab = __pyx_vtabptr_8_pruning_PruningPasser; + p->X = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + p->B = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + p->y = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + p->weights = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + p->basis = ((struct __pyx_obj_6_basis_Basis *)Py_None); Py_INCREF(Py_None); + p->record = ((struct __pyx_obj_7_record_PruningPassRecord *)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_8_pruning_PruningPasser(PyObject *o) { + struct __pyx_obj_8_pruning_PruningPasser *p = (struct __pyx_obj_8_pruning_PruningPasser *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->X); + Py_CLEAR(p->B); + Py_CLEAR(p->y); + Py_CLEAR(p->weights); + Py_CLEAR(p->basis); + Py_CLEAR(p->record); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_8_pruning_PruningPasser(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_8_pruning_PruningPasser *p = (struct __pyx_obj_8_pruning_PruningPasser *)o; + if (p->X) { + e = (*v)(((PyObject*)p->X), a); if (e) return e; + } + if (p->B) { + e = (*v)(((PyObject*)p->B), a); if (e) return e; + } + if (p->y) { + e = (*v)(((PyObject*)p->y), a); if (e) return e; + } + if (p->weights) { + e = (*v)(((PyObject*)p->weights), a); if (e) return e; + } + if (p->basis) { + e = (*v)(((PyObject*)p->basis), a); if (e) return e; + } + if (p->record) { + e = (*v)(((PyObject*)p->record), a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_8_pruning_PruningPasser(PyObject *o) { + struct __pyx_obj_8_pruning_PruningPasser *p = (struct __pyx_obj_8_pruning_PruningPasser *)o; + PyObject* tmp; + tmp = ((PyObject*)p->X); + p->X = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->B); + p->B = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->y); + p->y = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->weights); + p->weights = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->basis); + p->basis = ((struct __pyx_obj_6_basis_Basis *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->record); + p->record = ((struct __pyx_obj_7_record_PruningPassRecord *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_8_pruning_PruningPasser[] = { + {__Pyx_NAMESTR("run"), (PyCFunction)__pyx_pw_8_pruning_13PruningPasser_3run, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("trace"), (PyCFunction)__pyx_pw_8_pruning_13PruningPasser_5trace, METH_NOARGS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_PruningPasser = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_PruningPasser = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_PruningPasser = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_PruningPasser = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_8_pruning_PruningPasser = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("_pruning.PruningPasser"), /*tp_name*/ + sizeof(struct __pyx_obj_8_pruning_PruningPasser), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_8_pruning_PruningPasser, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_PruningPasser, /*tp_as_number*/ + &__pyx_tp_as_sequence_PruningPasser, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_PruningPasser, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_PruningPasser, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + __Pyx_DOCSTR("Implements the generic pruning pass as described by Friedman, 1991."), /*tp_doc*/ + __pyx_tp_traverse_8_pruning_PruningPasser, /*tp_traverse*/ + __pyx_tp_clear_8_pruning_PruningPasser, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_8_pruning_PruningPasser, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_8_pruning_13PruningPasser_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_8_pruning_PruningPasser, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + #if PY_VERSION_HEX < 0x03020000 + { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, + #else + PyModuleDef_HEAD_INIT, + #endif + __Pyx_NAMESTR("_pruning"), + 0, /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0}, + {&__pyx_kp_u_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 1, 0, 0}, + {&__pyx_kp_u_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 1, 0, 0}, + {&__pyx_kp_u_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 1, 0, 0}, + {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0}, + {&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0}, + {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, + {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, + {&__pyx_n_s__X, __pyx_k__X, sizeof(__pyx_k__X), 0, 0, 1, 1}, + {&__pyx_n_s____import__, __pyx_k____import__, sizeof(__pyx_k____import__), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____pyx_getbuffer, __pyx_k____pyx_getbuffer, sizeof(__pyx_k____pyx_getbuffer), 0, 0, 1, 1}, + {&__pyx_n_s____pyx_releasebuffer, __pyx_k____pyx_releasebuffer, sizeof(__pyx_k____pyx_releasebuffer), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s__average, __pyx_k__average, sizeof(__pyx_k__average), 0, 0, 1, 1}, + {&__pyx_n_s__basis, __pyx_k__basis, sizeof(__pyx_k__basis), 0, 0, 1, 1}, + {&__pyx_n_s__copy, __pyx_k__copy, sizeof(__pyx_k__copy), 0, 0, 1, 1}, + {&__pyx_n_s__dot, __pyx_k__dot, sizeof(__pyx_k__dot), 0, 0, 1, 1}, + {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, + {&__pyx_n_s__empty, __pyx_k__empty, sizeof(__pyx_k__empty), 0, 0, 1, 1}, + {&__pyx_n_s__float, __pyx_k__float, sizeof(__pyx_k__float), 0, 0, 1, 1}, + {&__pyx_n_s__is_prunable, __pyx_k__is_prunable, sizeof(__pyx_k__is_prunable), 0, 0, 1, 1}, + {&__pyx_n_s__is_pruned, __pyx_k__is_pruned, sizeof(__pyx_k__is_pruned), 0, 0, 1, 1}, + {&__pyx_n_s__linalg, __pyx_k__linalg, sizeof(__pyx_k__linalg), 0, 0, 1, 1}, + {&__pyx_n_s__lstsq, __pyx_k__lstsq, sizeof(__pyx_k__lstsq), 0, 0, 1, 1}, + {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, + {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, + {&__pyx_n_s__penalty, __pyx_k__penalty, sizeof(__pyx_k__penalty), 0, 0, 1, 1}, + {&__pyx_n_s__prune, __pyx_k__prune, sizeof(__pyx_k__prune), 0, 0, 1, 1}, + {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, + {&__pyx_n_s__run, __pyx_k__run, sizeof(__pyx_k__run), 0, 0, 1, 1}, + {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1}, + {&__pyx_n_s__sum, __pyx_k__sum, sizeof(__pyx_k__sum), 0, 0, 1, 1}, + {&__pyx_n_s__trace, __pyx_k__trace, sizeof(__pyx_k__trace), 0, 0, 1, 1}, + {&__pyx_n_s__unprune, __pyx_k__unprune, sizeof(__pyx_k__unprune), 0, 0, 1, 1}, + {&__pyx_n_s__weights, __pyx_k__weights, sizeof(__pyx_k__weights), 0, 0, 1, 1}, + {&__pyx_n_s__y, __pyx_k__y, sizeof(__pyx_k__y), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + + /* "_pruning.pyx":49 + * apply_weights_1d(weighted_y,weights) + * self.basis.weighted_transform(X,B,weights) + * beta, mse = np.linalg.lstsq(B[:,0:(basis_size)],weighted_y)[0:2] # <<<<<<<<<<<<<< + * if mse: + * mse /= self.m + */ + __pyx_k_slice_1 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_1); + __Pyx_GIVEREF(__pyx_k_slice_1); + __pyx_k_slice_2 = PySlice_New(__pyx_int_0, __pyx_int_2, Py_None); if (unlikely(!__pyx_k_slice_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_2); + __Pyx_GIVEREF(__pyx_k_slice_2); + + /* "_pruning.pyx":53 + * mse /= self.m + * else: + * mse = (1.0/self.m)*np.sum((np.dot(B[:,0:basis_size],beta) - weighted_y)**2) # <<<<<<<<<<<<<< + * + * #Create the record object + */ + __pyx_k_slice_3 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_3); + __Pyx_GIVEREF(__pyx_k_slice_3); + + /* "_pruning.pyx":75 + * bf.prune() + * self.basis.weighted_transform(X, B, weights) + * beta, mse = np.linalg.lstsq(B[:,0:pruned_basis_size],weighted_y)[0:2] # <<<<<<<<<<<<<< + * if mse: + * mse /= self.m + */ + __pyx_k_slice_4 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_4); + __Pyx_GIVEREF(__pyx_k_slice_4); + __pyx_k_slice_5 = PySlice_New(__pyx_int_0, __pyx_int_2, Py_None); if (unlikely(!__pyx_k_slice_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_5); + __Pyx_GIVEREF(__pyx_k_slice_5); + + /* "_pruning.pyx":79 + * mse /= self.m + * else: + * mse = (1/float(self.m))*np.sum((np.dot(B[:,0:pruned_basis_size],beta) - weighted_y)**2) # <<<<<<<<<<<<<< + * gcv_ = gcv(mse,pruned_basis_size,self.m,self.penalty) + * + */ + __pyx_k_slice_6 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_6); + __Pyx_GIVEREF(__pyx_k_slice_6); + + /* "numpy.pxd":215 + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + */ + __pyx_k_tuple_8 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_7)); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_8); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8)); + + /* "numpy.pxd":219 + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * + * info.buf = PyArray_DATA(self) + */ + __pyx_k_tuple_10 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_9)); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_10); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); + + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_k_tuple_12 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_11)); if (unlikely(!__pyx_k_tuple_12)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_12); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_12)); + + /* "numpy.pxd":799 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == c'>' and little_endian) or + */ + __pyx_k_tuple_15 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_14)); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_15); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15)); + + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_k_tuple_16 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_11)); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_16); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16)); + + /* "numpy.pxd":823 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings + */ + __pyx_k_tuple_18 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_17)); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_18); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18)); + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC init_pruning(void); /*proto*/ +PyMODINIT_FUNC init_pruning(void) +#else +PyMODINIT_FUNC PyInit__pruning(void); /*proto*/ +PyMODINIT_FUNC PyInit__pruning(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__pruning(void)", 0); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __Pyx_CyFunction_USED + if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_pruning"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + Py_INCREF(__pyx_d); + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyDict_GetItemString(modules, "_pruning")) { + if (unlikely(PyDict_SetItemString(modules, "_pruning", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if CYTHON_COMPILING_IN_PYPY + Py_INCREF(__pyx_b); + #endif + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) + if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + if (__pyx_module_is_main__pruning) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Global init code ---*/ + /*--- Variable export code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + __pyx_vtabptr_8_pruning_PruningPasser = &__pyx_vtable_8_pruning_PruningPasser; + __pyx_vtable_8_pruning_PruningPasser.run = (PyObject *(*)(struct __pyx_obj_8_pruning_PruningPasser *, int __pyx_skip_dispatch))__pyx_f_8_pruning_13PruningPasser_run; + __pyx_vtable_8_pruning_PruningPasser.trace = (struct __pyx_obj_7_record_PruningPassRecord *(*)(struct __pyx_obj_8_pruning_PruningPasser *, int __pyx_skip_dispatch))__pyx_f_8_pruning_13PruningPasser_trace; + if (PyType_Ready(&__pyx_type_8_pruning_PruningPasser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_8_pruning_PruningPasser.tp_dict, __pyx_vtabptr_8_pruning_PruningPasser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "PruningPasser", (PyObject *)&__pyx_type_8_pruning_PruningPasser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_8_pruning_PruningPasser = &__pyx_type_8_pruning_PruningPasser; + /*--- Type import code ---*/ + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", + #if CYTHON_COMPILING_IN_PYPY + sizeof(PyTypeObject), + #else + sizeof(PyHeapTypeObject), + #endif + 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6_basis_BasisFunction = __Pyx_ImportType("_basis", "BasisFunction", sizeof(struct __pyx_obj_6_basis_BasisFunction), 1); if (unlikely(!__pyx_ptype_6_basis_BasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_6_basis_BasisFunction = (struct __pyx_vtabstruct_6_basis_BasisFunction*)__Pyx_GetVtable(__pyx_ptype_6_basis_BasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_6_basis_BasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6_basis_ConstantBasisFunction = __Pyx_ImportType("_basis", "ConstantBasisFunction", sizeof(struct __pyx_obj_6_basis_ConstantBasisFunction), 1); if (unlikely(!__pyx_ptype_6_basis_ConstantBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_6_basis_ConstantBasisFunction = (struct __pyx_vtabstruct_6_basis_ConstantBasisFunction*)__Pyx_GetVtable(__pyx_ptype_6_basis_ConstantBasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_6_basis_ConstantBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6_basis_HingeBasisFunction = __Pyx_ImportType("_basis", "HingeBasisFunction", sizeof(struct __pyx_obj_6_basis_HingeBasisFunction), 1); if (unlikely(!__pyx_ptype_6_basis_HingeBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_6_basis_HingeBasisFunction = (struct __pyx_vtabstruct_6_basis_HingeBasisFunction*)__Pyx_GetVtable(__pyx_ptype_6_basis_HingeBasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_6_basis_HingeBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6_basis_LinearBasisFunction = __Pyx_ImportType("_basis", "LinearBasisFunction", sizeof(struct __pyx_obj_6_basis_LinearBasisFunction), 1); if (unlikely(!__pyx_ptype_6_basis_LinearBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_6_basis_LinearBasisFunction = (struct __pyx_vtabstruct_6_basis_LinearBasisFunction*)__Pyx_GetVtable(__pyx_ptype_6_basis_LinearBasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_6_basis_LinearBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6_basis_Basis = __Pyx_ImportType("_basis", "Basis", sizeof(struct __pyx_obj_6_basis_Basis), 1); if (unlikely(!__pyx_ptype_6_basis_Basis)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_6_basis_Basis = (struct __pyx_vtabstruct_6_basis_Basis*)__Pyx_GetVtable(__pyx_ptype_6_basis_Basis->tp_dict); if (unlikely(!__pyx_vtabptr_6_basis_Basis)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7_record_Record = __Pyx_ImportType("_record", "Record", sizeof(struct __pyx_obj_7_record_Record), 1); if (unlikely(!__pyx_ptype_7_record_Record)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7_record_Record = (struct __pyx_vtabstruct_7_record_Record*)__Pyx_GetVtable(__pyx_ptype_7_record_Record->tp_dict); if (unlikely(!__pyx_vtabptr_7_record_Record)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7_record_PruningPassRecord = __Pyx_ImportType("_record", "PruningPassRecord", sizeof(struct __pyx_obj_7_record_PruningPassRecord), 1); if (unlikely(!__pyx_ptype_7_record_PruningPassRecord)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7_record_PruningPassRecord = (struct __pyx_vtabstruct_7_record_PruningPassRecord*)__Pyx_GetVtable(__pyx_ptype_7_record_PruningPassRecord->tp_dict); if (unlikely(!__pyx_vtabptr_7_record_PruningPassRecord)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7_record_ForwardPassRecord = __Pyx_ImportType("_record", "ForwardPassRecord", sizeof(struct __pyx_obj_7_record_ForwardPassRecord), 1); if (unlikely(!__pyx_ptype_7_record_ForwardPassRecord)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7_record_ForwardPassRecord = (struct __pyx_vtabstruct_7_record_ForwardPassRecord*)__Pyx_GetVtable(__pyx_ptype_7_record_ForwardPassRecord->tp_dict); if (unlikely(!__pyx_vtabptr_7_record_ForwardPassRecord)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7_record_Iteration = __Pyx_ImportType("_record", "Iteration", sizeof(struct __pyx_obj_7_record_Iteration), 1); if (unlikely(!__pyx_ptype_7_record_Iteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7_record_Iteration = (struct __pyx_vtabstruct_7_record_Iteration*)__Pyx_GetVtable(__pyx_ptype_7_record_Iteration->tp_dict); if (unlikely(!__pyx_vtabptr_7_record_Iteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7_record_PruningPassIteration = __Pyx_ImportType("_record", "PruningPassIteration", sizeof(struct __pyx_obj_7_record_PruningPassIteration), 1); if (unlikely(!__pyx_ptype_7_record_PruningPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7_record_PruningPassIteration = (struct __pyx_vtabstruct_7_record_PruningPassIteration*)__Pyx_GetVtable(__pyx_ptype_7_record_PruningPassIteration->tp_dict); if (unlikely(!__pyx_vtabptr_7_record_PruningPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7_record_FirstPruningPassIteration = __Pyx_ImportType("_record", "FirstPruningPassIteration", sizeof(struct __pyx_obj_7_record_FirstPruningPassIteration), 1); if (unlikely(!__pyx_ptype_7_record_FirstPruningPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7_record_FirstPruningPassIteration = (struct __pyx_vtabstruct_7_record_FirstPruningPassIteration*)__Pyx_GetVtable(__pyx_ptype_7_record_FirstPruningPassIteration->tp_dict); if (unlikely(!__pyx_vtabptr_7_record_FirstPruningPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7_record_ForwardPassIteration = __Pyx_ImportType("_record", "ForwardPassIteration", sizeof(struct __pyx_obj_7_record_ForwardPassIteration), 1); if (unlikely(!__pyx_ptype_7_record_ForwardPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7_record_ForwardPassIteration = (struct __pyx_vtabstruct_7_record_ForwardPassIteration*)__Pyx_GetVtable(__pyx_ptype_7_record_ForwardPassIteration->tp_dict); if (unlikely(!__pyx_vtabptr_7_record_ForwardPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7_record_FirstForwardPassIteration = __Pyx_ImportType("_record", "FirstForwardPassIteration", sizeof(struct __pyx_obj_7_record_FirstForwardPassIteration), 1); if (unlikely(!__pyx_ptype_7_record_FirstForwardPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7_record_FirstForwardPassIteration = (struct __pyx_vtabstruct_7_record_FirstForwardPassIteration*)__Pyx_GetVtable(__pyx_ptype_7_record_FirstForwardPassIteration->tp_dict); if (unlikely(!__pyx_vtabptr_7_record_FirstForwardPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Variable import code ---*/ + /*--- Function import code ---*/ + __pyx_t_1 = __Pyx_ImportModule("_util"); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_t_1, "apply_weights_1d", (void (**)(void))&__pyx_f_5_util_apply_weights_1d, "PyObject *(PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_t_1, "gcv", (void (**)(void))&__pyx_f_5_util_gcv, "__pyx_t_5_util_FLOAT_t (__pyx_t_5_util_FLOAT_t, __pyx_t_5_util_INDEX_t, __pyx_t_5_util_INDEX_t, __pyx_t_5_util_FLOAT_t, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + Py_DECREF(__pyx_t_1); __pyx_t_1 = 0; + /*--- Execution code ---*/ + + /* "_pruning.pyx":9 + * from _record cimport PruningPassIteration + * from _util cimport gcv, apply_weights_1d + * import numpy as np # <<<<<<<<<<<<<< + * + * cdef class PruningPasser: + */ + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__np, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "_pruning.pyx":1 + * # distutils: language = c # <<<<<<<<<<<<<< + * # cython: cdivision = True + * # cython: boundscheck = False + */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + if (PyDict_SetItem(__pyx_d, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "numpy.pxd":975 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None + */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + if (__pyx_m) { + __Pyx_AddTraceback("init _pruning", __pyx_clineno, __pyx_lineno, __pyx_filename); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init _pruning"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* Runtime support code */ +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif /* CYTHON_REFNANNY */ + +static PyObject *__Pyx_GetBuiltinName(PyObject *name) { + PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); + if (unlikely(!result)) { + PyErr_Format(PyExc_NameError, +#if PY_MAJOR_VERSION >= 3 + "name '%U' is not defined", name); +#else + "name '%s' is not defined", PyString_AS_STRING(name)); +#endif + } + return result; +} + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AsString(kw_name)); + #endif +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; + } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; + } + } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact) +{ + if (!type) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (none_allowed && obj == Py_None) return 1; + else if (exact) { + if (Py_TYPE(obj) == type) return 1; + } + else { + if (PyObject_TypeCheck(obj, type)) return 1; + } + PyErr_Format(PyExc_TypeError, + "Argument '%s' has incorrect type (expected %s, got %s)", + name, type->tp_name, Py_TYPE(obj)->tp_name); + return 0; +} + +static CYTHON_INLINE int __Pyx_IsLittleEndian(void) { + unsigned int n = 1; + return *(unsigned char*)(&n) != 0; +} +static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, + __Pyx_BufFmt_StackElem* stack, + __Pyx_TypeInfo* type) { + stack[0].field = &ctx->root; + stack[0].parent_offset = 0; + ctx->root.type = type; + ctx->root.name = "buffer dtype"; + ctx->root.offset = 0; + ctx->head = stack; + ctx->head->field = &ctx->root; + ctx->fmt_offset = 0; + ctx->head->parent_offset = 0; + ctx->new_packmode = '@'; + ctx->enc_packmode = '@'; + ctx->new_count = 1; + ctx->enc_count = 0; + ctx->enc_type = 0; + ctx->is_complex = 0; + ctx->is_valid_array = 0; + ctx->struct_alignment = 0; + while (type->typegroup == 'S') { + ++ctx->head; + ctx->head->field = type->fields; + ctx->head->parent_offset = 0; + type = type->fields->type; + } +} +static int __Pyx_BufFmt_ParseNumber(const char** ts) { + int count; + const char* t = *ts; + if (*t < '0' || *t > '9') { + return -1; + } else { + count = *t++ - '0'; + while (*t >= '0' && *t < '9') { + count *= 10; + count += *t++ - '0'; + } + } + *ts = t; + return count; +} +static int __Pyx_BufFmt_ExpectNumber(const char **ts) { + int number = __Pyx_BufFmt_ParseNumber(ts); + if (number == -1) /* First char was not a digit */ + PyErr_Format(PyExc_ValueError,\ + "Does not understand character buffer dtype format string ('%c')", **ts); + return number; +} +static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { + PyErr_Format(PyExc_ValueError, + "Unexpected format string character: '%c'", ch); +} +static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { + switch (ch) { + case 'c': return "'char'"; + case 'b': return "'signed char'"; + case 'B': return "'unsigned char'"; + case 'h': return "'short'"; + case 'H': return "'unsigned short'"; + case 'i': return "'int'"; + case 'I': return "'unsigned int'"; + case 'l': return "'long'"; + case 'L': return "'unsigned long'"; + case 'q': return "'long long'"; + case 'Q': return "'unsigned long long'"; + case 'f': return (is_complex ? "'complex float'" : "'float'"); + case 'd': return (is_complex ? "'complex double'" : "'double'"); + case 'g': return (is_complex ? "'complex long double'" : "'long double'"); + case 'T': return "a struct"; + case 'O': return "Python object"; + case 'P': return "a pointer"; + case 's': case 'p': return "a string"; + case 0: return "end"; + default: return "unparseable format string"; + } +} +static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return 2; + case 'i': case 'I': case 'l': case 'L': return 4; + case 'q': case 'Q': return 8; + case 'f': return (is_complex ? 8 : 4); + case 'd': return (is_complex ? 16 : 8); + case 'g': { + PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g').."); + return 0; + } + case 'O': case 'P': return sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} +static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { + switch (ch) { + case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(short); + case 'i': case 'I': return sizeof(int); + case 'l': case 'L': return sizeof(long); + #ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(PY_LONG_LONG); + #endif + case 'f': return sizeof(float) * (is_complex ? 2 : 1); + case 'd': return sizeof(double) * (is_complex ? 2 : 1); + case 'g': return sizeof(long double) * (is_complex ? 2 : 1); + case 'O': case 'P': return sizeof(void*); + default: { + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } + } +} +typedef struct { char c; short x; } __Pyx_st_short; +typedef struct { char c; int x; } __Pyx_st_int; +typedef struct { char c; long x; } __Pyx_st_long; +typedef struct { char c; float x; } __Pyx_st_float; +typedef struct { char c; double x; } __Pyx_st_double; +typedef struct { char c; long double x; } __Pyx_st_longdouble; +typedef struct { char c; void *x; } __Pyx_st_void_p; +#ifdef HAVE_LONG_LONG +typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; +#endif +static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); + case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); + case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); +#ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG); +#endif + case 'f': return sizeof(__Pyx_st_float) - sizeof(float); + case 'd': return sizeof(__Pyx_st_double) - sizeof(double); + case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double); + case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} +/* These are for computing the padding at the end of the struct to align + on the first member of the struct. This will probably the same as above, + but we don't have any guarantees. + */ +typedef struct { short x; char c; } __Pyx_pad_short; +typedef struct { int x; char c; } __Pyx_pad_int; +typedef struct { long x; char c; } __Pyx_pad_long; +typedef struct { float x; char c; } __Pyx_pad_float; +typedef struct { double x; char c; } __Pyx_pad_double; +typedef struct { long double x; char c; } __Pyx_pad_longdouble; +typedef struct { void *x; char c; } __Pyx_pad_void_p; +#ifdef HAVE_LONG_LONG +typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong; +#endif +static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short); + case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int); + case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long); +#ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG); +#endif + case 'f': return sizeof(__Pyx_pad_float) - sizeof(float); + case 'd': return sizeof(__Pyx_pad_double) - sizeof(double); + case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double); + case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} +static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { + switch (ch) { + case 'c': + return 'H'; + case 'b': case 'h': case 'i': + case 'l': case 'q': case 's': case 'p': + return 'I'; + case 'B': case 'H': case 'I': case 'L': case 'Q': + return 'U'; + case 'f': case 'd': case 'g': + return (is_complex ? 'C' : 'R'); + case 'O': + return 'O'; + case 'P': + return 'P'; + default: { + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } + } +} +static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { + if (ctx->head == NULL || ctx->head->field == &ctx->root) { + const char* expected; + const char* quote; + if (ctx->head == NULL) { + expected = "end"; + quote = ""; + } else { + expected = ctx->head->field->type->name; + quote = "'"; + } + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch, expected %s%s%s but got %s", + quote, expected, quote, + __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex)); + } else { + __Pyx_StructField* field = ctx->head->field; + __Pyx_StructField* parent = (ctx->head - 1)->field; + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'", + field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex), + parent->type->name, field->name); + } +} +static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { + char group; + size_t size, offset, arraysize = 1; + if (ctx->enc_type == 0) return 0; + if (ctx->head->field->type->arraysize[0]) { + int i, ndim = 0; + if (ctx->enc_type == 's' || ctx->enc_type == 'p') { + ctx->is_valid_array = ctx->head->field->type->ndim == 1; + ndim = 1; + if (ctx->enc_count != ctx->head->field->type->arraysize[0]) { + PyErr_Format(PyExc_ValueError, + "Expected a dimension of size %zu, got %zu", + ctx->head->field->type->arraysize[0], ctx->enc_count); + return -1; + } + } + if (!ctx->is_valid_array) { + PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d", + ctx->head->field->type->ndim, ndim); + return -1; + } + for (i = 0; i < ctx->head->field->type->ndim; i++) { + arraysize *= ctx->head->field->type->arraysize[i]; + } + ctx->is_valid_array = 0; + ctx->enc_count = 1; + } + group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); + do { + __Pyx_StructField* field = ctx->head->field; + __Pyx_TypeInfo* type = field->type; + if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') { + size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); + } else { + size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); + } + if (ctx->enc_packmode == '@') { + size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); + size_t align_mod_offset; + if (align_at == 0) return -1; + align_mod_offset = ctx->fmt_offset % align_at; + if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; + if (ctx->struct_alignment == 0) + ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type, + ctx->is_complex); + } + if (type->size != size || type->typegroup != group) { + if (type->typegroup == 'C' && type->fields != NULL) { + size_t parent_offset = ctx->head->parent_offset + field->offset; + ++ctx->head; + ctx->head->field = type->fields; + ctx->head->parent_offset = parent_offset; + continue; + } + if ((type->typegroup == 'H' || group == 'H') && type->size == size) { + } else { + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } + } + offset = ctx->head->parent_offset + field->offset; + if (ctx->fmt_offset != offset) { + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected", + (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); + return -1; + } + ctx->fmt_offset += size; + if (arraysize) + ctx->fmt_offset += (arraysize - 1) * size; + --ctx->enc_count; /* Consume from buffer string */ + while (1) { + if (field == &ctx->root) { + ctx->head = NULL; + if (ctx->enc_count != 0) { + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } + break; /* breaks both loops as ctx->enc_count == 0 */ + } + ctx->head->field = ++field; + if (field->type == NULL) { + --ctx->head; + field = ctx->head->field; + continue; + } else if (field->type->typegroup == 'S') { + size_t parent_offset = ctx->head->parent_offset + field->offset; + if (field->type->fields->type == NULL) continue; /* empty struct */ + field = field->type->fields; + ++ctx->head; + ctx->head->field = field; + ctx->head->parent_offset = parent_offset; + break; + } else { + break; + } + } + } while (ctx->enc_count); + ctx->enc_type = 0; + ctx->is_complex = 0; + return 0; +} +static CYTHON_INLINE PyObject * +__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) +{ + const char *ts = *tsp; + int i = 0, number; + int ndim = ctx->head->field->type->ndim; +; + ++ts; + if (ctx->new_count != 1) { + PyErr_SetString(PyExc_ValueError, + "Cannot handle repeated arrays in format string"); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + while (*ts && *ts != ')') { + if (isspace(*ts)) + continue; + number = __Pyx_BufFmt_ExpectNumber(&ts); + if (number == -1) return NULL; + if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) + return PyErr_Format(PyExc_ValueError, + "Expected a dimension of size %zu, got %d", + ctx->head->field->type->arraysize[i], number); + if (*ts != ',' && *ts != ')') + return PyErr_Format(PyExc_ValueError, + "Expected a comma in format string, got '%c'", *ts); + if (*ts == ',') ts++; + i++; + } + if (i != ndim) + return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d", + ctx->head->field->type->ndim, i); + if (!*ts) { + PyErr_SetString(PyExc_ValueError, + "Unexpected end of format string, expected ')'"); + return NULL; + } + ctx->is_valid_array = 1; + ctx->new_count = 1; + *tsp = ++ts; + return Py_None; +} +static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { + int got_Z = 0; + while (1) { + switch(*ts) { + case 0: + if (ctx->enc_type != 0 && ctx->head == NULL) { + __Pyx_BufFmt_RaiseExpected(ctx); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + if (ctx->head != NULL) { + __Pyx_BufFmt_RaiseExpected(ctx); + return NULL; + } + return ts; + case ' ': + case 10: + case 13: + ++ts; + break; + case '<': + if (!__Pyx_IsLittleEndian()) { + PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); + return NULL; + } + ctx->new_packmode = '='; + ++ts; + break; + case '>': + case '!': + if (__Pyx_IsLittleEndian()) { + PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); + return NULL; + } + ctx->new_packmode = '='; + ++ts; + break; + case '=': + case '@': + case '^': + ctx->new_packmode = *ts++; + break; + case 'T': /* substruct */ + { + const char* ts_after_sub; + size_t i, struct_count = ctx->new_count; + size_t struct_alignment = ctx->struct_alignment; + ctx->new_count = 1; + ++ts; + if (*ts != '{') { + PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_type = 0; /* Erase processed last struct element */ + ctx->enc_count = 0; + ctx->struct_alignment = 0; + ++ts; + ts_after_sub = ts; + for (i = 0; i != struct_count; ++i) { + ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); + if (!ts_after_sub) return NULL; + } + ts = ts_after_sub; + if (struct_alignment) ctx->struct_alignment = struct_alignment; + } + break; + case '}': /* end of substruct; either repeat or move on */ + { + size_t alignment = ctx->struct_alignment; + ++ts; + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_type = 0; /* Erase processed last struct element */ + if (alignment && ctx->fmt_offset % alignment) { + ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment); + } + } + return ts; + case 'x': + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->fmt_offset += ctx->new_count; + ctx->new_count = 1; + ctx->enc_count = 0; + ctx->enc_type = 0; + ctx->enc_packmode = ctx->new_packmode; + ++ts; + break; + case 'Z': + got_Z = 1; + ++ts; + if (*ts != 'f' && *ts != 'd' && *ts != 'g') { + __Pyx_BufFmt_RaiseUnexpectedChar('Z'); + return NULL; + } /* fall through */ + case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': + case 'l': case 'L': case 'q': case 'Q': + case 'f': case 'd': case 'g': + case 'O': case 's': case 'p': + if (ctx->enc_type == *ts && got_Z == ctx->is_complex && + ctx->enc_packmode == ctx->new_packmode) { + ctx->enc_count += ctx->new_count; + } else { + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_count = ctx->new_count; + ctx->enc_packmode = ctx->new_packmode; + ctx->enc_type = *ts; + ctx->is_complex = got_Z; + } + ++ts; + ctx->new_count = 1; + got_Z = 0; + break; + case ':': + ++ts; + while(*ts != ':') ++ts; + ++ts; + break; + case '(': + if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL; + break; + default: + { + int number = __Pyx_BufFmt_ExpectNumber(&ts); + if (number == -1) return NULL; + ctx->new_count = (size_t)number; + } + } + } +} +static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { + buf->buf = NULL; + buf->obj = NULL; + buf->strides = __Pyx_zeros; + buf->shape = __Pyx_zeros; + buf->suboffsets = __Pyx_minusones; +} +static CYTHON_INLINE int __Pyx_GetBufferAndValidate( + Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, + int nd, int cast, __Pyx_BufFmt_StackElem* stack) +{ + if (obj == Py_None || obj == NULL) { + __Pyx_ZeroBuffer(buf); + return 0; + } + buf->buf = NULL; + if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail; + if (buf->ndim != nd) { + PyErr_Format(PyExc_ValueError, + "Buffer has wrong number of dimensions (expected %d, got %d)", + nd, buf->ndim); + goto fail; + } + if (!cast) { + __Pyx_BufFmt_Context ctx; + __Pyx_BufFmt_Init(&ctx, stack, dtype); + if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; + } + if ((unsigned)buf->itemsize != dtype->size) { + PyErr_Format(PyExc_ValueError, + "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)", + buf->itemsize, (buf->itemsize > 1) ? "s" : "", + dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : ""); + goto fail; + } + if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; + return 0; +fail:; + __Pyx_ZeroBuffer(buf); + return -1; +} +static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { + if (info->buf == NULL) return; + if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; + __Pyx_ReleaseBuffer(info); +} + +static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { + PyObject *result; +#if CYTHON_COMPILING_IN_CPYTHON + result = PyDict_GetItem(__pyx_d, name); + if (result) { + Py_INCREF(result); + } else { +#else + result = PyObject_GetItem(__pyx_d, name); + if (!result) { + PyErr_Clear(); +#endif + result = __Pyx_GetBuiltinName(name); + } + return result; +} + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + if (unlikely(!type)) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(PyObject_TypeCheck(obj, type))) + return 1; + PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", + Py_TYPE(obj)->tp_name, type->tp_name); + return 0; +} + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_Restore(type, value, tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#else + PyErr_Fetch(type, value, tb); +#endif +} + +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice( + PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop, + PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice, + int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) { +#if CYTHON_COMPILING_IN_CPYTHON + PyMappingMethods* mp; +#if PY_MAJOR_VERSION < 3 + PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence; + if (likely(ms && ms->sq_slice)) { + if (!has_cstart) { + if (_py_start && (*_py_start != Py_None)) { + cstart = __Pyx_PyIndex_AsSsize_t(*_py_start); + if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; + } else + cstart = 0; + } + if (!has_cstop) { + if (_py_stop && (*_py_stop != Py_None)) { + cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop); + if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; + } else + cstop = PY_SSIZE_T_MAX; + } + if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) { + Py_ssize_t l = ms->sq_length(obj); + if (likely(l >= 0)) { + if (cstop < 0) { + cstop += l; + if (cstop < 0) cstop = 0; + } + if (cstart < 0) { + cstart += l; + if (cstart < 0) cstart = 0; + } + } else { + if (PyErr_ExceptionMatches(PyExc_OverflowError)) + PyErr_Clear(); + else + goto bad; + } + } + return ms->sq_slice(obj, cstart, cstop); + } +#endif + mp = Py_TYPE(obj)->tp_as_mapping; + if (likely(mp && mp->mp_subscript)) +#endif + { + PyObject* result; + PyObject *py_slice, *py_start, *py_stop; + if (_py_slice) { + py_slice = *_py_slice; + } else { + PyObject* owned_start = NULL; + PyObject* owned_stop = NULL; + if (_py_start) { + py_start = *_py_start; + } else { + if (has_cstart) { + owned_start = py_start = PyInt_FromSsize_t(cstart); + if (unlikely(!py_start)) goto bad; + } else + py_start = Py_None; + } + if (_py_stop) { + py_stop = *_py_stop; + } else { + if (has_cstop) { + owned_stop = py_stop = PyInt_FromSsize_t(cstop); + if (unlikely(!py_stop)) { + Py_XDECREF(owned_start); + goto bad; + } + } else + py_stop = Py_None; + } + py_slice = PySlice_New(py_start, py_stop, Py_None); + Py_XDECREF(owned_start); + Py_XDECREF(owned_stop); + if (unlikely(!py_slice)) goto bad; + } +#if CYTHON_COMPILING_IN_CPYTHON + result = mp->mp_subscript(obj, py_slice); +#else + result = PyObject_GetItem(obj, py_slice); +#endif + if (!_py_slice) { + Py_DECREF(py_slice); + } + return result; + } + PyErr_Format(PyExc_TypeError, + "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name); +bad: + return NULL; +} + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); +} + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", + index, (index == 1) ? "" : "s"); +} + +static CYTHON_INLINE int __Pyx_IterFinish(void) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + PyObject* exc_type = tstate->curexc_type; + if (unlikely(exc_type)) { + if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { + PyObject *exc_value, *exc_tb; + exc_value = tstate->curexc_value; + exc_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + Py_DECREF(exc_type); + Py_XDECREF(exc_value); + Py_XDECREF(exc_tb); + return 0; + } else { + return -1; + } + } + return 0; +#else + if (unlikely(PyErr_Occurred())) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { + PyErr_Clear(); + return 0; + } else { + return -1; + } + } + return 0; +#endif +} + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; + } else { + return __Pyx_IterFinish(); + } + return 0; +} + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck) { +#if CYTHON_COMPILING_IN_CPYTHON + if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o); + if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck) { +#if CYTHON_COMPILING_IN_CPYTHON + if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, + int is_list, int wraparound, int boundscheck) { +#if CYTHON_COMPILING_IN_CPYTHON + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) { + PyObject *r = PyList_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } + else if (PyTuple_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } else { + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (PyErr_ExceptionMatches(PyExc_OverflowError)) + PyErr_Clear(); + else + return NULL; + } + } + return m->sq_item(o, i); + } + } +#else + if (is_list || PySequence_Check(o)) { + return PySequence_GetItem(o, i); + } +#endif + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, + CYTHON_UNUSED PyObject *cause) { + Py_XINCREF(type); + if (!value || value == Py_None) + value = NULL; + else + Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + } + #if PY_VERSION_HEX < 0x02050000 + if (PyClass_Check(type)) { + #else + if (PyType_Check(type)) { + #endif +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + value = type; + #if PY_VERSION_HEX < 0x02050000 + if (PyInstance_Check(type)) { + type = (PyObject*) ((PyInstanceObject*)type)->in_class; + Py_INCREF(type); + } else { + type = 0; + PyErr_SetString(PyExc_TypeError, + "raise: exception must be an old-style class or instance"); + goto raise_error; + } + #else + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + #endif + } + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} +#else /* Python 3+ */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (PyExceptionClass_Check(type)) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyEval_CallObject(type, args); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } +#if PY_VERSION_HEX >= 0x03030000 + if (cause) { +#else + if (cause && cause != Py_None) { +#endif + PyObject *fixed_cause; + if (cause == Py_None) { + fixed_cause = NULL; + } else if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); + } + PyErr_SetObject(type, value); + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } +bad: + Py_XDECREF(owned_instance); + return; +} +#endif + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +#if PY_MAJOR_VERSION < 3 +static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { + #if PY_VERSION_HEX >= 0x02060000 + if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); + #endif + if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags); + #if PY_VERSION_HEX < 0x02060000 + if (obj->ob_type->tp_dict) { + PyObject *getbuffer_cobj = PyObject_GetItem( + obj->ob_type->tp_dict, __pyx_n_s____pyx_getbuffer); + if (getbuffer_cobj) { + getbufferproc func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj); + Py_DECREF(getbuffer_cobj); + if (!func) + goto fail; + return func(obj, view, flags); + } else { + PyErr_Clear(); + } + } + #endif + PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name); +#if PY_VERSION_HEX < 0x02060000 +fail: +#endif + return -1; +} +static void __Pyx_ReleaseBuffer(Py_buffer *view) { + PyObject *obj = view->obj; + if (!obj) return; + #if PY_VERSION_HEX >= 0x02060000 + if (PyObject_CheckBuffer(obj)) { + PyBuffer_Release(view); + return; + } + #endif + if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; } + #if PY_VERSION_HEX < 0x02060000 + if (obj->ob_type->tp_dict) { + PyObject *releasebuffer_cobj = PyObject_GetItem( + obj->ob_type->tp_dict, __pyx_n_s____pyx_releasebuffer); + if (releasebuffer_cobj) { + releasebufferproc func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj); + Py_DECREF(releasebuffer_cobj); + if (!func) + goto fail; + func(obj, view); + return; + } else { + PyErr_Clear(); + } + } + #endif + goto nofail; +#if PY_VERSION_HEX < 0x02060000 +fail: +#endif + PyErr_WriteUnraisable(obj); +nofail: + Py_DECREF(obj); + view->obj = NULL; +} +#endif /* PY_MAJOR_VERSION < 3 */ + + + static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_import; + py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s____import__); + if (!py_import) + goto bad; + #endif + if (from_list) + list = from_list; + else { + empty_list = PyList_New(0); + if (!empty_list) + goto bad; + list = empty_list; + } + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + #if PY_VERSION_HEX >= 0x02050000 + { + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.')) { + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_level = PyInt_FromLong(1); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, global_dict, empty_dict, list, 1); + #endif + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; /* try absolute import on failure */ + } + #endif + if (!module) { + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, global_dict, empty_dict, list, level); + #endif + } + } + #else + if (level>0) { + PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); + goto bad; + } + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, NULL); + #endif +bad: + #if PY_VERSION_HEX < 0x03030000 + Py_XDECREF(py_import); + #endif + Py_XDECREF(empty_list); + Py_XDECREF(empty_dict); + return module; +} + +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_ulonglong(npy_ulonglong val) { + const npy_ulonglong neg_one = (npy_ulonglong)-1, const_zero = (npy_ulonglong)0; + const int is_unsigned = const_zero < neg_one; + if ((sizeof(npy_ulonglong) == sizeof(char)) || + (sizeof(npy_ulonglong) == sizeof(short))) { + return PyInt_FromLong((long)val); + } else if ((sizeof(npy_ulonglong) == sizeof(int)) || + (sizeof(npy_ulonglong) == sizeof(long))) { + if (is_unsigned) + return PyLong_FromUnsignedLong((unsigned long)val); + else + return PyInt_FromLong((long)val); + } else if (sizeof(npy_ulonglong) == sizeof(PY_LONG_LONG)) { + if (is_unsigned) + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); + else + return PyLong_FromLongLong((PY_LONG_LONG)val); + } else { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + return _PyLong_FromByteArray(bytes, sizeof(npy_ulonglong), + little, !is_unsigned); + } +} + +static CYTHON_INLINE npy_ulonglong __Pyx_PyInt_from_py_npy_ulonglong(PyObject* x) { + const npy_ulonglong neg_one = (npy_ulonglong)-1, const_zero = (npy_ulonglong)0; + const int is_unsigned = const_zero < neg_one; + if (sizeof(npy_ulonglong) == sizeof(char)) { + if (is_unsigned) + return (npy_ulonglong)__Pyx_PyInt_AsUnsignedChar(x); + else + return (npy_ulonglong)__Pyx_PyInt_AsSignedChar(x); + } else if (sizeof(npy_ulonglong) == sizeof(short)) { + if (is_unsigned) + return (npy_ulonglong)__Pyx_PyInt_AsUnsignedShort(x); + else + return (npy_ulonglong)__Pyx_PyInt_AsSignedShort(x); + } else if (sizeof(npy_ulonglong) == sizeof(int)) { + if (is_unsigned) + return (npy_ulonglong)__Pyx_PyInt_AsUnsignedInt(x); + else + return (npy_ulonglong)__Pyx_PyInt_AsSignedInt(x); + } else if (sizeof(npy_ulonglong) == sizeof(long)) { + if (is_unsigned) + return (npy_ulonglong)__Pyx_PyInt_AsUnsignedLong(x); + else + return (npy_ulonglong)__Pyx_PyInt_AsSignedLong(x); + } else if (sizeof(npy_ulonglong) == sizeof(PY_LONG_LONG)) { + if (is_unsigned) + return (npy_ulonglong)__Pyx_PyInt_AsUnsignedLongLong(x); + else + return (npy_ulonglong)__Pyx_PyInt_AsSignedLongLong(x); + } else { + #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); + #else + npy_ulonglong val; + PyObject *v = __Pyx_PyNumber_Int(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } + #endif + return (npy_ulonglong)-1; + } +} + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return ::std::complex< float >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return x + y*(__pyx_t_float_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + __pyx_t_float_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +#if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtf(z.real*z.real + z.imag*z.imag); + #else + return hypotf(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + float denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(a, a); + case 3: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, a); + case 4: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_absf(a); + theta = atan2f(a.imag, a.real); + } + lnr = logf(r); + z_r = expf(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosf(z_theta); + z.imag = z_r * sinf(z_theta); + return z; + } + #endif +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return ::std::complex< double >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return x + y*(__pyx_t_double_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + __pyx_t_double_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +#if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrt(z.real*z.real + z.imag*z.imag); + #else + return hypot(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(a, a); + case 3: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, a); + case 4: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_abs(a); + theta = atan2(a.imag, a.real); + } + lnr = log(r); + z_r = exp(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cos(z_theta); + z.imag = z_r * sin(z_theta); + return z; + } + #endif +#endif + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(unsigned long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (unsigned long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)PyLong_AsUnsignedLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(unsigned long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(unsigned long) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(unsigned long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (unsigned long)PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)PyLong_AsUnsignedLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(long) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (long)PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(signed long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (signed long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)PyLong_AsUnsignedLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(signed long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(signed long) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(signed long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (signed long)PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + +static int __Pyx_SetVtable(PyObject *dict, void *vtable) { +#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) + PyObject *ob = PyCapsule_New(vtable, 0, 0); +#else + PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); +#endif + if (!ob) + goto bad; + if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0) + goto bad; + Py_DECREF(ob); + return 0; +bad: + Py_XDECREF(ob); + return -1; +} + +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + py_name = __Pyx_PyIdentifier_FromString(name); + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + +#ifndef __PYX_HAVE_RT_ImportType +#define __PYX_HAVE_RT_ImportType +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, + size_t size, int strict) +{ + PyObject *py_module = 0; + PyObject *result = 0; + PyObject *py_name = 0; + char warning[200]; + Py_ssize_t basicsize; +#ifdef Py_LIMITED_API + PyObject *py_basicsize; +#endif + py_module = __Pyx_ImportModule(module_name); + if (!py_module) + goto bad; + py_name = __Pyx_PyIdentifier_FromString(class_name); + if (!py_name) + goto bad; + result = PyObject_GetAttr(py_module, py_name); + Py_DECREF(py_name); + py_name = 0; + Py_DECREF(py_module); + py_module = 0; + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%s.%s is not a type object", + module_name, class_name); + goto bad; + } +#ifndef Py_LIMITED_API + basicsize = ((PyTypeObject *)result)->tp_basicsize; +#else + py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); + if (!py_basicsize) + goto bad; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = 0; + if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) + goto bad; +#endif + if (!strict && (size_t)basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility", + module_name, class_name); + #if PY_VERSION_HEX < 0x02050000 + if (PyErr_Warn(NULL, warning) < 0) goto bad; + #else + if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; + #endif + } + else if ((size_t)basicsize != size) { + PyErr_Format(PyExc_ValueError, + "%s.%s has the wrong size, try recompiling", + module_name, class_name); + goto bad; + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(py_module); + Py_XDECREF(result); + return NULL; +} +#endif + +static void* __Pyx_GetVtable(PyObject *dict) { + void* ptr; + PyObject *ob = PyMapping_GetItemString(dict, (char *)"__pyx_vtable__"); + if (!ob) + goto bad; +#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) + ptr = PyCapsule_GetPointer(ob, 0); +#else + ptr = PyCObject_AsVoidPtr(ob); +#endif + if (!ptr && !PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); + Py_DECREF(ob); + return ptr; +bad: + Py_XDECREF(ob); + return NULL; +} + +#ifndef __PYX_HAVE_RT_ImportFunction +#define __PYX_HAVE_RT_ImportFunction +static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { + PyObject *d = 0; + PyObject *cobj = 0; + union { + void (*fp)(void); + void *p; + } tmp; + d = PyObject_GetAttrString(module, (char *)"__pyx_capi__"); + if (!d) + goto bad; + cobj = PyDict_GetItemString(d, funcname); + if (!cobj) { + PyErr_Format(PyExc_ImportError, + "%s does not export expected C function %s", + PyModule_GetName(module), funcname); + goto bad; + } +#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3 && PY_MINOR_VERSION==0) + if (!PyCapsule_IsValid(cobj, sig)) { + PyErr_Format(PyExc_TypeError, + "C function %s.%s has wrong signature (expected %s, got %s)", + PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj)); + goto bad; + } + tmp.p = PyCapsule_GetPointer(cobj, sig); +#else + {const char *desc, *s1, *s2; + desc = (const char *)PyCObject_GetDesc(cobj); + if (!desc) + goto bad; + s1 = desc; s2 = sig; + while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; } + if (*s1 != *s2) { + PyErr_Format(PyExc_TypeError, + "C function %s.%s has wrong signature (expected %s, got %s)", + PyModule_GetName(module), funcname, sig, desc); + goto bad; + } + tmp.p = PyCObject_AsVoidPtr(cobj);} +#endif + *f = tmp.fp; + if (!(*f)) + goto bad; + Py_DECREF(d); + return 0; +bad: + Py_XDECREF(d); + return -1; +} +#endif + +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = (start + end) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); +} + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(filename); + #else + py_srcfile = PyUnicode_FromString(filename); + #endif + if (!py_srcfile) goto bad; + if (c_line) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_code = __Pyx_PyCode_New( + 0, /*int argcount,*/ + 0, /*int kwonlyargcount,*/ + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + py_line, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + Py_DECREF(py_srcfile); + Py_DECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_globals = 0; + PyFrameObject *py_frame = 0; + py_code = __pyx_find_code_object(c_line ? c_line : py_line); + if (!py_code) { + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) goto bad; + __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + } + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = py_line; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char* c_str) { + return __Pyx_PyUnicode_FromStringAndSize(c_str, strlen(c_str)); +} +static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) { + Py_ssize_t ignore; + return __Pyx_PyObject_AsStringAndSize(o, &ignore); +} +static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT + if ( +#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + __Pyx_sys_getdefaultencoding_not_ascii && +#endif + PyUnicode_Check(o)) { +#if PY_VERSION_HEX < 0x03030000 + char* defenc_c; + PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); + if (!defenc) return NULL; + defenc_c = PyBytes_AS_STRING(defenc); +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + { + char* end = defenc_c + PyBytes_GET_SIZE(defenc); + char* c; + for (c = defenc_c; c < end; c++) { + if ((unsigned char) (*c) >= 128) { + PyUnicode_AsASCIIString(o); + return NULL; + } + } + } +#endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/ + *length = PyBytes_GET_SIZE(defenc); + return defenc_c; +#else /* PY_VERSION_HEX < 0x03030000 */ + if (PyUnicode_READY(o) == -1) return NULL; +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + if (PyUnicode_IS_ASCII(o)) { + *length = PyUnicode_GET_DATA_SIZE(o); + return PyUnicode_AsUTF8(o); + } else { + PyUnicode_AsASCIIString(o); + return NULL; + } +#else /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */ + return PyUnicode_AsUTF8AndSize(o, length); +#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */ +#endif /* PY_VERSION_HEX < 0x03030000 */ + } else +#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */ + { + char* result; + int r = PyBytes_AsStringAndSize(o, &result, length); + if (r < 0) { + return NULL; + } else { + return result; + } + } +} +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_MAJOR_VERSION < 3 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_MAJOR_VERSION < 3 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_MAJOR_VERSION < 3 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + if ((val != (unsigned PY_LONG_LONG)-1) || !PyErr_Occurred()) + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff --git a/sklearn/earth/_pruning.pxd b/sklearn/earth/_pruning.pxd new file mode 100644 index 0000000000000..b78f611965c7f --- /dev/null +++ b/sklearn/earth/_pruning.pxd @@ -0,0 +1,23 @@ +cimport numpy as cnp +ctypedef cnp.float64_t FLOAT_t +ctypedef cnp.intp_t INT_t +ctypedef cnp.ulong_t INDEX_t +ctypedef cnp.uint8_t BOOL_t +from _basis cimport Basis +from _record cimport PruningPassRecord + +cdef class PruningPasser: + cdef cnp.ndarray X + cdef cnp.ndarray B + cdef cnp.ndarray y + cdef cnp.ndarray weights + cdef INDEX_t m + cdef INDEX_t n + cdef Basis basis + cdef FLOAT_t penalty + cdef FLOAT_t sst + cdef PruningPassRecord record + + cpdef run(PruningPasser self) + + cpdef PruningPassRecord trace(PruningPasser self) \ No newline at end of file diff --git a/sklearn/earth/_pruning.pyx b/sklearn/earth/_pruning.pyx new file mode 100644 index 0000000000000..5581082fc7b73 --- /dev/null +++ b/sklearn/earth/_pruning.pyx @@ -0,0 +1,108 @@ +# distutils: language = c +# cython: cdivision = True +# cython: boundscheck = False +# cython: wraparound = False +# cython: profile = False + +from _record cimport PruningPassIteration +from _util cimport gcv, apply_weights_1d +import numpy as np + +cdef class PruningPasser: + '''Implements the generic pruning pass as described by Friedman, 1991.''' + def __init__(PruningPasser self, Basis basis, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] weights, **kwargs): + self.X = X + self.m = self.X.shape[0] + self.n = self.X.shape[1] + self.y = y + self.weights = weights + self.basis = basis + self.B = np.empty(shape=(self.m,len(self.basis)+1),dtype=np.float) + self.penalty = kwargs['penalty'] if 'penalty' in kwargs else 3.0 + self.sst = np.sum(self.weights*(self.y - np.average(self.y,weights=self.weights))**2) / self.m + + cpdef run(PruningPasser self): + #This is a totally naive implementation and could potentially be made faster + #through the use of updating algorithms. It is not clear that such + #optimization would be worthwhile, as the pruning pass is not the slowest + #part of the algorithm. + cdef INDEX_t i + cdef INDEX_t j + cdef INDEX_t basis_size = len(self.basis) + cdef INDEX_t pruned_basis_size = self.basis.plen() + cdef FLOAT_t gcv_ + cdef INDEX_t best_iteration + cdef INDEX_t best_bf_to_prune + cdef FLOAT_t best_gcv + cdef FLOAT_t best_iteration_gcv + cdef FLOAT_t best_iteration_mse + + cdef cnp.ndarray[FLOAT_t, ndim=2] B = self.B + cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X + cdef cnp.ndarray[FLOAT_t, ndim=1] y = self.y + cdef cnp.ndarray[FLOAT_t, ndim=1] weights = self.weights + cdef cnp.ndarray[FLOAT_t, ndim=1] weighted_y = y.copy() + + #Initial solution + apply_weights_1d(weighted_y,weights) + self.basis.weighted_transform(X,B,weights) + beta, mse = np.linalg.lstsq(B[:,0:(basis_size)],weighted_y)[0:2] + if mse: + mse /= self.m + else: + mse = (1.0/self.m)*np.sum((np.dot(B[:,0:basis_size],beta) - weighted_y)**2) + + #Create the record object + self.record = PruningPassRecord(self.m,self.n,self.penalty,self.sst,pruned_basis_size,mse) + gcv_ = self.record.gcv(0) + best_gcv = gcv_ + best_iteration = 0 + + #Prune basis functions sequentially + for i in range(1,pruned_basis_size): + first = True + pruned_basis_size -= 1 + + #Find the best basis function to prune + for j in range(basis_size): + bf = self.basis[j] + if bf.is_pruned(): + continue + if not bf.is_prunable(): + continue + bf.prune() + self.basis.weighted_transform(X, B, weights) + beta, mse = np.linalg.lstsq(B[:,0:pruned_basis_size],weighted_y)[0:2] + if mse: + mse /= self.m + else: + mse = (1/float(self.m))*np.sum((np.dot(B[:,0:pruned_basis_size],beta) - weighted_y)**2) + gcv_ = gcv(mse,pruned_basis_size,self.m,self.penalty) + + if gcv_ <= best_iteration_gcv or first: + best_iteration_gcv = gcv_ + best_iteration_mse = mse + best_bf_to_prune = j + first = False + bf.unprune() + + #The inner loop found the best basis function to remove for this iteration. + #Now check whether this iteration is better than all the previous ones. + if best_iteration_gcv <= best_gcv: + best_gcv = best_iteration_gcv + best_iteration = i + + #Update the record and prune the selected basis function + self.record.append(PruningPassIteration(best_bf_to_prune,pruned_basis_size,best_iteration_mse)) + self.basis[best_bf_to_prune].prune() + + #Unprune the basis functions pruned after the best iteration + self.record.set_selected(best_iteration) + self.record.roll_back(self.basis) + + cpdef PruningPassRecord trace(PruningPasser self): + return self.record + + + + diff --git a/sklearn/earth/_record.c b/sklearn/earth/_record.c new file mode 100644 index 0000000000000..f7c06c7420be7 --- /dev/null +++ b/sklearn/earth/_record.c @@ -0,0 +1,13919 @@ +/* Generated by Cython 0.19 on Sat Jul 20 23:46:45 2013 */ + +#define PY_SSIZE_T_CLEAN +#ifndef CYTHON_USE_PYLONG_INTERNALS +#ifdef PYLONG_BITS_IN_DIGIT +#define CYTHON_USE_PYLONG_INTERNALS 0 +#else +#include "pyconfig.h" +#ifdef PYLONG_BITS_IN_DIGIT +#define CYTHON_USE_PYLONG_INTERNALS 1 +#else +#define CYTHON_USE_PYLONG_INTERNALS 0 +#endif +#endif +#endif +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x02040000 + #error Cython requires Python 2.4+. +#else +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#ifdef PYPY_VERSION +#define CYTHON_COMPILING_IN_PYPY 1 +#define CYTHON_COMPILING_IN_CPYTHON 0 +#else +#define CYTHON_COMPILING_IN_PYPY 0 +#define CYTHON_COMPILING_IN_CPYTHON 1 +#endif +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define CYTHON_FORMAT_SSIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \ + (PyErr_Format(PyExc_TypeError, \ + "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ + (PyObject*)0)) + #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) + #define __PYX_BUILD_PY_SSIZE_T "i" +#else + #define __PYX_BUILD_PY_SSIZE_T "n" + #define CYTHON_FORMAT_SSIZE_T "z" + #define __Pyx_PyIndex_Check PyIndex_Check +#endif +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) + #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) + typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); + typedef void (*releasebufferproc)(PyObject *, Py_buffer *); +#endif +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#endif +#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 + #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") +#endif +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif +#if PY_VERSION_HEX < 0x02060000 + #define Py_TPFLAGS_HAVE_VERSION_TAG 0 +#endif +#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) + #define CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) +#else + #define CYTHON_PEP393_ENABLED 0 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) + #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#endif +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject + #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check + #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel +#endif +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) + #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) +#else + #define __Pyx_PyBaseString_Check(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || \ + PyString_Check(obj) || PyUnicode_Check(obj)) + #define __Pyx_PyBaseString_CheckExact(obj) (Py_TYPE(obj) == &PyBaseString_Type) +#endif +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) +#endif +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif +#ifdef NAN +#define __PYX_NAN() ((float) NAN) +#else +static CYTHON_INLINE float __PYX_NAN() { + /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and + a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is + a quiet NaN. */ + float value; + memset(&value, 0xFF, sizeof(value)); + return value; +} +#endif + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES +#endif +#include +#define __PYX_HAVE___record +#define __PYX_HAVE_API___record +#include "string.h" +#include "stdio.h" +#include "stdlib.h" +#include "numpy/arrayobject.h" +#include "numpy/ufuncobject.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif +typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding; + const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + +#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 +#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0 +#define __PYX_DEFAULT_STRING_ENCODING "" +#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString +#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); +static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); +#define __Pyx_PyBytes_FromString PyBytes_FromString +#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*); +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString + #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +#else + #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString + #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize +#endif +#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_FromUString(s) __Pyx_PyObject_FromString((char*)s) +#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s) +#define __Pyx_PyStr_FromUString(s) __Pyx_PyStr_FromString((char*)s) +#define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((char*)s) +#if PY_MAJOR_VERSION < 3 +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) +{ + const Py_UNICODE *u_end = u; + while (*u_end++) ; + return u_end - u - 1; +} +#else +#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen +#endif +#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) +#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode +#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); +#if CYTHON_COMPILING_IN_CPYTHON +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) +#else +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) +#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII +static int __Pyx_sys_getdefaultencoding_not_ascii; +static int __Pyx_init_sys_getdefaultencoding_params() { + PyObject* sys = NULL; + PyObject* default_encoding = NULL; + PyObject* ascii_chars_u = NULL; + PyObject* ascii_chars_b = NULL; + sys = PyImport_ImportModule("sys"); + if (sys == NULL) goto bad; + default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); + if (default_encoding == NULL) goto bad; + if (strcmp(PyBytes_AsString(default_encoding), "ascii") == 0) { + __Pyx_sys_getdefaultencoding_not_ascii = 0; + } else { + const char* default_encoding_c = PyBytes_AS_STRING(default_encoding); + char ascii_chars[128]; + int c; + for (c = 0; c < 128; c++) { + ascii_chars[c] = c; + } + __Pyx_sys_getdefaultencoding_not_ascii = 1; + ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); + if (ascii_chars_u == NULL) goto bad; + ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); + if (ascii_chars_b == NULL || strncmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { + PyErr_Format( + PyExc_ValueError, + "This module compiled with c_string_encoding=ascii, but default encoding '%s' is not a superset of ascii.", + default_encoding_c); + goto bad; + } + } + Py_XDECREF(sys); + Py_XDECREF(default_encoding); + Py_XDECREF(ascii_chars_u); + Py_XDECREF(ascii_chars_b); + return 0; +bad: + Py_XDECREF(sys); + Py_XDECREF(default_encoding); + Py_XDECREF(ascii_chars_u); + Py_XDECREF(ascii_chars_b); + return -1; +} +#endif +#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 +#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) +#else +#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) +#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT +static char* __PYX_DEFAULT_STRING_ENCODING; +static int __Pyx_init_sys_getdefaultencoding_params() { + PyObject* sys = NULL; + PyObject* default_encoding = NULL; + char* default_encoding_c; + sys = PyImport_ImportModule("sys"); + if (sys == NULL) goto bad; + default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); + if (default_encoding == NULL) goto bad; + default_encoding_c = PyBytes_AS_STRING(default_encoding); + __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); + strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); + Py_DECREF(sys); + Py_DECREF(default_encoding); + return 0; +bad: + Py_XDECREF(sys); + Py_XDECREF(default_encoding); + return -1; +} +#endif +#endif + + +#ifdef __GNUC__ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_d; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + +#if !defined(CYTHON_CCOMPLEX) + #if defined(__cplusplus) + #define CYTHON_CCOMPLEX 1 + #elif defined(_Complex_I) + #define CYTHON_CCOMPLEX 1 + #else + #define CYTHON_CCOMPLEX 0 + #endif +#endif +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #include + #else + #include + #endif +#endif +#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) + #undef _Complex_I + #define _Complex_I 1.0fj +#endif + + +static const char *__pyx_f[] = { + "_record.pyx", + "numpy.pxd", + "type.pxd", + "_basis.pxd", +}; + +/* "numpy.pxd":723 + * # in Cython to enable them only on the right systems. + * + * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + */ +typedef npy_int8 __pyx_t_5numpy_int8_t; + +/* "numpy.pxd":724 + * + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t + */ +typedef npy_int16 __pyx_t_5numpy_int16_t; + +/* "numpy.pxd":725 + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< + * ctypedef npy_int64 int64_t + * #ctypedef npy_int96 int96_t + */ +typedef npy_int32 __pyx_t_5numpy_int32_t; + +/* "numpy.pxd":726 + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< + * #ctypedef npy_int96 int96_t + * #ctypedef npy_int128 int128_t + */ +typedef npy_int64 __pyx_t_5numpy_int64_t; + +/* "numpy.pxd":730 + * #ctypedef npy_int128 int128_t + * + * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + */ +typedef npy_uint8 __pyx_t_5numpy_uint8_t; + +/* "numpy.pxd":731 + * + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t + */ +typedef npy_uint16 __pyx_t_5numpy_uint16_t; + +/* "numpy.pxd":732 + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< + * ctypedef npy_uint64 uint64_t + * #ctypedef npy_uint96 uint96_t + */ +typedef npy_uint32 __pyx_t_5numpy_uint32_t; + +/* "numpy.pxd":733 + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< + * #ctypedef npy_uint96 uint96_t + * #ctypedef npy_uint128 uint128_t + */ +typedef npy_uint64 __pyx_t_5numpy_uint64_t; + +/* "numpy.pxd":737 + * #ctypedef npy_uint128 uint128_t + * + * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< + * ctypedef npy_float64 float64_t + * #ctypedef npy_float80 float80_t + */ +typedef npy_float32 __pyx_t_5numpy_float32_t; + +/* "numpy.pxd":738 + * + * ctypedef npy_float32 float32_t + * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< + * #ctypedef npy_float80 float80_t + * #ctypedef npy_float128 float128_t + */ +typedef npy_float64 __pyx_t_5numpy_float64_t; + +/* "numpy.pxd":747 + * # The int types are mapped a bit surprising -- + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t + */ +typedef npy_long __pyx_t_5numpy_int_t; + +/* "numpy.pxd":748 + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong longlong_t + * + */ +typedef npy_longlong __pyx_t_5numpy_long_t; + +/* "numpy.pxd":749 + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_ulong uint_t + */ +typedef npy_longlong __pyx_t_5numpy_longlong_t; + +/* "numpy.pxd":751 + * ctypedef npy_longlong longlong_t + * + * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t + */ +typedef npy_ulong __pyx_t_5numpy_uint_t; + +/* "numpy.pxd":752 + * + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulonglong_t + * + */ +typedef npy_ulonglong __pyx_t_5numpy_ulong_t; + +/* "numpy.pxd":753 + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_intp intp_t + */ +typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; + +/* "numpy.pxd":755 + * ctypedef npy_ulonglong ulonglong_t + * + * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< + * ctypedef npy_uintp uintp_t + * + */ +typedef npy_intp __pyx_t_5numpy_intp_t; + +/* "numpy.pxd":756 + * + * ctypedef npy_intp intp_t + * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< + * + * ctypedef npy_double float_t + */ +typedef npy_uintp __pyx_t_5numpy_uintp_t; + +/* "numpy.pxd":758 + * ctypedef npy_uintp uintp_t + * + * ctypedef npy_double float_t # <<<<<<<<<<<<<< + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t + */ +typedef npy_double __pyx_t_5numpy_float_t; + +/* "numpy.pxd":759 + * + * ctypedef npy_double float_t + * ctypedef npy_double double_t # <<<<<<<<<<<<<< + * ctypedef npy_longdouble longdouble_t + * + */ +typedef npy_double __pyx_t_5numpy_double_t; + +/* "numpy.pxd":760 + * ctypedef npy_double float_t + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cfloat cfloat_t + */ +typedef npy_longdouble __pyx_t_5numpy_longdouble_t; + +/* "_basis.pxd":2 + * cimport numpy as cnp + * ctypedef cnp.float64_t FLOAT_t # <<<<<<<<<<<<<< + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t + */ +typedef __pyx_t_5numpy_float64_t __pyx_t_6_basis_FLOAT_t; + +/* "_basis.pxd":3 + * cimport numpy as cnp + * ctypedef cnp.float64_t FLOAT_t + * ctypedef cnp.intp_t INT_t # <<<<<<<<<<<<<< + * ctypedef cnp.ulong_t INDEX_t + * ctypedef cnp.uint8_t BOOL_t + */ +typedef __pyx_t_5numpy_intp_t __pyx_t_6_basis_INT_t; + +/* "_basis.pxd":4 + * ctypedef cnp.float64_t FLOAT_t + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t # <<<<<<<<<<<<<< + * ctypedef cnp.uint8_t BOOL_t + * + */ +typedef __pyx_t_5numpy_ulong_t __pyx_t_6_basis_INDEX_t; + +/* "_basis.pxd":5 + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t + * ctypedef cnp.uint8_t BOOL_t # <<<<<<<<<<<<<< + * + * cdef class BasisFunction: + */ +typedef __pyx_t_5numpy_uint8_t __pyx_t_6_basis_BOOL_t; + +/* "_util.pxd":2 + * cimport numpy as cnp + * ctypedef cnp.float64_t FLOAT_t # <<<<<<<<<<<<<< + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t + */ +typedef __pyx_t_5numpy_float64_t __pyx_t_5_util_FLOAT_t; + +/* "_util.pxd":3 + * cimport numpy as cnp + * ctypedef cnp.float64_t FLOAT_t + * ctypedef cnp.intp_t INT_t # <<<<<<<<<<<<<< + * ctypedef cnp.ulong_t INDEX_t + * ctypedef cnp.uint8_t BOOL_t + */ +typedef __pyx_t_5numpy_intp_t __pyx_t_5_util_INT_t; + +/* "_util.pxd":4 + * ctypedef cnp.float64_t FLOAT_t + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t # <<<<<<<<<<<<<< + * ctypedef cnp.uint8_t BOOL_t + * + */ +typedef __pyx_t_5numpy_ulong_t __pyx_t_5_util_INDEX_t; + +/* "_util.pxd":5 + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t + * ctypedef cnp.uint8_t BOOL_t # <<<<<<<<<<<<<< + * + * cdef FLOAT_t log2(FLOAT_t x) + */ +typedef __pyx_t_5numpy_uint8_t __pyx_t_5_util_BOOL_t; + +/* "_record.pxd":2 + * cimport numpy as cnp + * ctypedef cnp.float64_t FLOAT_t # <<<<<<<<<<<<<< + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t + */ +typedef __pyx_t_5numpy_float64_t __pyx_t_7_record_FLOAT_t; + +/* "_record.pxd":3 + * cimport numpy as cnp + * ctypedef cnp.float64_t FLOAT_t + * ctypedef cnp.intp_t INT_t # <<<<<<<<<<<<<< + * ctypedef cnp.ulong_t INDEX_t + * ctypedef cnp.uint8_t BOOL_t + */ +typedef __pyx_t_5numpy_intp_t __pyx_t_7_record_INT_t; + +/* "_record.pxd":4 + * ctypedef cnp.float64_t FLOAT_t + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t # <<<<<<<<<<<<<< + * ctypedef cnp.uint8_t BOOL_t + * from _basis cimport Basis + */ +typedef __pyx_t_5numpy_ulong_t __pyx_t_7_record_INDEX_t; + +/* "_record.pxd":5 + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t + * ctypedef cnp.uint8_t BOOL_t # <<<<<<<<<<<<<< + * from _basis cimport Basis + * + */ +typedef __pyx_t_5numpy_uint8_t __pyx_t_7_record_BOOL_t; +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< float > __pyx_t_float_complex; + #else + typedef float _Complex __pyx_t_float_complex; + #endif +#else + typedef struct { float real, imag; } __pyx_t_float_complex; +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< double > __pyx_t_double_complex; + #else + typedef double _Complex __pyx_t_double_complex; + #endif +#else + typedef struct { double real, imag; } __pyx_t_double_complex; +#endif + + +/*--- Type declarations ---*/ +struct __pyx_obj_7_record_Record; +struct __pyx_obj_7_record_PruningPassRecord; +struct __pyx_obj_7_record_Iteration; +struct __pyx_obj_7_record_ForwardPassIteration; +struct __pyx_obj_7_record_FirstForwardPassIteration; +struct __pyx_obj_6_basis_Basis; +struct __pyx_obj_6_basis_BasisFunction; +struct __pyx_obj_6_basis_LinearBasisFunction; +struct __pyx_obj_7_record_PruningPassIteration; +struct __pyx_obj_7_record_FirstPruningPassIteration; +struct __pyx_obj_6_basis_HingeBasisFunction; +struct __pyx_obj_7_record_ForwardPassRecord; +struct __pyx_obj_6_basis_ConstantBasisFunction; + +/* "numpy.pxd":762 + * ctypedef npy_longdouble longdouble_t + * + * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t + */ +typedef npy_cfloat __pyx_t_5numpy_cfloat_t; + +/* "numpy.pxd":763 + * + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< + * ctypedef npy_clongdouble clongdouble_t + * + */ +typedef npy_cdouble __pyx_t_5numpy_cdouble_t; + +/* "numpy.pxd":764 + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cdouble complex_t + */ +typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; + +/* "numpy.pxd":766 + * ctypedef npy_clongdouble clongdouble_t + * + * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew1(a): + */ +typedef npy_cdouble __pyx_t_5numpy_complex_t; +struct __pyx_opt_args_6_basis_13BasisFunction_apply; +struct __pyx_opt_args_6_basis_21ConstantBasisFunction_apply; +struct __pyx_opt_args_6_basis_18HingeBasisFunction_apply; +struct __pyx_opt_args_6_basis_19LinearBasisFunction_apply; + +/* "_basis.pxd":45 + * cpdef INDEX_t degree(BasisFunction self) + * + * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) # <<<<<<<<<<<<<< + * + * cpdef cnp.ndarray[INT_t, ndim=1] valid_knots(BasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] values, cnp.ndarray[FLOAT_t,ndim=1] variable, int variable_idx, INDEX_t check_every, int endspan, int minspan, FLOAT_t minspan_alpha, INDEX_t n, cnp.ndarray[INT_t,ndim=1] workspace) + */ +struct __pyx_opt_args_6_basis_13BasisFunction_apply { + int __pyx_n; + int recurse; +}; + +/* "_basis.pxd":62 + * cpdef BasisFunction get_parent(self) + * + * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) # <<<<<<<<<<<<<< + * + * + */ +struct __pyx_opt_args_6_basis_21ConstantBasisFunction_apply { + int __pyx_n; + int recurse; +}; + +/* "_basis.pxd":86 + * cpdef INDEX_t get_knot_idx(self) + * + * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) # <<<<<<<<<<<<<< + * + * cdef class LinearBasisFunction(BasisFunction): + */ +struct __pyx_opt_args_6_basis_18HingeBasisFunction_apply { + int __pyx_n; + int recurse; +}; + +/* "_basis.pxd":98 + * cpdef INDEX_t get_variable(self) + * + * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) # <<<<<<<<<<<<<< + * + * + */ +struct __pyx_opt_args_6_basis_19LinearBasisFunction_apply { + int __pyx_n; + int recurse; +}; + +/* "_record.pxd":8 + * from _basis cimport Basis + * + * cdef class Record: # <<<<<<<<<<<<<< + * cdef list iterations + * cdef int num_samples + */ +struct __pyx_obj_7_record_Record { + PyObject_HEAD + struct __pyx_vtabstruct_7_record_Record *__pyx_vtab; + PyObject *iterations; + int num_samples; + int num_variables; + __pyx_t_7_record_FLOAT_t penalty; + __pyx_t_7_record_FLOAT_t sst; +}; + + +/* "_record.pxd":25 + * cpdef FLOAT_t grsq(Record self, INDEX_t iteration) + * + * cdef class PruningPassRecord(Record): # <<<<<<<<<<<<<< + * cdef INDEX_t selected + * + */ +struct __pyx_obj_7_record_PruningPassRecord { + struct __pyx_obj_7_record_Record __pyx_base; + __pyx_t_7_record_INDEX_t selected; +}; + + +/* "_record.pxd":39 + * cpdef set_stopping_condition(ForwardPassRecord self, int stopping_condition) + * + * cdef class Iteration: # <<<<<<<<<<<<<< + * cdef FLOAT_t mse + * cdef INDEX_t size + */ +struct __pyx_obj_7_record_Iteration { + PyObject_HEAD + struct __pyx_vtabstruct_7_record_Iteration *__pyx_vtab; + __pyx_t_7_record_FLOAT_t mse; + __pyx_t_7_record_INDEX_t size; +}; + + +/* "_record.pxd":55 + * pass + * + * cdef class ForwardPassIteration(Iteration): # <<<<<<<<<<<<<< + * cdef INDEX_t parent + * cdef INDEX_t variable + */ +struct __pyx_obj_7_record_ForwardPassIteration { + struct __pyx_obj_7_record_Iteration __pyx_base; + __pyx_t_7_record_INDEX_t parent; + __pyx_t_7_record_INDEX_t variable; + __pyx_t_7_record_FLOAT_t knot; + int code; + int no_candidates; +}; + + +/* "_record.pxd":66 + * cpdef no_further_candidates(ForwardPassIteration self) + * + * cdef class FirstForwardPassIteration(ForwardPassIteration): # <<<<<<<<<<<<<< + * cpdef INDEX_t get_size(FirstForwardPassIteration self) + */ +struct __pyx_obj_7_record_FirstForwardPassIteration { + struct __pyx_obj_7_record_ForwardPassIteration __pyx_base; +}; + + +/* "_basis.pxd":102 + * + * + * cdef class Basis: # <<<<<<<<<<<<<< + * '''A wrapper that provides functionality related to a set of BasisFunctions with a + * common ConstantBasisFunction ancestor. Retains the order in which BasisFunctions are + */ +struct __pyx_obj_6_basis_Basis { + PyObject_HEAD + struct __pyx_vtabstruct_6_basis_Basis *__pyx_vtab; + PyObject *order; +}; + + +/* "_basis.pxd":7 + * ctypedef cnp.uint8_t BOOL_t + * + * cdef class BasisFunction: # <<<<<<<<<<<<<< + * '''Abstract. Subclasses must implement the apply, translate, scale, and __init__ methods.''' + * + */ +struct __pyx_obj_6_basis_BasisFunction { + PyObject_HEAD + struct __pyx_vtabstruct_6_basis_BasisFunction *__pyx_vtab; + struct __pyx_obj_6_basis_BasisFunction *parent; + PyObject *child_map; + PyObject *children; + int pruned; + int prunable; + int splittable; +}; + + +/* "_basis.pxd":88 + * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) + * + * cdef class LinearBasisFunction(BasisFunction): # <<<<<<<<<<<<<< + * cdef INDEX_t variable + * cdef str label + */ +struct __pyx_obj_6_basis_LinearBasisFunction { + struct __pyx_obj_6_basis_BasisFunction __pyx_base; + __pyx_t_6_basis_INDEX_t variable; + PyObject *label; +}; + + +/* "_record.pxd":47 + * cpdef INDEX_t get_size(Iteration self) + * + * cdef class PruningPassIteration(Iteration): # <<<<<<<<<<<<<< + * cdef INDEX_t pruned + * + */ +struct __pyx_obj_7_record_PruningPassIteration { + struct __pyx_obj_7_record_Iteration __pyx_base; + __pyx_t_7_record_INDEX_t pruned; +}; + + +/* "_record.pxd":52 + * cpdef INDEX_t get_pruned(PruningPassIteration self) + * + * cdef class FirstPruningPassIteration(PruningPassIteration): # <<<<<<<<<<<<<< + * pass + * + */ +struct __pyx_obj_7_record_FirstPruningPassIteration { + struct __pyx_obj_7_record_PruningPassIteration __pyx_base; +}; + + +/* "_basis.pxd":65 + * + * + * cdef class HingeBasisFunction(BasisFunction): # <<<<<<<<<<<<<< + * cdef FLOAT_t knot + * cdef INDEX_t knot_idx + */ +struct __pyx_obj_6_basis_HingeBasisFunction { + struct __pyx_obj_6_basis_BasisFunction __pyx_base; + __pyx_t_6_basis_FLOAT_t knot; + __pyx_t_6_basis_INDEX_t knot_idx; + __pyx_t_6_basis_INDEX_t variable; + int reverse; + PyObject *label; +}; + + +/* "_record.pxd":34 + * cpdef roll_back(PruningPassRecord self, Basis basis) + * + * cdef class ForwardPassRecord(Record): # <<<<<<<<<<<<<< + * cdef int stopping_condition + * + */ +struct __pyx_obj_7_record_ForwardPassRecord { + struct __pyx_obj_7_record_Record __pyx_base; + int stopping_condition; +}; + + +/* "_basis.pxd":50 + * + * + * cdef class ConstantBasisFunction(BasisFunction): # <<<<<<<<<<<<<< + * + * cpdef INDEX_t degree(ConstantBasisFunction self) + */ +struct __pyx_obj_6_basis_ConstantBasisFunction { + struct __pyx_obj_6_basis_BasisFunction __pyx_base; +}; + + + +/* "_basis.pxd":102 + * + * + * cdef class Basis: # <<<<<<<<<<<<<< + * '''A wrapper that provides functionality related to a set of BasisFunctions with a + * common ConstantBasisFunction ancestor. Retains the order in which BasisFunctions are + */ + +struct __pyx_vtabstruct_6_basis_Basis { + PyObject *(*translate)(struct __pyx_obj_6_basis_Basis *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); + PyObject *(*scale)(struct __pyx_obj_6_basis_Basis *, PyArrayObject *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); + struct __pyx_obj_6_basis_BasisFunction *(*get_root)(struct __pyx_obj_6_basis_Basis *, int __pyx_skip_dispatch); + PyObject *(*append)(struct __pyx_obj_6_basis_Basis *, struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + __pyx_t_6_basis_INDEX_t (*plen)(struct __pyx_obj_6_basis_Basis *, int __pyx_skip_dispatch); + struct __pyx_obj_6_basis_BasisFunction *(*get)(struct __pyx_obj_6_basis_Basis *, __pyx_t_6_basis_INDEX_t, int __pyx_skip_dispatch); + PyObject *(*transform)(struct __pyx_obj_6_basis_Basis *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); + PyObject *(*weighted_transform)(struct __pyx_obj_6_basis_Basis *, PyArrayObject *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_6_basis_Basis *__pyx_vtabptr_6_basis_Basis; + + +/* "_basis.pxd":7 + * ctypedef cnp.uint8_t BOOL_t + * + * cdef class BasisFunction: # <<<<<<<<<<<<<< + * '''Abstract. Subclasses must implement the apply, translate, scale, and __init__ methods.''' + * + */ + +struct __pyx_vtabstruct_6_basis_BasisFunction { + int (*has_knot)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + int (*is_prunable)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + int (*is_pruned)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + int (*is_splittable)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + int (*make_splittable)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + int (*make_unsplittable)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*get_children)(struct __pyx_obj_6_basis_BasisFunction *); + PyObject *(*_set_parent)(struct __pyx_obj_6_basis_BasisFunction *, struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*_add_child)(struct __pyx_obj_6_basis_BasisFunction *, struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + struct __pyx_obj_6_basis_BasisFunction *(*get_parent)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*prune)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*unprune)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*knots)(struct __pyx_obj_6_basis_BasisFunction *, __pyx_t_6_basis_INDEX_t, int __pyx_skip_dispatch); + __pyx_t_6_basis_INDEX_t (*degree)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*apply)(struct __pyx_obj_6_basis_BasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_6_basis_13BasisFunction_apply *__pyx_optional_args); + PyArrayObject *(*valid_knots)(struct __pyx_obj_6_basis_BasisFunction *, PyArrayObject *, PyArrayObject *, int, __pyx_t_6_basis_INDEX_t, int, int, __pyx_t_6_basis_FLOAT_t, __pyx_t_6_basis_INDEX_t, PyArrayObject *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_6_basis_BasisFunction *__pyx_vtabptr_6_basis_BasisFunction; + + +/* "_basis.pxd":88 + * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) + * + * cdef class LinearBasisFunction(BasisFunction): # <<<<<<<<<<<<<< + * cdef INDEX_t variable + * cdef str label + */ + +struct __pyx_vtabstruct_6_basis_LinearBasisFunction { + struct __pyx_vtabstruct_6_basis_BasisFunction __pyx_base; + PyObject *(*translate)(struct __pyx_obj_6_basis_LinearBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch); + __pyx_t_6_basis_FLOAT_t (*scale)(struct __pyx_obj_6_basis_LinearBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); + __pyx_t_6_basis_INDEX_t (*get_variable)(struct __pyx_obj_6_basis_LinearBasisFunction *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_6_basis_LinearBasisFunction *__pyx_vtabptr_6_basis_LinearBasisFunction; + + +/* "_record.pyx":141 + * return result + * + * cdef class Iteration: # <<<<<<<<<<<<<< + * + * def __richcmp__(self, other, method): + */ + +struct __pyx_vtabstruct_7_record_Iteration { + __pyx_t_7_record_FLOAT_t (*get_mse)(struct __pyx_obj_7_record_Iteration *, int __pyx_skip_dispatch); + __pyx_t_7_record_INDEX_t (*get_size)(struct __pyx_obj_7_record_Iteration *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_7_record_Iteration *__pyx_vtabptr_7_record_Iteration; + + +/* "_record.pyx":206 + * return result + * + * cdef class ForwardPassIteration(Iteration): # <<<<<<<<<<<<<< + * def __init__(ForwardPassIteration self, INDEX_t parent, INDEX_t variable, int knot, FLOAT_t mse, INDEX_t size): + * self.parent = parent + */ + +struct __pyx_vtabstruct_7_record_ForwardPassIteration { + struct __pyx_vtabstruct_7_record_Iteration __pyx_base; + PyObject *(*set_no_candidates)(struct __pyx_obj_7_record_ForwardPassIteration *, int, int __pyx_skip_dispatch); + PyObject *(*no_further_candidates)(struct __pyx_obj_7_record_ForwardPassIteration *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_7_record_ForwardPassIteration *__pyx_vtabptr_7_record_ForwardPassIteration; + + +/* "_record.pyx":241 + * return self.no_candidates + * + * cdef class FirstForwardPassIteration(ForwardPassIteration): # <<<<<<<<<<<<<< + * def __init__(FirstForwardPassIteration self, FLOAT_t mse): + * self.mse = mse + */ + +struct __pyx_vtabstruct_7_record_FirstForwardPassIteration { + struct __pyx_vtabstruct_7_record_ForwardPassIteration __pyx_base; +}; +static struct __pyx_vtabstruct_7_record_FirstForwardPassIteration *__pyx_vtabptr_7_record_FirstForwardPassIteration; + + +/* "_record.pyx":160 + * return self.size + * + * cdef class PruningPassIteration(Iteration): # <<<<<<<<<<<<<< + * def __init__(PruningPassIteration self, INDEX_t pruned, INDEX_t size, FLOAT_t mse): + * self.pruned = pruned + */ + +struct __pyx_vtabstruct_7_record_PruningPassIteration { + struct __pyx_vtabstruct_7_record_Iteration __pyx_base; + __pyx_t_7_record_INDEX_t (*get_pruned)(struct __pyx_obj_7_record_PruningPassIteration *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_7_record_PruningPassIteration *__pyx_vtabptr_7_record_PruningPassIteration; + + +/* "_basis.pxd":50 + * + * + * cdef class ConstantBasisFunction(BasisFunction): # <<<<<<<<<<<<<< + * + * cpdef INDEX_t degree(ConstantBasisFunction self) + */ + +struct __pyx_vtabstruct_6_basis_ConstantBasisFunction { + struct __pyx_vtabstruct_6_basis_BasisFunction __pyx_base; + PyObject *(*translate)(struct __pyx_obj_6_basis_ConstantBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch); + __pyx_t_6_basis_FLOAT_t (*scale)(struct __pyx_obj_6_basis_ConstantBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_6_basis_ConstantBasisFunction *__pyx_vtabptr_6_basis_ConstantBasisFunction; + + +/* "_record.pyx":10 + * import _forward + * + * cdef class Record: # <<<<<<<<<<<<<< + * + * def __richcmp__(self, other, method): + */ + +struct __pyx_vtabstruct_7_record_Record { + PyObject *(*append)(struct __pyx_obj_7_record_Record *, struct __pyx_obj_7_record_Iteration *, int __pyx_skip_dispatch); + __pyx_t_7_record_FLOAT_t (*mse)(struct __pyx_obj_7_record_Record *, __pyx_t_7_record_INDEX_t, int __pyx_skip_dispatch); + __pyx_t_7_record_FLOAT_t (*rsq)(struct __pyx_obj_7_record_Record *, __pyx_t_7_record_INDEX_t, int __pyx_skip_dispatch); + __pyx_t_7_record_FLOAT_t (*gcv)(struct __pyx_obj_7_record_Record *, __pyx_t_7_record_INDEX_t, int __pyx_skip_dispatch); + __pyx_t_7_record_FLOAT_t (*grsq)(struct __pyx_obj_7_record_Record *, __pyx_t_7_record_INDEX_t, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_7_record_Record *__pyx_vtabptr_7_record_Record; + + +/* "_record.pyx":50 + * return 1 - (gcv_/gcv0) + * + * cdef class PruningPassRecord(Record): # <<<<<<<<<<<<<< + * def __init__(PruningPassRecord self, INDEX_t num_samples, INDEX_t num_variables, FLOAT_t penalty, FLOAT_t sst, INDEX_t size, FLOAT_t mse): + * self.num_samples = num_samples + */ + +struct __pyx_vtabstruct_7_record_PruningPassRecord { + struct __pyx_vtabstruct_7_record_Record __pyx_base; + PyObject *(*set_selected)(struct __pyx_obj_7_record_PruningPassRecord *, __pyx_t_7_record_INDEX_t, int __pyx_skip_dispatch); + __pyx_t_7_record_INDEX_t (*get_selected)(struct __pyx_obj_7_record_PruningPassRecord *, int __pyx_skip_dispatch); + PyObject *(*roll_back)(struct __pyx_obj_7_record_PruningPassRecord *, struct __pyx_obj_6_basis_Basis *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_7_record_PruningPassRecord *__pyx_vtabptr_7_record_PruningPassRecord; + + +/* "_record.pyx":102 + * return result + * + * cdef class ForwardPassRecord(Record): # <<<<<<<<<<<<<< + * def __init__(ForwardPassRecord self, INDEX_t num_samples, INDEX_t num_variables, FLOAT_t penalty, FLOAT_t sst): + * self.num_samples = num_samples + */ + +struct __pyx_vtabstruct_7_record_ForwardPassRecord { + struct __pyx_vtabstruct_7_record_Record __pyx_base; + PyObject *(*set_stopping_condition)(struct __pyx_obj_7_record_ForwardPassRecord *, int, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_7_record_ForwardPassRecord *__pyx_vtabptr_7_record_ForwardPassRecord; + + +/* "_basis.pxd":65 + * + * + * cdef class HingeBasisFunction(BasisFunction): # <<<<<<<<<<<<<< + * cdef FLOAT_t knot + * cdef INDEX_t knot_idx + */ + +struct __pyx_vtabstruct_6_basis_HingeBasisFunction { + struct __pyx_vtabstruct_6_basis_BasisFunction __pyx_base; + PyObject *(*translate)(struct __pyx_obj_6_basis_HingeBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch); + __pyx_t_6_basis_FLOAT_t (*scale)(struct __pyx_obj_6_basis_HingeBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); + __pyx_t_6_basis_INDEX_t (*get_variable)(struct __pyx_obj_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); + __pyx_t_6_basis_FLOAT_t (*get_knot)(struct __pyx_obj_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); + int (*get_reverse)(struct __pyx_obj_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); + __pyx_t_6_basis_INDEX_t (*get_knot_idx)(struct __pyx_obj_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_6_basis_HingeBasisFunction *__pyx_vtabptr_6_basis_HingeBasisFunction; + + +/* "_record.pyx":186 + * return result + * + * cdef class FirstPruningPassIteration(PruningPassIteration): # <<<<<<<<<<<<<< + * def __init__(PruningPassIteration self, INDEX_t size, FLOAT_t mse): + * self.size = size + */ + +struct __pyx_vtabstruct_7_record_FirstPruningPassIteration { + struct __pyx_vtabstruct_7_record_PruningPassIteration __pyx_base; +}; +static struct __pyx_vtabstruct_7_record_FirstPruningPassIteration *__pyx_vtabptr_7_record_FirstPruningPassIteration; +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; +#ifdef WITH_THREAD + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + if (acquire_gil) { \ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + PyGILState_Release(__pyx_gilstate_save); \ + } else { \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) +#endif + #define __Pyx_RefNannyFinishContext() \ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name, acquire_gil) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif /* CYTHON_REFNANNY */ +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) + +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_getattr)) + return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); +#endif + return PyObject_GetAttr(obj, attr_name); +} +#else +#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#endif + +static PyObject *__Pyx_GetBuiltinName(PyObject *name); /*proto*/ + +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len) & likely(len > (L->allocated >> 1))) { + Py_INCREF(x); + PyList_SET_ITEM(list, len, x); + Py_SIZE(list) = len+1; + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_PyList_Append(L,x) PyList_Append(L,x) +#endif + +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact); /*proto*/ + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ + const char* function_name); /*proto*/ + +#if PY_MAJOR_VERSION >= 3 +static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { + PyObject *value; + value = PyDict_GetItemWithError(d, key); + if (unlikely(!value)) { + if (!PyErr_Occurred()) { + PyObject* args = PyTuple_Pack(1, key); + if (likely(args)) + PyErr_SetObject(PyExc_KeyError, args); + Py_XDECREF(args); + } + return NULL; + } + Py_INCREF(value); + return value; +} +#else + #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) +#endif + +static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /*proto*/ + +#define __Pyx_GetItemInt(o, i, size, to_py_func, is_list, wraparound, boundscheck) \ + (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Fast(o, i, is_list, wraparound, boundscheck) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) +#define __Pyx_GetItemInt_List(o, i, size, to_py_func, is_list, wraparound, boundscheck) \ + (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_List_Fast(o, i, wraparound, boundscheck) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck); +#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func, is_list, wraparound, boundscheck) \ + (((size) <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Tuple_Fast(o, i, wraparound, boundscheck) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck); +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j); +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, + int is_list, int wraparound, int boundscheck); + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); + +static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/ + +static CYTHON_INLINE npy_ulonglong __Pyx_PyInt_from_py_npy_ulonglong(PyObject *); + +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_ulonglong(npy_ulonglong); + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #define __Pyx_CREAL(z) ((z).real()) + #define __Pyx_CIMAG(z) ((z).imag()) + #else + #define __Pyx_CREAL(z) (__real__(z)) + #define __Pyx_CIMAG(z) (__imag__(z)) + #endif +#else + #define __Pyx_CREAL(z) ((z).real) + #define __Pyx_CIMAG(z) ((z).imag) +#endif +#if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX + #define __Pyx_SET_CREAL(z,x) ((z).real(x)) + #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) +#else + #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) + #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) +#endif + +static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); + +#if CYTHON_CCOMPLEX + #define __Pyx_c_eqf(a, b) ((a)==(b)) + #define __Pyx_c_sumf(a, b) ((a)+(b)) + #define __Pyx_c_difff(a, b) ((a)-(b)) + #define __Pyx_c_prodf(a, b) ((a)*(b)) + #define __Pyx_c_quotf(a, b) ((a)/(b)) + #define __Pyx_c_negf(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zerof(z) ((z)==(float)0) + #define __Pyx_c_conjf(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_absf(z) (::std::abs(z)) + #define __Pyx_c_powf(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zerof(z) ((z)==0) + #define __Pyx_c_conjf(z) (conjf(z)) + #if 1 + #define __Pyx_c_absf(z) (cabsf(z)) + #define __Pyx_c_powf(a, b) (cpowf(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex); + #endif +#endif + +static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); + +#if CYTHON_CCOMPLEX + #define __Pyx_c_eq(a, b) ((a)==(b)) + #define __Pyx_c_sum(a, b) ((a)+(b)) + #define __Pyx_c_diff(a, b) ((a)-(b)) + #define __Pyx_c_prod(a, b) ((a)*(b)) + #define __Pyx_c_quot(a, b) ((a)/(b)) + #define __Pyx_c_neg(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero(z) ((z)==(double)0) + #define __Pyx_c_conj(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs(z) (::std::abs(z)) + #define __Pyx_c_pow(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero(z) ((z)==0) + #define __Pyx_c_conj(z) (conj(z)) + #if 1 + #define __Pyx_c_abs(z) (cabs(z)) + #define __Pyx_c_pow(a, b) (cpow(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex); + #endif +#endif + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static void __Pyx_WriteUnraisable(const char *name, int clineno, + int lineno, const char *filename); /*proto*/ + +static int __Pyx_check_binary_version(void); + +static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ + +#if !defined(__Pyx_PyIdentifier_FromString) +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) +#else + #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) +#endif +#endif + +static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ + +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ + +static void* __Pyx_GetVtable(PyObject *dict); /*proto*/ + +static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig); /*proto*/ + +typedef struct { + int code_line; + PyCodeObject* code_object; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); + +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + + +/* Module declarations from 'cpython.buffer' */ + +/* Module declarations from 'cpython.ref' */ + +/* Module declarations from 'libc.string' */ + +/* Module declarations from 'libc.stdio' */ + +/* Module declarations from 'cpython.object' */ + +/* Module declarations from '__builtin__' */ + +/* Module declarations from 'cpython.type' */ +static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; + +/* Module declarations from 'libc.stdlib' */ + +/* Module declarations from 'numpy' */ + +/* Module declarations from 'numpy' */ +static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; +static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; +static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; +static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; +static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ + +/* Module declarations from '_basis' */ +static PyTypeObject *__pyx_ptype_6_basis_BasisFunction = 0; +static PyTypeObject *__pyx_ptype_6_basis_ConstantBasisFunction = 0; +static PyTypeObject *__pyx_ptype_6_basis_HingeBasisFunction = 0; +static PyTypeObject *__pyx_ptype_6_basis_LinearBasisFunction = 0; +static PyTypeObject *__pyx_ptype_6_basis_Basis = 0; + +/* Module declarations from '_util' */ +static __pyx_t_5_util_FLOAT_t (*__pyx_f_5_util_gcv)(__pyx_t_5_util_FLOAT_t, __pyx_t_5_util_INDEX_t, __pyx_t_5_util_INDEX_t, __pyx_t_5_util_FLOAT_t, int __pyx_skip_dispatch); /*proto*/ +static PyObject *(*__pyx_f_5_util_ascii_table)(PyObject *, PyObject *, int __pyx_skip_dispatch); /*proto*/ + +/* Module declarations from '_record' */ +static PyTypeObject *__pyx_ptype_7_record_Record = 0; +static PyTypeObject *__pyx_ptype_7_record_PruningPassRecord = 0; +static PyTypeObject *__pyx_ptype_7_record_ForwardPassRecord = 0; +static PyTypeObject *__pyx_ptype_7_record_Iteration = 0; +static PyTypeObject *__pyx_ptype_7_record_PruningPassIteration = 0; +static PyTypeObject *__pyx_ptype_7_record_FirstPruningPassIteration = 0; +static PyTypeObject *__pyx_ptype_7_record_ForwardPassIteration = 0; +static PyTypeObject *__pyx_ptype_7_record_FirstForwardPassIteration = 0; +#define __Pyx_MODULE_NAME "_record" +int __pyx_module_is_main__record = 0; + +/* Implementation of '_record' */ +static PyObject *__pyx_builtin_NotImplemented; +static PyObject *__pyx_builtin_range; +static PyObject *__pyx_builtin_enumerate; +static PyObject *__pyx_builtin_ValueError; +static PyObject *__pyx_builtin_RuntimeError; +static PyObject *__pyx_pf_7_record_6Record___richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_method); /* proto */ +static PyObject *__pyx_pf_7_record_6Record_2_eq(struct __pyx_obj_7_record_Record *__pyx_v_self, PyObject *__pyx_v_other); /* proto */ +static PyObject *__pyx_pf_7_record_6Record_4__getitem__(struct __pyx_obj_7_record_Record *__pyx_v_self, int __pyx_v_idx); /* proto */ +static Py_ssize_t __pyx_pf_7_record_6Record_6__len__(struct __pyx_obj_7_record_Record *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7_record_6Record_8append(struct __pyx_obj_7_record_Record *__pyx_v_self, struct __pyx_obj_7_record_Iteration *__pyx_v_iteration); /* proto */ +static PyObject *__pyx_pf_7_record_6Record_10mse(struct __pyx_obj_7_record_Record *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_iteration); /* proto */ +static PyObject *__pyx_pf_7_record_6Record_12gcv(struct __pyx_obj_7_record_Record *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_iteration); /* proto */ +static PyObject *__pyx_pf_7_record_6Record_14rsq(struct __pyx_obj_7_record_Record *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_iteration); /* proto */ +static PyObject *__pyx_pf_7_record_6Record_16grsq(struct __pyx_obj_7_record_Record *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_iteration); /* proto */ +static int __pyx_pf_7_record_17PruningPassRecord___init__(struct __pyx_obj_7_record_PruningPassRecord *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_num_samples, __pyx_t_7_record_INDEX_t __pyx_v_num_variables, __pyx_t_7_record_FLOAT_t __pyx_v_penalty, __pyx_t_7_record_FLOAT_t __pyx_v_sst, __pyx_t_7_record_INDEX_t __pyx_v_size, __pyx_t_7_record_FLOAT_t __pyx_v_mse); /* proto */ +static PyObject *__pyx_pf_7_record_17PruningPassRecord_2__reduce__(struct __pyx_obj_7_record_PruningPassRecord *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7_record_17PruningPassRecord_4_getstate(struct __pyx_obj_7_record_PruningPassRecord *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7_record_17PruningPassRecord_6__setstate__(struct __pyx_obj_7_record_PruningPassRecord *__pyx_v_self, PyObject *__pyx_v_state); /* proto */ +static PyObject *__pyx_pf_7_record_17PruningPassRecord_8set_selected(struct __pyx_obj_7_record_PruningPassRecord *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_selected); /* proto */ +static PyObject *__pyx_pf_7_record_17PruningPassRecord_10get_selected(struct __pyx_obj_7_record_PruningPassRecord *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7_record_17PruningPassRecord_12roll_back(struct __pyx_obj_7_record_PruningPassRecord *__pyx_v_self, struct __pyx_obj_6_basis_Basis *__pyx_v_basis); /* proto */ +static PyObject *__pyx_pf_7_record_17PruningPassRecord_14__str__(struct __pyx_obj_7_record_PruningPassRecord *__pyx_v_self); /* proto */ +static int __pyx_pf_7_record_17ForwardPassRecord___init__(struct __pyx_obj_7_record_ForwardPassRecord *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_num_samples, __pyx_t_7_record_INDEX_t __pyx_v_num_variables, __pyx_t_7_record_FLOAT_t __pyx_v_penalty, __pyx_t_7_record_FLOAT_t __pyx_v_sst); /* proto */ +static PyObject *__pyx_pf_7_record_17ForwardPassRecord_2__reduce__(struct __pyx_obj_7_record_ForwardPassRecord *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7_record_17ForwardPassRecord_4_getstate(struct __pyx_obj_7_record_ForwardPassRecord *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7_record_17ForwardPassRecord_6__setstate__(struct __pyx_obj_7_record_ForwardPassRecord *__pyx_v_self, PyObject *__pyx_v_state); /* proto */ +static PyObject *__pyx_pf_7_record_17ForwardPassRecord_8set_stopping_condition(struct __pyx_obj_7_record_ForwardPassRecord *__pyx_v_self, int __pyx_v_stopping_condition); /* proto */ +static PyObject *__pyx_pf_7_record_17ForwardPassRecord_10__str__(struct __pyx_obj_7_record_ForwardPassRecord *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7_record_9Iteration___richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_method); /* proto */ +static PyObject *__pyx_pf_7_record_9Iteration_2_eq(struct __pyx_obj_7_record_Iteration *__pyx_v_self, PyObject *__pyx_v_other); /* proto */ +static PyObject *__pyx_pf_7_record_9Iteration_4get_mse(struct __pyx_obj_7_record_Iteration *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7_record_9Iteration_6get_size(struct __pyx_obj_7_record_Iteration *__pyx_v_self); /* proto */ +static int __pyx_pf_7_record_20PruningPassIteration___init__(struct __pyx_obj_7_record_PruningPassIteration *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_pruned, __pyx_t_7_record_INDEX_t __pyx_v_size, __pyx_t_7_record_FLOAT_t __pyx_v_mse); /* proto */ +static PyObject *__pyx_pf_7_record_20PruningPassIteration_2__reduce__(struct __pyx_obj_7_record_PruningPassIteration *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7_record_20PruningPassIteration_4_getstate(struct __pyx_obj_7_record_PruningPassIteration *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7_record_20PruningPassIteration_6__setstate__(struct __pyx_obj_7_record_PruningPassIteration *__pyx_v_self, PyObject *__pyx_v_state); /* proto */ +static PyObject *__pyx_pf_7_record_20PruningPassIteration_8get_pruned(struct __pyx_obj_7_record_PruningPassIteration *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7_record_20PruningPassIteration_10__str__(struct __pyx_obj_7_record_PruningPassIteration *__pyx_v_self); /* proto */ +static int __pyx_pf_7_record_25FirstPruningPassIteration___init__(struct __pyx_obj_7_record_FirstPruningPassIteration *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_size, __pyx_t_7_record_FLOAT_t __pyx_v_mse); /* proto */ +static PyObject *__pyx_pf_7_record_25FirstPruningPassIteration_2__reduce__(struct __pyx_obj_7_record_FirstPruningPassIteration *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7_record_25FirstPruningPassIteration_4_getstate(struct __pyx_obj_7_record_FirstPruningPassIteration *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7_record_25FirstPruningPassIteration_6__setstate__(struct __pyx_obj_7_record_FirstPruningPassIteration *__pyx_v_self, PyObject *__pyx_v_state); /* proto */ +static PyObject *__pyx_pf_7_record_25FirstPruningPassIteration_8__str__(struct __pyx_obj_7_record_FirstPruningPassIteration *__pyx_v_self); /* proto */ +static int __pyx_pf_7_record_20ForwardPassIteration___init__(struct __pyx_obj_7_record_ForwardPassIteration *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_parent, __pyx_t_7_record_INDEX_t __pyx_v_variable, int __pyx_v_knot, __pyx_t_7_record_FLOAT_t __pyx_v_mse, __pyx_t_7_record_INDEX_t __pyx_v_size); /* proto */ +static PyObject *__pyx_pf_7_record_20ForwardPassIteration_2__reduce__(struct __pyx_obj_7_record_ForwardPassIteration *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7_record_20ForwardPassIteration_4_getstate(struct __pyx_obj_7_record_ForwardPassIteration *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7_record_20ForwardPassIteration_6__setstate__(struct __pyx_obj_7_record_ForwardPassIteration *__pyx_v_self, PyObject *__pyx_v_state); /* proto */ +static PyObject *__pyx_pf_7_record_20ForwardPassIteration_8__str__(struct __pyx_obj_7_record_ForwardPassIteration *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7_record_20ForwardPassIteration_10set_no_candidates(struct __pyx_obj_7_record_ForwardPassIteration *__pyx_v_self, int __pyx_v_value); /* proto */ +static PyObject *__pyx_pf_7_record_20ForwardPassIteration_12no_further_candidates(struct __pyx_obj_7_record_ForwardPassIteration *__pyx_v_self); /* proto */ +static int __pyx_pf_7_record_25FirstForwardPassIteration___init__(struct __pyx_obj_7_record_FirstForwardPassIteration *__pyx_v_self, __pyx_t_7_record_FLOAT_t __pyx_v_mse); /* proto */ +static PyObject *__pyx_pf_7_record_25FirstForwardPassIteration_2__reduce__(struct __pyx_obj_7_record_FirstForwardPassIteration *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7_record_25FirstForwardPassIteration_4_getstate(struct __pyx_obj_7_record_FirstForwardPassIteration *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7_record_25FirstForwardPassIteration_6__setstate__(struct __pyx_obj_7_record_FirstForwardPassIteration *__pyx_v_self, PyObject *__pyx_v_state); /* proto */ +static PyObject *__pyx_pf_7_record_25FirstForwardPassIteration_8get_size(struct __pyx_obj_7_record_FirstForwardPassIteration *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7_record_25FirstForwardPassIteration_10__str__(struct __pyx_obj_7_record_FirstForwardPassIteration *__pyx_v_self); /* proto */ +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ +static PyObject *__pyx_tp_new_7_record_Record(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7_record_PruningPassRecord(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7_record_ForwardPassRecord(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7_record_Iteration(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7_record_PruningPassIteration(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7_record_FirstPruningPassIteration(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7_record_ForwardPassIteration(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7_record_FirstForwardPassIteration(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static char __pyx_k_1[] = ""; +static char __pyx_k_2[] = "Pruning Pass\n"; +static char __pyx_k_3[] = "iter\tbf\tterms\tmse\tgcv\trsq\tgrsq"; +static char __pyx_k_4[] = "\t"; +static char __pyx_k_6[] = "\t%.3f\t%.3f\t%.3f"; +static char __pyx_k_8[] = "\nSelected iteration: "; +static char __pyx_k_9[] = "\n"; +static char __pyx_k_10[] = "set_stopping_condition"; +static char __pyx_k_12[] = "%.3f\t%.3f\t%.3f"; +static char __pyx_k_14[] = "Forward Pass\n"; +static char __pyx_k_15[] = "\nStopping Condition %d: %s\n"; +static char __pyx_k_16[] = "%s\t%s\t%s"; +static char __pyx_k_17[] = "%.2f"; +static char __pyx_k_18[] = "-"; +static char __pyx_k_19[] = "%d\t%d\t%d\t%4f\t%d"; +static char __pyx_k_20[] = "no_further_candidates"; +static char __pyx_k_21[] = "%s\t%s\t%s\t%4f\t%s"; +static char __pyx_k_22[] = "ndarray is not C contiguous"; +static char __pyx_k_24[] = "ndarray is not Fortran contiguous"; +static char __pyx_k_26[] = "Non-native byte order not supported"; +static char __pyx_k_28[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_29[] = "Format string allocated too short, see comment in numpy.pxd"; +static char __pyx_k_32[] = "Format string allocated too short."; +static char __pyx_k__B[] = "B"; +static char __pyx_k__H[] = "H"; +static char __pyx_k__I[] = "I"; +static char __pyx_k__L[] = "L"; +static char __pyx_k__O[] = "O"; +static char __pyx_k__Q[] = "Q"; +static char __pyx_k__b[] = "b"; +static char __pyx_k__d[] = "d"; +static char __pyx_k__f[] = "f"; +static char __pyx_k__g[] = "g"; +static char __pyx_k__h[] = "h"; +static char __pyx_k__i[] = "i"; +static char __pyx_k__l[] = "l"; +static char __pyx_k__q[] = "q"; +static char __pyx_k__Zd[] = "Zd"; +static char __pyx_k__Zf[] = "Zf"; +static char __pyx_k__Zg[] = "Zg"; +static char __pyx_k___eq[] = "_eq"; +static char __pyx_k__gcv[] = "gcv"; +static char __pyx_k__mse[] = "mse"; +static char __pyx_k__rsq[] = "rsq"; +static char __pyx_k__sst[] = "sst"; +static char __pyx_k__var[] = "var"; +static char __pyx_k__grsq[] = "grsq"; +static char __pyx_k__iter[] = "iter"; +static char __pyx_k__knot[] = "knot"; +static char __pyx_k__size[] = "size"; +static char __pyx_k__range[] = "range"; +static char __pyx_k__split[] = "split"; +static char __pyx_k__terms[] = "terms"; +static char __pyx_k__append[] = "append"; +static char __pyx_k__parent[] = "parent"; +static char __pyx_k__pruned[] = "pruned"; +static char __pyx_k__get_mse[] = "get_mse"; +static char __pyx_k__penalty[] = "penalty"; +static char __pyx_k__unprune[] = "unprune"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k___forward[] = "_forward"; +static char __pyx_k__get_size[] = "get_size"; +static char __pyx_k__selected[] = "selected"; +static char __pyx_k__variable[] = "variable"; +static char __pyx_k____class__[] = "__class__"; +static char __pyx_k___getstate[] = "_getstate"; +static char __pyx_k__enumerate[] = "enumerate"; +static char __pyx_k__roll_back[] = "roll_back"; +static char __pyx_k__ValueError[] = "ValueError"; +static char __pyx_k____import__[] = "__import__"; +static char __pyx_k__get_pruned[] = "get_pruned"; +static char __pyx_k__iterations[] = "iterations"; +static char __pyx_k__num_samples[] = "num_samples"; +static char __pyx_k__RuntimeError[] = "RuntimeError"; +static char __pyx_k__get_selected[] = "get_selected"; +static char __pyx_k__set_selected[] = "set_selected"; +static char __pyx_k__num_variables[] = "num_variables"; +static char __pyx_k__NotImplemented[] = "NotImplemented"; +static char __pyx_k__set_no_candidates[] = "set_no_candidates"; +static char __pyx_k__stopping_conditions[] = "stopping_conditions"; +static PyObject *__pyx_kp_s_1; +static PyObject *__pyx_n_s_10; +static PyObject *__pyx_kp_s_12; +static PyObject *__pyx_kp_s_14; +static PyObject *__pyx_kp_s_15; +static PyObject *__pyx_kp_s_16; +static PyObject *__pyx_kp_s_17; +static PyObject *__pyx_kp_s_18; +static PyObject *__pyx_kp_s_19; +static PyObject *__pyx_kp_s_2; +static PyObject *__pyx_n_s_20; +static PyObject *__pyx_kp_s_21; +static PyObject *__pyx_kp_u_22; +static PyObject *__pyx_kp_u_24; +static PyObject *__pyx_kp_u_26; +static PyObject *__pyx_kp_u_28; +static PyObject *__pyx_kp_u_29; +static PyObject *__pyx_kp_s_3; +static PyObject *__pyx_kp_u_32; +static PyObject *__pyx_kp_s_4; +static PyObject *__pyx_kp_s_6; +static PyObject *__pyx_kp_s_8; +static PyObject *__pyx_kp_s_9; +static PyObject *__pyx_n_s__NotImplemented; +static PyObject *__pyx_n_s__RuntimeError; +static PyObject *__pyx_n_s__ValueError; +static PyObject *__pyx_n_s____class__; +static PyObject *__pyx_n_s____import__; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s___eq; +static PyObject *__pyx_n_s___forward; +static PyObject *__pyx_n_s___getstate; +static PyObject *__pyx_n_s__append; +static PyObject *__pyx_n_s__enumerate; +static PyObject *__pyx_n_s__gcv; +static PyObject *__pyx_n_s__get_mse; +static PyObject *__pyx_n_s__get_pruned; +static PyObject *__pyx_n_s__get_selected; +static PyObject *__pyx_n_s__get_size; +static PyObject *__pyx_n_s__grsq; +static PyObject *__pyx_n_s__iter; +static PyObject *__pyx_n_s__iterations; +static PyObject *__pyx_n_s__knot; +static PyObject *__pyx_n_s__mse; +static PyObject *__pyx_n_s__num_samples; +static PyObject *__pyx_n_s__num_variables; +static PyObject *__pyx_n_s__parent; +static PyObject *__pyx_n_s__penalty; +static PyObject *__pyx_n_s__pruned; +static PyObject *__pyx_n_s__range; +static PyObject *__pyx_n_s__roll_back; +static PyObject *__pyx_n_s__rsq; +static PyObject *__pyx_n_s__selected; +static PyObject *__pyx_n_s__set_no_candidates; +static PyObject *__pyx_n_s__set_selected; +static PyObject *__pyx_n_s__size; +static PyObject *__pyx_n_s__split; +static PyObject *__pyx_n_s__sst; +static PyObject *__pyx_n_s__stopping_conditions; +static PyObject *__pyx_n_s__terms; +static PyObject *__pyx_n_s__unprune; +static PyObject *__pyx_n_s__var; +static PyObject *__pyx_n_s__variable; +static PyObject *__pyx_int_0; +static PyObject *__pyx_int_1; +static PyObject *__pyx_int_2; +static PyObject *__pyx_int_3; +static PyObject *__pyx_int_15; +static PyObject *__pyx_k_tuple_5; +static PyObject *__pyx_k_tuple_7; +static PyObject *__pyx_k_tuple_11; +static PyObject *__pyx_k_tuple_13; +static PyObject *__pyx_k_tuple_23; +static PyObject *__pyx_k_tuple_25; +static PyObject *__pyx_k_tuple_27; +static PyObject *__pyx_k_tuple_30; +static PyObject *__pyx_k_tuple_31; +static PyObject *__pyx_k_tuple_33; + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_6Record_1__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_arg_method); /*proto*/ +static PyObject *__pyx_pw_7_record_6Record_1__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_arg_method) { + PyObject *__pyx_v_method = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0); + __pyx_v_method = PyInt_FromLong(__pyx_arg_method); if (unlikely(!__pyx_v_method)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_v_method); + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("_record.Record.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7_record_6Record___richcmp__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other), ((PyObject *)__pyx_v_method)); + __Pyx_XDECREF(__pyx_v_method); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":12 + * cdef class Record: + * + * def __richcmp__(self, other, method): # <<<<<<<<<<<<<< + * if method == 2: + * return self._eq(other) + */ + +static PyObject *__pyx_pf_7_record_6Record___richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_method) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__richcmp__", 0); + + /* "_record.pyx":13 + * + * def __richcmp__(self, other, method): + * if method == 2: # <<<<<<<<<<<<<< + * return self._eq(other) + * elif method == 3: + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_method, __pyx_int_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "_record.pyx":14 + * def __richcmp__(self, other, method): + * if method == 2: + * return self._eq(other) # <<<<<<<<<<<<<< + * elif method == 3: + * return not self._eq(other) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s___eq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_other); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_other); + __Pyx_GIVEREF(__pyx_v_other); + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + goto __pyx_L3; + } + + /* "_record.pyx":15 + * if method == 2: + * return self._eq(other) + * elif method == 3: # <<<<<<<<<<<<<< + * return not self._eq(other) + * else: + */ + __pyx_t_4 = PyObject_RichCompare(__pyx_v_method, __pyx_int_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_2) { + + /* "_record.pyx":16 + * return self._eq(other) + * elif method == 3: + * return not self._eq(other) # <<<<<<<<<<<<<< + * else: + * return NotImplemented + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s___eq); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_other); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_other); + __Pyx_GIVEREF(__pyx_v_other); + __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyBool_FromLong((!__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "_record.pyx":18 + * return not self._eq(other) + * else: + * return NotImplemented # <<<<<<<<<<<<<< + * + * def _eq(self, other): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_builtin_NotImplemented); + __pyx_r = __pyx_builtin_NotImplemented; + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("_record.Record.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_6Record_3_eq(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static PyObject *__pyx_pw_7_record_6Record_3_eq(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_eq (wrapper)", 0); + __pyx_r = __pyx_pf_7_record_6Record_2_eq(((struct __pyx_obj_7_record_Record *)__pyx_v_self), ((PyObject *)__pyx_v_other)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":20 + * return NotImplemented + * + * def _eq(self, other): # <<<<<<<<<<<<<< + * return self.__class__ is other.__class__ and self._getstate() == other._getstate() + * + */ + +static PyObject *__pyx_pf_7_record_6Record_2_eq(struct __pyx_obj_7_record_Record *__pyx_v_self, PyObject *__pyx_v_other) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_eq", 0); + + /* "_record.pyx":21 + * + * def _eq(self, other): + * return self.__class__ is other.__class__ and self._getstate() == other._getstate() # <<<<<<<<<<<<<< + * + * def __getitem__(Record self, int idx): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = (__pyx_t_1 == __pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_3) { + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __pyx_t_1; + __pyx_t_1 = 0; + } else { + __pyx_t_5 = __pyx_t_2; + __pyx_t_2 = 0; + } + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("_record.Record._eq", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_6Record_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_idx); /*proto*/ +static PyObject *__pyx_pw_7_record_6Record_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_idx) { + int __pyx_v_idx; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); + assert(__pyx_arg_idx); { + __pyx_v_idx = __Pyx_PyInt_AsInt(__pyx_arg_idx); if (unlikely((__pyx_v_idx == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("_record.Record.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7_record_6Record_4__getitem__(((struct __pyx_obj_7_record_Record *)__pyx_v_self), ((int)__pyx_v_idx)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":23 + * return self.__class__ is other.__class__ and self._getstate() == other._getstate() + * + * def __getitem__(Record self, int idx): # <<<<<<<<<<<<<< + * return self.iterations[idx] + * + */ + +static PyObject *__pyx_pf_7_record_6Record_4__getitem__(struct __pyx_obj_7_record_Record *__pyx_v_self, int __pyx_v_idx) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getitem__", 0); + + /* "_record.pyx":24 + * + * def __getitem__(Record self, int idx): + * return self.iterations[idx] # <<<<<<<<<<<<<< + * + * def __len__(Record self): + */ + __Pyx_XDECREF(__pyx_r); + if (unlikely(((PyObject *)__pyx_v_self->iterations) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __Pyx_INCREF(PyList_GET_ITEM(__pyx_v_self->iterations, __pyx_v_idx)); + __pyx_r = PyList_GET_ITEM(__pyx_v_self->iterations, __pyx_v_idx); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_AddTraceback("_record.Record.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static Py_ssize_t __pyx_pw_7_record_6Record_7__len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_pw_7_record_6Record_7__len__(PyObject *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); + __pyx_r = __pyx_pf_7_record_6Record_6__len__(((struct __pyx_obj_7_record_Record *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":26 + * return self.iterations[idx] + * + * def __len__(Record self): # <<<<<<<<<<<<<< + * return len(self.iterations) + * + */ + +static Py_ssize_t __pyx_pf_7_record_6Record_6__len__(struct __pyx_obj_7_record_Record *__pyx_v_self) { + Py_ssize_t __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__len__", 0); + + /* "_record.pyx":27 + * + * def __len__(Record self): + * return len(self.iterations) # <<<<<<<<<<<<<< + * + * cpdef append(Record self, Iteration iteration): + */ + __pyx_t_1 = ((PyObject *)__pyx_v_self->iterations); + __Pyx_INCREF(__pyx_t_1); + if (unlikely(__pyx_t_1 == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_2 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_record.Record.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":29 + * return len(self.iterations) + * + * cpdef append(Record self, Iteration iteration): # <<<<<<<<<<<<<< + * self.iterations.append(iteration) + * + */ + +static PyObject *__pyx_pw_7_record_6Record_9append(PyObject *__pyx_v_self, PyObject *__pyx_v_iteration); /*proto*/ +static PyObject *__pyx_f_7_record_6Record_append(struct __pyx_obj_7_record_Record *__pyx_v_self, struct __pyx_obj_7_record_Iteration *__pyx_v_iteration, int __pyx_skip_dispatch) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("append", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__append); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7_record_6Record_9append)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_v_iteration)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_iteration)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_iteration)); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_record.pyx":30 + * + * cpdef append(Record self, Iteration iteration): + * self.iterations.append(iteration) # <<<<<<<<<<<<<< + * + * cpdef FLOAT_t mse(Record self, INDEX_t iteration): + */ + if (unlikely(((PyObject *)__pyx_v_self->iterations) == Py_None)) { + PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_self->iterations, ((PyObject *)__pyx_v_iteration)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("_record.Record.append", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_6Record_9append(PyObject *__pyx_v_self, PyObject *__pyx_v_iteration); /*proto*/ +static PyObject *__pyx_pw_7_record_6Record_9append(PyObject *__pyx_v_self, PyObject *__pyx_v_iteration) { + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("append (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_iteration), __pyx_ptype_7_record_Iteration, 1, "iteration", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7_record_6Record_8append(((struct __pyx_obj_7_record_Record *)__pyx_v_self), ((struct __pyx_obj_7_record_Iteration *)__pyx_v_iteration)); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":29 + * return len(self.iterations) + * + * cpdef append(Record self, Iteration iteration): # <<<<<<<<<<<<<< + * self.iterations.append(iteration) + * + */ + +static PyObject *__pyx_pf_7_record_6Record_8append(struct __pyx_obj_7_record_Record *__pyx_v_self, struct __pyx_obj_7_record_Iteration *__pyx_v_iteration) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("append", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_7_record_Record *)__pyx_v_self->__pyx_vtab)->append(__pyx_v_self, __pyx_v_iteration, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_record.Record.append", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":32 + * self.iterations.append(iteration) + * + * cpdef FLOAT_t mse(Record self, INDEX_t iteration): # <<<<<<<<<<<<<< + * return self.iterations[iteration].get_mse() + * + */ + +static PyObject *__pyx_pw_7_record_6Record_11mse(PyObject *__pyx_v_self, PyObject *__pyx_arg_iteration); /*proto*/ +static __pyx_t_7_record_FLOAT_t __pyx_f_7_record_6Record_mse(struct __pyx_obj_7_record_Record *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_iteration, int __pyx_skip_dispatch) { + __pyx_t_7_record_FLOAT_t __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __pyx_t_7_record_FLOAT_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("mse", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__mse); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7_record_6Record_11mse)) { + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_iteration); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_4; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_record.pyx":33 + * + * cpdef FLOAT_t mse(Record self, INDEX_t iteration): + * return self.iterations[iteration].get_mse() # <<<<<<<<<<<<<< + * + * cpdef FLOAT_t gcv(Record self, INDEX_t iteration): + */ + if (unlikely(((PyObject *)__pyx_v_self->iterations) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_self->iterations, __pyx_v_iteration), __pyx_n_s__get_mse); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_4; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_WriteUnraisable("_record.Record.mse", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_6Record_11mse(PyObject *__pyx_v_self, PyObject *__pyx_arg_iteration); /*proto*/ +static PyObject *__pyx_pw_7_record_6Record_11mse(PyObject *__pyx_v_self, PyObject *__pyx_arg_iteration) { + __pyx_t_7_record_INDEX_t __pyx_v_iteration; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("mse (wrapper)", 0); + assert(__pyx_arg_iteration); { + __pyx_v_iteration = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_arg_iteration); if (unlikely((__pyx_v_iteration == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("_record.Record.mse", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7_record_6Record_10mse(((struct __pyx_obj_7_record_Record *)__pyx_v_self), ((__pyx_t_7_record_INDEX_t)__pyx_v_iteration)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":32 + * self.iterations.append(iteration) + * + * cpdef FLOAT_t mse(Record self, INDEX_t iteration): # <<<<<<<<<<<<<< + * return self.iterations[iteration].get_mse() + * + */ + +static PyObject *__pyx_pf_7_record_6Record_10mse(struct __pyx_obj_7_record_Record *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_iteration) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("mse", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7_record_Record *)__pyx_v_self->__pyx_vtab)->mse(__pyx_v_self, __pyx_v_iteration, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_record.Record.mse", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":35 + * return self.iterations[iteration].get_mse() + * + * cpdef FLOAT_t gcv(Record self, INDEX_t iteration): # <<<<<<<<<<<<<< + * cdef Iteration it = self.iterations[iteration] + * cdef FLOAT_t mse = it.mse + */ + +static PyObject *__pyx_pw_7_record_6Record_13gcv(PyObject *__pyx_v_self, PyObject *__pyx_arg_iteration); /*proto*/ +static __pyx_t_7_record_FLOAT_t __pyx_f_7_record_6Record_gcv(struct __pyx_obj_7_record_Record *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_iteration, int __pyx_skip_dispatch) { + struct __pyx_obj_7_record_Iteration *__pyx_v_it = 0; + __pyx_t_7_record_FLOAT_t __pyx_v_mse; + __pyx_t_7_record_FLOAT_t __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __pyx_t_7_record_FLOAT_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("gcv", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__gcv); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7_record_6Record_13gcv)) { + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_iteration); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_4; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_record.pyx":36 + * + * cpdef FLOAT_t gcv(Record self, INDEX_t iteration): + * cdef Iteration it = self.iterations[iteration] # <<<<<<<<<<<<<< + * cdef FLOAT_t mse = it.mse + * return gcv(mse,it.get_size(),self.num_samples,self.penalty) + */ + if (unlikely(((PyObject *)__pyx_v_self->iterations) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + if (!(likely(((PyList_GET_ITEM(__pyx_v_self->iterations, __pyx_v_iteration)) == Py_None) || likely(__Pyx_TypeTest(PyList_GET_ITEM(__pyx_v_self->iterations, __pyx_v_iteration), __pyx_ptype_7_record_Iteration))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyList_GET_ITEM(__pyx_v_self->iterations, __pyx_v_iteration); + __Pyx_INCREF(__pyx_t_1); + __pyx_v_it = ((struct __pyx_obj_7_record_Iteration *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "_record.pyx":37 + * cpdef FLOAT_t gcv(Record self, INDEX_t iteration): + * cdef Iteration it = self.iterations[iteration] + * cdef FLOAT_t mse = it.mse # <<<<<<<<<<<<<< + * return gcv(mse,it.get_size(),self.num_samples,self.penalty) + * + */ + __pyx_t_4 = __pyx_v_it->mse; + __pyx_v_mse = __pyx_t_4; + + /* "_record.pyx":38 + * cdef Iteration it = self.iterations[iteration] + * cdef FLOAT_t mse = it.mse + * return gcv(mse,it.get_size(),self.num_samples,self.penalty) # <<<<<<<<<<<<<< + * + * cpdef FLOAT_t rsq(Record self, INDEX_t iteration): + */ + __pyx_r = __pyx_f_5_util_gcv(__pyx_v_mse, ((struct __pyx_vtabstruct_7_record_Iteration *)__pyx_v_it->__pyx_vtab)->get_size(__pyx_v_it, 0), __pyx_v_self->num_samples, __pyx_v_self->penalty, 0); + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_WriteUnraisable("_record.Record.gcv", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_it); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_6Record_13gcv(PyObject *__pyx_v_self, PyObject *__pyx_arg_iteration); /*proto*/ +static PyObject *__pyx_pw_7_record_6Record_13gcv(PyObject *__pyx_v_self, PyObject *__pyx_arg_iteration) { + __pyx_t_7_record_INDEX_t __pyx_v_iteration; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("gcv (wrapper)", 0); + assert(__pyx_arg_iteration); { + __pyx_v_iteration = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_arg_iteration); if (unlikely((__pyx_v_iteration == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("_record.Record.gcv", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7_record_6Record_12gcv(((struct __pyx_obj_7_record_Record *)__pyx_v_self), ((__pyx_t_7_record_INDEX_t)__pyx_v_iteration)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":35 + * return self.iterations[iteration].get_mse() + * + * cpdef FLOAT_t gcv(Record self, INDEX_t iteration): # <<<<<<<<<<<<<< + * cdef Iteration it = self.iterations[iteration] + * cdef FLOAT_t mse = it.mse + */ + +static PyObject *__pyx_pf_7_record_6Record_12gcv(struct __pyx_obj_7_record_Record *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_iteration) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("gcv", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7_record_Record *)__pyx_v_self->__pyx_vtab)->gcv(__pyx_v_self, __pyx_v_iteration, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_record.Record.gcv", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":40 + * return gcv(mse,it.get_size(),self.num_samples,self.penalty) + * + * cpdef FLOAT_t rsq(Record self, INDEX_t iteration): # <<<<<<<<<<<<<< + * cdef FLOAT_t mse0 = self.sst#gcv(self.sst,1,self.num_samples,self.penalty) + * cdef FLOAT_t mse = self.mse(iteration)#gcv(self.mse(iteration):,self.iterations[iteration].get_size(),self.num_samples,self.penalty)#self.gcv(iteration) + */ + +static PyObject *__pyx_pw_7_record_6Record_15rsq(PyObject *__pyx_v_self, PyObject *__pyx_arg_iteration); /*proto*/ +static __pyx_t_7_record_FLOAT_t __pyx_f_7_record_6Record_rsq(struct __pyx_obj_7_record_Record *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_iteration, int __pyx_skip_dispatch) { + __pyx_t_7_record_FLOAT_t __pyx_v_mse0; + __pyx_t_7_record_FLOAT_t __pyx_v_mse; + __pyx_t_7_record_FLOAT_t __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __pyx_t_7_record_FLOAT_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("rsq", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__rsq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7_record_6Record_15rsq)) { + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_iteration); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_4; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_record.pyx":41 + * + * cpdef FLOAT_t rsq(Record self, INDEX_t iteration): + * cdef FLOAT_t mse0 = self.sst#gcv(self.sst,1,self.num_samples,self.penalty) # <<<<<<<<<<<<<< + * cdef FLOAT_t mse = self.mse(iteration)#gcv(self.mse(iteration):,self.iterations[iteration].get_size(),self.num_samples,self.penalty)#self.gcv(iteration) + * return 1 - (mse / mse0) + */ + __pyx_t_4 = __pyx_v_self->sst; + __pyx_v_mse0 = __pyx_t_4; + + /* "_record.pyx":42 + * cpdef FLOAT_t rsq(Record self, INDEX_t iteration): + * cdef FLOAT_t mse0 = self.sst#gcv(self.sst,1,self.num_samples,self.penalty) + * cdef FLOAT_t mse = self.mse(iteration)#gcv(self.mse(iteration):,self.iterations[iteration].get_size(),self.num_samples,self.penalty)#self.gcv(iteration) # <<<<<<<<<<<<<< + * return 1 - (mse / mse0) + * + */ + __pyx_v_mse = ((struct __pyx_vtabstruct_7_record_Record *)__pyx_v_self->__pyx_vtab)->mse(__pyx_v_self, __pyx_v_iteration, 0); + + /* "_record.pyx":43 + * cdef FLOAT_t mse0 = self.sst#gcv(self.sst,1,self.num_samples,self.penalty) + * cdef FLOAT_t mse = self.mse(iteration)#gcv(self.mse(iteration):,self.iterations[iteration].get_size(),self.num_samples,self.penalty)#self.gcv(iteration) + * return 1 - (mse / mse0) # <<<<<<<<<<<<<< + * + * cpdef FLOAT_t grsq(Record self, INDEX_t iteration): + */ + __pyx_r = (1.0 - (__pyx_v_mse / __pyx_v_mse0)); + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_WriteUnraisable("_record.Record.rsq", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_6Record_15rsq(PyObject *__pyx_v_self, PyObject *__pyx_arg_iteration); /*proto*/ +static PyObject *__pyx_pw_7_record_6Record_15rsq(PyObject *__pyx_v_self, PyObject *__pyx_arg_iteration) { + __pyx_t_7_record_INDEX_t __pyx_v_iteration; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("rsq (wrapper)", 0); + assert(__pyx_arg_iteration); { + __pyx_v_iteration = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_arg_iteration); if (unlikely((__pyx_v_iteration == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("_record.Record.rsq", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7_record_6Record_14rsq(((struct __pyx_obj_7_record_Record *)__pyx_v_self), ((__pyx_t_7_record_INDEX_t)__pyx_v_iteration)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":40 + * return gcv(mse,it.get_size(),self.num_samples,self.penalty) + * + * cpdef FLOAT_t rsq(Record self, INDEX_t iteration): # <<<<<<<<<<<<<< + * cdef FLOAT_t mse0 = self.sst#gcv(self.sst,1,self.num_samples,self.penalty) + * cdef FLOAT_t mse = self.mse(iteration)#gcv(self.mse(iteration):,self.iterations[iteration].get_size(),self.num_samples,self.penalty)#self.gcv(iteration) + */ + +static PyObject *__pyx_pf_7_record_6Record_14rsq(struct __pyx_obj_7_record_Record *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_iteration) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("rsq", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7_record_Record *)__pyx_v_self->__pyx_vtab)->rsq(__pyx_v_self, __pyx_v_iteration, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_record.Record.rsq", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":45 + * return 1 - (mse / mse0) + * + * cpdef FLOAT_t grsq(Record self, INDEX_t iteration): # <<<<<<<<<<<<<< + * cdef FLOAT_t gcv0 = gcv(self.sst,1,self.num_samples,self.penalty) + * cdef FLOAT_t gcv_ = self.gcv(iteration) + */ + +static PyObject *__pyx_pw_7_record_6Record_17grsq(PyObject *__pyx_v_self, PyObject *__pyx_arg_iteration); /*proto*/ +static __pyx_t_7_record_FLOAT_t __pyx_f_7_record_6Record_grsq(struct __pyx_obj_7_record_Record *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_iteration, int __pyx_skip_dispatch) { + __pyx_t_7_record_FLOAT_t __pyx_v_gcv0; + __pyx_t_7_record_FLOAT_t __pyx_v_gcv_; + __pyx_t_7_record_FLOAT_t __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + __pyx_t_7_record_FLOAT_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("grsq", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__grsq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7_record_6Record_17grsq)) { + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_iteration); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_4; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_record.pyx":46 + * + * cpdef FLOAT_t grsq(Record self, INDEX_t iteration): + * cdef FLOAT_t gcv0 = gcv(self.sst,1,self.num_samples,self.penalty) # <<<<<<<<<<<<<< + * cdef FLOAT_t gcv_ = self.gcv(iteration) + * return 1 - (gcv_/gcv0) + */ + __pyx_v_gcv0 = __pyx_f_5_util_gcv(__pyx_v_self->sst, 1, __pyx_v_self->num_samples, __pyx_v_self->penalty, 0); + + /* "_record.pyx":47 + * cpdef FLOAT_t grsq(Record self, INDEX_t iteration): + * cdef FLOAT_t gcv0 = gcv(self.sst,1,self.num_samples,self.penalty) + * cdef FLOAT_t gcv_ = self.gcv(iteration) # <<<<<<<<<<<<<< + * return 1 - (gcv_/gcv0) + * + */ + __pyx_v_gcv_ = ((struct __pyx_vtabstruct_7_record_Record *)__pyx_v_self->__pyx_vtab)->gcv(__pyx_v_self, __pyx_v_iteration, 0); + + /* "_record.pyx":48 + * cdef FLOAT_t gcv0 = gcv(self.sst,1,self.num_samples,self.penalty) + * cdef FLOAT_t gcv_ = self.gcv(iteration) + * return 1 - (gcv_/gcv0) # <<<<<<<<<<<<<< + * + * cdef class PruningPassRecord(Record): + */ + __pyx_r = (1.0 - (__pyx_v_gcv_ / __pyx_v_gcv0)); + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_WriteUnraisable("_record.Record.grsq", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_6Record_17grsq(PyObject *__pyx_v_self, PyObject *__pyx_arg_iteration); /*proto*/ +static PyObject *__pyx_pw_7_record_6Record_17grsq(PyObject *__pyx_v_self, PyObject *__pyx_arg_iteration) { + __pyx_t_7_record_INDEX_t __pyx_v_iteration; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("grsq (wrapper)", 0); + assert(__pyx_arg_iteration); { + __pyx_v_iteration = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_arg_iteration); if (unlikely((__pyx_v_iteration == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("_record.Record.grsq", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7_record_6Record_16grsq(((struct __pyx_obj_7_record_Record *)__pyx_v_self), ((__pyx_t_7_record_INDEX_t)__pyx_v_iteration)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":45 + * return 1 - (mse / mse0) + * + * cpdef FLOAT_t grsq(Record self, INDEX_t iteration): # <<<<<<<<<<<<<< + * cdef FLOAT_t gcv0 = gcv(self.sst,1,self.num_samples,self.penalty) + * cdef FLOAT_t gcv_ = self.gcv(iteration) + */ + +static PyObject *__pyx_pf_7_record_6Record_16grsq(struct __pyx_obj_7_record_Record *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_iteration) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("grsq", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7_record_Record *)__pyx_v_self->__pyx_vtab)->grsq(__pyx_v_self, __pyx_v_iteration, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_record.Record.grsq", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_7_record_17PruningPassRecord_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7_record_17PruningPassRecord_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + __pyx_t_7_record_INDEX_t __pyx_v_num_samples; + __pyx_t_7_record_INDEX_t __pyx_v_num_variables; + __pyx_t_7_record_FLOAT_t __pyx_v_penalty; + __pyx_t_7_record_FLOAT_t __pyx_v_sst; + __pyx_t_7_record_INDEX_t __pyx_v_size; + __pyx_t_7_record_FLOAT_t __pyx_v_mse; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__num_samples,&__pyx_n_s__num_variables,&__pyx_n_s__penalty,&__pyx_n_s__sst,&__pyx_n_s__size,&__pyx_n_s__mse,0}; + PyObject* values[6] = {0,0,0,0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 6: values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__num_samples)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__num_variables)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__penalty)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sst)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 5: + if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mse)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 6) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + values[5] = PyTuple_GET_ITEM(__pyx_args, 5); + } + __pyx_v_num_samples = __Pyx_PyInt_from_py_npy_ulonglong(values[0]); if (unlikely((__pyx_v_num_samples == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_num_variables = __Pyx_PyInt_from_py_npy_ulonglong(values[1]); if (unlikely((__pyx_v_num_variables == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_penalty = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_penalty == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_sst = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_sst == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_size = __Pyx_PyInt_from_py_npy_ulonglong(values[4]); if (unlikely((__pyx_v_size == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_mse = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_mse == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("_record.PruningPassRecord.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7_record_17PruningPassRecord___init__(((struct __pyx_obj_7_record_PruningPassRecord *)__pyx_v_self), __pyx_v_num_samples, __pyx_v_num_variables, __pyx_v_penalty, __pyx_v_sst, __pyx_v_size, __pyx_v_mse); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":51 + * + * cdef class PruningPassRecord(Record): + * def __init__(PruningPassRecord self, INDEX_t num_samples, INDEX_t num_variables, FLOAT_t penalty, FLOAT_t sst, INDEX_t size, FLOAT_t mse): # <<<<<<<<<<<<<< + * self.num_samples = num_samples + * self.num_variables = num_variables + */ + +static int __pyx_pf_7_record_17PruningPassRecord___init__(struct __pyx_obj_7_record_PruningPassRecord *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_num_samples, __pyx_t_7_record_INDEX_t __pyx_v_num_variables, __pyx_t_7_record_FLOAT_t __pyx_v_penalty, __pyx_t_7_record_FLOAT_t __pyx_v_sst, __pyx_t_7_record_INDEX_t __pyx_v_size, __pyx_t_7_record_FLOAT_t __pyx_v_mse) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "_record.pyx":52 + * cdef class PruningPassRecord(Record): + * def __init__(PruningPassRecord self, INDEX_t num_samples, INDEX_t num_variables, FLOAT_t penalty, FLOAT_t sst, INDEX_t size, FLOAT_t mse): + * self.num_samples = num_samples # <<<<<<<<<<<<<< + * self.num_variables = num_variables + * self.penalty = penalty + */ + __pyx_v_self->__pyx_base.num_samples = __pyx_v_num_samples; + + /* "_record.pyx":53 + * def __init__(PruningPassRecord self, INDEX_t num_samples, INDEX_t num_variables, FLOAT_t penalty, FLOAT_t sst, INDEX_t size, FLOAT_t mse): + * self.num_samples = num_samples + * self.num_variables = num_variables # <<<<<<<<<<<<<< + * self.penalty = penalty + * self.sst = sst + */ + __pyx_v_self->__pyx_base.num_variables = __pyx_v_num_variables; + + /* "_record.pyx":54 + * self.num_samples = num_samples + * self.num_variables = num_variables + * self.penalty = penalty # <<<<<<<<<<<<<< + * self.sst = sst + * self.iterations = [FirstPruningPassIteration(size, mse)] + */ + __pyx_v_self->__pyx_base.penalty = __pyx_v_penalty; + + /* "_record.pyx":55 + * self.num_variables = num_variables + * self.penalty = penalty + * self.sst = sst # <<<<<<<<<<<<<< + * self.iterations = [FirstPruningPassIteration(size, mse)] + * + */ + __pyx_v_self->__pyx_base.sst = __pyx_v_sst; + + /* "_record.pyx":56 + * self.penalty = penalty + * self.sst = sst + * self.iterations = [FirstPruningPassIteration(size, mse)] # <<<<<<<<<<<<<< + * + * def __reduce__(PruningPassRecord self): + */ + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_mse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7_record_FirstPruningPassIteration)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_v_self->__pyx_base.iterations); + __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.iterations)); + __pyx_v_self->__pyx_base.iterations = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("_record.PruningPassRecord.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_17PruningPassRecord_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7_record_17PruningPassRecord_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); + __pyx_r = __pyx_pf_7_record_17PruningPassRecord_2__reduce__(((struct __pyx_obj_7_record_PruningPassRecord *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":58 + * self.iterations = [FirstPruningPassIteration(size, mse)] + * + * def __reduce__(PruningPassRecord self): # <<<<<<<<<<<<<< + * return (PruningPassRecord, (1,1,1.0,1.0,1,1.0), self._getstate()) + * + */ + +static PyObject *__pyx_pf_7_record_17PruningPassRecord_2__reduce__(struct __pyx_obj_7_record_PruningPassRecord *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce__", 0); + + /* "_record.pyx":59 + * + * def __reduce__(PruningPassRecord self): + * return (PruningPassRecord, (1,1,1.0,1.0,1,1.0), self._getstate()) # <<<<<<<<<<<<<< + * + * def _getstate(PruningPassRecord self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_4, 3, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_4, 4, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_4, 5, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7_record_PruningPassRecord))); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((PyObject*)__pyx_ptype_7_record_PruningPassRecord))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7_record_PruningPassRecord))); + PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_t_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_4 = 0; + __pyx_t_2 = 0; + __pyx_r = ((PyObject *)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("_record.PruningPassRecord.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_17PruningPassRecord_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7_record_17PruningPassRecord_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_getstate (wrapper)", 0); + __pyx_r = __pyx_pf_7_record_17PruningPassRecord_4_getstate(((struct __pyx_obj_7_record_PruningPassRecord *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":61 + * return (PruningPassRecord, (1,1,1.0,1.0,1,1.0), self._getstate()) + * + * def _getstate(PruningPassRecord self): # <<<<<<<<<<<<<< + * result = {'num_samples': self.num_samples, + * 'num_variables': self.num_variables, + */ + +static PyObject *__pyx_pf_7_record_17PruningPassRecord_4_getstate(struct __pyx_obj_7_record_PruningPassRecord *__pyx_v_self) { + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_getstate", 0); + + /* "_record.pyx":62 + * + * def _getstate(PruningPassRecord self): + * result = {'num_samples': self.num_samples, # <<<<<<<<<<<<<< + * 'num_variables': self.num_variables, + * 'penalty': self.penalty, + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = PyInt_FromLong(__pyx_v_self->__pyx_base.num_samples); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__num_samples), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "_record.pyx":63 + * def _getstate(PruningPassRecord self): + * result = {'num_samples': self.num_samples, + * 'num_variables': self.num_variables, # <<<<<<<<<<<<<< + * 'penalty': self.penalty, + * 'sst': self.sst, + */ + __pyx_t_2 = PyInt_FromLong(__pyx_v_self->__pyx_base.num_variables); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__num_variables), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "_record.pyx":64 + * result = {'num_samples': self.num_samples, + * 'num_variables': self.num_variables, + * 'penalty': self.penalty, # <<<<<<<<<<<<<< + * 'sst': self.sst, + * 'iterations': self.iterations, + */ + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.penalty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__penalty), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "_record.pyx":65 + * 'num_variables': self.num_variables, + * 'penalty': self.penalty, + * 'sst': self.sst, # <<<<<<<<<<<<<< + * 'iterations': self.iterations, + * 'selected': self.selected} + */ + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.sst); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__sst), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "_record.pyx":66 + * 'penalty': self.penalty, + * 'sst': self.sst, + * 'iterations': self.iterations, # <<<<<<<<<<<<<< + * 'selected': self.selected} + * return result + */ + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__iterations), ((PyObject *)__pyx_v_self->__pyx_base.iterations)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "_record.pyx":67 + * 'sst': self.sst, + * 'iterations': self.iterations, + * 'selected': self.selected} # <<<<<<<<<<<<<< + * return result + * + */ + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->selected); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__selected), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_result = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "_record.pyx":68 + * 'iterations': self.iterations, + * 'selected': self.selected} + * return result # <<<<<<<<<<<<<< + * + * def __setstate__(PruningPassRecord self, dict state): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_result)); + __pyx_r = ((PyObject *)__pyx_v_result); + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("_record.PruningPassRecord._getstate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_17PruningPassRecord_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ +static PyObject *__pyx_pw_7_record_17PruningPassRecord_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), (&PyDict_Type), 1, "state", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7_record_17PruningPassRecord_6__setstate__(((struct __pyx_obj_7_record_PruningPassRecord *)__pyx_v_self), ((PyObject*)__pyx_v_state)); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":70 + * return result + * + * def __setstate__(PruningPassRecord self, dict state): # <<<<<<<<<<<<<< + * self.num_samples = state['num_samples'] + * self.num_variables = state['num_variables'] + */ + +static PyObject *__pyx_pf_7_record_17PruningPassRecord_6__setstate__(struct __pyx_obj_7_record_PruningPassRecord *__pyx_v_self, PyObject *__pyx_v_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + __pyx_t_7_record_FLOAT_t __pyx_t_3; + __pyx_t_7_record_INDEX_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate__", 0); + + /* "_record.pyx":71 + * + * def __setstate__(PruningPassRecord self, dict state): + * self.num_samples = state['num_samples'] # <<<<<<<<<<<<<< + * self.num_variables = state['num_variables'] + * self.penalty = state['penalty'] + */ + if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__num_samples)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->__pyx_base.num_samples = __pyx_t_2; + + /* "_record.pyx":72 + * def __setstate__(PruningPassRecord self, dict state): + * self.num_samples = state['num_samples'] + * self.num_variables = state['num_variables'] # <<<<<<<<<<<<<< + * self.penalty = state['penalty'] + * self.sst = state['sst'] + */ + if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__num_variables)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->__pyx_base.num_variables = __pyx_t_2; + + /* "_record.pyx":73 + * self.num_samples = state['num_samples'] + * self.num_variables = state['num_variables'] + * self.penalty = state['penalty'] # <<<<<<<<<<<<<< + * self.sst = state['sst'] + * self.iterations = state['iterations'] + */ + if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__penalty)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->__pyx_base.penalty = __pyx_t_3; + + /* "_record.pyx":74 + * self.num_variables = state['num_variables'] + * self.penalty = state['penalty'] + * self.sst = state['sst'] # <<<<<<<<<<<<<< + * self.iterations = state['iterations'] + * self.selected = state['selected'] + */ + if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__sst)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->__pyx_base.sst = __pyx_t_3; + + /* "_record.pyx":75 + * self.penalty = state['penalty'] + * self.sst = state['sst'] + * self.iterations = state['iterations'] # <<<<<<<<<<<<<< + * self.selected = state['selected'] + * + */ + if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__iterations)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->__pyx_base.iterations); + __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.iterations)); + __pyx_v_self->__pyx_base.iterations = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "_record.pyx":76 + * self.sst = state['sst'] + * self.iterations = state['iterations'] + * self.selected = state['selected'] # <<<<<<<<<<<<<< + * + * cpdef set_selected(PruningPassRecord self, INDEX_t selected): + */ + if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__selected)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_4 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->selected = __pyx_t_4; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_record.PruningPassRecord.__setstate__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":78 + * self.selected = state['selected'] + * + * cpdef set_selected(PruningPassRecord self, INDEX_t selected): # <<<<<<<<<<<<<< + * self.selected = selected + * + */ + +static PyObject *__pyx_pw_7_record_17PruningPassRecord_9set_selected(PyObject *__pyx_v_self, PyObject *__pyx_arg_selected); /*proto*/ +static PyObject *__pyx_f_7_record_17PruningPassRecord_set_selected(struct __pyx_obj_7_record_PruningPassRecord *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_selected, int __pyx_skip_dispatch) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("set_selected", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__set_selected); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7_record_17PruningPassRecord_9set_selected)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_selected); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_record.pyx":79 + * + * cpdef set_selected(PruningPassRecord self, INDEX_t selected): + * self.selected = selected # <<<<<<<<<<<<<< + * + * cpdef INDEX_t get_selected(PruningPassRecord self): + */ + __pyx_v_self->selected = __pyx_v_selected; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("_record.PruningPassRecord.set_selected", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_17PruningPassRecord_9set_selected(PyObject *__pyx_v_self, PyObject *__pyx_arg_selected); /*proto*/ +static PyObject *__pyx_pw_7_record_17PruningPassRecord_9set_selected(PyObject *__pyx_v_self, PyObject *__pyx_arg_selected) { + __pyx_t_7_record_INDEX_t __pyx_v_selected; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_selected (wrapper)", 0); + assert(__pyx_arg_selected); { + __pyx_v_selected = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_arg_selected); if (unlikely((__pyx_v_selected == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("_record.PruningPassRecord.set_selected", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7_record_17PruningPassRecord_8set_selected(((struct __pyx_obj_7_record_PruningPassRecord *)__pyx_v_self), ((__pyx_t_7_record_INDEX_t)__pyx_v_selected)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":78 + * self.selected = state['selected'] + * + * cpdef set_selected(PruningPassRecord self, INDEX_t selected): # <<<<<<<<<<<<<< + * self.selected = selected + * + */ + +static PyObject *__pyx_pf_7_record_17PruningPassRecord_8set_selected(struct __pyx_obj_7_record_PruningPassRecord *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_selected) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("set_selected", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_7_record_PruningPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->set_selected(__pyx_v_self, __pyx_v_selected, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_record.PruningPassRecord.set_selected", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":81 + * self.selected = selected + * + * cpdef INDEX_t get_selected(PruningPassRecord self): # <<<<<<<<<<<<<< + * return self.selected + * + */ + +static PyObject *__pyx_pw_7_record_17PruningPassRecord_11get_selected(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static __pyx_t_7_record_INDEX_t __pyx_f_7_record_17PruningPassRecord_get_selected(struct __pyx_obj_7_record_PruningPassRecord *__pyx_v_self, int __pyx_skip_dispatch) { + __pyx_t_7_record_INDEX_t __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __pyx_t_7_record_INDEX_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_selected", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_selected); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7_record_17PruningPassRecord_11get_selected)) { + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_record.pyx":82 + * + * cpdef INDEX_t get_selected(PruningPassRecord self): + * return self.selected # <<<<<<<<<<<<<< + * + * cpdef roll_back(PruningPassRecord self, Basis basis): + */ + __pyx_r = __pyx_v_self->selected; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_WriteUnraisable("_record.PruningPassRecord.get_selected", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_17PruningPassRecord_11get_selected(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7_record_17PruningPassRecord_11get_selected(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_selected (wrapper)", 0); + __pyx_r = __pyx_pf_7_record_17PruningPassRecord_10get_selected(((struct __pyx_obj_7_record_PruningPassRecord *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":81 + * self.selected = selected + * + * cpdef INDEX_t get_selected(PruningPassRecord self): # <<<<<<<<<<<<<< + * return self.selected + * + */ + +static PyObject *__pyx_pf_7_record_17PruningPassRecord_10get_selected(struct __pyx_obj_7_record_PruningPassRecord *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_selected", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_7_record_PruningPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_selected(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_record.PruningPassRecord.get_selected", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":84 + * return self.selected + * + * cpdef roll_back(PruningPassRecord self, Basis basis): # <<<<<<<<<<<<<< + * cdef INDEX_t n = len(self.iterations) + * cdef INDEX_t i + */ + +static PyObject *__pyx_pw_7_record_17PruningPassRecord_13roll_back(PyObject *__pyx_v_self, PyObject *__pyx_v_basis); /*proto*/ +static PyObject *__pyx_f_7_record_17PruningPassRecord_roll_back(struct __pyx_obj_7_record_PruningPassRecord *__pyx_v_self, struct __pyx_obj_6_basis_Basis *__pyx_v_basis, int __pyx_skip_dispatch) { + __pyx_t_7_record_INDEX_t __pyx_v_n; + __pyx_t_7_record_INDEX_t __pyx_v_i; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + Py_ssize_t __pyx_t_4; + __pyx_t_7_record_INDEX_t __pyx_t_5; + __pyx_t_7_record_INDEX_t __pyx_t_6; + __pyx_t_7_record_INDEX_t __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("roll_back", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__roll_back); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7_record_17PruningPassRecord_13roll_back)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_v_basis)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_basis)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_basis)); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_record.pyx":85 + * + * cpdef roll_back(PruningPassRecord self, Basis basis): + * cdef INDEX_t n = len(self.iterations) # <<<<<<<<<<<<<< + * cdef INDEX_t i + * for i in range(n - self.selected - 1): + */ + __pyx_t_1 = ((PyObject *)__pyx_v_self->__pyx_base.iterations); + __Pyx_INCREF(__pyx_t_1); + if (unlikely(__pyx_t_1 == Py_None)) { + PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_4 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_n = __pyx_t_4; + + /* "_record.pyx":87 + * cdef INDEX_t n = len(self.iterations) + * cdef INDEX_t i + * for i in range(n - self.selected - 1): # <<<<<<<<<<<<<< + * basis[self.iterations[n - i - 1].get_pruned()].unprune() + * + */ + __pyx_t_5 = ((__pyx_v_n - __pyx_v_self->selected) - 1); + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "_record.pyx":88 + * cdef INDEX_t i + * for i in range(n - self.selected - 1): + * basis[self.iterations[n - i - 1].get_pruned()].unprune() # <<<<<<<<<<<<<< + * + * def __str__(PruningPassRecord self): + */ + if (unlikely(((PyObject *)__pyx_v_self->__pyx_base.iterations) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_7 = ((__pyx_v_n - __pyx_v_i) - 1); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_self->__pyx_base.iterations, __pyx_t_7), __pyx_n_s__get_pruned); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_basis), __pyx_t_3); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__unprune); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("_record.PruningPassRecord.roll_back", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_17PruningPassRecord_13roll_back(PyObject *__pyx_v_self, PyObject *__pyx_v_basis); /*proto*/ +static PyObject *__pyx_pw_7_record_17PruningPassRecord_13roll_back(PyObject *__pyx_v_self, PyObject *__pyx_v_basis) { + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("roll_back (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_basis), __pyx_ptype_6_basis_Basis, 1, "basis", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7_record_17PruningPassRecord_12roll_back(((struct __pyx_obj_7_record_PruningPassRecord *)__pyx_v_self), ((struct __pyx_obj_6_basis_Basis *)__pyx_v_basis)); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":84 + * return self.selected + * + * cpdef roll_back(PruningPassRecord self, Basis basis): # <<<<<<<<<<<<<< + * cdef INDEX_t n = len(self.iterations) + * cdef INDEX_t i + */ + +static PyObject *__pyx_pf_7_record_17PruningPassRecord_12roll_back(struct __pyx_obj_7_record_PruningPassRecord *__pyx_v_self, struct __pyx_obj_6_basis_Basis *__pyx_v_basis) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("roll_back", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_7_record_PruningPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->roll_back(__pyx_v_self, __pyx_v_basis, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_record.PruningPassRecord.roll_back", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_17PruningPassRecord_15__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_7_record_17PruningPassRecord_15__str__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_r = __pyx_pf_7_record_17PruningPassRecord_14__str__(((struct __pyx_obj_7_record_PruningPassRecord *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":90 + * basis[self.iterations[n - i - 1].get_pruned()].unprune() + * + * def __str__(PruningPassRecord self): # <<<<<<<<<<<<<< + * result = '' + * result += 'Pruning Pass\n' + */ + +static PyObject *__pyx_pf_7_record_17PruningPassRecord_14__str__(struct __pyx_obj_7_record_PruningPassRecord *__pyx_v_self) { + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_v_header = NULL; + PyObject *__pyx_v_data = NULL; + PyObject *__pyx_v_i = NULL; + PyObject *__pyx_v_iteration = NULL; + PyObject *__pyx_v_row = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + __pyx_t_7_record_INDEX_t __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + int __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__str__", 0); + + /* "_record.pyx":91 + * + * def __str__(PruningPassRecord self): + * result = '' # <<<<<<<<<<<<<< + * result += 'Pruning Pass\n' + * header = 'iter\tbf\tterms\tmse\tgcv\trsq\tgrsq'.split('\t') + */ + __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); + __pyx_v_result = ((PyObject *)__pyx_kp_s_1); + + /* "_record.pyx":92 + * def __str__(PruningPassRecord self): + * result = '' + * result += 'Pruning Pass\n' # <<<<<<<<<<<<<< + * header = 'iter\tbf\tterms\tmse\tgcv\trsq\tgrsq'.split('\t') + * data = [] + */ + __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_1; + __pyx_t_1 = 0; + + /* "_record.pyx":93 + * result = '' + * result += 'Pruning Pass\n' + * header = 'iter\tbf\tterms\tmse\tgcv\trsq\tgrsq'.split('\t') # <<<<<<<<<<<<<< + * data = [] + * for i, iteration in enumerate(self.iterations): + */ + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_3), __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_header = __pyx_t_2; + __pyx_t_2 = 0; + + /* "_record.pyx":94 + * result += 'Pruning Pass\n' + * header = 'iter\tbf\tterms\tmse\tgcv\trsq\tgrsq'.split('\t') + * data = [] # <<<<<<<<<<<<<< + * for i, iteration in enumerate(self.iterations): + * row = str(i) + '\t' + str(iteration) + '\t%.3f\t%.3f\t%.3f' % (self.gcv(i),self.rsq(i),self.grsq(i)) + */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_data = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "_record.pyx":95 + * header = 'iter\tbf\tterms\tmse\tgcv\trsq\tgrsq'.split('\t') + * data = [] + * for i, iteration in enumerate(self.iterations): # <<<<<<<<<<<<<< + * row = str(i) + '\t' + str(iteration) + '\t%.3f\t%.3f\t%.3f' % (self.gcv(i),self.rsq(i),self.grsq(i)) + * data.append(row.split('\t')) + */ + __Pyx_INCREF(__pyx_int_0); + __pyx_t_2 = __pyx_int_0; + __pyx_t_1 = ((PyObject *)__pyx_v_self->__pyx_base.iterations); __Pyx_INCREF(__pyx_t_1); __pyx_t_3 = 0; + for (;;) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + __Pyx_XDECREF(__pyx_v_iteration); + __pyx_v_iteration = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_2; + __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); + __pyx_t_2 = __pyx_t_4; + __pyx_t_4 = 0; + + /* "_record.pyx":96 + * data = [] + * for i, iteration in enumerate(self.iterations): + * row = str(i) + '\t' + str(iteration) + '\t%.3f\t%.3f\t%.3f' % (self.gcv(i),self.rsq(i),self.grsq(i)) # <<<<<<<<<<<<<< + * data.append(row.split('\t')) + * result += ascii_table(header,data) + */ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_i); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_i); + __Pyx_GIVEREF(__pyx_v_i); + __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Add(__pyx_t_5, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_v_iteration); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_iteration); + __Pyx_GIVEREF(__pyx_v_iteration); + __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Add(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_7 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_i); if (unlikely((__pyx_t_7 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7_record_PruningPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.gcv(((struct __pyx_obj_7_record_Record *)__pyx_v_self), __pyx_t_7, 0)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_i); if (unlikely((__pyx_t_7 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7_record_PruningPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.rsq(((struct __pyx_obj_7_record_Record *)__pyx_v_self), __pyx_t_7, 0)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_i); if (unlikely((__pyx_t_7 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7_record_PruningPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.grsq(((struct __pyx_obj_7_record_Record *)__pyx_v_self), __pyx_t_7, 0)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + __pyx_t_6 = 0; + __pyx_t_4 = 0; + __pyx_t_8 = 0; + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_6), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + __pyx_t_9 = PyNumber_Add(__pyx_t_5, ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __Pyx_XDECREF(__pyx_v_row); + __pyx_v_row = __pyx_t_9; + __pyx_t_9 = 0; + + /* "_record.pyx":97 + * for i, iteration in enumerate(self.iterations): + * row = str(i) + '\t' + str(iteration) + '\t%.3f\t%.3f\t%.3f' % (self.gcv(i),self.rsq(i),self.grsq(i)) + * data.append(row.split('\t')) # <<<<<<<<<<<<<< + * result += ascii_table(header,data) + * result += '\nSelected iteration: ' + str(self.selected) + '\n' + */ + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_row, __pyx_n_s__split); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_8 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_k_tuple_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_data, __pyx_t_8); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "_record.pyx":98 + * row = str(i) + '\t' + str(iteration) + '\t%.3f\t%.3f\t%.3f' % (self.gcv(i),self.rsq(i),self.grsq(i)) + * data.append(row.split('\t')) + * result += ascii_table(header,data) # <<<<<<<<<<<<<< + * result += '\nSelected iteration: ' + str(self.selected) + '\n' + * return result + */ + __pyx_t_2 = __pyx_f_5_util_ascii_table(__pyx_v_header, ((PyObject *)__pyx_v_data), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_result, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_1; + __pyx_t_1 = 0; + + /* "_record.pyx":99 + * data.append(row.split('\t')) + * result += ascii_table(header,data) + * result += '\nSelected iteration: ' + str(self.selected) + '\n' # <<<<<<<<<<<<<< + * return result + * + */ + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->selected); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Add(((PyObject *)__pyx_kp_s_8), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Add(__pyx_t_2, ((PyObject *)__pyx_kp_s_9)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_result, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_2; + __pyx_t_2 = 0; + + /* "_record.pyx":100 + * result += ascii_table(header,data) + * result += '\nSelected iteration: ' + str(self.selected) + '\n' + * return result # <<<<<<<<<<<<<< + * + * cdef class ForwardPassRecord(Record): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("_record.PruningPassRecord.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_header); + __Pyx_XDECREF(__pyx_v_data); + __Pyx_XDECREF(__pyx_v_i); + __Pyx_XDECREF(__pyx_v_iteration); + __Pyx_XDECREF(__pyx_v_row); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_7_record_17ForwardPassRecord_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7_record_17ForwardPassRecord_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + __pyx_t_7_record_INDEX_t __pyx_v_num_samples; + __pyx_t_7_record_INDEX_t __pyx_v_num_variables; + __pyx_t_7_record_FLOAT_t __pyx_v_penalty; + __pyx_t_7_record_FLOAT_t __pyx_v_sst; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__num_samples,&__pyx_n_s__num_variables,&__pyx_n_s__penalty,&__pyx_n_s__sst,0}; + PyObject* values[4] = {0,0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__num_samples)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__num_variables)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__penalty)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sst)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + } + __pyx_v_num_samples = __Pyx_PyInt_from_py_npy_ulonglong(values[0]); if (unlikely((__pyx_v_num_samples == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_num_variables = __Pyx_PyInt_from_py_npy_ulonglong(values[1]); if (unlikely((__pyx_v_num_variables == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_penalty = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_penalty == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_sst = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_sst == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("_record.ForwardPassRecord.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7_record_17ForwardPassRecord___init__(((struct __pyx_obj_7_record_ForwardPassRecord *)__pyx_v_self), __pyx_v_num_samples, __pyx_v_num_variables, __pyx_v_penalty, __pyx_v_sst); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":103 + * + * cdef class ForwardPassRecord(Record): + * def __init__(ForwardPassRecord self, INDEX_t num_samples, INDEX_t num_variables, FLOAT_t penalty, FLOAT_t sst): # <<<<<<<<<<<<<< + * self.num_samples = num_samples + * self.num_variables = num_variables + */ + +static int __pyx_pf_7_record_17ForwardPassRecord___init__(struct __pyx_obj_7_record_ForwardPassRecord *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_num_samples, __pyx_t_7_record_INDEX_t __pyx_v_num_variables, __pyx_t_7_record_FLOAT_t __pyx_v_penalty, __pyx_t_7_record_FLOAT_t __pyx_v_sst) { + int __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__init__", 0); + + /* "_record.pyx":104 + * cdef class ForwardPassRecord(Record): + * def __init__(ForwardPassRecord self, INDEX_t num_samples, INDEX_t num_variables, FLOAT_t penalty, FLOAT_t sst): + * self.num_samples = num_samples # <<<<<<<<<<<<<< + * self.num_variables = num_variables + * self.penalty = penalty + */ + __pyx_v_self->__pyx_base.num_samples = __pyx_v_num_samples; + + /* "_record.pyx":105 + * def __init__(ForwardPassRecord self, INDEX_t num_samples, INDEX_t num_variables, FLOAT_t penalty, FLOAT_t sst): + * self.num_samples = num_samples + * self.num_variables = num_variables # <<<<<<<<<<<<<< + * self.penalty = penalty + * self.sst = sst + */ + __pyx_v_self->__pyx_base.num_variables = __pyx_v_num_variables; + + /* "_record.pyx":106 + * self.num_samples = num_samples + * self.num_variables = num_variables + * self.penalty = penalty # <<<<<<<<<<<<<< + * self.sst = sst + * self.iterations = [FirstForwardPassIteration(self.sst)] + */ + __pyx_v_self->__pyx_base.penalty = __pyx_v_penalty; + + /* "_record.pyx":107 + * self.num_variables = num_variables + * self.penalty = penalty + * self.sst = sst # <<<<<<<<<<<<<< + * self.iterations = [FirstForwardPassIteration(self.sst)] + * + */ + __pyx_v_self->__pyx_base.sst = __pyx_v_sst; + + /* "_record.pyx":108 + * self.penalty = penalty + * self.sst = sst + * self.iterations = [FirstForwardPassIteration(self.sst)] # <<<<<<<<<<<<<< + * + * def __reduce__(ForwardPassRecord self): + */ + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.sst); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7_record_FirstForwardPassIteration)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_v_self->__pyx_base.iterations); + __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.iterations)); + __pyx_v_self->__pyx_base.iterations = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("_record.ForwardPassRecord.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_17ForwardPassRecord_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7_record_17ForwardPassRecord_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); + __pyx_r = __pyx_pf_7_record_17ForwardPassRecord_2__reduce__(((struct __pyx_obj_7_record_ForwardPassRecord *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":110 + * self.iterations = [FirstForwardPassIteration(self.sst)] + * + * def __reduce__(ForwardPassRecord self): # <<<<<<<<<<<<<< + * return (ForwardPassRecord, (1,1,1.0,1.0), self._getstate()) + * + */ + +static PyObject *__pyx_pf_7_record_17ForwardPassRecord_2__reduce__(struct __pyx_obj_7_record_ForwardPassRecord *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce__", 0); + + /* "_record.pyx":111 + * + * def __reduce__(ForwardPassRecord self): + * return (ForwardPassRecord, (1,1,1.0,1.0), self._getstate()) # <<<<<<<<<<<<<< + * + * def _getstate(ForwardPassRecord self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7_record_ForwardPassRecord))); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((PyObject*)__pyx_ptype_7_record_ForwardPassRecord))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7_record_ForwardPassRecord))); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_3 = 0; + __pyx_t_1 = 0; + __pyx_r = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("_record.ForwardPassRecord.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_17ForwardPassRecord_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7_record_17ForwardPassRecord_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_getstate (wrapper)", 0); + __pyx_r = __pyx_pf_7_record_17ForwardPassRecord_4_getstate(((struct __pyx_obj_7_record_ForwardPassRecord *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":113 + * return (ForwardPassRecord, (1,1,1.0,1.0), self._getstate()) + * + * def _getstate(ForwardPassRecord self): # <<<<<<<<<<<<<< + * return {'num_samples': self.num_samples, + * 'num_variables': self.num_variables, + */ + +static PyObject *__pyx_pf_7_record_17ForwardPassRecord_4_getstate(struct __pyx_obj_7_record_ForwardPassRecord *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_getstate", 0); + + /* "_record.pyx":114 + * + * def _getstate(ForwardPassRecord self): + * return {'num_samples': self.num_samples, # <<<<<<<<<<<<<< + * 'num_variables': self.num_variables, + * 'penalty': self.penalty, + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = PyInt_FromLong(__pyx_v_self->__pyx_base.num_samples); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__num_samples), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "_record.pyx":115 + * def _getstate(ForwardPassRecord self): + * return {'num_samples': self.num_samples, + * 'num_variables': self.num_variables, # <<<<<<<<<<<<<< + * 'penalty': self.penalty, + * 'sst': self.sst, + */ + __pyx_t_2 = PyInt_FromLong(__pyx_v_self->__pyx_base.num_variables); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__num_variables), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "_record.pyx":116 + * return {'num_samples': self.num_samples, + * 'num_variables': self.num_variables, + * 'penalty': self.penalty, # <<<<<<<<<<<<<< + * 'sst': self.sst, + * 'iterations': self.iterations} + */ + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.penalty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__penalty), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "_record.pyx":117 + * 'num_variables': self.num_variables, + * 'penalty': self.penalty, + * 'sst': self.sst, # <<<<<<<<<<<<<< + * 'iterations': self.iterations} + * + */ + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.sst); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__sst), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "_record.pyx":118 + * 'penalty': self.penalty, + * 'sst': self.sst, + * 'iterations': self.iterations} # <<<<<<<<<<<<<< + * + * def __setstate__(ForwardPassRecord self, dict state): + */ + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__iterations), ((PyObject *)__pyx_v_self->__pyx_base.iterations)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("_record.ForwardPassRecord._getstate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_17ForwardPassRecord_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ +static PyObject *__pyx_pw_7_record_17ForwardPassRecord_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), (&PyDict_Type), 1, "state", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7_record_17ForwardPassRecord_6__setstate__(((struct __pyx_obj_7_record_ForwardPassRecord *)__pyx_v_self), ((PyObject*)__pyx_v_state)); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":120 + * 'iterations': self.iterations} + * + * def __setstate__(ForwardPassRecord self, dict state): # <<<<<<<<<<<<<< + * self.num_samples = state['num_samples'] + * self.num_variables = state['num_variables'] + */ + +static PyObject *__pyx_pf_7_record_17ForwardPassRecord_6__setstate__(struct __pyx_obj_7_record_ForwardPassRecord *__pyx_v_self, PyObject *__pyx_v_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + __pyx_t_7_record_FLOAT_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate__", 0); + + /* "_record.pyx":121 + * + * def __setstate__(ForwardPassRecord self, dict state): + * self.num_samples = state['num_samples'] # <<<<<<<<<<<<<< + * self.num_variables = state['num_variables'] + * self.penalty = state['penalty'] + */ + if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__num_samples)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->__pyx_base.num_samples = __pyx_t_2; + + /* "_record.pyx":122 + * def __setstate__(ForwardPassRecord self, dict state): + * self.num_samples = state['num_samples'] + * self.num_variables = state['num_variables'] # <<<<<<<<<<<<<< + * self.penalty = state['penalty'] + * self.sst = state['sst'] + */ + if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__num_variables)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->__pyx_base.num_variables = __pyx_t_2; + + /* "_record.pyx":123 + * self.num_samples = state['num_samples'] + * self.num_variables = state['num_variables'] + * self.penalty = state['penalty'] # <<<<<<<<<<<<<< + * self.sst = state['sst'] + * self.iterations = state['iterations'] + */ + if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__penalty)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->__pyx_base.penalty = __pyx_t_3; + + /* "_record.pyx":124 + * self.num_variables = state['num_variables'] + * self.penalty = state['penalty'] + * self.sst = state['sst'] # <<<<<<<<<<<<<< + * self.iterations = state['iterations'] + * + */ + if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__sst)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->__pyx_base.sst = __pyx_t_3; + + /* "_record.pyx":125 + * self.penalty = state['penalty'] + * self.sst = state['sst'] + * self.iterations = state['iterations'] # <<<<<<<<<<<<<< + * + * cpdef set_stopping_condition(ForwardPassRecord self, int stopping_condition): + */ + if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__iterations)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->__pyx_base.iterations); + __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.iterations)); + __pyx_v_self->__pyx_base.iterations = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_record.ForwardPassRecord.__setstate__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":127 + * self.iterations = state['iterations'] + * + * cpdef set_stopping_condition(ForwardPassRecord self, int stopping_condition): # <<<<<<<<<<<<<< + * self.stopping_condition = stopping_condition + * + */ + +static PyObject *__pyx_pw_7_record_17ForwardPassRecord_9set_stopping_condition(PyObject *__pyx_v_self, PyObject *__pyx_arg_stopping_condition); /*proto*/ +static PyObject *__pyx_f_7_record_17ForwardPassRecord_set_stopping_condition(struct __pyx_obj_7_record_ForwardPassRecord *__pyx_v_self, int __pyx_v_stopping_condition, int __pyx_skip_dispatch) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("set_stopping_condition", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_10); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7_record_17ForwardPassRecord_9set_stopping_condition)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyInt_FromLong(__pyx_v_stopping_condition); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_record.pyx":128 + * + * cpdef set_stopping_condition(ForwardPassRecord self, int stopping_condition): + * self.stopping_condition = stopping_condition # <<<<<<<<<<<<<< + * + * def __str__(ForwardPassRecord self): + */ + __pyx_v_self->stopping_condition = __pyx_v_stopping_condition; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("_record.ForwardPassRecord.set_stopping_condition", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_17ForwardPassRecord_9set_stopping_condition(PyObject *__pyx_v_self, PyObject *__pyx_arg_stopping_condition); /*proto*/ +static PyObject *__pyx_pw_7_record_17ForwardPassRecord_9set_stopping_condition(PyObject *__pyx_v_self, PyObject *__pyx_arg_stopping_condition) { + int __pyx_v_stopping_condition; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_stopping_condition (wrapper)", 0); + assert(__pyx_arg_stopping_condition); { + __pyx_v_stopping_condition = __Pyx_PyInt_AsInt(__pyx_arg_stopping_condition); if (unlikely((__pyx_v_stopping_condition == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("_record.ForwardPassRecord.set_stopping_condition", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7_record_17ForwardPassRecord_8set_stopping_condition(((struct __pyx_obj_7_record_ForwardPassRecord *)__pyx_v_self), ((int)__pyx_v_stopping_condition)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":127 + * self.iterations = state['iterations'] + * + * cpdef set_stopping_condition(ForwardPassRecord self, int stopping_condition): # <<<<<<<<<<<<<< + * self.stopping_condition = stopping_condition + * + */ + +static PyObject *__pyx_pf_7_record_17ForwardPassRecord_8set_stopping_condition(struct __pyx_obj_7_record_ForwardPassRecord *__pyx_v_self, int __pyx_v_stopping_condition) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("set_stopping_condition", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_7_record_ForwardPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->set_stopping_condition(__pyx_v_self, __pyx_v_stopping_condition, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_record.ForwardPassRecord.set_stopping_condition", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_17ForwardPassRecord_11__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_7_record_17ForwardPassRecord_11__str__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_r = __pyx_pf_7_record_17ForwardPassRecord_10__str__(((struct __pyx_obj_7_record_ForwardPassRecord *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":130 + * self.stopping_condition = stopping_condition + * + * def __str__(ForwardPassRecord self): # <<<<<<<<<<<<<< + * header = ['iter','parent','var','knot','mse','terms','gcv','rsq','grsq'] + * data = [] + */ + +static PyObject *__pyx_pf_7_record_17ForwardPassRecord_10__str__(struct __pyx_obj_7_record_ForwardPassRecord *__pyx_v_self) { + PyObject *__pyx_v_header = NULL; + PyObject *__pyx_v_data = NULL; + PyObject *__pyx_v_i = NULL; + PyObject *__pyx_v_iteration = NULL; + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + Py_ssize_t __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + __pyx_t_7_record_INDEX_t __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + int __pyx_t_10; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__str__", 0); + + /* "_record.pyx":131 + * + * def __str__(ForwardPassRecord self): + * header = ['iter','parent','var','knot','mse','terms','gcv','rsq','grsq'] # <<<<<<<<<<<<<< + * data = [] + * for i, iteration in enumerate(self.iterations): + */ + __pyx_t_1 = PyList_New(9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_n_s__iter)); + PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__iter)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__iter)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__parent)); + PyList_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__parent)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__parent)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__var)); + PyList_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_n_s__var)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__var)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__knot)); + PyList_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_n_s__knot)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__knot)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__mse)); + PyList_SET_ITEM(__pyx_t_1, 4, ((PyObject *)__pyx_n_s__mse)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__mse)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__terms)); + PyList_SET_ITEM(__pyx_t_1, 5, ((PyObject *)__pyx_n_s__terms)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__terms)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__gcv)); + PyList_SET_ITEM(__pyx_t_1, 6, ((PyObject *)__pyx_n_s__gcv)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__gcv)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__rsq)); + PyList_SET_ITEM(__pyx_t_1, 7, ((PyObject *)__pyx_n_s__rsq)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__rsq)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__grsq)); + PyList_SET_ITEM(__pyx_t_1, 8, ((PyObject *)__pyx_n_s__grsq)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__grsq)); + __pyx_v_header = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "_record.pyx":132 + * def __str__(ForwardPassRecord self): + * header = ['iter','parent','var','knot','mse','terms','gcv','rsq','grsq'] + * data = [] # <<<<<<<<<<<<<< + * for i, iteration in enumerate(self.iterations): + * data.append([str(i)] + str(iteration).split('\t') + ('%.3f\t%.3f\t%.3f' % (self.gcv(i),self.rsq(i),self.grsq(i))).split('\t')) + */ + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_v_data = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + + /* "_record.pyx":133 + * header = ['iter','parent','var','knot','mse','terms','gcv','rsq','grsq'] + * data = [] + * for i, iteration in enumerate(self.iterations): # <<<<<<<<<<<<<< + * data.append([str(i)] + str(iteration).split('\t') + ('%.3f\t%.3f\t%.3f' % (self.gcv(i),self.rsq(i),self.grsq(i))).split('\t')) + * result = '' + */ + __Pyx_INCREF(__pyx_int_0); + __pyx_t_1 = __pyx_int_0; + __pyx_t_2 = ((PyObject *)__pyx_v_self->__pyx_base.iterations); __Pyx_INCREF(__pyx_t_2); __pyx_t_3 = 0; + for (;;) { + if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + __Pyx_XDECREF(__pyx_v_iteration); + __pyx_v_iteration = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_1; + __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); + __pyx_t_1 = __pyx_t_4; + __pyx_t_4 = 0; + + /* "_record.pyx":134 + * data = [] + * for i, iteration in enumerate(self.iterations): + * data.append([str(i)] + str(iteration).split('\t') + ('%.3f\t%.3f\t%.3f' % (self.gcv(i),self.rsq(i),self.grsq(i))).split('\t')) # <<<<<<<<<<<<<< + * result = '' + * result += 'Forward Pass\n' + */ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_i); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_i); + __Pyx_GIVEREF(__pyx_v_i); + __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_v_iteration); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_iteration); + __Pyx_GIVEREF(__pyx_v_iteration); + __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__split); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_t_4), __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_7 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_i); if (unlikely((__pyx_t_7 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7_record_ForwardPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.gcv(((struct __pyx_obj_7_record_Record *)__pyx_v_self), __pyx_t_7, 0)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_i); if (unlikely((__pyx_t_7 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7_record_ForwardPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.rsq(((struct __pyx_obj_7_record_Record *)__pyx_v_self), __pyx_t_7, 0)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_7 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_i); if (unlikely((__pyx_t_7 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7_record_ForwardPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.grsq(((struct __pyx_obj_7_record_Record *)__pyx_v_self), __pyx_t_7, 0)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_8); + __Pyx_GIVEREF(__pyx_t_8); + __pyx_t_6 = 0; + __pyx_t_4 = 0; + __pyx_t_8 = 0; + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_12), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_t_8), __pyx_n_s__split); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyNumber_Add(__pyx_t_5, __pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_data, __pyx_t_9); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "_record.pyx":135 + * for i, iteration in enumerate(self.iterations): + * data.append([str(i)] + str(iteration).split('\t') + ('%.3f\t%.3f\t%.3f' % (self.gcv(i),self.rsq(i),self.grsq(i))).split('\t')) + * result = '' # <<<<<<<<<<<<<< + * result += 'Forward Pass\n' + * result += ascii_table(header, data) + */ + __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); + __pyx_v_result = ((PyObject *)__pyx_kp_s_1); + + /* "_record.pyx":136 + * data.append([str(i)] + str(iteration).split('\t') + ('%.3f\t%.3f\t%.3f' % (self.gcv(i),self.rsq(i),self.grsq(i))).split('\t')) + * result = '' + * result += 'Forward Pass\n' # <<<<<<<<<<<<<< + * result += ascii_table(header, data) + * result += '\nStopping Condition %d: %s\n' % (self.stopping_condition, _forward.stopping_conditions[self.stopping_condition]) + */ + __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_14)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_1; + __pyx_t_1 = 0; + + /* "_record.pyx":137 + * result = '' + * result += 'Forward Pass\n' + * result += ascii_table(header, data) # <<<<<<<<<<<<<< + * result += '\nStopping Condition %d: %s\n' % (self.stopping_condition, _forward.stopping_conditions[self.stopping_condition]) + * return result + */ + __pyx_t_1 = __pyx_f_5_util_ascii_table(((PyObject *)__pyx_v_header), ((PyObject *)__pyx_v_data), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_result, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_2; + __pyx_t_2 = 0; + + /* "_record.pyx":138 + * result += 'Forward Pass\n' + * result += ascii_table(header, data) + * result += '\nStopping Condition %d: %s\n' % (self.stopping_condition, _forward.stopping_conditions[self.stopping_condition]) # <<<<<<<<<<<<<< + * return result + * + */ + __pyx_t_2 = PyInt_FromLong(__pyx_v_self->stopping_condition); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s___forward); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__stopping_conditions); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_9, __pyx_v_self->stopping_condition, sizeof(int), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_2 = 0; + __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_15), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; + __pyx_t_9 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_9; + __pyx_t_9 = 0; + + /* "_record.pyx":139 + * result += ascii_table(header, data) + * result += '\nStopping Condition %d: %s\n' % (self.stopping_condition, _forward.stopping_conditions[self.stopping_condition]) + * return result # <<<<<<<<<<<<<< + * + * cdef class Iteration: + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_AddTraceback("_record.ForwardPassRecord.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_header); + __Pyx_XDECREF(__pyx_v_data); + __Pyx_XDECREF(__pyx_v_i); + __Pyx_XDECREF(__pyx_v_iteration); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_9Iteration_1__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_arg_method); /*proto*/ +static PyObject *__pyx_pw_7_record_9Iteration_1__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_arg_method) { + PyObject *__pyx_v_method = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0); + __pyx_v_method = PyInt_FromLong(__pyx_arg_method); if (unlikely(!__pyx_v_method)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_GOTREF(__pyx_v_method); + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("_record.Iteration.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7_record_9Iteration___richcmp__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other), ((PyObject *)__pyx_v_method)); + __Pyx_XDECREF(__pyx_v_method); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":143 + * cdef class Iteration: + * + * def __richcmp__(self, other, method): # <<<<<<<<<<<<<< + * if method == 2: + * return self._eq(other) + */ + +static PyObject *__pyx_pf_7_record_9Iteration___richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_method) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__richcmp__", 0); + + /* "_record.pyx":144 + * + * def __richcmp__(self, other, method): + * if method == 2: # <<<<<<<<<<<<<< + * return self._eq(other) + * elif method == 3: + */ + __pyx_t_1 = PyObject_RichCompare(__pyx_v_method, __pyx_int_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (__pyx_t_2) { + + /* "_record.pyx":145 + * def __richcmp__(self, other, method): + * if method == 2: + * return self._eq(other) # <<<<<<<<<<<<<< + * elif method == 3: + * return not self._eq(other) + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s___eq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_other); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_other); + __Pyx_GIVEREF(__pyx_v_other); + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; + goto __pyx_L0; + goto __pyx_L3; + } + + /* "_record.pyx":146 + * if method == 2: + * return self._eq(other) + * elif method == 3: # <<<<<<<<<<<<<< + * return not self._eq(other) + * else: + */ + __pyx_t_4 = PyObject_RichCompare(__pyx_v_method, __pyx_int_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_2) { + + /* "_record.pyx":147 + * return self._eq(other) + * elif method == 3: + * return not self._eq(other) # <<<<<<<<<<<<<< + * else: + * return NotImplemented + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s___eq); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_other); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_other); + __Pyx_GIVEREF(__pyx_v_other); + __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyBool_FromLong((!__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "_record.pyx":149 + * return not self._eq(other) + * else: + * return NotImplemented # <<<<<<<<<<<<<< + * + * def _eq(self, other): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_builtin_NotImplemented); + __pyx_r = __pyx_builtin_NotImplemented; + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_AddTraceback("_record.Iteration.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_9Iteration_3_eq(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static PyObject *__pyx_pw_7_record_9Iteration_3_eq(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_eq (wrapper)", 0); + __pyx_r = __pyx_pf_7_record_9Iteration_2_eq(((struct __pyx_obj_7_record_Iteration *)__pyx_v_self), ((PyObject *)__pyx_v_other)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":151 + * return NotImplemented + * + * def _eq(self, other): # <<<<<<<<<<<<<< + * return self.__class__ is other.__class__ and self._getstate() == other._getstate() + * + */ + +static PyObject *__pyx_pf_7_record_9Iteration_2_eq(struct __pyx_obj_7_record_Iteration *__pyx_v_self, PyObject *__pyx_v_other) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_eq", 0); + + /* "_record.pyx":152 + * + * def _eq(self, other): + * return self.__class__ is other.__class__ and self._getstate() == other._getstate() # <<<<<<<<<<<<<< + * + * cpdef FLOAT_t get_mse(Iteration self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = (__pyx_t_1 == __pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_3) { + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __pyx_t_1; + __pyx_t_1 = 0; + } else { + __pyx_t_5 = __pyx_t_2; + __pyx_t_2 = 0; + } + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("_record.Iteration._eq", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":154 + * return self.__class__ is other.__class__ and self._getstate() == other._getstate() + * + * cpdef FLOAT_t get_mse(Iteration self): # <<<<<<<<<<<<<< + * return self.mse + * + */ + +static PyObject *__pyx_pw_7_record_9Iteration_5get_mse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static __pyx_t_7_record_FLOAT_t __pyx_f_7_record_9Iteration_get_mse(struct __pyx_obj_7_record_Iteration *__pyx_v_self, int __pyx_skip_dispatch) { + __pyx_t_7_record_FLOAT_t __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __pyx_t_7_record_FLOAT_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_mse", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_mse); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7_record_9Iteration_5get_mse)) { + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_record.pyx":155 + * + * cpdef FLOAT_t get_mse(Iteration self): + * return self.mse # <<<<<<<<<<<<<< + * + * cpdef INDEX_t get_size(Iteration self): + */ + __pyx_r = __pyx_v_self->mse; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_WriteUnraisable("_record.Iteration.get_mse", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_9Iteration_5get_mse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7_record_9Iteration_5get_mse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_mse (wrapper)", 0); + __pyx_r = __pyx_pf_7_record_9Iteration_4get_mse(((struct __pyx_obj_7_record_Iteration *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":154 + * return self.__class__ is other.__class__ and self._getstate() == other._getstate() + * + * cpdef FLOAT_t get_mse(Iteration self): # <<<<<<<<<<<<<< + * return self.mse + * + */ + +static PyObject *__pyx_pf_7_record_9Iteration_4get_mse(struct __pyx_obj_7_record_Iteration *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_mse", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7_record_Iteration *)__pyx_v_self->__pyx_vtab)->get_mse(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_record.Iteration.get_mse", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":157 + * return self.mse + * + * cpdef INDEX_t get_size(Iteration self): # <<<<<<<<<<<<<< + * return self.size + * + */ + +static PyObject *__pyx_pw_7_record_9Iteration_7get_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static __pyx_t_7_record_INDEX_t __pyx_f_7_record_9Iteration_get_size(struct __pyx_obj_7_record_Iteration *__pyx_v_self, int __pyx_skip_dispatch) { + __pyx_t_7_record_INDEX_t __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __pyx_t_7_record_INDEX_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_size", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7_record_9Iteration_7get_size)) { + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_record.pyx":158 + * + * cpdef INDEX_t get_size(Iteration self): + * return self.size # <<<<<<<<<<<<<< + * + * cdef class PruningPassIteration(Iteration): + */ + __pyx_r = __pyx_v_self->size; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_WriteUnraisable("_record.Iteration.get_size", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_9Iteration_7get_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7_record_9Iteration_7get_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_size (wrapper)", 0); + __pyx_r = __pyx_pf_7_record_9Iteration_6get_size(((struct __pyx_obj_7_record_Iteration *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":157 + * return self.mse + * + * cpdef INDEX_t get_size(Iteration self): # <<<<<<<<<<<<<< + * return self.size + * + */ + +static PyObject *__pyx_pf_7_record_9Iteration_6get_size(struct __pyx_obj_7_record_Iteration *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_size", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_7_record_Iteration *)__pyx_v_self->__pyx_vtab)->get_size(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_record.Iteration.get_size", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_7_record_20PruningPassIteration_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7_record_20PruningPassIteration_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + __pyx_t_7_record_INDEX_t __pyx_v_pruned; + __pyx_t_7_record_INDEX_t __pyx_v_size; + __pyx_t_7_record_FLOAT_t __pyx_v_mse; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__pruned,&__pyx_n_s__size,&__pyx_n_s__mse,0}; + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__pruned)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mse)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_pruned = __Pyx_PyInt_from_py_npy_ulonglong(values[0]); if (unlikely((__pyx_v_pruned == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_size = __Pyx_PyInt_from_py_npy_ulonglong(values[1]); if (unlikely((__pyx_v_size == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_mse = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_mse == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("_record.PruningPassIteration.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7_record_20PruningPassIteration___init__(((struct __pyx_obj_7_record_PruningPassIteration *)__pyx_v_self), __pyx_v_pruned, __pyx_v_size, __pyx_v_mse); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":161 + * + * cdef class PruningPassIteration(Iteration): + * def __init__(PruningPassIteration self, INDEX_t pruned, INDEX_t size, FLOAT_t mse): # <<<<<<<<<<<<<< + * self.pruned = pruned + * self.size = size + */ + +static int __pyx_pf_7_record_20PruningPassIteration___init__(struct __pyx_obj_7_record_PruningPassIteration *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_pruned, __pyx_t_7_record_INDEX_t __pyx_v_size, __pyx_t_7_record_FLOAT_t __pyx_v_mse) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__", 0); + + /* "_record.pyx":162 + * cdef class PruningPassIteration(Iteration): + * def __init__(PruningPassIteration self, INDEX_t pruned, INDEX_t size, FLOAT_t mse): + * self.pruned = pruned # <<<<<<<<<<<<<< + * self.size = size + * self.mse = mse + */ + __pyx_v_self->pruned = __pyx_v_pruned; + + /* "_record.pyx":163 + * def __init__(PruningPassIteration self, INDEX_t pruned, INDEX_t size, FLOAT_t mse): + * self.pruned = pruned + * self.size = size # <<<<<<<<<<<<<< + * self.mse = mse + * + */ + __pyx_v_self->__pyx_base.size = __pyx_v_size; + + /* "_record.pyx":164 + * self.pruned = pruned + * self.size = size + * self.mse = mse # <<<<<<<<<<<<<< + * + * def __reduce__(PruningPassIteration self): + */ + __pyx_v_self->__pyx_base.mse = __pyx_v_mse; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_20PruningPassIteration_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7_record_20PruningPassIteration_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); + __pyx_r = __pyx_pf_7_record_20PruningPassIteration_2__reduce__(((struct __pyx_obj_7_record_PruningPassIteration *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":166 + * self.mse = mse + * + * def __reduce__(PruningPassIteration self): # <<<<<<<<<<<<<< + * return (PruningPassIteration, (1,1,1.0), self._getstate()) + * + */ + +static PyObject *__pyx_pf_7_record_20PruningPassIteration_2__reduce__(struct __pyx_obj_7_record_PruningPassIteration *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce__", 0); + + /* "_record.pyx":167 + * + * def __reduce__(PruningPassIteration self): + * return (PruningPassIteration, (1,1,1.0), self._getstate()) # <<<<<<<<<<<<<< + * + * def _getstate(PruningPassIteration self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7_record_PruningPassIteration))); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7_record_PruningPassIteration))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7_record_PruningPassIteration))); + PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("_record.PruningPassIteration.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_20PruningPassIteration_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7_record_20PruningPassIteration_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_getstate (wrapper)", 0); + __pyx_r = __pyx_pf_7_record_20PruningPassIteration_4_getstate(((struct __pyx_obj_7_record_PruningPassIteration *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":169 + * return (PruningPassIteration, (1,1,1.0), self._getstate()) + * + * def _getstate(PruningPassIteration self): # <<<<<<<<<<<<<< + * return {'pruned': self.pruned, + * 'size': self.size, + */ + +static PyObject *__pyx_pf_7_record_20PruningPassIteration_4_getstate(struct __pyx_obj_7_record_PruningPassIteration *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_getstate", 0); + + /* "_record.pyx":170 + * + * def _getstate(PruningPassIteration self): + * return {'pruned': self.pruned, # <<<<<<<<<<<<<< + * 'size': self.size, + * 'mse': self.mse} + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->pruned); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__pruned), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "_record.pyx":171 + * def _getstate(PruningPassIteration self): + * return {'pruned': self.pruned, + * 'size': self.size, # <<<<<<<<<<<<<< + * 'mse': self.mse} + * + */ + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->__pyx_base.size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__size), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "_record.pyx":172 + * return {'pruned': self.pruned, + * 'size': self.size, + * 'mse': self.mse} # <<<<<<<<<<<<<< + * + * def __setstate__(PruningPassIteration self, dict state): + */ + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.mse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__mse), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("_record.PruningPassIteration._getstate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_20PruningPassIteration_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ +static PyObject *__pyx_pw_7_record_20PruningPassIteration_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), (&PyDict_Type), 1, "state", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7_record_20PruningPassIteration_6__setstate__(((struct __pyx_obj_7_record_PruningPassIteration *)__pyx_v_self), ((PyObject*)__pyx_v_state)); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":174 + * 'mse': self.mse} + * + * def __setstate__(PruningPassIteration self, dict state): # <<<<<<<<<<<<<< + * self.pruned = state['pruned'] + * self.size = state['size'] + */ + +static PyObject *__pyx_pf_7_record_20PruningPassIteration_6__setstate__(struct __pyx_obj_7_record_PruningPassIteration *__pyx_v_self, PyObject *__pyx_v_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __pyx_t_7_record_INDEX_t __pyx_t_2; + __pyx_t_7_record_FLOAT_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate__", 0); + + /* "_record.pyx":175 + * + * def __setstate__(PruningPassIteration self, dict state): + * self.pruned = state['pruned'] # <<<<<<<<<<<<<< + * self.size = state['size'] + * self.mse = state['mse'] + */ + if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__pruned)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->pruned = __pyx_t_2; + + /* "_record.pyx":176 + * def __setstate__(PruningPassIteration self, dict state): + * self.pruned = state['pruned'] + * self.size = state['size'] # <<<<<<<<<<<<<< + * self.mse = state['mse'] + * + */ + if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__size)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->__pyx_base.size = __pyx_t_2; + + /* "_record.pyx":177 + * self.pruned = state['pruned'] + * self.size = state['size'] + * self.mse = state['mse'] # <<<<<<<<<<<<<< + * + * cpdef INDEX_t get_pruned(PruningPassIteration self): + */ + if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__mse)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->__pyx_base.mse = __pyx_t_3; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_record.PruningPassIteration.__setstate__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":179 + * self.mse = state['mse'] + * + * cpdef INDEX_t get_pruned(PruningPassIteration self): # <<<<<<<<<<<<<< + * return self.pruned + * + */ + +static PyObject *__pyx_pw_7_record_20PruningPassIteration_9get_pruned(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static __pyx_t_7_record_INDEX_t __pyx_f_7_record_20PruningPassIteration_get_pruned(struct __pyx_obj_7_record_PruningPassIteration *__pyx_v_self, int __pyx_skip_dispatch) { + __pyx_t_7_record_INDEX_t __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __pyx_t_7_record_INDEX_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_pruned", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_pruned); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7_record_20PruningPassIteration_9get_pruned)) { + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_record.pyx":180 + * + * cpdef INDEX_t get_pruned(PruningPassIteration self): + * return self.pruned # <<<<<<<<<<<<<< + * + * def __str__(PruningPassIteration self): + */ + __pyx_r = __pyx_v_self->pruned; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_WriteUnraisable("_record.PruningPassIteration.get_pruned", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_20PruningPassIteration_9get_pruned(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7_record_20PruningPassIteration_9get_pruned(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_pruned (wrapper)", 0); + __pyx_r = __pyx_pf_7_record_20PruningPassIteration_8get_pruned(((struct __pyx_obj_7_record_PruningPassIteration *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":179 + * self.mse = state['mse'] + * + * cpdef INDEX_t get_pruned(PruningPassIteration self): # <<<<<<<<<<<<<< + * return self.pruned + * + */ + +static PyObject *__pyx_pf_7_record_20PruningPassIteration_8get_pruned(struct __pyx_obj_7_record_PruningPassIteration *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_pruned", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_7_record_PruningPassIteration *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_pruned(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_record.PruningPassIteration.get_pruned", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_20PruningPassIteration_11__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_7_record_20PruningPassIteration_11__str__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_r = __pyx_pf_7_record_20PruningPassIteration_10__str__(((struct __pyx_obj_7_record_PruningPassIteration *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":182 + * return self.pruned + * + * def __str__(PruningPassIteration self): # <<<<<<<<<<<<<< + * result = '%s\t%s\t%s' % (str(self.pruned),self.size,'%.2f' % self.mse if self.mse is not None else None) + * return result + */ + +static PyObject *__pyx_pf_7_record_20PruningPassIteration_10__str__(struct __pyx_obj_7_record_PruningPassIteration *__pyx_v_self) { + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__str__", 0); + + /* "_record.pyx":183 + * + * def __str__(PruningPassIteration self): + * result = '%s\t%s\t%s' % (str(self.pruned),self.size,'%.2f' % self.mse if self.mse is not None else None) # <<<<<<<<<<<<<< + * return result + * + */ + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->pruned); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->__pyx_base.size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.mse); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = (__pyx_t_4 != Py_None); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (__pyx_t_5) { + __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.mse); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_17), __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_3 = ((PyObject *)__pyx_t_6); + __pyx_t_6 = 0; + } else { + __Pyx_INCREF(Py_None); + __pyx_t_3 = Py_None; + } + __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_16), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_v_result = ((PyObject *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "_record.pyx":184 + * def __str__(PruningPassIteration self): + * result = '%s\t%s\t%s' % (str(self.pruned),self.size,'%.2f' % self.mse if self.mse is not None else None) + * return result # <<<<<<<<<<<<<< + * + * cdef class FirstPruningPassIteration(PruningPassIteration): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("_record.PruningPassIteration.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_7_record_25FirstPruningPassIteration_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7_record_25FirstPruningPassIteration_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + __pyx_t_7_record_INDEX_t __pyx_v_size; + __pyx_t_7_record_FLOAT_t __pyx_v_mse; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__size,&__pyx_n_s__mse,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mse)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_size = __Pyx_PyInt_from_py_npy_ulonglong(values[0]); if (unlikely((__pyx_v_size == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_mse = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_mse == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("_record.FirstPruningPassIteration.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7_record_25FirstPruningPassIteration___init__(((struct __pyx_obj_7_record_FirstPruningPassIteration *)__pyx_v_self), __pyx_v_size, __pyx_v_mse); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":187 + * + * cdef class FirstPruningPassIteration(PruningPassIteration): + * def __init__(PruningPassIteration self, INDEX_t size, FLOAT_t mse): # <<<<<<<<<<<<<< + * self.size = size + * self.mse = mse + */ + +static int __pyx_pf_7_record_25FirstPruningPassIteration___init__(struct __pyx_obj_7_record_FirstPruningPassIteration *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_size, __pyx_t_7_record_FLOAT_t __pyx_v_mse) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__", 0); + + /* "_record.pyx":188 + * cdef class FirstPruningPassIteration(PruningPassIteration): + * def __init__(PruningPassIteration self, INDEX_t size, FLOAT_t mse): + * self.size = size # <<<<<<<<<<<<<< + * self.mse = mse + * + */ + __pyx_v_self->__pyx_base.__pyx_base.size = __pyx_v_size; + + /* "_record.pyx":189 + * def __init__(PruningPassIteration self, INDEX_t size, FLOAT_t mse): + * self.size = size + * self.mse = mse # <<<<<<<<<<<<<< + * + * def __reduce__(FirstPruningPassIteration self): + */ + __pyx_v_self->__pyx_base.__pyx_base.mse = __pyx_v_mse; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_25FirstPruningPassIteration_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7_record_25FirstPruningPassIteration_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); + __pyx_r = __pyx_pf_7_record_25FirstPruningPassIteration_2__reduce__(((struct __pyx_obj_7_record_FirstPruningPassIteration *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":191 + * self.mse = mse + * + * def __reduce__(FirstPruningPassIteration self): # <<<<<<<<<<<<<< + * return (FirstPruningPassIteration, (1,1.0), self._getstate()) + * + */ + +static PyObject *__pyx_pf_7_record_25FirstPruningPassIteration_2__reduce__(struct __pyx_obj_7_record_FirstPruningPassIteration *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce__", 0); + + /* "_record.pyx":192 + * + * def __reduce__(FirstPruningPassIteration self): + * return (FirstPruningPassIteration, (1,1.0), self._getstate()) # <<<<<<<<<<<<<< + * + * def _getstate(FirstPruningPassIteration self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7_record_FirstPruningPassIteration))); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7_record_FirstPruningPassIteration))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7_record_FirstPruningPassIteration))); + PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("_record.FirstPruningPassIteration.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_25FirstPruningPassIteration_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7_record_25FirstPruningPassIteration_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_getstate (wrapper)", 0); + __pyx_r = __pyx_pf_7_record_25FirstPruningPassIteration_4_getstate(((struct __pyx_obj_7_record_FirstPruningPassIteration *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":194 + * return (FirstPruningPassIteration, (1,1.0), self._getstate()) + * + * def _getstate(FirstPruningPassIteration self): # <<<<<<<<<<<<<< + * return {'size': self.size, + * 'mse': self.mse} + */ + +static PyObject *__pyx_pf_7_record_25FirstPruningPassIteration_4_getstate(struct __pyx_obj_7_record_FirstPruningPassIteration *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_getstate", 0); + + /* "_record.pyx":195 + * + * def _getstate(FirstPruningPassIteration self): + * return {'size': self.size, # <<<<<<<<<<<<<< + * 'mse': self.mse} + * + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->__pyx_base.__pyx_base.size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__size), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "_record.pyx":196 + * def _getstate(FirstPruningPassIteration self): + * return {'size': self.size, + * 'mse': self.mse} # <<<<<<<<<<<<<< + * + * def __setstate__(FirstPruningPassIteration self, dict state): + */ + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.__pyx_base.mse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__mse), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("_record.FirstPruningPassIteration._getstate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_25FirstPruningPassIteration_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ +static PyObject *__pyx_pw_7_record_25FirstPruningPassIteration_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), (&PyDict_Type), 1, "state", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7_record_25FirstPruningPassIteration_6__setstate__(((struct __pyx_obj_7_record_FirstPruningPassIteration *)__pyx_v_self), ((PyObject*)__pyx_v_state)); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":198 + * 'mse': self.mse} + * + * def __setstate__(FirstPruningPassIteration self, dict state): # <<<<<<<<<<<<<< + * self.size = state['size'] + * self.mse = state['mse'] + */ + +static PyObject *__pyx_pf_7_record_25FirstPruningPassIteration_6__setstate__(struct __pyx_obj_7_record_FirstPruningPassIteration *__pyx_v_self, PyObject *__pyx_v_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __pyx_t_7_record_INDEX_t __pyx_t_2; + __pyx_t_7_record_FLOAT_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate__", 0); + + /* "_record.pyx":199 + * + * def __setstate__(FirstPruningPassIteration self, dict state): + * self.size = state['size'] # <<<<<<<<<<<<<< + * self.mse = state['mse'] + * + */ + if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__size)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->__pyx_base.__pyx_base.size = __pyx_t_2; + + /* "_record.pyx":200 + * def __setstate__(FirstPruningPassIteration self, dict state): + * self.size = state['size'] + * self.mse = state['mse'] # <<<<<<<<<<<<<< + * + * def __str__(PruningPassIteration self): + */ + if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__mse)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->__pyx_base.__pyx_base.mse = __pyx_t_3; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_record.FirstPruningPassIteration.__setstate__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_25FirstPruningPassIteration_9__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_7_record_25FirstPruningPassIteration_9__str__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_r = __pyx_pf_7_record_25FirstPruningPassIteration_8__str__(((struct __pyx_obj_7_record_FirstPruningPassIteration *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":202 + * self.mse = state['mse'] + * + * def __str__(PruningPassIteration self): # <<<<<<<<<<<<<< + * result = '%s\t%s\t%s' % ('-',self.size,'%.2f' % self.mse if self.mse is not None else None) + * return result + */ + +static PyObject *__pyx_pf_7_record_25FirstPruningPassIteration_8__str__(struct __pyx_obj_7_record_FirstPruningPassIteration *__pyx_v_self) { + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__str__", 0); + + /* "_record.pyx":203 + * + * def __str__(PruningPassIteration self): + * result = '%s\t%s\t%s' % ('-',self.size,'%.2f' % self.mse if self.mse is not None else None) # <<<<<<<<<<<<<< + * return result + * + */ + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->__pyx_base.__pyx_base.size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.__pyx_base.mse); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = (__pyx_t_3 != Py_None); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_4) { + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.__pyx_base.mse); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_17), __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = ((PyObject *)__pyx_t_5); + __pyx_t_5 = 0; + } else { + __Pyx_INCREF(Py_None); + __pyx_t_2 = Py_None; + } + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_18)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_18)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_18)); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_16), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_v_result = ((PyObject *)__pyx_t_2); + __pyx_t_2 = 0; + + /* "_record.pyx":204 + * def __str__(PruningPassIteration self): + * result = '%s\t%s\t%s' % ('-',self.size,'%.2f' % self.mse if self.mse is not None else None) + * return result # <<<<<<<<<<<<<< + * + * cdef class ForwardPassIteration(Iteration): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("_record.FirstPruningPassIteration.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_7_record_20ForwardPassIteration_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7_record_20ForwardPassIteration_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + __pyx_t_7_record_INDEX_t __pyx_v_parent; + __pyx_t_7_record_INDEX_t __pyx_v_variable; + int __pyx_v_knot; + __pyx_t_7_record_FLOAT_t __pyx_v_mse; + __pyx_t_7_record_INDEX_t __pyx_v_size; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__parent,&__pyx_n_s__variable,&__pyx_n_s__knot,&__pyx_n_s__mse,&__pyx_n_s__size,0}; + PyObject* values[5] = {0,0,0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__parent)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__variable)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__knot)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mse)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[4] = PyTuple_GET_ITEM(__pyx_args, 4); + } + __pyx_v_parent = __Pyx_PyInt_from_py_npy_ulonglong(values[0]); if (unlikely((__pyx_v_parent == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_variable = __Pyx_PyInt_from_py_npy_ulonglong(values[1]); if (unlikely((__pyx_v_variable == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_knot = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_knot == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_mse = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_mse == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_size = __Pyx_PyInt_from_py_npy_ulonglong(values[4]); if (unlikely((__pyx_v_size == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("_record.ForwardPassIteration.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7_record_20ForwardPassIteration___init__(((struct __pyx_obj_7_record_ForwardPassIteration *)__pyx_v_self), __pyx_v_parent, __pyx_v_variable, __pyx_v_knot, __pyx_v_mse, __pyx_v_size); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":207 + * + * cdef class ForwardPassIteration(Iteration): + * def __init__(ForwardPassIteration self, INDEX_t parent, INDEX_t variable, int knot, FLOAT_t mse, INDEX_t size): # <<<<<<<<<<<<<< + * self.parent = parent + * self.variable = variable + */ + +static int __pyx_pf_7_record_20ForwardPassIteration___init__(struct __pyx_obj_7_record_ForwardPassIteration *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_parent, __pyx_t_7_record_INDEX_t __pyx_v_variable, int __pyx_v_knot, __pyx_t_7_record_FLOAT_t __pyx_v_mse, __pyx_t_7_record_INDEX_t __pyx_v_size) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__", 0); + + /* "_record.pyx":208 + * cdef class ForwardPassIteration(Iteration): + * def __init__(ForwardPassIteration self, INDEX_t parent, INDEX_t variable, int knot, FLOAT_t mse, INDEX_t size): + * self.parent = parent # <<<<<<<<<<<<<< + * self.variable = variable + * self.knot = knot + */ + __pyx_v_self->parent = __pyx_v_parent; + + /* "_record.pyx":209 + * def __init__(ForwardPassIteration self, INDEX_t parent, INDEX_t variable, int knot, FLOAT_t mse, INDEX_t size): + * self.parent = parent + * self.variable = variable # <<<<<<<<<<<<<< + * self.knot = knot + * self.mse = mse + */ + __pyx_v_self->variable = __pyx_v_variable; + + /* "_record.pyx":210 + * self.parent = parent + * self.variable = variable + * self.knot = knot # <<<<<<<<<<<<<< + * self.mse = mse + * self.size = size + */ + __pyx_v_self->knot = __pyx_v_knot; + + /* "_record.pyx":211 + * self.variable = variable + * self.knot = knot + * self.mse = mse # <<<<<<<<<<<<<< + * self.size = size + * + */ + __pyx_v_self->__pyx_base.mse = __pyx_v_mse; + + /* "_record.pyx":212 + * self.knot = knot + * self.mse = mse + * self.size = size # <<<<<<<<<<<<<< + * + * def __reduce__(ForwardPassIteration self): + */ + __pyx_v_self->__pyx_base.size = __pyx_v_size; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_20ForwardPassIteration_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7_record_20ForwardPassIteration_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); + __pyx_r = __pyx_pf_7_record_20ForwardPassIteration_2__reduce__(((struct __pyx_obj_7_record_ForwardPassIteration *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":214 + * self.size = size + * + * def __reduce__(ForwardPassIteration self): # <<<<<<<<<<<<<< + * return (ForwardPassIteration, (1,1,1,1.0,1), self._getstate()) + * + */ + +static PyObject *__pyx_pf_7_record_20ForwardPassIteration_2__reduce__(struct __pyx_obj_7_record_ForwardPassIteration *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce__", 0); + + /* "_record.pyx":215 + * + * def __reduce__(ForwardPassIteration self): + * return (ForwardPassIteration, (1,1,1,1.0,1), self._getstate()) # <<<<<<<<<<<<<< + * + * def _getstate(ForwardPassIteration self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7_record_ForwardPassIteration))); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7_record_ForwardPassIteration))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7_record_ForwardPassIteration))); + PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("_record.ForwardPassIteration.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_20ForwardPassIteration_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7_record_20ForwardPassIteration_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_getstate (wrapper)", 0); + __pyx_r = __pyx_pf_7_record_20ForwardPassIteration_4_getstate(((struct __pyx_obj_7_record_ForwardPassIteration *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":217 + * return (ForwardPassIteration, (1,1,1,1.0,1), self._getstate()) + * + * def _getstate(ForwardPassIteration self): # <<<<<<<<<<<<<< + * return {'parent': self.parent, + * 'variable': self.variable, + */ + +static PyObject *__pyx_pf_7_record_20ForwardPassIteration_4_getstate(struct __pyx_obj_7_record_ForwardPassIteration *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_getstate", 0); + + /* "_record.pyx":218 + * + * def _getstate(ForwardPassIteration self): + * return {'parent': self.parent, # <<<<<<<<<<<<<< + * 'variable': self.variable, + * 'knot': self.knot, + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->parent); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__parent), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "_record.pyx":219 + * def _getstate(ForwardPassIteration self): + * return {'parent': self.parent, + * 'variable': self.variable, # <<<<<<<<<<<<<< + * 'knot': self.knot, + * 'mse': self.mse, + */ + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->variable); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__variable), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "_record.pyx":220 + * return {'parent': self.parent, + * 'variable': self.variable, + * 'knot': self.knot, # <<<<<<<<<<<<<< + * 'mse': self.mse, + * 'size': self.size} + */ + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->knot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__knot), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "_record.pyx":221 + * 'variable': self.variable, + * 'knot': self.knot, + * 'mse': self.mse, # <<<<<<<<<<<<<< + * 'size': self.size} + * + */ + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.mse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__mse), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "_record.pyx":222 + * 'knot': self.knot, + * 'mse': self.mse, + * 'size': self.size} # <<<<<<<<<<<<<< + * + * def __setstate__(ForwardPassIteration self, dict state): + */ + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->__pyx_base.size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__size), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("_record.ForwardPassIteration._getstate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_20ForwardPassIteration_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ +static PyObject *__pyx_pw_7_record_20ForwardPassIteration_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), (&PyDict_Type), 1, "state", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7_record_20ForwardPassIteration_6__setstate__(((struct __pyx_obj_7_record_ForwardPassIteration *)__pyx_v_self), ((PyObject*)__pyx_v_state)); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":224 + * 'size': self.size} + * + * def __setstate__(ForwardPassIteration self, dict state): # <<<<<<<<<<<<<< + * self.parent = state['parent'] + * self.variable = state['variable'] + */ + +static PyObject *__pyx_pf_7_record_20ForwardPassIteration_6__setstate__(struct __pyx_obj_7_record_ForwardPassIteration *__pyx_v_self, PyObject *__pyx_v_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __pyx_t_7_record_INDEX_t __pyx_t_2; + __pyx_t_7_record_FLOAT_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate__", 0); + + /* "_record.pyx":225 + * + * def __setstate__(ForwardPassIteration self, dict state): + * self.parent = state['parent'] # <<<<<<<<<<<<<< + * self.variable = state['variable'] + * self.knot = state['knot'] + */ + if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__parent)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->parent = __pyx_t_2; + + /* "_record.pyx":226 + * def __setstate__(ForwardPassIteration self, dict state): + * self.parent = state['parent'] + * self.variable = state['variable'] # <<<<<<<<<<<<<< + * self.knot = state['knot'] + * self.mse = state['mse'] + */ + if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__variable)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->variable = __pyx_t_2; + + /* "_record.pyx":227 + * self.parent = state['parent'] + * self.variable = state['variable'] + * self.knot = state['knot'] # <<<<<<<<<<<<<< + * self.mse = state['mse'] + * self.size = state['size'] + */ + if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__knot)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->knot = __pyx_t_3; + + /* "_record.pyx":228 + * self.variable = state['variable'] + * self.knot = state['knot'] + * self.mse = state['mse'] # <<<<<<<<<<<<<< + * self.size = state['size'] + * + */ + if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__mse)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->__pyx_base.mse = __pyx_t_3; + + /* "_record.pyx":229 + * self.knot = state['knot'] + * self.mse = state['mse'] + * self.size = state['size'] # <<<<<<<<<<<<<< + * + * def __str__(self): + */ + if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__size)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->__pyx_base.size = __pyx_t_2; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_record.ForwardPassIteration.__setstate__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_20ForwardPassIteration_9__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_7_record_20ForwardPassIteration_9__str__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_r = __pyx_pf_7_record_20ForwardPassIteration_8__str__(((struct __pyx_obj_7_record_ForwardPassIteration *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":231 + * self.size = state['size'] + * + * def __str__(self): # <<<<<<<<<<<<<< + * result = '%d\t%d\t%d\t%4f\t%d' % (self.parent,self.variable,self.knot,self.mse,self.size) + * return result + */ + +static PyObject *__pyx_pf_7_record_20ForwardPassIteration_8__str__(struct __pyx_obj_7_record_ForwardPassIteration *__pyx_v_self) { + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_6 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__str__", 0); + + /* "_record.pyx":232 + * + * def __str__(self): + * result = '%d\t%d\t%d\t%4f\t%d' % (self.parent,self.variable,self.knot,self.mse,self.size) # <<<<<<<<<<<<<< + * return result + * + */ + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->parent); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->variable); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->knot); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.mse); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->__pyx_base.size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyTuple_New(5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_6, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_6, 3, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_6, 4, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_1 = 0; + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_4 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_19), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + __pyx_v_result = ((PyObject *)__pyx_t_5); + __pyx_t_5 = 0; + + /* "_record.pyx":233 + * def __str__(self): + * result = '%d\t%d\t%d\t%4f\t%d' % (self.parent,self.variable,self.knot,self.mse,self.size) + * return result # <<<<<<<<<<<<<< + * + * cpdef set_no_candidates(ForwardPassIteration self, bint value): + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); + __Pyx_AddTraceback("_record.ForwardPassIteration.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":235 + * return result + * + * cpdef set_no_candidates(ForwardPassIteration self, bint value): # <<<<<<<<<<<<<< + * self.no_candidates = value + * + */ + +static PyObject *__pyx_pw_7_record_20ForwardPassIteration_11set_no_candidates(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/ +static PyObject *__pyx_f_7_record_20ForwardPassIteration_set_no_candidates(struct __pyx_obj_7_record_ForwardPassIteration *__pyx_v_self, int __pyx_v_value, int __pyx_skip_dispatch) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("set_no_candidates", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__set_no_candidates); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7_record_20ForwardPassIteration_11set_no_candidates)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_record.pyx":236 + * + * cpdef set_no_candidates(ForwardPassIteration self, bint value): + * self.no_candidates = value # <<<<<<<<<<<<<< + * + * cpdef no_further_candidates(ForwardPassIteration self): + */ + __pyx_v_self->no_candidates = __pyx_v_value; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("_record.ForwardPassIteration.set_no_candidates", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_20ForwardPassIteration_11set_no_candidates(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/ +static PyObject *__pyx_pw_7_record_20ForwardPassIteration_11set_no_candidates(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) { + int __pyx_v_value; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("set_no_candidates (wrapper)", 0); + assert(__pyx_arg_value); { + __pyx_v_value = __Pyx_PyObject_IsTrue(__pyx_arg_value); if (unlikely((__pyx_v_value == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L3_error:; + __Pyx_AddTraceback("_record.ForwardPassIteration.set_no_candidates", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7_record_20ForwardPassIteration_10set_no_candidates(((struct __pyx_obj_7_record_ForwardPassIteration *)__pyx_v_self), ((int)__pyx_v_value)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":235 + * return result + * + * cpdef set_no_candidates(ForwardPassIteration self, bint value): # <<<<<<<<<<<<<< + * self.no_candidates = value + * + */ + +static PyObject *__pyx_pf_7_record_20ForwardPassIteration_10set_no_candidates(struct __pyx_obj_7_record_ForwardPassIteration *__pyx_v_self, int __pyx_v_value) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("set_no_candidates", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_7_record_ForwardPassIteration *)__pyx_v_self->__pyx_base.__pyx_vtab)->set_no_candidates(__pyx_v_self, __pyx_v_value, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_record.ForwardPassIteration.set_no_candidates", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":238 + * self.no_candidates = value + * + * cpdef no_further_candidates(ForwardPassIteration self): # <<<<<<<<<<<<<< + * return self.no_candidates + * + */ + +static PyObject *__pyx_pw_7_record_20ForwardPassIteration_13no_further_candidates(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_f_7_record_20ForwardPassIteration_no_further_candidates(struct __pyx_obj_7_record_ForwardPassIteration *__pyx_v_self, int __pyx_skip_dispatch) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("no_further_candidates", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_20); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7_record_20ForwardPassIteration_13no_further_candidates)) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_record.pyx":239 + * + * cpdef no_further_candidates(ForwardPassIteration self): + * return self.no_candidates # <<<<<<<<<<<<<< + * + * cdef class FirstForwardPassIteration(ForwardPassIteration): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->no_candidates); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("_record.ForwardPassIteration.no_further_candidates", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_20ForwardPassIteration_13no_further_candidates(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7_record_20ForwardPassIteration_13no_further_candidates(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("no_further_candidates (wrapper)", 0); + __pyx_r = __pyx_pf_7_record_20ForwardPassIteration_12no_further_candidates(((struct __pyx_obj_7_record_ForwardPassIteration *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":238 + * self.no_candidates = value + * + * cpdef no_further_candidates(ForwardPassIteration self): # <<<<<<<<<<<<<< + * return self.no_candidates + * + */ + +static PyObject *__pyx_pf_7_record_20ForwardPassIteration_12no_further_candidates(struct __pyx_obj_7_record_ForwardPassIteration *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("no_further_candidates", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = ((struct __pyx_vtabstruct_7_record_ForwardPassIteration *)__pyx_v_self->__pyx_base.__pyx_vtab)->no_further_candidates(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_record.ForwardPassIteration.no_further_candidates", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static int __pyx_pw_7_record_25FirstForwardPassIteration_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7_record_25FirstForwardPassIteration_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + __pyx_t_7_record_FLOAT_t __pyx_v_mse; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__mse,0}; + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mse)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_mse = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_mse == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("_record.FirstForwardPassIteration.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7_record_25FirstForwardPassIteration___init__(((struct __pyx_obj_7_record_FirstForwardPassIteration *)__pyx_v_self), __pyx_v_mse); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":242 + * + * cdef class FirstForwardPassIteration(ForwardPassIteration): + * def __init__(FirstForwardPassIteration self, FLOAT_t mse): # <<<<<<<<<<<<<< + * self.mse = mse + * + */ + +static int __pyx_pf_7_record_25FirstForwardPassIteration___init__(struct __pyx_obj_7_record_FirstForwardPassIteration *__pyx_v_self, __pyx_t_7_record_FLOAT_t __pyx_v_mse) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__init__", 0); + + /* "_record.pyx":243 + * cdef class FirstForwardPassIteration(ForwardPassIteration): + * def __init__(FirstForwardPassIteration self, FLOAT_t mse): + * self.mse = mse # <<<<<<<<<<<<<< + * + * def __reduce__(FirstForwardPassIteration self): + */ + __pyx_v_self->__pyx_base.__pyx_base.mse = __pyx_v_mse; + + __pyx_r = 0; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_25FirstForwardPassIteration_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7_record_25FirstForwardPassIteration_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); + __pyx_r = __pyx_pf_7_record_25FirstForwardPassIteration_2__reduce__(((struct __pyx_obj_7_record_FirstForwardPassIteration *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":245 + * self.mse = mse + * + * def __reduce__(FirstForwardPassIteration self): # <<<<<<<<<<<<<< + * return (FirstForwardPassIteration, (1.0,), self._getstate()) + * + */ + +static PyObject *__pyx_pf_7_record_25FirstForwardPassIteration_2__reduce__(struct __pyx_obj_7_record_FirstForwardPassIteration *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__reduce__", 0); + + /* "_record.pyx":246 + * + * def __reduce__(FirstForwardPassIteration self): + * return (FirstForwardPassIteration, (1.0,), self._getstate()) # <<<<<<<<<<<<<< + * + * def _getstate(FirstForwardPassIteration self): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7_record_FirstForwardPassIteration))); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7_record_FirstForwardPassIteration))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7_record_FirstForwardPassIteration))); + PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("_record.FirstForwardPassIteration.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_25FirstForwardPassIteration_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7_record_25FirstForwardPassIteration_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("_getstate (wrapper)", 0); + __pyx_r = __pyx_pf_7_record_25FirstForwardPassIteration_4_getstate(((struct __pyx_obj_7_record_FirstForwardPassIteration *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":248 + * return (FirstForwardPassIteration, (1.0,), self._getstate()) + * + * def _getstate(FirstForwardPassIteration self): # <<<<<<<<<<<<<< + * return {'mse': self.mse} + * + */ + +static PyObject *__pyx_pf_7_record_25FirstForwardPassIteration_4_getstate(struct __pyx_obj_7_record_FirstForwardPassIteration *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_getstate", 0); + + /* "_record.pyx":249 + * + * def _getstate(FirstForwardPassIteration self): + * return {'mse': self.mse} # <<<<<<<<<<<<<< + * + * def __setstate__(FirstForwardPassIteration self, dict state): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.__pyx_base.mse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__mse), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("_record.FirstForwardPassIteration._getstate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_25FirstForwardPassIteration_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ +static PyObject *__pyx_pw_7_record_25FirstForwardPassIteration_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), (&PyDict_Type), 1, "state", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7_record_25FirstForwardPassIteration_6__setstate__(((struct __pyx_obj_7_record_FirstForwardPassIteration *)__pyx_v_self), ((PyObject*)__pyx_v_state)); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":251 + * return {'mse': self.mse} + * + * def __setstate__(FirstForwardPassIteration self, dict state): # <<<<<<<<<<<<<< + * self.mse = state['mse'] + * + */ + +static PyObject *__pyx_pf_7_record_25FirstForwardPassIteration_6__setstate__(struct __pyx_obj_7_record_FirstForwardPassIteration *__pyx_v_self, PyObject *__pyx_v_state) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + __pyx_t_7_record_FLOAT_t __pyx_t_2; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__setstate__", 0); + + /* "_record.pyx":252 + * + * def __setstate__(FirstForwardPassIteration self, dict state): + * self.mse = state['mse'] # <<<<<<<<<<<<<< + * + * cpdef INDEX_t get_size(FirstForwardPassIteration self): + */ + if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__mse)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_self->__pyx_base.__pyx_base.mse = __pyx_t_2; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_record.FirstForwardPassIteration.__setstate__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":254 + * self.mse = state['mse'] + * + * cpdef INDEX_t get_size(FirstForwardPassIteration self): # <<<<<<<<<<<<<< + * return 1 + * + */ + +static PyObject *__pyx_pw_7_record_25FirstForwardPassIteration_9get_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static __pyx_t_7_record_INDEX_t __pyx_f_7_record_25FirstForwardPassIteration_get_size(CYTHON_UNUSED struct __pyx_obj_7_record_FirstForwardPassIteration *__pyx_v_self, int __pyx_skip_dispatch) { + __pyx_t_7_record_INDEX_t __pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + __pyx_t_7_record_INDEX_t __pyx_t_3; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_size", 0); + /* Check if called by wrapper */ + if (unlikely(__pyx_skip_dispatch)) ; + /* Check if overridden in Python */ + else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7_record_25FirstForwardPassIteration_9get_size)) { + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + goto __pyx_L0; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + } + + /* "_record.pyx":255 + * + * cpdef INDEX_t get_size(FirstForwardPassIteration self): + * return 1 # <<<<<<<<<<<<<< + * + * def __str__(self): + */ + __pyx_r = 1; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_WriteUnraisable("_record.FirstForwardPassIteration.get_size", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_25FirstForwardPassIteration_9get_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7_record_25FirstForwardPassIteration_9get_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("get_size (wrapper)", 0); + __pyx_r = __pyx_pf_7_record_25FirstForwardPassIteration_8get_size(((struct __pyx_obj_7_record_FirstForwardPassIteration *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":254 + * self.mse = state['mse'] + * + * cpdef INDEX_t get_size(FirstForwardPassIteration self): # <<<<<<<<<<<<<< + * return 1 + * + */ + +static PyObject *__pyx_pf_7_record_25FirstForwardPassIteration_8get_size(struct __pyx_obj_7_record_FirstForwardPassIteration *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("get_size", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_7_record_FirstForwardPassIteration *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.get_size(((struct __pyx_obj_7_record_Iteration *)__pyx_v_self), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_record.FirstForwardPassIteration.get_size", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7_record_25FirstForwardPassIteration_11__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_7_record_25FirstForwardPassIteration_11__str__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); + __pyx_r = __pyx_pf_7_record_25FirstForwardPassIteration_10__str__(((struct __pyx_obj_7_record_FirstForwardPassIteration *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_record.pyx":257 + * return 1 + * + * def __str__(self): # <<<<<<<<<<<<<< + * result = '%s\t%s\t%s\t%4f\t%s' % ('-','-','-',self.mse,1) + * return result + */ + +static PyObject *__pyx_pf_7_record_25FirstForwardPassIteration_10__str__(struct __pyx_obj_7_record_FirstForwardPassIteration *__pyx_v_self) { + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__str__", 0); + + /* "_record.pyx":258 + * + * def __str__(self): + * result = '%s\t%s\t%s\t%4f\t%s' % ('-','-','-',self.mse,1) # <<<<<<<<<<<<<< + * return result + * + */ + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.__pyx_base.mse); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_18)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_18)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_18)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_18)); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_kp_s_18)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_18)); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_18)); + PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_kp_s_18)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_18)); + PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_v_result = ((PyObject *)__pyx_t_1); + __pyx_t_1 = 0; + + /* "_record.pyx":259 + * def __str__(self): + * result = '%s\t%s\t%s\t%4f\t%s' % ('-','-','-',self.mse,1) + * return result # <<<<<<<<<<<<<< + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_AddTraceback("_record.FirstForwardPassIteration.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":194 + * # experimental exception made for __getbuffer__ and __releasebuffer__ + * # -- the details of this may change. + * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< + * # This implementation of getbuffer is geared towards Cython + * # requirements, and does not yet fullfill the PEP. + */ + +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_v_copy_shape; + int __pyx_v_i; + int __pyx_v_ndim; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; + int __pyx_v_t; + char *__pyx_v_f; + PyArray_Descr *__pyx_v_descr = 0; + int __pyx_v_offset; + int __pyx_v_hasfields; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + char *__pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getbuffer__", 0); + if (__pyx_v_info != NULL) { + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + } + + /* "numpy.pxd":200 + * # of flags + * + * if info == NULL: return # <<<<<<<<<<<<<< + * + * cdef int copy_shape, i, ndim + */ + __pyx_t_1 = (__pyx_v_info == NULL); + if (__pyx_t_1) { + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "numpy.pxd":203 + * + * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + */ + __pyx_v_endian_detector = 1; + + /* "numpy.pxd":204 + * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * + * ndim = PyArray_NDIM(self) + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "numpy.pxd":206 + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + */ + __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); + + /* "numpy.pxd":208 + * ndim = PyArray_NDIM(self) + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< + * copy_shape = 1 + * else: + */ + __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_1) { + + /* "numpy.pxd":209 + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * copy_shape = 1 # <<<<<<<<<<<<<< + * else: + * copy_shape = 0 + */ + __pyx_v_copy_shape = 1; + goto __pyx_L4; + } + /*else*/ { + + /* "numpy.pxd":211 + * copy_shape = 1 + * else: + * copy_shape = 0 # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + */ + __pyx_v_copy_shape = 0; + } + __pyx_L4:; + + /* "numpy.pxd":213 + * copy_shape = 0 + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") + */ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); + if (__pyx_t_1) { + + /* "numpy.pxd":214 + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not C contiguous") + * + */ + __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS)); + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + + /* "numpy.pxd":215 + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + */ + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_23), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "numpy.pxd":217 + * raise ValueError(u"ndarray is not C contiguous") + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") + */ + __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); + if (__pyx_t_3) { + + /* "numpy.pxd":218 + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not Fortran contiguous") + * + */ + __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS)); + __pyx_t_2 = __pyx_t_1; + } else { + __pyx_t_2 = __pyx_t_3; + } + if (__pyx_t_2) { + + /* "numpy.pxd":219 + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * + * info.buf = PyArray_DATA(self) + */ + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_25), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "numpy.pxd":221 + * raise ValueError(u"ndarray is not Fortran contiguous") + * + * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< + * info.ndim = ndim + * if copy_shape: + */ + __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); + + /* "numpy.pxd":222 + * + * info.buf = PyArray_DATA(self) + * info.ndim = ndim # <<<<<<<<<<<<<< + * if copy_shape: + * # Allocate new buffer for strides and shape info. + */ + __pyx_v_info->ndim = __pyx_v_ndim; + + /* "numpy.pxd":223 + * info.buf = PyArray_DATA(self) + * info.ndim = ndim + * if copy_shape: # <<<<<<<<<<<<<< + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. + */ + if (__pyx_v_copy_shape) { + + /* "numpy.pxd":226 + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< + * info.shape = info.strides + ndim + * for i in range(ndim): + */ + __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); + + /* "numpy.pxd":227 + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + * info.shape = info.strides + ndim # <<<<<<<<<<<<<< + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] + */ + __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); + + /* "numpy.pxd":228 + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + * info.shape = info.strides + ndim + * for i in range(ndim): # <<<<<<<<<<<<<< + * info.strides[i] = PyArray_STRIDES(self)[i] + * info.shape[i] = PyArray_DIMS(self)[i] + */ + __pyx_t_5 = __pyx_v_ndim; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "numpy.pxd":229 + * info.shape = info.strides + ndim + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< + * info.shape[i] = PyArray_DIMS(self)[i] + * else: + */ + (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); + + /* "numpy.pxd":230 + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] + * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< + * else: + * info.strides = PyArray_STRIDES(self) + */ + (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); + } + goto __pyx_L7; + } + /*else*/ { + + /* "numpy.pxd":232 + * info.shape[i] = PyArray_DIMS(self)[i] + * else: + * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL + */ + __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); + + /* "numpy.pxd":233 + * else: + * info.strides = PyArray_STRIDES(self) + * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) + */ + __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); + } + __pyx_L7:; + + /* "numpy.pxd":234 + * info.strides = PyArray_STRIDES(self) + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL # <<<<<<<<<<<<<< + * info.itemsize = PyArray_ITEMSIZE(self) + * info.readonly = not PyArray_ISWRITEABLE(self) + */ + __pyx_v_info->suboffsets = NULL; + + /* "numpy.pxd":235 + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< + * info.readonly = not PyArray_ISWRITEABLE(self) + * + */ + __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); + + /* "numpy.pxd":236 + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) + * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< + * + * cdef int t + */ + __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self)); + + /* "numpy.pxd":239 + * + * cdef int t + * cdef char* f = NULL # <<<<<<<<<<<<<< + * cdef dtype descr = self.descr + * cdef list stack + */ + __pyx_v_f = NULL; + + /* "numpy.pxd":240 + * cdef int t + * cdef char* f = NULL + * cdef dtype descr = self.descr # <<<<<<<<<<<<<< + * cdef list stack + * cdef int offset + */ + __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); + __Pyx_INCREF(__pyx_t_4); + __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "numpy.pxd":244 + * cdef int offset + * + * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< + * + * if not hasfields and not copy_shape: + */ + __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); + + /* "numpy.pxd":246 + * cdef bint hasfields = PyDataType_HASFIELDS(descr) + * + * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< + * # do not call releasebuffer + * info.obj = None + */ + __pyx_t_2 = (!__pyx_v_hasfields); + if (__pyx_t_2) { + __pyx_t_3 = (!__pyx_v_copy_shape); + __pyx_t_1 = __pyx_t_3; + } else { + __pyx_t_1 = __pyx_t_2; + } + if (__pyx_t_1) { + + /* "numpy.pxd":248 + * if not hasfields and not copy_shape: + * # do not call releasebuffer + * info.obj = None # <<<<<<<<<<<<<< + * else: + * # need to call releasebuffer + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = Py_None; + goto __pyx_L10; + } + /*else*/ { + + /* "numpy.pxd":251 + * else: + * # need to call releasebuffer + * info.obj = self # <<<<<<<<<<<<<< + * + * if not hasfields: + */ + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); + } + __pyx_L10:; + + /* "numpy.pxd":253 + * info.obj = self + * + * if not hasfields: # <<<<<<<<<<<<<< + * t = descr.type_num + * if ((descr.byteorder == c'>' and little_endian) or + */ + __pyx_t_1 = (!__pyx_v_hasfields); + if (__pyx_t_1) { + + /* "numpy.pxd":254 + * + * if not hasfields: + * t = descr.type_num # <<<<<<<<<<<<<< + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): + */ + __pyx_t_5 = __pyx_v_descr->type_num; + __pyx_v_t = __pyx_t_5; + + /* "numpy.pxd":255 + * if not hasfields: + * t = descr.type_num + * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + */ + __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); + if (__pyx_t_1) { + __pyx_t_2 = __pyx_v_little_endian; + } else { + __pyx_t_2 = __pyx_t_1; + } + if (!__pyx_t_2) { + + /* "numpy.pxd":256 + * t = descr.type_num + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" + */ + __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); + if (__pyx_t_1) { + __pyx_t_3 = (!__pyx_v_little_endian); + __pyx_t_7 = __pyx_t_3; + } else { + __pyx_t_7 = __pyx_t_1; + } + __pyx_t_1 = __pyx_t_7; + } else { + __pyx_t_1 = __pyx_t_2; + } + if (__pyx_t_1) { + + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_27), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; + } + __pyx_L12:; + + /* "numpy.pxd":274 + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" + * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + */ + switch (__pyx_v_t) { + + /* "numpy.pxd":258 + * (descr.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" + */ + case NPY_BYTE: + __pyx_v_f = __pyx_k__b; + break; + + /* "numpy.pxd":259 + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" + */ + case NPY_UBYTE: + __pyx_v_f = __pyx_k__B; + break; + + /* "numpy.pxd":260 + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" + */ + case NPY_SHORT: + __pyx_v_f = __pyx_k__h; + break; + + /* "numpy.pxd":261 + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" + */ + case NPY_USHORT: + __pyx_v_f = __pyx_k__H; + break; + + /* "numpy.pxd":262 + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" + */ + case NPY_INT: + __pyx_v_f = __pyx_k__i; + break; + + /* "numpy.pxd":263 + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" + */ + case NPY_UINT: + __pyx_v_f = __pyx_k__I; + break; + + /* "numpy.pxd":264 + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" + */ + case NPY_LONG: + __pyx_v_f = __pyx_k__l; + break; + + /* "numpy.pxd":265 + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" + */ + case NPY_ULONG: + __pyx_v_f = __pyx_k__L; + break; + + /* "numpy.pxd":266 + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" + */ + case NPY_LONGLONG: + __pyx_v_f = __pyx_k__q; + break; + + /* "numpy.pxd":267 + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" + */ + case NPY_ULONGLONG: + __pyx_v_f = __pyx_k__Q; + break; + + /* "numpy.pxd":268 + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" + */ + case NPY_FLOAT: + __pyx_v_f = __pyx_k__f; + break; + + /* "numpy.pxd":269 + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" + */ + case NPY_DOUBLE: + __pyx_v_f = __pyx_k__d; + break; + + /* "numpy.pxd":270 + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" + */ + case NPY_LONGDOUBLE: + __pyx_v_f = __pyx_k__g; + break; + + /* "numpy.pxd":271 + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" + */ + case NPY_CFLOAT: + __pyx_v_f = __pyx_k__Zf; + break; + + /* "numpy.pxd":272 + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< + * elif t == NPY_CLONGDOUBLE: f = "Zg" + * elif t == NPY_OBJECT: f = "O" + */ + case NPY_CDOUBLE: + __pyx_v_f = __pyx_k__Zd; + break; + + /* "numpy.pxd":273 + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< + * elif t == NPY_OBJECT: f = "O" + * else: + */ + case NPY_CLONGDOUBLE: + __pyx_v_f = __pyx_k__Zg; + break; + + /* "numpy.pxd":274 + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" + * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + */ + case NPY_OBJECT: + __pyx_v_f = __pyx_k__O; + break; + default: + + /* "numpy.pxd":276 + * elif t == NPY_OBJECT: f = "O" + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * info.format = f + * return + */ + __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_28), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + + /* "numpy.pxd":277 + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * info.format = f # <<<<<<<<<<<<<< + * return + * else: + */ + __pyx_v_info->format = __pyx_v_f; + + /* "numpy.pxd":278 + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * info.format = f + * return # <<<<<<<<<<<<<< + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L11; + } + /*else*/ { + + /* "numpy.pxd":280 + * return + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< + * info.format[0] = c'^' # Native data types, manual alignment + * offset = 0 + */ + __pyx_v_info->format = ((char *)malloc(255)); + + /* "numpy.pxd":281 + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) + * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * offset = 0 + * f = _util_dtypestring(descr, info.format + 1, + */ + (__pyx_v_info->format[0]) = '^'; + + /* "numpy.pxd":282 + * info.format = stdlib.malloc(_buffer_format_string_len) + * info.format[0] = c'^' # Native data types, manual alignment + * offset = 0 # <<<<<<<<<<<<<< + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + */ + __pyx_v_offset = 0; + + /* "numpy.pxd":285 + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + * &offset) # <<<<<<<<<<<<<< + * f[0] = c'\0' # Terminate format string + * + */ + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_9; + + /* "numpy.pxd":286 + * info.format + _buffer_format_string_len, + * &offset) + * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< + * + * def __releasebuffer__(ndarray self, Py_buffer* info): + */ + (__pyx_v_f[0]) = '\x00'; + } + __pyx_L11:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; + } + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(Py_None); + __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; + } + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_descr); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); + __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":288 + * f[0] = c'\0' # Terminate format string + * + * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + */ + +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("__releasebuffer__", 0); + + /* "numpy.pxd":289 + * + * def __releasebuffer__(ndarray self, Py_buffer* info): + * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + */ + __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self); + if (__pyx_t_1) { + + /* "numpy.pxd":290 + * def __releasebuffer__(ndarray self, Py_buffer* info): + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) # <<<<<<<<<<<<<< + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * stdlib.free(info.strides) + */ + free(__pyx_v_info->format); + goto __pyx_L3; + } + __pyx_L3:; + + /* "numpy.pxd":291 + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< + * stdlib.free(info.strides) + * # info.shape was stored after info.strides in the same block + */ + __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_1) { + + /* "numpy.pxd":292 + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * stdlib.free(info.strides) # <<<<<<<<<<<<<< + * # info.shape was stored after info.strides in the same block + * + */ + free(__pyx_v_info->strides); + goto __pyx_L4; + } + __pyx_L4:; + + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":768 + * ctypedef npy_cdouble complex_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); + + /* "numpy.pxd":769 + * + * cdef inline object PyArray_MultiIterNew1(a): + * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew2(a, b): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":771 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); + + /* "numpy.pxd":772 + * + * cdef inline object PyArray_MultiIterNew2(a, b): + * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":774 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); + + /* "numpy.pxd":775 + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":777 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); + + /* "numpy.pxd":778 + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":780 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); + + /* "numpy.pxd":781 + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":783 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< + * # Recursive utility function used in __getbuffer__ to get format + * # string. The new location in the format string is returned. + */ + +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { + PyArray_Descr *__pyx_v_child = 0; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; + PyObject *__pyx_v_fields = 0; + PyObject *__pyx_v_childname = NULL; + PyObject *__pyx_v_new_offset = NULL; + PyObject *__pyx_v_t = NULL; + char *__pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *(*__pyx_t_6)(PyObject *); + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + long __pyx_t_11; + char *__pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_util_dtypestring", 0); + + /* "numpy.pxd":790 + * cdef int delta_offset + * cdef tuple i + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * cdef tuple fields + */ + __pyx_v_endian_detector = 1; + + /* "numpy.pxd":791 + * cdef tuple i + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * cdef tuple fields + * + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "numpy.pxd":794 + * cdef tuple fields + * + * for childname in descr.names: # <<<<<<<<<<<<<< + * fields = descr.fields[childname] + * child, new_offset = fields + */ + if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; + for (;;) { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + __Pyx_XDECREF(__pyx_v_childname); + __pyx_v_childname = __pyx_t_3; + __pyx_t_3 = 0; + + /* "numpy.pxd":795 + * + * for childname in descr.names: + * fields = descr.fields[childname] # <<<<<<<<<<<<<< + * child, new_offset = fields + * + */ + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); + __pyx_v_fields = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + + /* "numpy.pxd":796 + * for childname in descr.names: + * fields = descr.fields[childname] + * child, new_offset = fields # <<<<<<<<<<<<<< + * + * if (end - f) - (new_offset - offset[0]) < 15: + */ + if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { + PyObject* sequence = ((PyObject *)__pyx_v_fields); + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + #else + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + #endif + } else if (1) { + __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else + { + Py_ssize_t index = -1; + __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_fields)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; + index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = NULL; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L6_unpacking_done; + __pyx_L5_unpacking_failed:; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L6_unpacking_done:; + } + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_child)); + __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); + __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_v_new_offset); + __pyx_v_new_offset = __pyx_t_4; + __pyx_t_4 = 0; + + /* "numpy.pxd":798 + * child, new_offset = fields + * + * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") + * + */ + __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + + /* "numpy.pxd":799 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == c'>' and little_endian) or + */ + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_30), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + /* "numpy.pxd":801 + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") + * + * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (child.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + */ + __pyx_t_7 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_7) { + __pyx_t_8 = __pyx_v_little_endian; + } else { + __pyx_t_8 = __pyx_t_7; + } + if (!__pyx_t_8) { + + /* "numpy.pxd":802 + * + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError(u"Non-native byte order not supported") + * # One could encode it in the format string and have Cython + */ + __pyx_t_7 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_7) { + __pyx_t_9 = (!__pyx_v_little_endian); + __pyx_t_10 = __pyx_t_9; + } else { + __pyx_t_10 = __pyx_t_7; + } + __pyx_t_7 = __pyx_t_10; + } else { + __pyx_t_7 = __pyx_t_8; + } + if (__pyx_t_7) { + + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_31), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + + /* "numpy.pxd":813 + * + * # Output padding bytes + * while offset[0] < new_offset: # <<<<<<<<<<<<<< + * f[0] = 120 # "x"; pad byte + * f += 1 + */ + while (1) { + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!__pyx_t_7) break; + + /* "numpy.pxd":814 + * # Output padding bytes + * while offset[0] < new_offset: + * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< + * f += 1 + * offset[0] += 1 + */ + (__pyx_v_f[0]) = 120; + + /* "numpy.pxd":815 + * while offset[0] < new_offset: + * f[0] = 120 # "x"; pad byte + * f += 1 # <<<<<<<<<<<<<< + * offset[0] += 1 + * + */ + __pyx_v_f = (__pyx_v_f + 1); + + /* "numpy.pxd":816 + * f[0] = 120 # "x"; pad byte + * f += 1 + * offset[0] += 1 # <<<<<<<<<<<<<< + * + * offset[0] += child.itemsize + */ + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1); + } + + /* "numpy.pxd":818 + * offset[0] += 1 + * + * offset[0] += child.itemsize # <<<<<<<<<<<<<< + * + * if not PyDataType_HASFIELDS(child): + */ + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize); + + /* "numpy.pxd":820 + * offset[0] += child.itemsize + * + * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< + * t = child.type_num + * if end - f < 5: + */ + __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_7) { + + /* "numpy.pxd":821 + * + * if not PyDataType_HASFIELDS(child): + * t = child.type_num # <<<<<<<<<<<<<< + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") + */ + __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_v_t); + __pyx_v_t = __pyx_t_3; + __pyx_t_3 = 0; + + /* "numpy.pxd":822 + * if not PyDataType_HASFIELDS(child): + * t = child.type_num + * if end - f < 5: # <<<<<<<<<<<<<< + * raise RuntimeError(u"Format string allocated too short.") + * + */ + __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_7) { + + /* "numpy.pxd":823 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings + */ + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_33), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; + } + __pyx_L12:; + + /* "numpy.pxd":826 + * + * # Until ticket #99 is fixed, use integers to avoid warnings + * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" + */ + __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 98; + goto __pyx_L13; + } + + /* "numpy.pxd":827 + * # Until ticket #99 is fixed, use integers to avoid warnings + * if t == NPY_BYTE: f[0] = 98 #"b" + * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" + */ + __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 66; + goto __pyx_L13; + } + + /* "numpy.pxd":828 + * if t == NPY_BYTE: f[0] = 98 #"b" + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" + */ + __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 104; + goto __pyx_L13; + } + + /* "numpy.pxd":829 + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" + */ + __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 72; + goto __pyx_L13; + } + + /* "numpy.pxd":830 + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" + */ + __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 105; + goto __pyx_L13; + } + + /* "numpy.pxd":831 + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" + */ + __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 73; + goto __pyx_L13; + } + + /* "numpy.pxd":832 + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + */ + __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 108; + goto __pyx_L13; + } + + /* "numpy.pxd":833 + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + */ + __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 76; + goto __pyx_L13; + } + + /* "numpy.pxd":834 + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" + */ + __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 113; + goto __pyx_L13; + } + + /* "numpy.pxd":835 + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + */ + __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 81; + goto __pyx_L13; + } + + /* "numpy.pxd":836 + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + */ + __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 102; + goto __pyx_L13; + } + + /* "numpy.pxd":837 + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + */ + __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 100; + goto __pyx_L13; + } + + /* "numpy.pxd":838 + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + */ + __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 103; + goto __pyx_L13; + } + + /* "numpy.pxd":839 + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + */ + __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 102; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; + } + + /* "numpy.pxd":840 + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + * elif t == NPY_OBJECT: f[0] = 79 #"O" + */ + __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 100; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; + } + + /* "numpy.pxd":841 + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: + */ + __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 103; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; + } + + /* "numpy.pxd":842 + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + */ + __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 79; + goto __pyx_L13; + } + /*else*/ { + + /* "numpy.pxd":844 + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * f += 1 + * else: + */ + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_28), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L13:; + + /* "numpy.pxd":845 + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * f += 1 # <<<<<<<<<<<<<< + * else: + * # Cython ignores struct boundary information ("T{...}"), + */ + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L11; + } + /*else*/ { + + /* "numpy.pxd":849 + * # Cython ignores struct boundary information ("T{...}"), + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< + * return f + * + */ + __pyx_t_12 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_12; + } + __pyx_L11:; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "numpy.pxd":850 + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) + * return f # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_f; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_child); + __Pyx_XDECREF(__pyx_v_fields); + __Pyx_XDECREF(__pyx_v_childname); + __Pyx_XDECREF(__pyx_v_new_offset); + __Pyx_XDECREF(__pyx_v_t); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":965 + * + * + * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< + * cdef PyObject* baseptr + * if base is None: + */ + +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { + PyObject *__pyx_v_baseptr; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("set_array_base", 0); + + /* "numpy.pxd":967 + * cdef inline void set_array_base(ndarray arr, object base): + * cdef PyObject* baseptr + * if base is None: # <<<<<<<<<<<<<< + * baseptr = NULL + * else: + */ + __pyx_t_1 = (__pyx_v_base == Py_None); + if (__pyx_t_1) { + + /* "numpy.pxd":968 + * cdef PyObject* baseptr + * if base is None: + * baseptr = NULL # <<<<<<<<<<<<<< + * else: + * Py_INCREF(base) # important to do this before decref below! + */ + __pyx_v_baseptr = NULL; + goto __pyx_L3; + } + /*else*/ { + + /* "numpy.pxd":970 + * baseptr = NULL + * else: + * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< + * baseptr = base + * Py_XDECREF(arr.base) + */ + Py_INCREF(__pyx_v_base); + + /* "numpy.pxd":971 + * else: + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base # <<<<<<<<<<<<<< + * Py_XDECREF(arr.base) + * arr.base = baseptr + */ + __pyx_v_baseptr = ((PyObject *)__pyx_v_base); + } + __pyx_L3:; + + /* "numpy.pxd":972 + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base + * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< + * arr.base = baseptr + * + */ + Py_XDECREF(__pyx_v_arr->base); + + /* "numpy.pxd":973 + * baseptr = base + * Py_XDECREF(arr.base) + * arr.base = baseptr # <<<<<<<<<<<<<< + * + * cdef inline object get_array_base(ndarray arr): + */ + __pyx_v_arr->base = __pyx_v_baseptr; + + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":975 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("get_array_base", 0); + + /* "numpy.pxd":976 + * + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: # <<<<<<<<<<<<<< + * return None + * else: + */ + __pyx_t_1 = (__pyx_v_arr->base == NULL); + if (__pyx_t_1) { + + /* "numpy.pxd":977 + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: + * return None # <<<<<<<<<<<<<< + * else: + * return arr.base + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "numpy.pxd":979 + * return None + * else: + * return arr.base # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); + __pyx_r = ((PyObject *)__pyx_v_arr->base); + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} +static struct __pyx_vtabstruct_7_record_Record __pyx_vtable_7_record_Record; + +static PyObject *__pyx_tp_new_7_record_Record(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_7_record_Record *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_7_record_Record *)o); + p->__pyx_vtab = __pyx_vtabptr_7_record_Record; + p->iterations = ((PyObject*)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_7_record_Record(PyObject *o) { + struct __pyx_obj_7_record_Record *p = (struct __pyx_obj_7_record_Record *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->iterations); + (*Py_TYPE(o)->tp_free)(o); +} + +static int __pyx_tp_traverse_7_record_Record(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_7_record_Record *p = (struct __pyx_obj_7_record_Record *)o; + if (p->iterations) { + e = (*v)(p->iterations, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_7_record_Record(PyObject *o) { + struct __pyx_obj_7_record_Record *p = (struct __pyx_obj_7_record_Record *)o; + PyObject* tmp; + tmp = ((PyObject*)p->iterations); + p->iterations = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} +static PyObject *__pyx_sq_item_7_record_Record(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + Py_DECREF(x); + return r; +} + +static PyMethodDef __pyx_methods_7_record_Record[] = { + {__Pyx_NAMESTR("_eq"), (PyCFunction)__pyx_pw_7_record_6Record_3_eq, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("append"), (PyCFunction)__pyx_pw_7_record_6Record_9append, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("mse"), (PyCFunction)__pyx_pw_7_record_6Record_11mse, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("gcv"), (PyCFunction)__pyx_pw_7_record_6Record_13gcv, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("rsq"), (PyCFunction)__pyx_pw_7_record_6Record_15rsq, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("grsq"), (PyCFunction)__pyx_pw_7_record_6Record_17grsq, METH_O, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_Record = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_Record = { + __pyx_pw_7_record_6Record_7__len__, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + __pyx_sq_item_7_record_Record, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_Record = { + __pyx_pw_7_record_6Record_7__len__, /*mp_length*/ + __pyx_pw_7_record_6Record_5__getitem__, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_Record = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_7_record_Record = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("_record.Record"), /*tp_name*/ + sizeof(struct __pyx_obj_7_record_Record), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_7_record_Record, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_Record, /*tp_as_number*/ + &__pyx_tp_as_sequence_Record, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_Record, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_Record, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_7_record_Record, /*tp_traverse*/ + __pyx_tp_clear_7_record_Record, /*tp_clear*/ + __pyx_pw_7_record_6Record_1__richcmp__, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_7_record_Record, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_7_record_Record, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_7_record_PruningPassRecord __pyx_vtable_7_record_PruningPassRecord; + +static PyObject *__pyx_tp_new_7_record_PruningPassRecord(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7_record_PruningPassRecord *p; + PyObject *o = __pyx_tp_new_7_record_Record(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_7_record_PruningPassRecord *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7_record_Record*)__pyx_vtabptr_7_record_PruningPassRecord; + return o; +} + +static PyMethodDef __pyx_methods_7_record_PruningPassRecord[] = { + {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_7_record_17PruningPassRecord_3__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_getstate"), (PyCFunction)__pyx_pw_7_record_17PruningPassRecord_5_getstate, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__setstate__"), (PyCFunction)__pyx_pw_7_record_17PruningPassRecord_7__setstate__, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("set_selected"), (PyCFunction)__pyx_pw_7_record_17PruningPassRecord_9set_selected, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_selected"), (PyCFunction)__pyx_pw_7_record_17PruningPassRecord_11get_selected, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("roll_back"), (PyCFunction)__pyx_pw_7_record_17PruningPassRecord_13roll_back, METH_O, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_PruningPassRecord = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_PruningPassRecord = { + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_7_record_6Record_7__len__, /*sq_length*/ + #else + 0, /*sq_length*/ + #endif + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_PruningPassRecord = { + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_7_record_6Record_7__len__, /*mp_length*/ + #else + 0, /*mp_length*/ + #endif + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_7_record_6Record_5__getitem__, /*mp_subscript*/ + #else + 0, /*mp_subscript*/ + #endif + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_PruningPassRecord = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_7_record_PruningPassRecord = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("_record.PruningPassRecord"), /*tp_name*/ + sizeof(struct __pyx_obj_7_record_PruningPassRecord), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_7_record_Record, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_PruningPassRecord, /*tp_as_number*/ + &__pyx_tp_as_sequence_PruningPassRecord, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_PruningPassRecord, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + __pyx_pw_7_record_17PruningPassRecord_15__str__, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_PruningPassRecord, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_7_record_Record, /*tp_traverse*/ + __pyx_tp_clear_7_record_Record, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_7_record_PruningPassRecord, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_7_record_17PruningPassRecord_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_7_record_PruningPassRecord, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_7_record_ForwardPassRecord __pyx_vtable_7_record_ForwardPassRecord; + +static PyObject *__pyx_tp_new_7_record_ForwardPassRecord(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7_record_ForwardPassRecord *p; + PyObject *o = __pyx_tp_new_7_record_Record(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_7_record_ForwardPassRecord *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7_record_Record*)__pyx_vtabptr_7_record_ForwardPassRecord; + return o; +} + +static PyMethodDef __pyx_methods_7_record_ForwardPassRecord[] = { + {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_7_record_17ForwardPassRecord_3__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_getstate"), (PyCFunction)__pyx_pw_7_record_17ForwardPassRecord_5_getstate, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__setstate__"), (PyCFunction)__pyx_pw_7_record_17ForwardPassRecord_7__setstate__, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("set_stopping_condition"), (PyCFunction)__pyx_pw_7_record_17ForwardPassRecord_9set_stopping_condition, METH_O, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_ForwardPassRecord = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_ForwardPassRecord = { + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_7_record_6Record_7__len__, /*sq_length*/ + #else + 0, /*sq_length*/ + #endif + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_ForwardPassRecord = { + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_7_record_6Record_7__len__, /*mp_length*/ + #else + 0, /*mp_length*/ + #endif + #if CYTHON_COMPILING_IN_PYPY + __pyx_pw_7_record_6Record_5__getitem__, /*mp_subscript*/ + #else + 0, /*mp_subscript*/ + #endif + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_ForwardPassRecord = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_7_record_ForwardPassRecord = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("_record.ForwardPassRecord"), /*tp_name*/ + sizeof(struct __pyx_obj_7_record_ForwardPassRecord), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_7_record_Record, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_ForwardPassRecord, /*tp_as_number*/ + &__pyx_tp_as_sequence_ForwardPassRecord, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_ForwardPassRecord, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + __pyx_pw_7_record_17ForwardPassRecord_11__str__, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_ForwardPassRecord, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_7_record_Record, /*tp_traverse*/ + __pyx_tp_clear_7_record_Record, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_7_record_ForwardPassRecord, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_7_record_17ForwardPassRecord_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_7_record_ForwardPassRecord, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_7_record_Iteration __pyx_vtable_7_record_Iteration; + +static PyObject *__pyx_tp_new_7_record_Iteration(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_7_record_Iteration *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_7_record_Iteration *)o); + p->__pyx_vtab = __pyx_vtabptr_7_record_Iteration; + return o; +} + +static void __pyx_tp_dealloc_7_record_Iteration(PyObject *o) { + (*Py_TYPE(o)->tp_free)(o); +} + +static PyMethodDef __pyx_methods_7_record_Iteration[] = { + {__Pyx_NAMESTR("_eq"), (PyCFunction)__pyx_pw_7_record_9Iteration_3_eq, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_mse"), (PyCFunction)__pyx_pw_7_record_9Iteration_5get_mse, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_size"), (PyCFunction)__pyx_pw_7_record_9Iteration_7get_size, METH_NOARGS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_Iteration = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_Iteration = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_Iteration = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_Iteration = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_7_record_Iteration = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("_record.Iteration"), /*tp_name*/ + sizeof(struct __pyx_obj_7_record_Iteration), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_7_record_Iteration, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_Iteration, /*tp_as_number*/ + &__pyx_tp_as_sequence_Iteration, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_Iteration, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_Iteration, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + __pyx_pw_7_record_9Iteration_1__richcmp__, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_7_record_Iteration, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_7_record_Iteration, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_7_record_PruningPassIteration __pyx_vtable_7_record_PruningPassIteration; + +static PyObject *__pyx_tp_new_7_record_PruningPassIteration(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7_record_PruningPassIteration *p; + PyObject *o = __pyx_tp_new_7_record_Iteration(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_7_record_PruningPassIteration *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7_record_Iteration*)__pyx_vtabptr_7_record_PruningPassIteration; + return o; +} + +static PyMethodDef __pyx_methods_7_record_PruningPassIteration[] = { + {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_7_record_20PruningPassIteration_3__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_getstate"), (PyCFunction)__pyx_pw_7_record_20PruningPassIteration_5_getstate, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__setstate__"), (PyCFunction)__pyx_pw_7_record_20PruningPassIteration_7__setstate__, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_pruned"), (PyCFunction)__pyx_pw_7_record_20PruningPassIteration_9get_pruned, METH_NOARGS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_PruningPassIteration = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_PruningPassIteration = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_PruningPassIteration = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_PruningPassIteration = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_7_record_PruningPassIteration = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("_record.PruningPassIteration"), /*tp_name*/ + sizeof(struct __pyx_obj_7_record_PruningPassIteration), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_7_record_Iteration, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_PruningPassIteration, /*tp_as_number*/ + &__pyx_tp_as_sequence_PruningPassIteration, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_PruningPassIteration, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + __pyx_pw_7_record_20PruningPassIteration_11__str__, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_PruningPassIteration, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_7_record_PruningPassIteration, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_7_record_20PruningPassIteration_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_7_record_PruningPassIteration, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_7_record_FirstPruningPassIteration __pyx_vtable_7_record_FirstPruningPassIteration; + +static PyObject *__pyx_tp_new_7_record_FirstPruningPassIteration(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7_record_FirstPruningPassIteration *p; + PyObject *o = __pyx_tp_new_7_record_PruningPassIteration(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_7_record_FirstPruningPassIteration *)o); + p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7_record_Iteration*)__pyx_vtabptr_7_record_FirstPruningPassIteration; + return o; +} + +static PyMethodDef __pyx_methods_7_record_FirstPruningPassIteration[] = { + {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_7_record_25FirstPruningPassIteration_3__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_getstate"), (PyCFunction)__pyx_pw_7_record_25FirstPruningPassIteration_5_getstate, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__setstate__"), (PyCFunction)__pyx_pw_7_record_25FirstPruningPassIteration_7__setstate__, METH_O, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_FirstPruningPassIteration = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_FirstPruningPassIteration = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_FirstPruningPassIteration = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_FirstPruningPassIteration = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_7_record_FirstPruningPassIteration = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("_record.FirstPruningPassIteration"), /*tp_name*/ + sizeof(struct __pyx_obj_7_record_FirstPruningPassIteration), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_7_record_Iteration, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_FirstPruningPassIteration, /*tp_as_number*/ + &__pyx_tp_as_sequence_FirstPruningPassIteration, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_FirstPruningPassIteration, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + __pyx_pw_7_record_25FirstPruningPassIteration_9__str__, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_FirstPruningPassIteration, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_7_record_FirstPruningPassIteration, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_7_record_25FirstPruningPassIteration_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_7_record_FirstPruningPassIteration, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_7_record_ForwardPassIteration __pyx_vtable_7_record_ForwardPassIteration; + +static PyObject *__pyx_tp_new_7_record_ForwardPassIteration(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7_record_ForwardPassIteration *p; + PyObject *o = __pyx_tp_new_7_record_Iteration(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_7_record_ForwardPassIteration *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7_record_Iteration*)__pyx_vtabptr_7_record_ForwardPassIteration; + return o; +} + +static PyMethodDef __pyx_methods_7_record_ForwardPassIteration[] = { + {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_7_record_20ForwardPassIteration_3__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_getstate"), (PyCFunction)__pyx_pw_7_record_20ForwardPassIteration_5_getstate, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__setstate__"), (PyCFunction)__pyx_pw_7_record_20ForwardPassIteration_7__setstate__, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("set_no_candidates"), (PyCFunction)__pyx_pw_7_record_20ForwardPassIteration_11set_no_candidates, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("no_further_candidates"), (PyCFunction)__pyx_pw_7_record_20ForwardPassIteration_13no_further_candidates, METH_NOARGS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_ForwardPassIteration = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_ForwardPassIteration = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_ForwardPassIteration = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_ForwardPassIteration = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_7_record_ForwardPassIteration = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("_record.ForwardPassIteration"), /*tp_name*/ + sizeof(struct __pyx_obj_7_record_ForwardPassIteration), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_7_record_Iteration, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_ForwardPassIteration, /*tp_as_number*/ + &__pyx_tp_as_sequence_ForwardPassIteration, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_ForwardPassIteration, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + __pyx_pw_7_record_20ForwardPassIteration_9__str__, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_ForwardPassIteration, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_7_record_ForwardPassIteration, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_7_record_20ForwardPassIteration_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_7_record_ForwardPassIteration, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; +static struct __pyx_vtabstruct_7_record_FirstForwardPassIteration __pyx_vtable_7_record_FirstForwardPassIteration; + +static PyObject *__pyx_tp_new_7_record_FirstForwardPassIteration(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7_record_FirstForwardPassIteration *p; + PyObject *o = __pyx_tp_new_7_record_ForwardPassIteration(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_7_record_FirstForwardPassIteration *)o); + p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7_record_Iteration*)__pyx_vtabptr_7_record_FirstForwardPassIteration; + return o; +} + +static PyMethodDef __pyx_methods_7_record_FirstForwardPassIteration[] = { + {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_7_record_25FirstForwardPassIteration_3__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_getstate"), (PyCFunction)__pyx_pw_7_record_25FirstForwardPassIteration_5_getstate, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__setstate__"), (PyCFunction)__pyx_pw_7_record_25FirstForwardPassIteration_7__setstate__, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_size"), (PyCFunction)__pyx_pw_7_record_25FirstForwardPassIteration_9get_size, METH_NOARGS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} +}; + +static PyNumberMethods __pyx_tp_as_number_FirstForwardPassIteration = { + 0, /*nb_add*/ + 0, /*nb_subtract*/ + 0, /*nb_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_divide*/ + #endif + 0, /*nb_remainder*/ + 0, /*nb_divmod*/ + 0, /*nb_power*/ + 0, /*nb_negative*/ + 0, /*nb_positive*/ + 0, /*nb_absolute*/ + 0, /*nb_nonzero*/ + 0, /*nb_invert*/ + 0, /*nb_lshift*/ + 0, /*nb_rshift*/ + 0, /*nb_and*/ + 0, /*nb_xor*/ + 0, /*nb_or*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_coerce*/ + #endif + 0, /*nb_int*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_long*/ + #else + 0, /*reserved*/ + #endif + 0, /*nb_float*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_oct*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*nb_hex*/ + #endif + 0, /*nb_inplace_add*/ + 0, /*nb_inplace_subtract*/ + 0, /*nb_inplace_multiply*/ + #if PY_MAJOR_VERSION < 3 + 0, /*nb_inplace_divide*/ + #endif + 0, /*nb_inplace_remainder*/ + 0, /*nb_inplace_power*/ + 0, /*nb_inplace_lshift*/ + 0, /*nb_inplace_rshift*/ + 0, /*nb_inplace_and*/ + 0, /*nb_inplace_xor*/ + 0, /*nb_inplace_or*/ + 0, /*nb_floor_divide*/ + 0, /*nb_true_divide*/ + 0, /*nb_inplace_floor_divide*/ + 0, /*nb_inplace_true_divide*/ + #if PY_VERSION_HEX >= 0x02050000 + 0, /*nb_index*/ + #endif +}; + +static PySequenceMethods __pyx_tp_as_sequence_FirstForwardPassIteration = { + 0, /*sq_length*/ + 0, /*sq_concat*/ + 0, /*sq_repeat*/ + 0, /*sq_item*/ + 0, /*sq_slice*/ + 0, /*sq_ass_item*/ + 0, /*sq_ass_slice*/ + 0, /*sq_contains*/ + 0, /*sq_inplace_concat*/ + 0, /*sq_inplace_repeat*/ +}; + +static PyMappingMethods __pyx_tp_as_mapping_FirstForwardPassIteration = { + 0, /*mp_length*/ + 0, /*mp_subscript*/ + 0, /*mp_ass_subscript*/ +}; + +static PyBufferProcs __pyx_tp_as_buffer_FirstForwardPassIteration = { + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getreadbuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getwritebuffer*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getsegcount*/ + #endif + #if PY_MAJOR_VERSION < 3 + 0, /*bf_getcharbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_getbuffer*/ + #endif + #if PY_VERSION_HEX >= 0x02060000 + 0, /*bf_releasebuffer*/ + #endif +}; + +static PyTypeObject __pyx_type_7_record_FirstForwardPassIteration = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("_record.FirstForwardPassIteration"), /*tp_name*/ + sizeof(struct __pyx_obj_7_record_FirstForwardPassIteration), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_7_record_Iteration, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ + #if PY_MAJOR_VERSION < 3 + 0, /*tp_compare*/ + #else + 0, /*reserved*/ + #endif + 0, /*tp_repr*/ + &__pyx_tp_as_number_FirstForwardPassIteration, /*tp_as_number*/ + &__pyx_tp_as_sequence_FirstForwardPassIteration, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_FirstForwardPassIteration, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + __pyx_pw_7_record_25FirstForwardPassIteration_11__str__, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + &__pyx_tp_as_buffer_FirstForwardPassIteration, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_7_record_FirstForwardPassIteration, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + __pyx_pw_7_record_25FirstForwardPassIteration_1__init__, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_7_record_FirstForwardPassIteration, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif +}; + +static PyMethodDef __pyx_methods[] = { + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + #if PY_VERSION_HEX < 0x03020000 + { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, + #else + PyModuleDef_HEAD_INIT, + #endif + __Pyx_NAMESTR("_record"), + 0, /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, + {&__pyx_n_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 1}, + {&__pyx_kp_s_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 0, 1, 0}, + {&__pyx_kp_s_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 0, 1, 0}, + {&__pyx_kp_s_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 0, 1, 0}, + {&__pyx_kp_s_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 0, 1, 0}, + {&__pyx_kp_s_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 0, 1, 0}, + {&__pyx_kp_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 0}, + {&__pyx_kp_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 0}, + {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0}, + {&__pyx_n_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 1}, + {&__pyx_kp_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 0}, + {&__pyx_kp_u_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 1, 0, 0}, + {&__pyx_kp_u_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 1, 0, 0}, + {&__pyx_kp_u_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 1, 0, 0}, + {&__pyx_kp_u_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 1, 0, 0}, + {&__pyx_kp_u_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 1, 0, 0}, + {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, + {&__pyx_kp_u_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 1, 0, 0}, + {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0}, + {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0}, + {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0}, + {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0}, + {&__pyx_n_s__NotImplemented, __pyx_k__NotImplemented, sizeof(__pyx_k__NotImplemented), 0, 0, 1, 1}, + {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, + {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, + {&__pyx_n_s____class__, __pyx_k____class__, sizeof(__pyx_k____class__), 0, 0, 1, 1}, + {&__pyx_n_s____import__, __pyx_k____import__, sizeof(__pyx_k____import__), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s___eq, __pyx_k___eq, sizeof(__pyx_k___eq), 0, 0, 1, 1}, + {&__pyx_n_s___forward, __pyx_k___forward, sizeof(__pyx_k___forward), 0, 0, 1, 1}, + {&__pyx_n_s___getstate, __pyx_k___getstate, sizeof(__pyx_k___getstate), 0, 0, 1, 1}, + {&__pyx_n_s__append, __pyx_k__append, sizeof(__pyx_k__append), 0, 0, 1, 1}, + {&__pyx_n_s__enumerate, __pyx_k__enumerate, sizeof(__pyx_k__enumerate), 0, 0, 1, 1}, + {&__pyx_n_s__gcv, __pyx_k__gcv, sizeof(__pyx_k__gcv), 0, 0, 1, 1}, + {&__pyx_n_s__get_mse, __pyx_k__get_mse, sizeof(__pyx_k__get_mse), 0, 0, 1, 1}, + {&__pyx_n_s__get_pruned, __pyx_k__get_pruned, sizeof(__pyx_k__get_pruned), 0, 0, 1, 1}, + {&__pyx_n_s__get_selected, __pyx_k__get_selected, sizeof(__pyx_k__get_selected), 0, 0, 1, 1}, + {&__pyx_n_s__get_size, __pyx_k__get_size, sizeof(__pyx_k__get_size), 0, 0, 1, 1}, + {&__pyx_n_s__grsq, __pyx_k__grsq, sizeof(__pyx_k__grsq), 0, 0, 1, 1}, + {&__pyx_n_s__iter, __pyx_k__iter, sizeof(__pyx_k__iter), 0, 0, 1, 1}, + {&__pyx_n_s__iterations, __pyx_k__iterations, sizeof(__pyx_k__iterations), 0, 0, 1, 1}, + {&__pyx_n_s__knot, __pyx_k__knot, sizeof(__pyx_k__knot), 0, 0, 1, 1}, + {&__pyx_n_s__mse, __pyx_k__mse, sizeof(__pyx_k__mse), 0, 0, 1, 1}, + {&__pyx_n_s__num_samples, __pyx_k__num_samples, sizeof(__pyx_k__num_samples), 0, 0, 1, 1}, + {&__pyx_n_s__num_variables, __pyx_k__num_variables, sizeof(__pyx_k__num_variables), 0, 0, 1, 1}, + {&__pyx_n_s__parent, __pyx_k__parent, sizeof(__pyx_k__parent), 0, 0, 1, 1}, + {&__pyx_n_s__penalty, __pyx_k__penalty, sizeof(__pyx_k__penalty), 0, 0, 1, 1}, + {&__pyx_n_s__pruned, __pyx_k__pruned, sizeof(__pyx_k__pruned), 0, 0, 1, 1}, + {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, + {&__pyx_n_s__roll_back, __pyx_k__roll_back, sizeof(__pyx_k__roll_back), 0, 0, 1, 1}, + {&__pyx_n_s__rsq, __pyx_k__rsq, sizeof(__pyx_k__rsq), 0, 0, 1, 1}, + {&__pyx_n_s__selected, __pyx_k__selected, sizeof(__pyx_k__selected), 0, 0, 1, 1}, + {&__pyx_n_s__set_no_candidates, __pyx_k__set_no_candidates, sizeof(__pyx_k__set_no_candidates), 0, 0, 1, 1}, + {&__pyx_n_s__set_selected, __pyx_k__set_selected, sizeof(__pyx_k__set_selected), 0, 0, 1, 1}, + {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1}, + {&__pyx_n_s__split, __pyx_k__split, sizeof(__pyx_k__split), 0, 0, 1, 1}, + {&__pyx_n_s__sst, __pyx_k__sst, sizeof(__pyx_k__sst), 0, 0, 1, 1}, + {&__pyx_n_s__stopping_conditions, __pyx_k__stopping_conditions, sizeof(__pyx_k__stopping_conditions), 0, 0, 1, 1}, + {&__pyx_n_s__terms, __pyx_k__terms, sizeof(__pyx_k__terms), 0, 0, 1, 1}, + {&__pyx_n_s__unprune, __pyx_k__unprune, sizeof(__pyx_k__unprune), 0, 0, 1, 1}, + {&__pyx_n_s__var, __pyx_k__var, sizeof(__pyx_k__var), 0, 0, 1, 1}, + {&__pyx_n_s__variable, __pyx_k__variable, sizeof(__pyx_k__variable), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_NotImplemented = __Pyx_GetBuiltinName(__pyx_n_s__NotImplemented); if (!__pyx_builtin_NotImplemented) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + + /* "_record.pyx":93 + * result = '' + * result += 'Pruning Pass\n' + * header = 'iter\tbf\tterms\tmse\tgcv\trsq\tgrsq'.split('\t') # <<<<<<<<<<<<<< + * data = [] + * for i, iteration in enumerate(self.iterations): + */ + __pyx_k_tuple_5 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_5); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5)); + + /* "_record.pyx":97 + * for i, iteration in enumerate(self.iterations): + * row = str(i) + '\t' + str(iteration) + '\t%.3f\t%.3f\t%.3f' % (self.gcv(i),self.rsq(i),self.grsq(i)) + * data.append(row.split('\t')) # <<<<<<<<<<<<<< + * result += ascii_table(header,data) + * result += '\nSelected iteration: ' + str(self.selected) + '\n' + */ + __pyx_k_tuple_7 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_7); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7)); + + /* "_record.pyx":134 + * data = [] + * for i, iteration in enumerate(self.iterations): + * data.append([str(i)] + str(iteration).split('\t') + ('%.3f\t%.3f\t%.3f' % (self.gcv(i),self.rsq(i),self.grsq(i))).split('\t')) # <<<<<<<<<<<<<< + * result = '' + * result += 'Forward Pass\n' + */ + __pyx_k_tuple_11 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_11); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11)); + __pyx_k_tuple_13 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_13); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13)); + + /* "numpy.pxd":215 + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + */ + __pyx_k_tuple_23 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_22)); if (unlikely(!__pyx_k_tuple_23)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_23); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_23)); + + /* "numpy.pxd":219 + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * + * info.buf = PyArray_DATA(self) + */ + __pyx_k_tuple_25 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_24)); if (unlikely(!__pyx_k_tuple_25)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_25); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_25)); + + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_k_tuple_27 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_26)); if (unlikely(!__pyx_k_tuple_27)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_27); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_27)); + + /* "numpy.pxd":799 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == c'>' and little_endian) or + */ + __pyx_k_tuple_30 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_29)); if (unlikely(!__pyx_k_tuple_30)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_30); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_30)); + + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_k_tuple_31 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_26)); if (unlikely(!__pyx_k_tuple_31)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_31); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_31)); + + /* "numpy.pxd":823 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings + */ + __pyx_k_tuple_33 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_32)); if (unlikely(!__pyx_k_tuple_33)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_33); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_33)); + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC init_record(void); /*proto*/ +PyMODINIT_FUNC init_record(void) +#else +PyMODINIT_FUNC PyInit__record(void); /*proto*/ +PyMODINIT_FUNC PyInit__record(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__record(void)", 0); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __Pyx_CyFunction_USED + if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_record"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + Py_INCREF(__pyx_d); + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyDict_GetItemString(modules, "_record")) { + if (unlikely(PyDict_SetItemString(modules, "_record", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if CYTHON_COMPILING_IN_PYPY + Py_INCREF(__pyx_b); + #endif + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) + if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + if (__pyx_module_is_main__record) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Global init code ---*/ + /*--- Variable export code ---*/ + /*--- Function export code ---*/ + /*--- Type init code ---*/ + __pyx_vtabptr_7_record_Record = &__pyx_vtable_7_record_Record; + __pyx_vtable_7_record_Record.append = (PyObject *(*)(struct __pyx_obj_7_record_Record *, struct __pyx_obj_7_record_Iteration *, int __pyx_skip_dispatch))__pyx_f_7_record_6Record_append; + __pyx_vtable_7_record_Record.mse = (__pyx_t_7_record_FLOAT_t (*)(struct __pyx_obj_7_record_Record *, __pyx_t_7_record_INDEX_t, int __pyx_skip_dispatch))__pyx_f_7_record_6Record_mse; + __pyx_vtable_7_record_Record.rsq = (__pyx_t_7_record_FLOAT_t (*)(struct __pyx_obj_7_record_Record *, __pyx_t_7_record_INDEX_t, int __pyx_skip_dispatch))__pyx_f_7_record_6Record_rsq; + __pyx_vtable_7_record_Record.gcv = (__pyx_t_7_record_FLOAT_t (*)(struct __pyx_obj_7_record_Record *, __pyx_t_7_record_INDEX_t, int __pyx_skip_dispatch))__pyx_f_7_record_6Record_gcv; + __pyx_vtable_7_record_Record.grsq = (__pyx_t_7_record_FLOAT_t (*)(struct __pyx_obj_7_record_Record *, __pyx_t_7_record_INDEX_t, int __pyx_skip_dispatch))__pyx_f_7_record_6Record_grsq; + if (PyType_Ready(&__pyx_type_7_record_Record) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7_record_Record.tp_dict, __pyx_vtabptr_7_record_Record) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "Record", (PyObject *)&__pyx_type_7_record_Record) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7_record_Record = &__pyx_type_7_record_Record; + __pyx_vtabptr_7_record_PruningPassRecord = &__pyx_vtable_7_record_PruningPassRecord; + __pyx_vtable_7_record_PruningPassRecord.__pyx_base = *__pyx_vtabptr_7_record_Record; + __pyx_vtable_7_record_PruningPassRecord.set_selected = (PyObject *(*)(struct __pyx_obj_7_record_PruningPassRecord *, __pyx_t_7_record_INDEX_t, int __pyx_skip_dispatch))__pyx_f_7_record_17PruningPassRecord_set_selected; + __pyx_vtable_7_record_PruningPassRecord.get_selected = (__pyx_t_7_record_INDEX_t (*)(struct __pyx_obj_7_record_PruningPassRecord *, int __pyx_skip_dispatch))__pyx_f_7_record_17PruningPassRecord_get_selected; + __pyx_vtable_7_record_PruningPassRecord.roll_back = (PyObject *(*)(struct __pyx_obj_7_record_PruningPassRecord *, struct __pyx_obj_6_basis_Basis *, int __pyx_skip_dispatch))__pyx_f_7_record_17PruningPassRecord_roll_back; + __pyx_type_7_record_PruningPassRecord.tp_base = __pyx_ptype_7_record_Record; + if (PyType_Ready(&__pyx_type_7_record_PruningPassRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7_record_PruningPassRecord.tp_dict, __pyx_vtabptr_7_record_PruningPassRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "PruningPassRecord", (PyObject *)&__pyx_type_7_record_PruningPassRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7_record_PruningPassRecord = &__pyx_type_7_record_PruningPassRecord; + __pyx_vtabptr_7_record_ForwardPassRecord = &__pyx_vtable_7_record_ForwardPassRecord; + __pyx_vtable_7_record_ForwardPassRecord.__pyx_base = *__pyx_vtabptr_7_record_Record; + __pyx_vtable_7_record_ForwardPassRecord.set_stopping_condition = (PyObject *(*)(struct __pyx_obj_7_record_ForwardPassRecord *, int, int __pyx_skip_dispatch))__pyx_f_7_record_17ForwardPassRecord_set_stopping_condition; + __pyx_type_7_record_ForwardPassRecord.tp_base = __pyx_ptype_7_record_Record; + if (PyType_Ready(&__pyx_type_7_record_ForwardPassRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7_record_ForwardPassRecord.tp_dict, __pyx_vtabptr_7_record_ForwardPassRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "ForwardPassRecord", (PyObject *)&__pyx_type_7_record_ForwardPassRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7_record_ForwardPassRecord = &__pyx_type_7_record_ForwardPassRecord; + __pyx_vtabptr_7_record_Iteration = &__pyx_vtable_7_record_Iteration; + __pyx_vtable_7_record_Iteration.get_mse = (__pyx_t_7_record_FLOAT_t (*)(struct __pyx_obj_7_record_Iteration *, int __pyx_skip_dispatch))__pyx_f_7_record_9Iteration_get_mse; + __pyx_vtable_7_record_Iteration.get_size = (__pyx_t_7_record_INDEX_t (*)(struct __pyx_obj_7_record_Iteration *, int __pyx_skip_dispatch))__pyx_f_7_record_9Iteration_get_size; + if (PyType_Ready(&__pyx_type_7_record_Iteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7_record_Iteration.tp_dict, __pyx_vtabptr_7_record_Iteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "Iteration", (PyObject *)&__pyx_type_7_record_Iteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7_record_Iteration = &__pyx_type_7_record_Iteration; + __pyx_vtabptr_7_record_PruningPassIteration = &__pyx_vtable_7_record_PruningPassIteration; + __pyx_vtable_7_record_PruningPassIteration.__pyx_base = *__pyx_vtabptr_7_record_Iteration; + __pyx_vtable_7_record_PruningPassIteration.get_pruned = (__pyx_t_7_record_INDEX_t (*)(struct __pyx_obj_7_record_PruningPassIteration *, int __pyx_skip_dispatch))__pyx_f_7_record_20PruningPassIteration_get_pruned; + __pyx_type_7_record_PruningPassIteration.tp_base = __pyx_ptype_7_record_Iteration; + if (PyType_Ready(&__pyx_type_7_record_PruningPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7_record_PruningPassIteration.tp_dict, __pyx_vtabptr_7_record_PruningPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "PruningPassIteration", (PyObject *)&__pyx_type_7_record_PruningPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7_record_PruningPassIteration = &__pyx_type_7_record_PruningPassIteration; + __pyx_vtabptr_7_record_FirstPruningPassIteration = &__pyx_vtable_7_record_FirstPruningPassIteration; + __pyx_vtable_7_record_FirstPruningPassIteration.__pyx_base = *__pyx_vtabptr_7_record_PruningPassIteration; + __pyx_type_7_record_FirstPruningPassIteration.tp_base = __pyx_ptype_7_record_PruningPassIteration; + if (PyType_Ready(&__pyx_type_7_record_FirstPruningPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7_record_FirstPruningPassIteration.tp_dict, __pyx_vtabptr_7_record_FirstPruningPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "FirstPruningPassIteration", (PyObject *)&__pyx_type_7_record_FirstPruningPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7_record_FirstPruningPassIteration = &__pyx_type_7_record_FirstPruningPassIteration; + __pyx_vtabptr_7_record_ForwardPassIteration = &__pyx_vtable_7_record_ForwardPassIteration; + __pyx_vtable_7_record_ForwardPassIteration.__pyx_base = *__pyx_vtabptr_7_record_Iteration; + __pyx_vtable_7_record_ForwardPassIteration.set_no_candidates = (PyObject *(*)(struct __pyx_obj_7_record_ForwardPassIteration *, int, int __pyx_skip_dispatch))__pyx_f_7_record_20ForwardPassIteration_set_no_candidates; + __pyx_vtable_7_record_ForwardPassIteration.no_further_candidates = (PyObject *(*)(struct __pyx_obj_7_record_ForwardPassIteration *, int __pyx_skip_dispatch))__pyx_f_7_record_20ForwardPassIteration_no_further_candidates; + __pyx_type_7_record_ForwardPassIteration.tp_base = __pyx_ptype_7_record_Iteration; + if (PyType_Ready(&__pyx_type_7_record_ForwardPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7_record_ForwardPassIteration.tp_dict, __pyx_vtabptr_7_record_ForwardPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "ForwardPassIteration", (PyObject *)&__pyx_type_7_record_ForwardPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7_record_ForwardPassIteration = &__pyx_type_7_record_ForwardPassIteration; + __pyx_vtabptr_7_record_FirstForwardPassIteration = &__pyx_vtable_7_record_FirstForwardPassIteration; + __pyx_vtable_7_record_FirstForwardPassIteration.__pyx_base = *__pyx_vtabptr_7_record_ForwardPassIteration; + __pyx_vtable_7_record_FirstForwardPassIteration.__pyx_base.__pyx_base.get_size = (__pyx_t_7_record_INDEX_t (*)(struct __pyx_obj_7_record_Iteration *, int __pyx_skip_dispatch))__pyx_f_7_record_25FirstForwardPassIteration_get_size; + __pyx_type_7_record_FirstForwardPassIteration.tp_base = __pyx_ptype_7_record_ForwardPassIteration; + if (PyType_Ready(&__pyx_type_7_record_FirstForwardPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7_record_FirstForwardPassIteration.tp_dict, __pyx_vtabptr_7_record_FirstForwardPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "FirstForwardPassIteration", (PyObject *)&__pyx_type_7_record_FirstForwardPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7_record_FirstForwardPassIteration = &__pyx_type_7_record_FirstForwardPassIteration; + /*--- Type import code ---*/ + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", + #if CYTHON_COMPILING_IN_PYPY + sizeof(PyTypeObject), + #else + sizeof(PyHeapTypeObject), + #endif + 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6_basis_BasisFunction = __Pyx_ImportType("_basis", "BasisFunction", sizeof(struct __pyx_obj_6_basis_BasisFunction), 1); if (unlikely(!__pyx_ptype_6_basis_BasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_6_basis_BasisFunction = (struct __pyx_vtabstruct_6_basis_BasisFunction*)__Pyx_GetVtable(__pyx_ptype_6_basis_BasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_6_basis_BasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6_basis_ConstantBasisFunction = __Pyx_ImportType("_basis", "ConstantBasisFunction", sizeof(struct __pyx_obj_6_basis_ConstantBasisFunction), 1); if (unlikely(!__pyx_ptype_6_basis_ConstantBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_6_basis_ConstantBasisFunction = (struct __pyx_vtabstruct_6_basis_ConstantBasisFunction*)__Pyx_GetVtable(__pyx_ptype_6_basis_ConstantBasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_6_basis_ConstantBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6_basis_HingeBasisFunction = __Pyx_ImportType("_basis", "HingeBasisFunction", sizeof(struct __pyx_obj_6_basis_HingeBasisFunction), 1); if (unlikely(!__pyx_ptype_6_basis_HingeBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_6_basis_HingeBasisFunction = (struct __pyx_vtabstruct_6_basis_HingeBasisFunction*)__Pyx_GetVtable(__pyx_ptype_6_basis_HingeBasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_6_basis_HingeBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6_basis_LinearBasisFunction = __Pyx_ImportType("_basis", "LinearBasisFunction", sizeof(struct __pyx_obj_6_basis_LinearBasisFunction), 1); if (unlikely(!__pyx_ptype_6_basis_LinearBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_6_basis_LinearBasisFunction = (struct __pyx_vtabstruct_6_basis_LinearBasisFunction*)__Pyx_GetVtable(__pyx_ptype_6_basis_LinearBasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_6_basis_LinearBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_6_basis_Basis = __Pyx_ImportType("_basis", "Basis", sizeof(struct __pyx_obj_6_basis_Basis), 1); if (unlikely(!__pyx_ptype_6_basis_Basis)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_6_basis_Basis = (struct __pyx_vtabstruct_6_basis_Basis*)__Pyx_GetVtable(__pyx_ptype_6_basis_Basis->tp_dict); if (unlikely(!__pyx_vtabptr_6_basis_Basis)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Variable import code ---*/ + /*--- Function import code ---*/ + __pyx_t_1 = __Pyx_ImportModule("_util"); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_t_1, "gcv", (void (**)(void))&__pyx_f_5_util_gcv, "__pyx_t_5_util_FLOAT_t (__pyx_t_5_util_FLOAT_t, __pyx_t_5_util_INDEX_t, __pyx_t_5_util_INDEX_t, __pyx_t_5_util_FLOAT_t, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_t_1, "ascii_table", (void (**)(void))&__pyx_f_5_util_ascii_table, "PyObject *(PyObject *, PyObject *, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + Py_DECREF(__pyx_t_1); __pyx_t_1 = 0; + /*--- Execution code ---*/ + + /* "_record.pyx":8 + * + * from _util cimport gcv, ascii_table + * import _forward # <<<<<<<<<<<<<< + * + * cdef class Record: + */ + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s___forward), 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_d, __pyx_n_s___forward, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "_record.pyx":1 + * # distutils: language = c # <<<<<<<<<<<<<< + * # cython: cdivision = True + * # cython: boundscheck = False + */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + if (PyDict_SetItem(__pyx_d, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "numpy.pxd":975 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None + */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + if (__pyx_m) { + __Pyx_AddTraceback("init _record", __pyx_clineno, __pyx_lineno, __pyx_filename); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init _record"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* Runtime support code */ +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif /* CYTHON_REFNANNY */ + +static PyObject *__Pyx_GetBuiltinName(PyObject *name) { + PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); + if (unlikely(!result)) { + PyErr_Format(PyExc_NameError, +#if PY_MAJOR_VERSION >= 3 + "name '%U' is not defined", name); +#else + "name '%s' is not defined", PyString_AS_STRING(name)); +#endif + } + return result; +} + +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact) +{ + if (!type) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (none_allowed && obj == Py_None) return 1; + else if (exact) { + if (Py_TYPE(obj) == type) return 1; + } + else { + if (PyObject_TypeCheck(obj, type)) return 1; + } + PyErr_Format(PyExc_TypeError, + "Argument '%s' has incorrect type (expected %s, got %s)", + name, type->tp_name, Py_TYPE(obj)->tp_name); + return 0; +} + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + if (unlikely(!type)) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(PyObject_TypeCheck(obj, type))) + return 1; + PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", + Py_TYPE(obj)->tp_name, type->tp_name); + return 0; +} + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AsString(kw_name)); + #endif +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; + } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; + } + } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { + PyObject *result; +#if CYTHON_COMPILING_IN_CPYTHON + result = PyDict_GetItem(__pyx_d, name); + if (result) { + Py_INCREF(result); + } else { +#else + result = PyObject_GetItem(__pyx_d, name); + if (!result) { + PyErr_Clear(); +#endif + result = __Pyx_GetBuiltinName(name); + } + return result; +} + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck) { +#if CYTHON_COMPILING_IN_CPYTHON + if (wraparound & unlikely(i < 0)) i += PyList_GET_SIZE(o); + if ((!boundscheck) || likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, + int wraparound, int boundscheck) { +#if CYTHON_COMPILING_IN_CPYTHON + if (wraparound & unlikely(i < 0)) i += PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +#else + return PySequence_GetItem(o, i); +#endif +} +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, + int is_list, int wraparound, int boundscheck) { +#if CYTHON_COMPILING_IN_CPYTHON + if (is_list || PyList_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyList_GET_SIZE(o); + if ((!boundscheck) || (likely((n >= 0) & (n < PyList_GET_SIZE(o))))) { + PyObject *r = PyList_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } + else if (PyTuple_CheckExact(o)) { + Py_ssize_t n = ((!wraparound) | likely(i >= 0)) ? i : i + PyTuple_GET_SIZE(o); + if ((!boundscheck) || likely((n >= 0) & (n < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, n); + Py_INCREF(r); + return r; + } + } else { + PySequenceMethods *m = Py_TYPE(o)->tp_as_sequence; + if (likely(m && m->sq_item)) { + if (wraparound && unlikely(i < 0) && likely(m->sq_length)) { + Py_ssize_t l = m->sq_length(o); + if (likely(l >= 0)) { + i += l; + } else { + if (PyErr_ExceptionMatches(PyExc_OverflowError)) + PyErr_Clear(); + else + return NULL; + } + } + return m->sq_item(o, i); + } + } +#else + if (is_list || PySequence_Check(o)) { + return PySequence_GetItem(o, i); + } +#endif + return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); +} + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_Restore(type, value, tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#else + PyErr_Fetch(type, value, tb); +#endif +} + +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, + CYTHON_UNUSED PyObject *cause) { + Py_XINCREF(type); + if (!value || value == Py_None) + value = NULL; + else + Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + } + #if PY_VERSION_HEX < 0x02050000 + if (PyClass_Check(type)) { + #else + if (PyType_Check(type)) { + #endif +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + value = type; + #if PY_VERSION_HEX < 0x02050000 + if (PyInstance_Check(type)) { + type = (PyObject*) ((PyInstanceObject*)type)->in_class; + Py_INCREF(type); + } else { + type = 0; + PyErr_SetString(PyExc_TypeError, + "raise: exception must be an old-style class or instance"); + goto raise_error; + } + #else + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + #endif + } + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} +#else /* Python 3+ */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (PyExceptionClass_Check(type)) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyEval_CallObject(type, args); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } +#if PY_VERSION_HEX >= 0x03030000 + if (cause) { +#else + if (cause && cause != Py_None) { +#endif + PyObject *fixed_cause; + if (cause == Py_None) { + fixed_cause = NULL; + } else if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); + } + PyErr_SetObject(type, value); + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } +bad: + Py_XDECREF(owned_instance); + return; +} +#endif + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); +} + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", + index, (index == 1) ? "" : "s"); +} + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +static CYTHON_INLINE int __Pyx_IterFinish(void) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + PyObject* exc_type = tstate->curexc_type; + if (unlikely(exc_type)) { + if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { + PyObject *exc_value, *exc_tb; + exc_value = tstate->curexc_value; + exc_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + Py_DECREF(exc_type); + Py_XDECREF(exc_value); + Py_XDECREF(exc_tb); + return 0; + } else { + return -1; + } + } + return 0; +#else + if (unlikely(PyErr_Occurred())) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { + PyErr_Clear(); + return 0; + } else { + return -1; + } + } + return 0; +#endif +} + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; + } else { + return __Pyx_IterFinish(); + } + return 0; +} + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_import; + py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s____import__); + if (!py_import) + goto bad; + #endif + if (from_list) + list = from_list; + else { + empty_list = PyList_New(0); + if (!empty_list) + goto bad; + list = empty_list; + } + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + #if PY_VERSION_HEX >= 0x02050000 + { + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.')) { + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_level = PyInt_FromLong(1); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, global_dict, empty_dict, list, 1); + #endif + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; /* try absolute import on failure */ + } + #endif + if (!module) { + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, global_dict, empty_dict, list, level); + #endif + } + } + #else + if (level>0) { + PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); + goto bad; + } + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, NULL); + #endif +bad: + #if PY_VERSION_HEX < 0x03030000 + Py_XDECREF(py_import); + #endif + Py_XDECREF(empty_list); + Py_XDECREF(empty_dict); + return module; +} + +static CYTHON_INLINE npy_ulonglong __Pyx_PyInt_from_py_npy_ulonglong(PyObject* x) { + const npy_ulonglong neg_one = (npy_ulonglong)-1, const_zero = (npy_ulonglong)0; + const int is_unsigned = const_zero < neg_one; + if (sizeof(npy_ulonglong) == sizeof(char)) { + if (is_unsigned) + return (npy_ulonglong)__Pyx_PyInt_AsUnsignedChar(x); + else + return (npy_ulonglong)__Pyx_PyInt_AsSignedChar(x); + } else if (sizeof(npy_ulonglong) == sizeof(short)) { + if (is_unsigned) + return (npy_ulonglong)__Pyx_PyInt_AsUnsignedShort(x); + else + return (npy_ulonglong)__Pyx_PyInt_AsSignedShort(x); + } else if (sizeof(npy_ulonglong) == sizeof(int)) { + if (is_unsigned) + return (npy_ulonglong)__Pyx_PyInt_AsUnsignedInt(x); + else + return (npy_ulonglong)__Pyx_PyInt_AsSignedInt(x); + } else if (sizeof(npy_ulonglong) == sizeof(long)) { + if (is_unsigned) + return (npy_ulonglong)__Pyx_PyInt_AsUnsignedLong(x); + else + return (npy_ulonglong)__Pyx_PyInt_AsSignedLong(x); + } else if (sizeof(npy_ulonglong) == sizeof(PY_LONG_LONG)) { + if (is_unsigned) + return (npy_ulonglong)__Pyx_PyInt_AsUnsignedLongLong(x); + else + return (npy_ulonglong)__Pyx_PyInt_AsSignedLongLong(x); + } else { + #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); + #else + npy_ulonglong val; + PyObject *v = __Pyx_PyNumber_Int(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } + #endif + return (npy_ulonglong)-1; + } +} + +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_ulonglong(npy_ulonglong val) { + const npy_ulonglong neg_one = (npy_ulonglong)-1, const_zero = (npy_ulonglong)0; + const int is_unsigned = const_zero < neg_one; + if ((sizeof(npy_ulonglong) == sizeof(char)) || + (sizeof(npy_ulonglong) == sizeof(short))) { + return PyInt_FromLong((long)val); + } else if ((sizeof(npy_ulonglong) == sizeof(int)) || + (sizeof(npy_ulonglong) == sizeof(long))) { + if (is_unsigned) + return PyLong_FromUnsignedLong((unsigned long)val); + else + return PyInt_FromLong((long)val); + } else if (sizeof(npy_ulonglong) == sizeof(PY_LONG_LONG)) { + if (is_unsigned) + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); + else + return PyLong_FromLongLong((PY_LONG_LONG)val); + } else { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + return _PyLong_FromByteArray(bytes, sizeof(npy_ulonglong), + little, !is_unsigned); + } +} + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return ::std::complex< float >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return x + y*(__pyx_t_float_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + __pyx_t_float_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +#if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtf(z.real*z.real + z.imag*z.imag); + #else + return hypotf(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + float denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(a, a); + case 3: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, a); + case 4: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_absf(a); + theta = atan2f(a.imag, a.real); + } + lnr = logf(r); + z_r = expf(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosf(z_theta); + z.imag = z_r * sinf(z_theta); + return z; + } + #endif +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return ::std::complex< double >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return x + y*(__pyx_t_double_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + __pyx_t_double_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +#if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrt(z.real*z.real + z.imag*z.imag); + #else + return hypot(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(a, a); + case 3: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, a); + case 4: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_abs(a); + theta = atan2(a.imag, a.real); + } + lnr = log(r); + z_r = exp(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cos(z_theta); + z.imag = z_r * sin(z_theta); + return z; + } + #endif +#endif + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(unsigned long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (unsigned long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)PyLong_AsUnsignedLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(unsigned long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(unsigned long) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(unsigned long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (unsigned long)PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)PyLong_AsUnsignedLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(long) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (long)PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(signed long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (signed long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)PyLong_AsUnsignedLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(signed long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(signed long) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(signed long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (signed long)PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, + CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) { + PyObject *old_exc, *old_val, *old_tb; + PyObject *ctx; + __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); + #if PY_MAJOR_VERSION < 3 + ctx = PyString_FromString(name); + #else + ctx = PyUnicode_FromString(name); + #endif + __Pyx_ErrRestore(old_exc, old_val, old_tb); + if (!ctx) { + PyErr_WriteUnraisable(Py_None); + } else { + PyErr_WriteUnraisable(ctx); + Py_DECREF(ctx); + } +} + +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + +static int __Pyx_SetVtable(PyObject *dict, void *vtable) { +#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) + PyObject *ob = PyCapsule_New(vtable, 0, 0); +#else + PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); +#endif + if (!ob) + goto bad; + if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0) + goto bad; + Py_DECREF(ob); + return 0; +bad: + Py_XDECREF(ob); + return -1; +} + +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + py_name = __Pyx_PyIdentifier_FromString(name); + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + +#ifndef __PYX_HAVE_RT_ImportType +#define __PYX_HAVE_RT_ImportType +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, + size_t size, int strict) +{ + PyObject *py_module = 0; + PyObject *result = 0; + PyObject *py_name = 0; + char warning[200]; + Py_ssize_t basicsize; +#ifdef Py_LIMITED_API + PyObject *py_basicsize; +#endif + py_module = __Pyx_ImportModule(module_name); + if (!py_module) + goto bad; + py_name = __Pyx_PyIdentifier_FromString(class_name); + if (!py_name) + goto bad; + result = PyObject_GetAttr(py_module, py_name); + Py_DECREF(py_name); + py_name = 0; + Py_DECREF(py_module); + py_module = 0; + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%s.%s is not a type object", + module_name, class_name); + goto bad; + } +#ifndef Py_LIMITED_API + basicsize = ((PyTypeObject *)result)->tp_basicsize; +#else + py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); + if (!py_basicsize) + goto bad; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = 0; + if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) + goto bad; +#endif + if (!strict && (size_t)basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility", + module_name, class_name); + #if PY_VERSION_HEX < 0x02050000 + if (PyErr_Warn(NULL, warning) < 0) goto bad; + #else + if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; + #endif + } + else if ((size_t)basicsize != size) { + PyErr_Format(PyExc_ValueError, + "%s.%s has the wrong size, try recompiling", + module_name, class_name); + goto bad; + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(py_module); + Py_XDECREF(result); + return NULL; +} +#endif + +static void* __Pyx_GetVtable(PyObject *dict) { + void* ptr; + PyObject *ob = PyMapping_GetItemString(dict, (char *)"__pyx_vtable__"); + if (!ob) + goto bad; +#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) + ptr = PyCapsule_GetPointer(ob, 0); +#else + ptr = PyCObject_AsVoidPtr(ob); +#endif + if (!ptr && !PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); + Py_DECREF(ob); + return ptr; +bad: + Py_XDECREF(ob); + return NULL; +} + +#ifndef __PYX_HAVE_RT_ImportFunction +#define __PYX_HAVE_RT_ImportFunction +static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { + PyObject *d = 0; + PyObject *cobj = 0; + union { + void (*fp)(void); + void *p; + } tmp; + d = PyObject_GetAttrString(module, (char *)"__pyx_capi__"); + if (!d) + goto bad; + cobj = PyDict_GetItemString(d, funcname); + if (!cobj) { + PyErr_Format(PyExc_ImportError, + "%s does not export expected C function %s", + PyModule_GetName(module), funcname); + goto bad; + } +#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3 && PY_MINOR_VERSION==0) + if (!PyCapsule_IsValid(cobj, sig)) { + PyErr_Format(PyExc_TypeError, + "C function %s.%s has wrong signature (expected %s, got %s)", + PyModule_GetName(module), funcname, sig, PyCapsule_GetName(cobj)); + goto bad; + } + tmp.p = PyCapsule_GetPointer(cobj, sig); +#else + {const char *desc, *s1, *s2; + desc = (const char *)PyCObject_GetDesc(cobj); + if (!desc) + goto bad; + s1 = desc; s2 = sig; + while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; } + if (*s1 != *s2) { + PyErr_Format(PyExc_TypeError, + "C function %s.%s has wrong signature (expected %s, got %s)", + PyModule_GetName(module), funcname, sig, desc); + goto bad; + } + tmp.p = PyCObject_AsVoidPtr(cobj);} +#endif + *f = tmp.fp; + if (!(*f)) + goto bad; + Py_DECREF(d); + return 0; +bad: + Py_XDECREF(d); + return -1; +} +#endif + +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = (start + end) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); +} + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(filename); + #else + py_srcfile = PyUnicode_FromString(filename); + #endif + if (!py_srcfile) goto bad; + if (c_line) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_code = __Pyx_PyCode_New( + 0, /*int argcount,*/ + 0, /*int kwonlyargcount,*/ + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + py_line, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + Py_DECREF(py_srcfile); + Py_DECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_globals = 0; + PyFrameObject *py_frame = 0; + py_code = __pyx_find_code_object(c_line ? c_line : py_line); + if (!py_code) { + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) goto bad; + __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + } + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = py_line; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char* c_str) { + return __Pyx_PyUnicode_FromStringAndSize(c_str, strlen(c_str)); +} +static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) { + Py_ssize_t ignore; + return __Pyx_PyObject_AsStringAndSize(o, &ignore); +} +static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT + if ( +#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + __Pyx_sys_getdefaultencoding_not_ascii && +#endif + PyUnicode_Check(o)) { +#if PY_VERSION_HEX < 0x03030000 + char* defenc_c; + PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); + if (!defenc) return NULL; + defenc_c = PyBytes_AS_STRING(defenc); +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + { + char* end = defenc_c + PyBytes_GET_SIZE(defenc); + char* c; + for (c = defenc_c; c < end; c++) { + if ((unsigned char) (*c) >= 128) { + PyUnicode_AsASCIIString(o); + return NULL; + } + } + } +#endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/ + *length = PyBytes_GET_SIZE(defenc); + return defenc_c; +#else /* PY_VERSION_HEX < 0x03030000 */ + if (PyUnicode_READY(o) == -1) return NULL; +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + if (PyUnicode_IS_ASCII(o)) { + *length = PyUnicode_GET_DATA_SIZE(o); + return PyUnicode_AsUTF8(o); + } else { + PyUnicode_AsASCIIString(o); + return NULL; + } +#else /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */ + return PyUnicode_AsUTF8AndSize(o, length); +#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */ +#endif /* PY_VERSION_HEX < 0x03030000 */ + } else +#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */ + { + char* result; + int r = PyBytes_AsStringAndSize(o, &result, length); + if (r < 0) { + return NULL; + } else { + return result; + } + } +} +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_MAJOR_VERSION < 3 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_MAJOR_VERSION < 3 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_MAJOR_VERSION < 3 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + if ((val != (unsigned PY_LONG_LONG)-1) || !PyErr_Occurred()) + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff --git a/sklearn/earth/_record.pxd b/sklearn/earth/_record.pxd new file mode 100644 index 0000000000000..d8846e8ad8f0e --- /dev/null +++ b/sklearn/earth/_record.pxd @@ -0,0 +1,67 @@ +cimport numpy as cnp +ctypedef cnp.float64_t FLOAT_t +ctypedef cnp.intp_t INT_t +ctypedef cnp.ulong_t INDEX_t +ctypedef cnp.uint8_t BOOL_t +from _basis cimport Basis + +cdef class Record: + cdef list iterations + cdef int num_samples + cdef int num_variables + cdef FLOAT_t penalty + cdef FLOAT_t sst #Sum of squares total + + cpdef append(Record self, Iteration iteration) + + cpdef FLOAT_t mse(Record self, INDEX_t iteration) + + cpdef FLOAT_t rsq(Record self, INDEX_t iteration) + + cpdef FLOAT_t gcv(Record self, INDEX_t iteration) + + cpdef FLOAT_t grsq(Record self, INDEX_t iteration) + +cdef class PruningPassRecord(Record): + cdef INDEX_t selected + + cpdef set_selected(PruningPassRecord self, INDEX_t selected) + + cpdef INDEX_t get_selected(PruningPassRecord self) + + cpdef roll_back(PruningPassRecord self, Basis basis) + +cdef class ForwardPassRecord(Record): + cdef int stopping_condition + + cpdef set_stopping_condition(ForwardPassRecord self, int stopping_condition) + +cdef class Iteration: + cdef FLOAT_t mse + cdef INDEX_t size + + cpdef FLOAT_t get_mse(Iteration self) + + cpdef INDEX_t get_size(Iteration self) + +cdef class PruningPassIteration(Iteration): + cdef INDEX_t pruned + + cpdef INDEX_t get_pruned(PruningPassIteration self) + +cdef class FirstPruningPassIteration(PruningPassIteration): + pass + +cdef class ForwardPassIteration(Iteration): + cdef INDEX_t parent + cdef INDEX_t variable + cdef FLOAT_t knot + cdef int code + cdef bint no_candidates + + cpdef set_no_candidates(ForwardPassIteration self, bint value) + + cpdef no_further_candidates(ForwardPassIteration self) + +cdef class FirstForwardPassIteration(ForwardPassIteration): + cpdef INDEX_t get_size(FirstForwardPassIteration self) \ No newline at end of file diff --git a/sklearn/earth/_record.pyx b/sklearn/earth/_record.pyx new file mode 100644 index 0000000000000..bdd05c3adc8ff --- /dev/null +++ b/sklearn/earth/_record.pyx @@ -0,0 +1,260 @@ +# distutils: language = c +# cython: cdivision = True +# cython: boundscheck = False +# cython: wraparound = False +# cython: profile = False + +from _util cimport gcv, ascii_table +import _forward + +cdef class Record: + + def __richcmp__(self, other, method): + if method == 2: + return self._eq(other) + elif method == 3: + return not self._eq(other) + else: + return NotImplemented + + def _eq(self, other): + return self.__class__ is other.__class__ and self._getstate() == other._getstate() + + def __getitem__(Record self, int idx): + return self.iterations[idx] + + def __len__(Record self): + return len(self.iterations) + + cpdef append(Record self, Iteration iteration): + self.iterations.append(iteration) + + cpdef FLOAT_t mse(Record self, INDEX_t iteration): + return self.iterations[iteration].get_mse() + + cpdef FLOAT_t gcv(Record self, INDEX_t iteration): + cdef Iteration it = self.iterations[iteration] + cdef FLOAT_t mse = it.mse + return gcv(mse,it.get_size(),self.num_samples,self.penalty) + + cpdef FLOAT_t rsq(Record self, INDEX_t iteration): + cdef FLOAT_t mse0 = self.sst#gcv(self.sst,1,self.num_samples,self.penalty) + cdef FLOAT_t mse = self.mse(iteration)#gcv(self.mse(iteration):,self.iterations[iteration].get_size(),self.num_samples,self.penalty)#self.gcv(iteration) + return 1 - (mse / mse0) + + cpdef FLOAT_t grsq(Record self, INDEX_t iteration): + cdef FLOAT_t gcv0 = gcv(self.sst,1,self.num_samples,self.penalty) + cdef FLOAT_t gcv_ = self.gcv(iteration) + return 1 - (gcv_/gcv0) + +cdef class PruningPassRecord(Record): + def __init__(PruningPassRecord self, INDEX_t num_samples, INDEX_t num_variables, FLOAT_t penalty, FLOAT_t sst, INDEX_t size, FLOAT_t mse): + self.num_samples = num_samples + self.num_variables = num_variables + self.penalty = penalty + self.sst = sst + self.iterations = [FirstPruningPassIteration(size, mse)] + + def __reduce__(PruningPassRecord self): + return (PruningPassRecord, (1,1,1.0,1.0,1,1.0), self._getstate()) + + def _getstate(PruningPassRecord self): + result = {'num_samples': self.num_samples, + 'num_variables': self.num_variables, + 'penalty': self.penalty, + 'sst': self.sst, + 'iterations': self.iterations, + 'selected': self.selected} + return result + + def __setstate__(PruningPassRecord self, dict state): + self.num_samples = state['num_samples'] + self.num_variables = state['num_variables'] + self.penalty = state['penalty'] + self.sst = state['sst'] + self.iterations = state['iterations'] + self.selected = state['selected'] + + cpdef set_selected(PruningPassRecord self, INDEX_t selected): + self.selected = selected + + cpdef INDEX_t get_selected(PruningPassRecord self): + return self.selected + + cpdef roll_back(PruningPassRecord self, Basis basis): + cdef INDEX_t n = len(self.iterations) + cdef INDEX_t i + for i in range(n - self.selected - 1): + basis[self.iterations[n - i - 1].get_pruned()].unprune() + + def __str__(PruningPassRecord self): + result = '' + result += 'Pruning Pass\n' + header = 'iter\tbf\tterms\tmse\tgcv\trsq\tgrsq'.split('\t') + data = [] + for i, iteration in enumerate(self.iterations): + row = str(i) + '\t' + str(iteration) + '\t%.3f\t%.3f\t%.3f' % (self.gcv(i),self.rsq(i),self.grsq(i)) + data.append(row.split('\t')) + result += ascii_table(header,data) + result += '\nSelected iteration: ' + str(self.selected) + '\n' + return result + +cdef class ForwardPassRecord(Record): + def __init__(ForwardPassRecord self, INDEX_t num_samples, INDEX_t num_variables, FLOAT_t penalty, FLOAT_t sst): + self.num_samples = num_samples + self.num_variables = num_variables + self.penalty = penalty + self.sst = sst + self.iterations = [FirstForwardPassIteration(self.sst)] + + def __reduce__(ForwardPassRecord self): + return (ForwardPassRecord, (1,1,1.0,1.0), self._getstate()) + + def _getstate(ForwardPassRecord self): + return {'num_samples': self.num_samples, + 'num_variables': self.num_variables, + 'penalty': self.penalty, + 'sst': self.sst, + 'iterations': self.iterations} + + def __setstate__(ForwardPassRecord self, dict state): + self.num_samples = state['num_samples'] + self.num_variables = state['num_variables'] + self.penalty = state['penalty'] + self.sst = state['sst'] + self.iterations = state['iterations'] + + cpdef set_stopping_condition(ForwardPassRecord self, int stopping_condition): + self.stopping_condition = stopping_condition + + def __str__(ForwardPassRecord self): + header = ['iter','parent','var','knot','mse','terms','gcv','rsq','grsq'] + data = [] + for i, iteration in enumerate(self.iterations): + data.append([str(i)] + str(iteration).split('\t') + ('%.3f\t%.3f\t%.3f' % (self.gcv(i),self.rsq(i),self.grsq(i))).split('\t')) + result = '' + result += 'Forward Pass\n' + result += ascii_table(header, data) + result += '\nStopping Condition %d: %s\n' % (self.stopping_condition, _forward.stopping_conditions[self.stopping_condition]) + return result + +cdef class Iteration: + + def __richcmp__(self, other, method): + if method == 2: + return self._eq(other) + elif method == 3: + return not self._eq(other) + else: + return NotImplemented + + def _eq(self, other): + return self.__class__ is other.__class__ and self._getstate() == other._getstate() + + cpdef FLOAT_t get_mse(Iteration self): + return self.mse + + cpdef INDEX_t get_size(Iteration self): + return self.size + +cdef class PruningPassIteration(Iteration): + def __init__(PruningPassIteration self, INDEX_t pruned, INDEX_t size, FLOAT_t mse): + self.pruned = pruned + self.size = size + self.mse = mse + + def __reduce__(PruningPassIteration self): + return (PruningPassIteration, (1,1,1.0), self._getstate()) + + def _getstate(PruningPassIteration self): + return {'pruned': self.pruned, + 'size': self.size, + 'mse': self.mse} + + def __setstate__(PruningPassIteration self, dict state): + self.pruned = state['pruned'] + self.size = state['size'] + self.mse = state['mse'] + + cpdef INDEX_t get_pruned(PruningPassIteration self): + return self.pruned + + def __str__(PruningPassIteration self): + result = '%s\t%s\t%s' % (str(self.pruned),self.size,'%.2f' % self.mse if self.mse is not None else None) + return result + +cdef class FirstPruningPassIteration(PruningPassIteration): + def __init__(PruningPassIteration self, INDEX_t size, FLOAT_t mse): + self.size = size + self.mse = mse + + def __reduce__(FirstPruningPassIteration self): + return (FirstPruningPassIteration, (1,1.0), self._getstate()) + + def _getstate(FirstPruningPassIteration self): + return {'size': self.size, + 'mse': self.mse} + + def __setstate__(FirstPruningPassIteration self, dict state): + self.size = state['size'] + self.mse = state['mse'] + + def __str__(PruningPassIteration self): + result = '%s\t%s\t%s' % ('-',self.size,'%.2f' % self.mse if self.mse is not None else None) + return result + +cdef class ForwardPassIteration(Iteration): + def __init__(ForwardPassIteration self, INDEX_t parent, INDEX_t variable, int knot, FLOAT_t mse, INDEX_t size): + self.parent = parent + self.variable = variable + self.knot = knot + self.mse = mse + self.size = size + + def __reduce__(ForwardPassIteration self): + return (ForwardPassIteration, (1,1,1,1.0,1), self._getstate()) + + def _getstate(ForwardPassIteration self): + return {'parent': self.parent, + 'variable': self.variable, + 'knot': self.knot, + 'mse': self.mse, + 'size': self.size} + + def __setstate__(ForwardPassIteration self, dict state): + self.parent = state['parent'] + self.variable = state['variable'] + self.knot = state['knot'] + self.mse = state['mse'] + self.size = state['size'] + + def __str__(self): + result = '%d\t%d\t%d\t%4f\t%d' % (self.parent,self.variable,self.knot,self.mse,self.size) + return result + + cpdef set_no_candidates(ForwardPassIteration self, bint value): + self.no_candidates = value + + cpdef no_further_candidates(ForwardPassIteration self): + return self.no_candidates + +cdef class FirstForwardPassIteration(ForwardPassIteration): + def __init__(FirstForwardPassIteration self, FLOAT_t mse): + self.mse = mse + + def __reduce__(FirstForwardPassIteration self): + return (FirstForwardPassIteration, (1.0,), self._getstate()) + + def _getstate(FirstForwardPassIteration self): + return {'mse': self.mse} + + def __setstate__(FirstForwardPassIteration self, dict state): + self.mse = state['mse'] + + cpdef INDEX_t get_size(FirstForwardPassIteration self): + return 1 + + def __str__(self): + result = '%s\t%s\t%s\t%4f\t%s' % ('-','-','-',self.mse,1) + return result + \ No newline at end of file diff --git a/sklearn/earth/_util.c b/sklearn/earth/_util.c new file mode 100644 index 0000000000000..89ccf94e8e3ad --- /dev/null +++ b/sklearn/earth/_util.c @@ -0,0 +1,8030 @@ +/* Generated by Cython 0.19 on Sat Jul 20 23:46:45 2013 */ + +#define PY_SSIZE_T_CLEAN +#ifndef CYTHON_USE_PYLONG_INTERNALS +#ifdef PYLONG_BITS_IN_DIGIT +#define CYTHON_USE_PYLONG_INTERNALS 0 +#else +#include "pyconfig.h" +#ifdef PYLONG_BITS_IN_DIGIT +#define CYTHON_USE_PYLONG_INTERNALS 1 +#else +#define CYTHON_USE_PYLONG_INTERNALS 0 +#endif +#endif +#endif +#include "Python.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#elif PY_VERSION_HEX < 0x02040000 + #error Cython requires Python 2.4+. +#else +#include /* For offsetof */ +#ifndef offsetof +#define offsetof(type, member) ( (size_t) & ((type*)0) -> member ) +#endif +#if !defined(WIN32) && !defined(MS_WINDOWS) + #ifndef __stdcall + #define __stdcall + #endif + #ifndef __cdecl + #define __cdecl + #endif + #ifndef __fastcall + #define __fastcall + #endif +#endif +#ifndef DL_IMPORT + #define DL_IMPORT(t) t +#endif +#ifndef DL_EXPORT + #define DL_EXPORT(t) t +#endif +#ifndef PY_LONG_LONG + #define PY_LONG_LONG LONG_LONG +#endif +#ifndef Py_HUGE_VAL + #define Py_HUGE_VAL HUGE_VAL +#endif +#ifdef PYPY_VERSION +#define CYTHON_COMPILING_IN_PYPY 1 +#define CYTHON_COMPILING_IN_CPYTHON 0 +#else +#define CYTHON_COMPILING_IN_PYPY 0 +#define CYTHON_COMPILING_IN_CPYTHON 1 +#endif +#if PY_VERSION_HEX < 0x02050000 + typedef int Py_ssize_t; + #define PY_SSIZE_T_MAX INT_MAX + #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" + #define CYTHON_FORMAT_SSIZE_T "" + #define PyInt_FromSsize_t(z) PyInt_FromLong(z) + #define PyInt_AsSsize_t(o) __Pyx_PyInt_AsInt(o) + #define PyNumber_Index(o) ((PyNumber_Check(o) && !PyFloat_Check(o)) ? PyNumber_Int(o) : \ + (PyErr_Format(PyExc_TypeError, \ + "expected index value, got %.200s", Py_TYPE(o)->tp_name), \ + (PyObject*)0)) + #define __Pyx_PyIndex_Check(o) (PyNumber_Check(o) && !PyFloat_Check(o) && \ + !PyComplex_Check(o)) + #define PyIndex_Check __Pyx_PyIndex_Check + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) + #define __PYX_BUILD_PY_SSIZE_T "i" +#else + #define __PYX_BUILD_PY_SSIZE_T "n" + #define CYTHON_FORMAT_SSIZE_T "z" + #define __Pyx_PyIndex_Check PyIndex_Check +#endif +#if PY_VERSION_HEX < 0x02060000 + #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) + #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) + #define Py_SIZE(ob) (((PyVarObject*)(ob))->ob_size) + #define PyVarObject_HEAD_INIT(type, size) \ + PyObject_HEAD_INIT(type) size, + #define PyType_Modified(t) + typedef struct { + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; + } Py_buffer; + #define PyBUF_SIMPLE 0 + #define PyBUF_WRITABLE 0x0001 + #define PyBUF_FORMAT 0x0004 + #define PyBUF_ND 0x0008 + #define PyBUF_STRIDES (0x0010 | PyBUF_ND) + #define PyBUF_C_CONTIGUOUS (0x0020 | PyBUF_STRIDES) + #define PyBUF_F_CONTIGUOUS (0x0040 | PyBUF_STRIDES) + #define PyBUF_ANY_CONTIGUOUS (0x0080 | PyBUF_STRIDES) + #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) + #define PyBUF_RECORDS (PyBUF_STRIDES | PyBUF_FORMAT | PyBUF_WRITABLE) + #define PyBUF_FULL (PyBUF_INDIRECT | PyBUF_FORMAT | PyBUF_WRITABLE) + typedef int (*getbufferproc)(PyObject *, Py_buffer *, int); + typedef void (*releasebufferproc)(PyObject *, Py_buffer *); +#endif +#if PY_MAJOR_VERSION < 3 + #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#else + #define __Pyx_BUILTIN_MODULE_NAME "builtins" + #define __Pyx_PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) \ + PyCode_New(a, k, l, s, f, code, c, n, v, fv, cell, fn, name, fline, lnos) +#endif +#if PY_MAJOR_VERSION < 3 && PY_MINOR_VERSION < 6 + #define PyUnicode_FromString(s) PyUnicode_Decode(s, strlen(s), "UTF-8", "strict") +#endif +#if PY_MAJOR_VERSION >= 3 + #define Py_TPFLAGS_CHECKTYPES 0 + #define Py_TPFLAGS_HAVE_INDEX 0 +#endif +#if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) + #define Py_TPFLAGS_HAVE_NEWBUFFER 0 +#endif +#if PY_VERSION_HEX < 0x02060000 + #define Py_TPFLAGS_HAVE_VERSION_TAG 0 +#endif +#if PY_VERSION_HEX > 0x03030000 && defined(PyUnicode_KIND) + #define CYTHON_PEP393_ENABLED 1 + #define __Pyx_PyUnicode_READY(op) (likely(PyUnicode_IS_READY(op)) ? \ + 0 : _PyUnicode_Ready((PyObject *)(op))) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_LENGTH(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) PyUnicode_READ_CHAR(u, i) + #define __Pyx_PyUnicode_READ(k, d, i) PyUnicode_READ(k, d, i) +#else + #define CYTHON_PEP393_ENABLED 0 + #define __Pyx_PyUnicode_READY(op) (0) + #define __Pyx_PyUnicode_GET_LENGTH(u) PyUnicode_GET_SIZE(u) + #define __Pyx_PyUnicode_READ_CHAR(u, i) ((Py_UCS4)(PyUnicode_AS_UNICODE(u)[i])) + #define __Pyx_PyUnicode_READ(k, d, i) ((k=k), (Py_UCS4)(((Py_UNICODE*)d)[i])) +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyBaseString_Type PyUnicode_Type + #define PyStringObject PyUnicodeObject + #define PyString_Type PyUnicode_Type + #define PyString_Check PyUnicode_Check + #define PyString_CheckExact PyUnicode_CheckExact +#endif +#if PY_VERSION_HEX < 0x02060000 + #define PyBytesObject PyStringObject + #define PyBytes_Type PyString_Type + #define PyBytes_Check PyString_Check + #define PyBytes_CheckExact PyString_CheckExact + #define PyBytes_FromString PyString_FromString + #define PyBytes_FromStringAndSize PyString_FromStringAndSize + #define PyBytes_FromFormat PyString_FromFormat + #define PyBytes_DecodeEscape PyString_DecodeEscape + #define PyBytes_AsString PyString_AsString + #define PyBytes_AsStringAndSize PyString_AsStringAndSize + #define PyBytes_Size PyString_Size + #define PyBytes_AS_STRING PyString_AS_STRING + #define PyBytes_GET_SIZE PyString_GET_SIZE + #define PyBytes_Repr PyString_Repr + #define PyBytes_Concat PyString_Concat + #define PyBytes_ConcatAndDel PyString_ConcatAndDel +#endif +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyBaseString_Check(obj) PyUnicode_Check(obj) + #define __Pyx_PyBaseString_CheckExact(obj) PyUnicode_CheckExact(obj) +#else + #define __Pyx_PyBaseString_Check(obj) (PyString_CheckExact(obj) || PyUnicode_CheckExact(obj) || \ + PyString_Check(obj) || PyUnicode_Check(obj)) + #define __Pyx_PyBaseString_CheckExact(obj) (Py_TYPE(obj) == &PyBaseString_Type) +#endif +#if PY_VERSION_HEX < 0x02060000 + #define PySet_Check(obj) PyObject_TypeCheck(obj, &PySet_Type) + #define PyFrozenSet_Check(obj) PyObject_TypeCheck(obj, &PyFrozenSet_Type) +#endif +#ifndef PySet_CheckExact + #define PySet_CheckExact(obj) (Py_TYPE(obj) == &PySet_Type) +#endif +#define __Pyx_TypeCheck(obj, type) PyObject_TypeCheck(obj, (PyTypeObject *)type) +#if PY_MAJOR_VERSION >= 3 + #define PyIntObject PyLongObject + #define PyInt_Type PyLong_Type + #define PyInt_Check(op) PyLong_Check(op) + #define PyInt_CheckExact(op) PyLong_CheckExact(op) + #define PyInt_FromString PyLong_FromString + #define PyInt_FromUnicode PyLong_FromUnicode + #define PyInt_FromLong PyLong_FromLong + #define PyInt_FromSize_t PyLong_FromSize_t + #define PyInt_FromSsize_t PyLong_FromSsize_t + #define PyInt_AsLong PyLong_AsLong + #define PyInt_AS_LONG PyLong_AS_LONG + #define PyInt_AsSsize_t PyLong_AsSsize_t + #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask + #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyBoolObject PyLongObject +#endif +#if PY_VERSION_HEX < 0x03020000 + typedef long Py_hash_t; + #define __Pyx_PyInt_FromHash_t PyInt_FromLong + #define __Pyx_PyInt_AsHash_t PyInt_AsLong +#else + #define __Pyx_PyInt_FromHash_t PyInt_FromSsize_t + #define __Pyx_PyInt_AsHash_t PyInt_AsSsize_t +#endif +#if (PY_MAJOR_VERSION < 3) || (PY_VERSION_HEX >= 0x03010300) + #define __Pyx_PySequence_GetSlice(obj, a, b) PySequence_GetSlice(obj, a, b) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) PySequence_SetSlice(obj, a, b, value) + #define __Pyx_PySequence_DelSlice(obj, a, b) PySequence_DelSlice(obj, a, b) +#else + #define __Pyx_PySequence_GetSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), (PyObject*)0) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_GetSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object is unsliceable", (obj)->ob_type->tp_name), (PyObject*)0))) + #define __Pyx_PySequence_SetSlice(obj, a, b, value) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_SetSlice(obj, a, b, value)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice assignment", (obj)->ob_type->tp_name), -1))) + #define __Pyx_PySequence_DelSlice(obj, a, b) (unlikely(!(obj)) ? \ + (PyErr_SetString(PyExc_SystemError, "null argument to internal routine"), -1) : \ + (likely((obj)->ob_type->tp_as_mapping) ? (PySequence_DelSlice(obj, a, b)) : \ + (PyErr_Format(PyExc_TypeError, "'%.200s' object doesn't support slice deletion", (obj)->ob_type->tp_name), -1))) +#endif +#if PY_MAJOR_VERSION >= 3 + #define PyMethod_New(func, self, klass) ((self) ? PyMethod_New(func, self) : PyInstanceMethod_New(func)) +#endif +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_INLINE inline + #else + #define CYTHON_INLINE + #endif +#endif +#ifdef NAN +#define __PYX_NAN() ((float) NAN) +#else +static CYTHON_INLINE float __PYX_NAN() { + /* Initialize NaN. The sign is irrelevant, an exponent with all bits 1 and + a nonzero mantissa means NaN. If the first bit in the mantissa is 1, it is + a quiet NaN. */ + float value; + memset(&value, 0xFF, sizeof(value)); + return value; +} +#endif + + +#if PY_MAJOR_VERSION >= 3 + #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) +#else + #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) +#endif + +#ifndef __PYX_EXTERN_C + #ifdef __cplusplus + #define __PYX_EXTERN_C extern "C" + #else + #define __PYX_EXTERN_C extern + #endif +#endif + +#if defined(WIN32) || defined(MS_WINDOWS) +#define _USE_MATH_DEFINES +#endif +#include +#define __PYX_HAVE___util +#define __PYX_HAVE_API___util +#include "string.h" +#include "stdio.h" +#include "stdlib.h" +#include "numpy/arrayobject.h" +#include "numpy/ufuncobject.h" +#include "math.h" +#ifdef _OPENMP +#include +#endif /* _OPENMP */ + +#ifdef PYREX_WITHOUT_ASSERTIONS +#define CYTHON_WITHOUT_ASSERTIONS +#endif + +#ifndef CYTHON_UNUSED +# if defined(__GNUC__) +# if !(defined(__cplusplus)) || (__GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +# elif defined(__ICC) || (defined(__INTEL_COMPILER) && !defined(_MSC_VER)) +# define CYTHON_UNUSED __attribute__ ((__unused__)) +# else +# define CYTHON_UNUSED +# endif +#endif +typedef struct {PyObject **p; char *s; const Py_ssize_t n; const char* encoding; + const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + +#define __PYX_DEFAULT_STRING_ENCODING_IS_ASCII 0 +#define __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT 0 +#define __PYX_DEFAULT_STRING_ENCODING "" +#define __Pyx_PyObject_FromString __Pyx_PyBytes_FromString +#define __Pyx_PyObject_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject*); +static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject*, Py_ssize_t* length); +#define __Pyx_PyBytes_FromString PyBytes_FromString +#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char*); +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyStr_FromString __Pyx_PyBytes_FromString + #define __Pyx_PyStr_FromStringAndSize __Pyx_PyBytes_FromStringAndSize +#else + #define __Pyx_PyStr_FromString __Pyx_PyUnicode_FromString + #define __Pyx_PyStr_FromStringAndSize __Pyx_PyUnicode_FromStringAndSize +#endif +#define __Pyx_PyObject_AsUString(s) ((unsigned char*) __Pyx_PyObject_AsString(s)) +#define __Pyx_PyObject_FromUString(s) __Pyx_PyObject_FromString((char*)s) +#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s) +#define __Pyx_PyStr_FromUString(s) __Pyx_PyStr_FromString((char*)s) +#define __Pyx_PyUnicode_FromUString(s) __Pyx_PyUnicode_FromString((char*)s) +#if PY_MAJOR_VERSION < 3 +static CYTHON_INLINE size_t __Pyx_Py_UNICODE_strlen(const Py_UNICODE *u) +{ + const Py_UNICODE *u_end = u; + while (*u_end++) ; + return u_end - u - 1; +} +#else +#define __Pyx_Py_UNICODE_strlen Py_UNICODE_strlen +#endif +#define __Pyx_PyUnicode_FromUnicode(u) PyUnicode_FromUnicode(u, __Pyx_Py_UNICODE_strlen(u)) +#define __Pyx_PyUnicode_FromUnicodeAndLength PyUnicode_FromUnicode +#define __Pyx_PyUnicode_AsUnicode PyUnicode_AsUnicode +#define __Pyx_Owned_Py_None(b) (Py_INCREF(Py_None), Py_None) +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); +#if CYTHON_COMPILING_IN_CPYTHON +#define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) +#else +#define __pyx_PyFloat_AsDouble(x) PyFloat_AsDouble(x) +#endif +#define __pyx_PyFloat_AsFloat(x) ((float) __pyx_PyFloat_AsDouble(x)) +#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII +static int __Pyx_sys_getdefaultencoding_not_ascii; +static int __Pyx_init_sys_getdefaultencoding_params() { + PyObject* sys = NULL; + PyObject* default_encoding = NULL; + PyObject* ascii_chars_u = NULL; + PyObject* ascii_chars_b = NULL; + sys = PyImport_ImportModule("sys"); + if (sys == NULL) goto bad; + default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); + if (default_encoding == NULL) goto bad; + if (strcmp(PyBytes_AsString(default_encoding), "ascii") == 0) { + __Pyx_sys_getdefaultencoding_not_ascii = 0; + } else { + const char* default_encoding_c = PyBytes_AS_STRING(default_encoding); + char ascii_chars[128]; + int c; + for (c = 0; c < 128; c++) { + ascii_chars[c] = c; + } + __Pyx_sys_getdefaultencoding_not_ascii = 1; + ascii_chars_u = PyUnicode_DecodeASCII(ascii_chars, 128, NULL); + if (ascii_chars_u == NULL) goto bad; + ascii_chars_b = PyUnicode_AsEncodedString(ascii_chars_u, default_encoding_c, NULL); + if (ascii_chars_b == NULL || strncmp(ascii_chars, PyBytes_AS_STRING(ascii_chars_b), 128) != 0) { + PyErr_Format( + PyExc_ValueError, + "This module compiled with c_string_encoding=ascii, but default encoding '%s' is not a superset of ascii.", + default_encoding_c); + goto bad; + } + } + Py_XDECREF(sys); + Py_XDECREF(default_encoding); + Py_XDECREF(ascii_chars_u); + Py_XDECREF(ascii_chars_b); + return 0; +bad: + Py_XDECREF(sys); + Py_XDECREF(default_encoding); + Py_XDECREF(ascii_chars_u); + Py_XDECREF(ascii_chars_b); + return -1; +} +#endif +#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT && PY_MAJOR_VERSION >= 3 +#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_DecodeUTF8(c_str, size, NULL) +#else +#define __Pyx_PyUnicode_FromStringAndSize(c_str, size) PyUnicode_Decode(c_str, size, __PYX_DEFAULT_STRING_ENCODING, NULL) +#if __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT +static char* __PYX_DEFAULT_STRING_ENCODING; +static int __Pyx_init_sys_getdefaultencoding_params() { + PyObject* sys = NULL; + PyObject* default_encoding = NULL; + char* default_encoding_c; + sys = PyImport_ImportModule("sys"); + if (sys == NULL) goto bad; + default_encoding = PyObject_CallMethod(sys, (char*) (const char*) "getdefaultencoding", NULL); + if (default_encoding == NULL) goto bad; + default_encoding_c = PyBytes_AS_STRING(default_encoding); + __PYX_DEFAULT_STRING_ENCODING = (char*) malloc(strlen(default_encoding_c)); + strcpy(__PYX_DEFAULT_STRING_ENCODING, default_encoding_c); + Py_DECREF(sys); + Py_DECREF(default_encoding); + return 0; +bad: + Py_XDECREF(sys); + Py_XDECREF(default_encoding); + return -1; +} +#endif +#endif + + +#ifdef __GNUC__ + /* Test for GCC > 2.95 */ + #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) + #else /* __GNUC__ > 2 ... */ + #define likely(x) (x) + #define unlikely(x) (x) + #endif /* __GNUC__ > 2 ... */ +#else /* __GNUC__ */ + #define likely(x) (x) + #define unlikely(x) (x) +#endif /* __GNUC__ */ + +static PyObject *__pyx_m; +static PyObject *__pyx_d; +static PyObject *__pyx_b; +static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; +static int __pyx_lineno; +static int __pyx_clineno = 0; +static const char * __pyx_cfilenm= __FILE__; +static const char *__pyx_filename; + +#if !defined(CYTHON_CCOMPLEX) + #if defined(__cplusplus) + #define CYTHON_CCOMPLEX 1 + #elif defined(_Complex_I) + #define CYTHON_CCOMPLEX 1 + #else + #define CYTHON_CCOMPLEX 0 + #endif +#endif +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #include + #else + #include + #endif +#endif +#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) + #undef _Complex_I + #define _Complex_I 1.0fj +#endif + + +static const char *__pyx_f[] = { + "_util.pyx", + "numpy.pxd", + "type.pxd", +}; +#define IS_UNSIGNED(type) (((type) -1) > 0) +struct __Pyx_StructField_; +#define __PYX_BUF_FLAGS_PACKED_STRUCT (1 << 0) +typedef struct { + const char* name; /* for error messages only */ + struct __Pyx_StructField_* fields; + size_t size; /* sizeof(type) */ + size_t arraysize[8]; /* length of array in each dimension */ + int ndim; + char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject, c_H_ar */ + char is_unsigned; + int flags; +} __Pyx_TypeInfo; +typedef struct __Pyx_StructField_ { + __Pyx_TypeInfo* type; + const char* name; + size_t offset; +} __Pyx_StructField; +typedef struct { + __Pyx_StructField* field; + size_t parent_offset; +} __Pyx_BufFmt_StackElem; +typedef struct { + __Pyx_StructField root; + __Pyx_BufFmt_StackElem* head; + size_t fmt_offset; + size_t new_count, enc_count; + size_t struct_alignment; + int is_complex; + char enc_type; + char new_packmode; + char enc_packmode; + char is_valid_array; +} __Pyx_BufFmt_Context; + + +/* "numpy.pxd":723 + * # in Cython to enable them only on the right systems. + * + * ctypedef npy_int8 int8_t # <<<<<<<<<<<<<< + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + */ +typedef npy_int8 __pyx_t_5numpy_int8_t; + +/* "numpy.pxd":724 + * + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t # <<<<<<<<<<<<<< + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t + */ +typedef npy_int16 __pyx_t_5numpy_int16_t; + +/* "numpy.pxd":725 + * ctypedef npy_int8 int8_t + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t # <<<<<<<<<<<<<< + * ctypedef npy_int64 int64_t + * #ctypedef npy_int96 int96_t + */ +typedef npy_int32 __pyx_t_5numpy_int32_t; + +/* "numpy.pxd":726 + * ctypedef npy_int16 int16_t + * ctypedef npy_int32 int32_t + * ctypedef npy_int64 int64_t # <<<<<<<<<<<<<< + * #ctypedef npy_int96 int96_t + * #ctypedef npy_int128 int128_t + */ +typedef npy_int64 __pyx_t_5numpy_int64_t; + +/* "numpy.pxd":730 + * #ctypedef npy_int128 int128_t + * + * ctypedef npy_uint8 uint8_t # <<<<<<<<<<<<<< + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + */ +typedef npy_uint8 __pyx_t_5numpy_uint8_t; + +/* "numpy.pxd":731 + * + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t # <<<<<<<<<<<<<< + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t + */ +typedef npy_uint16 __pyx_t_5numpy_uint16_t; + +/* "numpy.pxd":732 + * ctypedef npy_uint8 uint8_t + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t # <<<<<<<<<<<<<< + * ctypedef npy_uint64 uint64_t + * #ctypedef npy_uint96 uint96_t + */ +typedef npy_uint32 __pyx_t_5numpy_uint32_t; + +/* "numpy.pxd":733 + * ctypedef npy_uint16 uint16_t + * ctypedef npy_uint32 uint32_t + * ctypedef npy_uint64 uint64_t # <<<<<<<<<<<<<< + * #ctypedef npy_uint96 uint96_t + * #ctypedef npy_uint128 uint128_t + */ +typedef npy_uint64 __pyx_t_5numpy_uint64_t; + +/* "numpy.pxd":737 + * #ctypedef npy_uint128 uint128_t + * + * ctypedef npy_float32 float32_t # <<<<<<<<<<<<<< + * ctypedef npy_float64 float64_t + * #ctypedef npy_float80 float80_t + */ +typedef npy_float32 __pyx_t_5numpy_float32_t; + +/* "numpy.pxd":738 + * + * ctypedef npy_float32 float32_t + * ctypedef npy_float64 float64_t # <<<<<<<<<<<<<< + * #ctypedef npy_float80 float80_t + * #ctypedef npy_float128 float128_t + */ +typedef npy_float64 __pyx_t_5numpy_float64_t; + +/* "numpy.pxd":747 + * # The int types are mapped a bit surprising -- + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t + */ +typedef npy_long __pyx_t_5numpy_int_t; + +/* "numpy.pxd":748 + * # numpy.int corresponds to 'l' and numpy.long to 'q' + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t # <<<<<<<<<<<<<< + * ctypedef npy_longlong longlong_t + * + */ +typedef npy_longlong __pyx_t_5numpy_long_t; + +/* "numpy.pxd":749 + * ctypedef npy_long int_t + * ctypedef npy_longlong long_t + * ctypedef npy_longlong longlong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_ulong uint_t + */ +typedef npy_longlong __pyx_t_5numpy_longlong_t; + +/* "numpy.pxd":751 + * ctypedef npy_longlong longlong_t + * + * ctypedef npy_ulong uint_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t + */ +typedef npy_ulong __pyx_t_5numpy_uint_t; + +/* "numpy.pxd":752 + * + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t # <<<<<<<<<<<<<< + * ctypedef npy_ulonglong ulonglong_t + * + */ +typedef npy_ulonglong __pyx_t_5numpy_ulong_t; + +/* "numpy.pxd":753 + * ctypedef npy_ulong uint_t + * ctypedef npy_ulonglong ulong_t + * ctypedef npy_ulonglong ulonglong_t # <<<<<<<<<<<<<< + * + * ctypedef npy_intp intp_t + */ +typedef npy_ulonglong __pyx_t_5numpy_ulonglong_t; + +/* "numpy.pxd":755 + * ctypedef npy_ulonglong ulonglong_t + * + * ctypedef npy_intp intp_t # <<<<<<<<<<<<<< + * ctypedef npy_uintp uintp_t + * + */ +typedef npy_intp __pyx_t_5numpy_intp_t; + +/* "numpy.pxd":756 + * + * ctypedef npy_intp intp_t + * ctypedef npy_uintp uintp_t # <<<<<<<<<<<<<< + * + * ctypedef npy_double float_t + */ +typedef npy_uintp __pyx_t_5numpy_uintp_t; + +/* "numpy.pxd":758 + * ctypedef npy_uintp uintp_t + * + * ctypedef npy_double float_t # <<<<<<<<<<<<<< + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t + */ +typedef npy_double __pyx_t_5numpy_float_t; + +/* "numpy.pxd":759 + * + * ctypedef npy_double float_t + * ctypedef npy_double double_t # <<<<<<<<<<<<<< + * ctypedef npy_longdouble longdouble_t + * + */ +typedef npy_double __pyx_t_5numpy_double_t; + +/* "numpy.pxd":760 + * ctypedef npy_double float_t + * ctypedef npy_double double_t + * ctypedef npy_longdouble longdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cfloat cfloat_t + */ +typedef npy_longdouble __pyx_t_5numpy_longdouble_t; + +/* "_util.pxd":2 + * cimport numpy as cnp + * ctypedef cnp.float64_t FLOAT_t # <<<<<<<<<<<<<< + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t + */ +typedef __pyx_t_5numpy_float64_t __pyx_t_5_util_FLOAT_t; + +/* "_util.pxd":3 + * cimport numpy as cnp + * ctypedef cnp.float64_t FLOAT_t + * ctypedef cnp.intp_t INT_t # <<<<<<<<<<<<<< + * ctypedef cnp.ulong_t INDEX_t + * ctypedef cnp.uint8_t BOOL_t + */ +typedef __pyx_t_5numpy_intp_t __pyx_t_5_util_INT_t; + +/* "_util.pxd":4 + * ctypedef cnp.float64_t FLOAT_t + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t # <<<<<<<<<<<<<< + * ctypedef cnp.uint8_t BOOL_t + * + */ +typedef __pyx_t_5numpy_ulong_t __pyx_t_5_util_INDEX_t; + +/* "_util.pxd":5 + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t + * ctypedef cnp.uint8_t BOOL_t # <<<<<<<<<<<<<< + * + * cdef FLOAT_t log2(FLOAT_t x) + */ +typedef __pyx_t_5numpy_uint8_t __pyx_t_5_util_BOOL_t; +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< float > __pyx_t_float_complex; + #else + typedef float _Complex __pyx_t_float_complex; + #endif +#else + typedef struct { float real, imag; } __pyx_t_float_complex; +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< double > __pyx_t_double_complex; + #else + typedef double _Complex __pyx_t_double_complex; + #endif +#else + typedef struct { double real, imag; } __pyx_t_double_complex; +#endif + + +/*--- Type declarations ---*/ + +/* "numpy.pxd":762 + * ctypedef npy_longdouble longdouble_t + * + * ctypedef npy_cfloat cfloat_t # <<<<<<<<<<<<<< + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t + */ +typedef npy_cfloat __pyx_t_5numpy_cfloat_t; + +/* "numpy.pxd":763 + * + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t # <<<<<<<<<<<<<< + * ctypedef npy_clongdouble clongdouble_t + * + */ +typedef npy_cdouble __pyx_t_5numpy_cdouble_t; + +/* "numpy.pxd":764 + * ctypedef npy_cfloat cfloat_t + * ctypedef npy_cdouble cdouble_t + * ctypedef npy_clongdouble clongdouble_t # <<<<<<<<<<<<<< + * + * ctypedef npy_cdouble complex_t + */ +typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; + +/* "numpy.pxd":766 + * ctypedef npy_clongdouble clongdouble_t + * + * ctypedef npy_cdouble complex_t # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew1(a): + */ +typedef npy_cdouble __pyx_t_5numpy_complex_t; +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname); /*proto*/ + #define __Pyx_RefNannyDeclarations void *__pyx_refnanny = NULL; +#ifdef WITH_THREAD + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + if (acquire_gil) { \ + PyGILState_STATE __pyx_gilstate_save = PyGILState_Ensure(); \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + PyGILState_Release(__pyx_gilstate_save); \ + } else { \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__); \ + } +#else + #define __Pyx_RefNannySetupContext(name, acquire_gil) \ + __pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) +#endif + #define __Pyx_RefNannyFinishContext() \ + __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XINCREF(r) do { if((r) != NULL) {__Pyx_INCREF(r); }} while(0) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r); }} while(0) + #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r); }} while(0) + #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);}} while(0) +#else + #define __Pyx_RefNannyDeclarations + #define __Pyx_RefNannySetupContext(name, acquire_gil) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XINCREF(r) Py_XINCREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) + #define __Pyx_XGOTREF(r) + #define __Pyx_XGIVEREF(r) +#endif /* CYTHON_REFNANNY */ +#define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) +#define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) + +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetAttrStr(PyObject* obj, PyObject* attr_name) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_getattro)) + return tp->tp_getattro(obj, attr_name); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_getattr)) + return tp->tp_getattr(obj, PyString_AS_STRING(attr_name)); +#endif + return PyObject_GetAttr(obj, attr_name); +} +#else +#define __Pyx_PyObject_GetAttrStr(o,n) PyObject_GetAttr(o,n) +#endif + +static PyObject *__Pyx_GetBuiltinName(PyObject *name); /*proto*/ + +static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, + __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); +static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); + +#define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) +#define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1) +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ + PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, \ + const char* function_name); /*proto*/ + +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact); /*proto*/ + +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice( + PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop, + PyObject** py_start, PyObject** py_stop, PyObject** py_slice, + int has_cstart, int has_cstop, int wraparound); + +#if CYTHON_COMPILING_IN_CPYTHON +static CYTHON_INLINE int __Pyx_ListComp_Append(PyObject* list, PyObject* x) { + PyListObject* L = (PyListObject*) list; + Py_ssize_t len = Py_SIZE(list); + if (likely(L->allocated > len)) { + Py_INCREF(x); + PyList_SET_ITEM(list, len, x); + Py_SIZE(list) = len+1; + return 0; + } + return PyList_Append(list, x); +} +#else +#define __Pyx_ListComp_Append(L,x) PyList_Append(L,x) +#endif + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); + +static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ + +typedef struct { + Py_ssize_t shape, strides, suboffsets; +} __Pyx_Buf_DimInfo; +typedef struct { + size_t refcount; + Py_buffer pybuffer; +} __Pyx_Buffer; +typedef struct { + __Pyx_Buffer *rcbuffer; + char *data; + __Pyx_Buf_DimInfo diminfo[8]; +} __Pyx_LocalBuf_ND; + +#if PY_MAJOR_VERSION < 3 + static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); + static void __Pyx_ReleaseBuffer(Py_buffer *view); +#else + #define __Pyx_GetBuffer PyObject_GetBuffer + #define __Pyx_ReleaseBuffer PyBuffer_Release +#endif + + +static Py_ssize_t __Pyx_zeros[] = {0, 0, 0, 0, 0, 0, 0, 0}; +static Py_ssize_t __Pyx_minusones[] = {-1, -1, -1, -1, -1, -1, -1, -1}; + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/ + +static CYTHON_INLINE npy_ulonglong __Pyx_PyInt_from_py_npy_ulonglong(PyObject *); + +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_ulonglong(npy_ulonglong); + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #define __Pyx_CREAL(z) ((z).real()) + #define __Pyx_CIMAG(z) ((z).imag()) + #else + #define __Pyx_CREAL(z) (__real__(z)) + #define __Pyx_CIMAG(z) (__imag__(z)) + #endif +#else + #define __Pyx_CREAL(z) ((z).real) + #define __Pyx_CIMAG(z) ((z).imag) +#endif +#if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX + #define __Pyx_SET_CREAL(z,x) ((z).real(x)) + #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) +#else + #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) + #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) +#endif + +static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); + +#if CYTHON_CCOMPLEX + #define __Pyx_c_eqf(a, b) ((a)==(b)) + #define __Pyx_c_sumf(a, b) ((a)+(b)) + #define __Pyx_c_difff(a, b) ((a)-(b)) + #define __Pyx_c_prodf(a, b) ((a)*(b)) + #define __Pyx_c_quotf(a, b) ((a)/(b)) + #define __Pyx_c_negf(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zerof(z) ((z)==(float)0) + #define __Pyx_c_conjf(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_absf(z) (::std::abs(z)) + #define __Pyx_c_powf(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zerof(z) ((z)==0) + #define __Pyx_c_conjf(z) (conjf(z)) + #if 1 + #define __Pyx_c_absf(z) (cabsf(z)) + #define __Pyx_c_powf(a, b) (cpowf(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex, __pyx_t_float_complex); + #endif +#endif + +static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); + +#if CYTHON_CCOMPLEX + #define __Pyx_c_eq(a, b) ((a)==(b)) + #define __Pyx_c_sum(a, b) ((a)+(b)) + #define __Pyx_c_diff(a, b) ((a)-(b)) + #define __Pyx_c_prod(a, b) ((a)*(b)) + #define __Pyx_c_quot(a, b) ((a)/(b)) + #define __Pyx_c_neg(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero(z) ((z)==(double)0) + #define __Pyx_c_conj(z) (::std::conj(z)) + #if 1 + #define __Pyx_c_abs(z) (::std::abs(z)) + #define __Pyx_c_pow(a, b) (::std::pow(a, b)) + #endif + #else + #define __Pyx_c_is_zero(z) ((z)==0) + #define __Pyx_c_conj(z) (conj(z)) + #if 1 + #define __Pyx_c_abs(z) (cabs(z)) + #define __Pyx_c_pow(a, b) (cpow(a, b)) + #endif + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex, __pyx_t_double_complex); + #endif +#endif + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static int __Pyx_check_binary_version(void); + +static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig); /*proto*/ + +#if !defined(__Pyx_PyIdentifier_FromString) +#if PY_MAJOR_VERSION < 3 + #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) +#else + #define __Pyx_PyIdentifier_FromString(s) PyUnicode_FromString(s) +#endif +#endif + +static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ + +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ + +typedef struct { + int code_line; + PyCodeObject* code_object; +} __Pyx_CodeObjectCacheEntry; +struct __Pyx_CodeObjectCache { + int count; + int max_count; + __Pyx_CodeObjectCacheEntry* entries; +}; +static struct __Pyx_CodeObjectCache __pyx_code_cache = {0,0,NULL}; +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line); +static PyCodeObject *__pyx_find_code_object(int code_line); +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object); + +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ + + +/* Module declarations from 'cpython.buffer' */ + +/* Module declarations from 'cpython.ref' */ + +/* Module declarations from 'libc.string' */ + +/* Module declarations from 'libc.stdio' */ + +/* Module declarations from 'cpython.object' */ + +/* Module declarations from '__builtin__' */ + +/* Module declarations from 'cpython.type' */ +static PyTypeObject *__pyx_ptype_7cpython_4type_type = 0; + +/* Module declarations from 'libc.stdlib' */ + +/* Module declarations from 'numpy' */ + +/* Module declarations from 'numpy' */ +static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; +static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; +static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; +static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; +static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ + +/* Module declarations from 'libc.math' */ + +/* Module declarations from '_util' */ +static PyObject *__pyx_f_5_util_apply_weights_2d(PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); /*proto*/ +static PyObject *__pyx_f_5_util_apply_weights_1d(PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); /*proto*/ +static __pyx_t_5_util_FLOAT_t __pyx_f_5_util_gcv(__pyx_t_5_util_FLOAT_t, __pyx_t_5_util_INDEX_t, __pyx_t_5_util_INDEX_t, __pyx_t_5_util_FLOAT_t, int __pyx_skip_dispatch); /*proto*/ +static __pyx_t_5_util_FLOAT_t __pyx_f_5_util_gcv_adjust(__pyx_t_5_util_INDEX_t, __pyx_t_5_util_INDEX_t, __pyx_t_5_util_FLOAT_t, int __pyx_skip_dispatch); /*proto*/ +static PyObject *__pyx_f_5_util_str_pad(PyObject *, PyObject *, int __pyx_skip_dispatch); /*proto*/ +static PyObject *__pyx_f_5_util_ascii_table(PyObject *, PyObject *, int __pyx_skip_dispatch); /*proto*/ +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5_util_FLOAT_t = { "FLOAT_t", NULL, sizeof(__pyx_t_5_util_FLOAT_t), { 0 }, 0, 'R', 0, 0 }; +#define __Pyx_MODULE_NAME "_util" +int __pyx_module_is_main__util = 0; + +/* Implementation of '_util' */ +static PyObject *__pyx_builtin_range; +static PyObject *__pyx_builtin_enumerate; +static PyObject *__pyx_builtin_ValueError; +static PyObject *__pyx_builtin_RuntimeError; +static PyObject *__pyx_pf_5_util_apply_weights_2d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_B, PyArrayObject *__pyx_v_weights); /* proto */ +static PyObject *__pyx_pf_5_util_2apply_weights_1d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_y, PyArrayObject *__pyx_v_weights); /* proto */ +static PyObject *__pyx_pf_5_util_4gcv(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_5_util_FLOAT_t __pyx_v_mse, __pyx_t_5_util_INDEX_t __pyx_v_basis_size, __pyx_t_5_util_INDEX_t __pyx_v_data_size, __pyx_t_5_util_FLOAT_t __pyx_v_penalty); /* proto */ +static PyObject *__pyx_pf_5_util_6gcv_adjust(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_5_util_INDEX_t __pyx_v_basis_size, __pyx_t_5_util_INDEX_t __pyx_v_data_size, __pyx_t_5_util_FLOAT_t __pyx_v_penalty); /* proto */ +static PyObject *__pyx_pf_5_util_8str_pad(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_string, PyObject *__pyx_v_length); /* proto */ +static PyObject *__pyx_pf_5_util_10ascii_table(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_header, PyObject *__pyx_v_data); /* proto */ +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ +static char __pyx_k_1[] = " "; +static char __pyx_k_2[] = ""; +static char __pyx_k_3[] = "-"; +static char __pyx_k_4[] = "\n"; +static char __pyx_k_5[] = "ndarray is not C contiguous"; +static char __pyx_k_7[] = "ndarray is not Fortran contiguous"; +static char __pyx_k_9[] = "Non-native byte order not supported"; +static char __pyx_k_11[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_12[] = "Format string allocated too short, see comment in numpy.pxd"; +static char __pyx_k_15[] = "Format string allocated too short."; +static char __pyx_k__B[] = "B"; +static char __pyx_k__H[] = "H"; +static char __pyx_k__I[] = "I"; +static char __pyx_k__L[] = "L"; +static char __pyx_k__O[] = "O"; +static char __pyx_k__Q[] = "Q"; +static char __pyx_k__b[] = "b"; +static char __pyx_k__d[] = "d"; +static char __pyx_k__f[] = "f"; +static char __pyx_k__g[] = "g"; +static char __pyx_k__h[] = "h"; +static char __pyx_k__i[] = "i"; +static char __pyx_k__l[] = "l"; +static char __pyx_k__q[] = "q"; +static char __pyx_k__y[] = "y"; +static char __pyx_k__Zd[] = "Zd"; +static char __pyx_k__Zf[] = "Zf"; +static char __pyx_k__Zg[] = "Zg"; +static char __pyx_k__np[] = "np"; +static char __pyx_k__mse[] = "mse"; +static char __pyx_k__data[] = "data"; +static char __pyx_k__numpy[] = "numpy"; +static char __pyx_k__range[] = "range"; +static char __pyx_k__header[] = "header"; +static char __pyx_k__length[] = "length"; +static char __pyx_k__string[] = "string"; +static char __pyx_k__penalty[] = "penalty"; +static char __pyx_k__weights[] = "weights"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__data_size[] = "data_size"; +static char __pyx_k__enumerate[] = "enumerate"; +static char __pyx_k__ValueError[] = "ValueError"; +static char __pyx_k____import__[] = "__import__"; +static char __pyx_k__basis_size[] = "basis_size"; +static char __pyx_k__RuntimeError[] = "RuntimeError"; +static char __pyx_k____pyx_getbuffer[] = "__pyx_getbuffer"; +static char __pyx_k____pyx_releasebuffer[] = "__pyx_releasebuffer"; +static PyObject *__pyx_kp_s_1; +static PyObject *__pyx_kp_u_11; +static PyObject *__pyx_kp_u_12; +static PyObject *__pyx_kp_u_15; +static PyObject *__pyx_kp_s_2; +static PyObject *__pyx_kp_s_3; +static PyObject *__pyx_kp_s_4; +static PyObject *__pyx_kp_u_5; +static PyObject *__pyx_kp_u_7; +static PyObject *__pyx_kp_u_9; +static PyObject *__pyx_n_s__B; +static PyObject *__pyx_n_s__RuntimeError; +static PyObject *__pyx_n_s__ValueError; +static PyObject *__pyx_n_s____import__; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____pyx_getbuffer; +static PyObject *__pyx_n_s____pyx_releasebuffer; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s__basis_size; +static PyObject *__pyx_n_s__data; +static PyObject *__pyx_n_s__data_size; +static PyObject *__pyx_n_s__enumerate; +static PyObject *__pyx_n_s__header; +static PyObject *__pyx_n_s__length; +static PyObject *__pyx_n_s__mse; +static PyObject *__pyx_n_s__np; +static PyObject *__pyx_n_s__numpy; +static PyObject *__pyx_n_s__penalty; +static PyObject *__pyx_n_s__range; +static PyObject *__pyx_n_s__string; +static PyObject *__pyx_n_s__weights; +static PyObject *__pyx_n_s__y; +static PyObject *__pyx_int_0; +static PyObject *__pyx_int_1; +static PyObject *__pyx_int_15; +static PyObject *__pyx_k_tuple_6; +static PyObject *__pyx_k_tuple_8; +static PyObject *__pyx_k_tuple_10; +static PyObject *__pyx_k_tuple_13; +static PyObject *__pyx_k_tuple_14; +static PyObject *__pyx_k_tuple_16; + +/* "_util.pyx":10 + * from libc.math cimport sqrt, log + * + * cdef FLOAT_t log2(FLOAT_t x): # <<<<<<<<<<<<<< + * return log(x) / log(2.0) + * + */ + +static __pyx_t_5_util_FLOAT_t __pyx_f_5_util_log2(__pyx_t_5_util_FLOAT_t __pyx_v_x) { + __pyx_t_5_util_FLOAT_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("log2", 0); + + /* "_util.pyx":11 + * + * cdef FLOAT_t log2(FLOAT_t x): + * return log(x) / log(2.0) # <<<<<<<<<<<<<< + * + * cpdef apply_weights_2d(cnp.ndarray[FLOAT_t, ndim=2] B, cnp.ndarray[FLOAT_t, ndim=1] weights): + */ + __pyx_r = (log(__pyx_v_x) / log(2.0)); + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_util.pyx":13 + * return log(x) / log(2.0) + * + * cpdef apply_weights_2d(cnp.ndarray[FLOAT_t, ndim=2] B, cnp.ndarray[FLOAT_t, ndim=1] weights): # <<<<<<<<<<<<<< + * cdef INDEX_t i + * cdef INDEX_t j + */ + +static PyObject *__pyx_pw_5_util_1apply_weights_2d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_5_util_apply_weights_2d(PyArrayObject *__pyx_v_B, PyArrayObject *__pyx_v_weights, CYTHON_UNUSED int __pyx_skip_dispatch) { + __pyx_t_5_util_INDEX_t __pyx_v_i; + __pyx_t_5_util_INDEX_t __pyx_v_j; + __pyx_t_5_util_INDEX_t __pyx_v_m; + __pyx_t_5_util_INDEX_t __pyx_v_n; + __Pyx_LocalBuf_ND __pyx_pybuffernd_B; + __Pyx_Buffer __pyx_pybuffer_B; + __Pyx_LocalBuf_ND __pyx_pybuffernd_weights; + __Pyx_Buffer __pyx_pybuffer_weights; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __pyx_t_5_util_INDEX_t __pyx_t_1; + __pyx_t_5_util_INDEX_t __pyx_t_2; + __pyx_t_5_util_INDEX_t __pyx_t_3; + __pyx_t_5_util_INDEX_t __pyx_t_4; + __pyx_t_5_util_INDEX_t __pyx_t_5; + __pyx_t_5_util_INDEX_t __pyx_t_6; + __pyx_t_5_util_INDEX_t __pyx_t_7; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("apply_weights_2d", 0); + __pyx_pybuffer_B.pybuffer.buf = NULL; + __pyx_pybuffer_B.refcount = 0; + __pyx_pybuffernd_B.data = NULL; + __pyx_pybuffernd_B.rcbuffer = &__pyx_pybuffer_B; + __pyx_pybuffer_weights.pybuffer.buf = NULL; + __pyx_pybuffer_weights.refcount = 0; + __pyx_pybuffernd_weights.data = NULL; + __pyx_pybuffernd_weights.rcbuffer = &__pyx_pybuffer_weights; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_v_B, &__Pyx_TypeInfo_nn___pyx_t_5_util_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_B.diminfo[0].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B.diminfo[0].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B.diminfo[1].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B.diminfo[1].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_5_util_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_weights.diminfo[0].strides = __pyx_pybuffernd_weights.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weights.diminfo[0].shape = __pyx_pybuffernd_weights.rcbuffer->pybuffer.shape[0]; + + /* "_util.pyx":16 + * cdef INDEX_t i + * cdef INDEX_t j + * cdef INDEX_t m = B.shape[0] # <<<<<<<<<<<<<< + * cdef INDEX_t n = B.shape[1] + * for i in range(m): + */ + __pyx_v_m = (__pyx_v_B->dimensions[0]); + + /* "_util.pyx":17 + * cdef INDEX_t j + * cdef INDEX_t m = B.shape[0] + * cdef INDEX_t n = B.shape[1] # <<<<<<<<<<<<<< + * for i in range(m): + * for j in range(n): + */ + __pyx_v_n = (__pyx_v_B->dimensions[1]); + + /* "_util.pyx":18 + * cdef INDEX_t m = B.shape[0] + * cdef INDEX_t n = B.shape[1] + * for i in range(m): # <<<<<<<<<<<<<< + * for j in range(n): + * B[i,j] *= sqrt(weights[i]) + */ + __pyx_t_1 = __pyx_v_m; + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { + __pyx_v_i = __pyx_t_2; + + /* "_util.pyx":19 + * cdef INDEX_t n = B.shape[1] + * for i in range(m): + * for j in range(n): # <<<<<<<<<<<<<< + * B[i,j] *= sqrt(weights[i]) + * + */ + __pyx_t_3 = __pyx_v_n; + for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { + __pyx_v_j = __pyx_t_4; + + /* "_util.pyx":20 + * for i in range(m): + * for j in range(n): + * B[i,j] *= sqrt(weights[i]) # <<<<<<<<<<<<<< + * + * cpdef apply_weights_1d(cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] weights): + */ + __pyx_t_5 = __pyx_v_i; + __pyx_t_6 = __pyx_v_i; + __pyx_t_7 = __pyx_v_j; + *__Pyx_BufPtrStrided2d(__pyx_t_5_util_FLOAT_t *, __pyx_pybuffernd_B.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_B.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_B.diminfo[1].strides) *= sqrt((*__Pyx_BufPtrStrided1d(__pyx_t_5_util_FLOAT_t *, __pyx_pybuffernd_weights.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_weights.diminfo[0].strides))); + } + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_B.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("_util.apply_weights_2d", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_B.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_5_util_1apply_weights_2d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_5_util_1apply_weights_2d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_B = 0; + PyArrayObject *__pyx_v_weights = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("apply_weights_2d (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__B,&__pyx_n_s__weights,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__B)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weights)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("apply_weights_2d", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply_weights_2d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_B = ((PyArrayObject *)values[0]); + __pyx_v_weights = ((PyArrayObject *)values[1]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("apply_weights_2d", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("_util.apply_weights_2d", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_B), __pyx_ptype_5numpy_ndarray, 1, "B", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weights), __pyx_ptype_5numpy_ndarray, 1, "weights", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_5_util_apply_weights_2d(__pyx_self, __pyx_v_B, __pyx_v_weights); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_util.pyx":13 + * return log(x) / log(2.0) + * + * cpdef apply_weights_2d(cnp.ndarray[FLOAT_t, ndim=2] B, cnp.ndarray[FLOAT_t, ndim=1] weights): # <<<<<<<<<<<<<< + * cdef INDEX_t i + * cdef INDEX_t j + */ + +static PyObject *__pyx_pf_5_util_apply_weights_2d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_B, PyArrayObject *__pyx_v_weights) { + __Pyx_LocalBuf_ND __pyx_pybuffernd_B; + __Pyx_Buffer __pyx_pybuffer_B; + __Pyx_LocalBuf_ND __pyx_pybuffernd_weights; + __Pyx_Buffer __pyx_pybuffer_weights; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("apply_weights_2d", 0); + __pyx_pybuffer_B.pybuffer.buf = NULL; + __pyx_pybuffer_B.refcount = 0; + __pyx_pybuffernd_B.data = NULL; + __pyx_pybuffernd_B.rcbuffer = &__pyx_pybuffer_B; + __pyx_pybuffer_weights.pybuffer.buf = NULL; + __pyx_pybuffer_weights.refcount = 0; + __pyx_pybuffernd_weights.data = NULL; + __pyx_pybuffernd_weights.rcbuffer = &__pyx_pybuffer_weights; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_v_B, &__Pyx_TypeInfo_nn___pyx_t_5_util_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_B.diminfo[0].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B.diminfo[0].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B.diminfo[1].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B.diminfo[1].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_5_util_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_weights.diminfo[0].strides = __pyx_pybuffernd_weights.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weights.diminfo[0].shape = __pyx_pybuffernd_weights.rcbuffer->pybuffer.shape[0]; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_5_util_apply_weights_2d(((PyArrayObject *)__pyx_v_B), ((PyArrayObject *)__pyx_v_weights), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_B.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("_util.apply_weights_2d", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_B.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_util.pyx":22 + * B[i,j] *= sqrt(weights[i]) + * + * cpdef apply_weights_1d(cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] weights): # <<<<<<<<<<<<<< + * cdef INDEX_t i + * cdef INDEX_t m = y.shape[0] + */ + +static PyObject *__pyx_pw_5_util_3apply_weights_1d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_5_util_apply_weights_1d(PyArrayObject *__pyx_v_y, PyArrayObject *__pyx_v_weights, CYTHON_UNUSED int __pyx_skip_dispatch) { + __pyx_t_5_util_INDEX_t __pyx_v_i; + __pyx_t_5_util_INDEX_t __pyx_v_m; + __Pyx_LocalBuf_ND __pyx_pybuffernd_weights; + __Pyx_Buffer __pyx_pybuffer_weights; + __Pyx_LocalBuf_ND __pyx_pybuffernd_y; + __Pyx_Buffer __pyx_pybuffer_y; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __pyx_t_5_util_INDEX_t __pyx_t_1; + __pyx_t_5_util_INDEX_t __pyx_t_2; + __pyx_t_5_util_INDEX_t __pyx_t_3; + __pyx_t_5_util_INDEX_t __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("apply_weights_1d", 0); + __pyx_pybuffer_y.pybuffer.buf = NULL; + __pyx_pybuffer_y.refcount = 0; + __pyx_pybuffernd_y.data = NULL; + __pyx_pybuffernd_y.rcbuffer = &__pyx_pybuffer_y; + __pyx_pybuffer_weights.pybuffer.buf = NULL; + __pyx_pybuffer_weights.refcount = 0; + __pyx_pybuffernd_weights.data = NULL; + __pyx_pybuffernd_weights.rcbuffer = &__pyx_pybuffer_weights; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_5_util_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_y.diminfo[0].strides = __pyx_pybuffernd_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y.diminfo[0].shape = __pyx_pybuffernd_y.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_5_util_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_weights.diminfo[0].strides = __pyx_pybuffernd_weights.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weights.diminfo[0].shape = __pyx_pybuffernd_weights.rcbuffer->pybuffer.shape[0]; + + /* "_util.pyx":24 + * cpdef apply_weights_1d(cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] weights): + * cdef INDEX_t i + * cdef INDEX_t m = y.shape[0] # <<<<<<<<<<<<<< + * for i in range(m): + * y[i] *= sqrt(weights[i]) + */ + __pyx_v_m = (__pyx_v_y->dimensions[0]); + + /* "_util.pyx":25 + * cdef INDEX_t i + * cdef INDEX_t m = y.shape[0] + * for i in range(m): # <<<<<<<<<<<<<< + * y[i] *= sqrt(weights[i]) + * + */ + __pyx_t_1 = __pyx_v_m; + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { + __pyx_v_i = __pyx_t_2; + + /* "_util.pyx":26 + * cdef INDEX_t m = y.shape[0] + * for i in range(m): + * y[i] *= sqrt(weights[i]) # <<<<<<<<<<<<<< + * + * cpdef FLOAT_t gcv(FLOAT_t mse, INDEX_t basis_size, INDEX_t data_size, FLOAT_t penalty): + */ + __pyx_t_3 = __pyx_v_i; + __pyx_t_4 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_5_util_FLOAT_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_y.diminfo[0].strides) *= sqrt((*__Pyx_BufPtrStrided1d(__pyx_t_5_util_FLOAT_t *, __pyx_pybuffernd_weights.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_weights.diminfo[0].strides))); + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("_util.apply_weights_1d", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_5_util_3apply_weights_1d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_5_util_3apply_weights_1d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_y = 0; + PyArrayObject *__pyx_v_weights = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("apply_weights_1d (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__y,&__pyx_n_s__weights,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weights)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("apply_weights_1d", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply_weights_1d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_y = ((PyArrayObject *)values[0]); + __pyx_v_weights = ((PyArrayObject *)values[1]); + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("apply_weights_1d", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("_util.apply_weights_1d", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weights), __pyx_ptype_5numpy_ndarray, 1, "weights", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_5_util_2apply_weights_1d(__pyx_self, __pyx_v_y, __pyx_v_weights); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_util.pyx":22 + * B[i,j] *= sqrt(weights[i]) + * + * cpdef apply_weights_1d(cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] weights): # <<<<<<<<<<<<<< + * cdef INDEX_t i + * cdef INDEX_t m = y.shape[0] + */ + +static PyObject *__pyx_pf_5_util_2apply_weights_1d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_y, PyArrayObject *__pyx_v_weights) { + __Pyx_LocalBuf_ND __pyx_pybuffernd_weights; + __Pyx_Buffer __pyx_pybuffer_weights; + __Pyx_LocalBuf_ND __pyx_pybuffernd_y; + __Pyx_Buffer __pyx_pybuffer_y; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("apply_weights_1d", 0); + __pyx_pybuffer_y.pybuffer.buf = NULL; + __pyx_pybuffer_y.refcount = 0; + __pyx_pybuffernd_y.data = NULL; + __pyx_pybuffernd_y.rcbuffer = &__pyx_pybuffer_y; + __pyx_pybuffer_weights.pybuffer.buf = NULL; + __pyx_pybuffer_weights.refcount = 0; + __pyx_pybuffernd_weights.data = NULL; + __pyx_pybuffernd_weights.rcbuffer = &__pyx_pybuffer_weights; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_5_util_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_y.diminfo[0].strides = __pyx_pybuffernd_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y.diminfo[0].shape = __pyx_pybuffernd_y.rcbuffer->pybuffer.shape[0]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_5_util_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_weights.diminfo[0].strides = __pyx_pybuffernd_weights.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weights.diminfo[0].shape = __pyx_pybuffernd_weights.rcbuffer->pybuffer.shape[0]; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_5_util_apply_weights_1d(((PyArrayObject *)__pyx_v_y), ((PyArrayObject *)__pyx_v_weights), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("_util.apply_weights_1d", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_util.pyx":28 + * y[i] *= sqrt(weights[i]) + * + * cpdef FLOAT_t gcv(FLOAT_t mse, INDEX_t basis_size, INDEX_t data_size, FLOAT_t penalty): # <<<<<<<<<<<<<< + * return mse * gcv_adjust(basis_size, data_size, penalty) + * + */ + +static PyObject *__pyx_pw_5_util_5gcv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static __pyx_t_5_util_FLOAT_t __pyx_f_5_util_gcv(__pyx_t_5_util_FLOAT_t __pyx_v_mse, __pyx_t_5_util_INDEX_t __pyx_v_basis_size, __pyx_t_5_util_INDEX_t __pyx_v_data_size, __pyx_t_5_util_FLOAT_t __pyx_v_penalty, CYTHON_UNUSED int __pyx_skip_dispatch) { + __pyx_t_5_util_FLOAT_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("gcv", 0); + + /* "_util.pyx":29 + * + * cpdef FLOAT_t gcv(FLOAT_t mse, INDEX_t basis_size, INDEX_t data_size, FLOAT_t penalty): + * return mse * gcv_adjust(basis_size, data_size, penalty) # <<<<<<<<<<<<<< + * + * cpdef FLOAT_t gcv_adjust(INDEX_t basis_size, INDEX_t data_size, FLOAT_t penalty): + */ + __pyx_r = (__pyx_v_mse * __pyx_f_5_util_gcv_adjust(__pyx_v_basis_size, __pyx_v_data_size, __pyx_v_penalty, 0)); + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_5_util_5gcv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_5_util_5gcv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + __pyx_t_5_util_FLOAT_t __pyx_v_mse; + __pyx_t_5_util_INDEX_t __pyx_v_basis_size; + __pyx_t_5_util_INDEX_t __pyx_v_data_size; + __pyx_t_5_util_FLOAT_t __pyx_v_penalty; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("gcv (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__mse,&__pyx_n_s__basis_size,&__pyx_n_s__data_size,&__pyx_n_s__penalty,0}; + PyObject* values[4] = {0,0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mse)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__basis_size)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("gcv", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data_size)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("gcv", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 3: + if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__penalty)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("gcv", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "gcv") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + } + __pyx_v_mse = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_mse == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_basis_size = __Pyx_PyInt_from_py_npy_ulonglong(values[1]); if (unlikely((__pyx_v_basis_size == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_data_size = __Pyx_PyInt_from_py_npy_ulonglong(values[2]); if (unlikely((__pyx_v_data_size == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_penalty = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_penalty == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("gcv", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("_util.gcv", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5_util_4gcv(__pyx_self, __pyx_v_mse, __pyx_v_basis_size, __pyx_v_data_size, __pyx_v_penalty); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_util.pyx":28 + * y[i] *= sqrt(weights[i]) + * + * cpdef FLOAT_t gcv(FLOAT_t mse, INDEX_t basis_size, INDEX_t data_size, FLOAT_t penalty): # <<<<<<<<<<<<<< + * return mse * gcv_adjust(basis_size, data_size, penalty) + * + */ + +static PyObject *__pyx_pf_5_util_4gcv(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_5_util_FLOAT_t __pyx_v_mse, __pyx_t_5_util_INDEX_t __pyx_v_basis_size, __pyx_t_5_util_INDEX_t __pyx_v_data_size, __pyx_t_5_util_FLOAT_t __pyx_v_penalty) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("gcv", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(__pyx_f_5_util_gcv(__pyx_v_mse, __pyx_v_basis_size, __pyx_v_data_size, __pyx_v_penalty, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_util.gcv", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_util.pyx":31 + * return mse * gcv_adjust(basis_size, data_size, penalty) + * + * cpdef FLOAT_t gcv_adjust(INDEX_t basis_size, INDEX_t data_size, FLOAT_t penalty): # <<<<<<<<<<<<<< + * return 1.0 / ((1 - ((basis_size + penalty*(basis_size - 1))/data_size)) ** 2) + * + */ + +static PyObject *__pyx_pw_5_util_7gcv_adjust(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static __pyx_t_5_util_FLOAT_t __pyx_f_5_util_gcv_adjust(__pyx_t_5_util_INDEX_t __pyx_v_basis_size, __pyx_t_5_util_INDEX_t __pyx_v_data_size, __pyx_t_5_util_FLOAT_t __pyx_v_penalty, CYTHON_UNUSED int __pyx_skip_dispatch) { + __pyx_t_5_util_FLOAT_t __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("gcv_adjust", 0); + + /* "_util.pyx":32 + * + * cpdef FLOAT_t gcv_adjust(INDEX_t basis_size, INDEX_t data_size, FLOAT_t penalty): + * return 1.0 / ((1 - ((basis_size + penalty*(basis_size - 1))/data_size)) ** 2) # <<<<<<<<<<<<<< + * + * cpdef str_pad(string, length): + */ + __pyx_r = (1.0 / pow((1.0 - ((__pyx_v_basis_size + (__pyx_v_penalty * (__pyx_v_basis_size - 1))) / __pyx_v_data_size)), 2.0)); + goto __pyx_L0; + + __pyx_r = 0; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_5_util_7gcv_adjust(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_5_util_7gcv_adjust(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + __pyx_t_5_util_INDEX_t __pyx_v_basis_size; + __pyx_t_5_util_INDEX_t __pyx_v_data_size; + __pyx_t_5_util_FLOAT_t __pyx_v_penalty; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("gcv_adjust (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__basis_size,&__pyx_n_s__data_size,&__pyx_n_s__penalty,0}; + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__basis_size)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data_size)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("gcv_adjust", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__penalty)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("gcv_adjust", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "gcv_adjust") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_basis_size = __Pyx_PyInt_from_py_npy_ulonglong(values[0]); if (unlikely((__pyx_v_basis_size == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_data_size = __Pyx_PyInt_from_py_npy_ulonglong(values[1]); if (unlikely((__pyx_v_data_size == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_penalty = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_penalty == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("gcv_adjust", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("_util.gcv_adjust", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5_util_6gcv_adjust(__pyx_self, __pyx_v_basis_size, __pyx_v_data_size, __pyx_v_penalty); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_util.pyx":31 + * return mse * gcv_adjust(basis_size, data_size, penalty) + * + * cpdef FLOAT_t gcv_adjust(INDEX_t basis_size, INDEX_t data_size, FLOAT_t penalty): # <<<<<<<<<<<<<< + * return 1.0 / ((1 - ((basis_size + penalty*(basis_size - 1))/data_size)) ** 2) + * + */ + +static PyObject *__pyx_pf_5_util_6gcv_adjust(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_5_util_INDEX_t __pyx_v_basis_size, __pyx_t_5_util_INDEX_t __pyx_v_data_size, __pyx_t_5_util_FLOAT_t __pyx_v_penalty) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("gcv_adjust", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyFloat_FromDouble(__pyx_f_5_util_gcv_adjust(__pyx_v_basis_size, __pyx_v_data_size, __pyx_v_penalty, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_util.gcv_adjust", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_util.pyx":34 + * return 1.0 / ((1 - ((basis_size + penalty*(basis_size - 1))/data_size)) ** 2) + * + * cpdef str_pad(string, length): # <<<<<<<<<<<<<< + * if len(string) >= length: + * return string[0:length] + */ + +static PyObject *__pyx_pw_5_util_9str_pad(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_5_util_str_pad(PyObject *__pyx_v_string, PyObject *__pyx_v_length, CYTHON_UNUSED int __pyx_skip_dispatch) { + PyObject *__pyx_v_pad = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("str_pad", 0); + + /* "_util.pyx":35 + * + * cpdef str_pad(string, length): + * if len(string) >= length: # <<<<<<<<<<<<<< + * return string[0:length] + * pad = length - len(string) + */ + __pyx_t_1 = PyObject_Length(__pyx_v_string); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_v_length, Py_GE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_4) { + + /* "_util.pyx":36 + * cpdef str_pad(string, length): + * if len(string) >= length: + * return string[0:length] # <<<<<<<<<<<<<< + * pad = length - len(string) + * return string + ' '*pad + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_string, 0, 0, NULL, &__pyx_v_length, NULL, 1, 0, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "_util.pyx":37 + * if len(string) >= length: + * return string[0:length] + * pad = length - len(string) # <<<<<<<<<<<<<< + * return string + ' '*pad + * + */ + __pyx_t_1 = PyObject_Length(__pyx_v_string); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyNumber_Subtract(__pyx_v_length, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_pad = __pyx_t_2; + __pyx_t_2 = 0; + + /* "_util.pyx":38 + * return string[0:length] + * pad = length - len(string) + * return string + ' '*pad # <<<<<<<<<<<<<< + * + * cpdef ascii_table(header, data): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = PyNumber_Multiply(((PyObject *)__pyx_kp_s_1), __pyx_v_pad); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_3 = PyNumber_Add(__pyx_v_string, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_AddTraceback("_util.str_pad", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_pad); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_5_util_9str_pad(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_5_util_9str_pad(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_string = 0; + PyObject *__pyx_v_length = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("str_pad (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__string,&__pyx_n_s__length,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__string)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__length)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("str_pad", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "str_pad") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_string = values[0]; + __pyx_v_length = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("str_pad", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("_util.str_pad", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5_util_8str_pad(__pyx_self, __pyx_v_string, __pyx_v_length); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_util.pyx":34 + * return 1.0 / ((1 - ((basis_size + penalty*(basis_size - 1))/data_size)) ** 2) + * + * cpdef str_pad(string, length): # <<<<<<<<<<<<<< + * if len(string) >= length: + * return string[0:length] + */ + +static PyObject *__pyx_pf_5_util_8str_pad(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_string, PyObject *__pyx_v_length) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("str_pad", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_5_util_str_pad(__pyx_v_string, __pyx_v_length, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_util.str_pad", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_util.pyx":40 + * return string + ' '*pad + * + * cpdef ascii_table(header, data): # <<<<<<<<<<<<<< + * ''' + * header - list of strings representing the header row + */ + +static PyObject *__pyx_pw_5_util_11ascii_table(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_5_util_ascii_table(PyObject *__pyx_v_header, PyObject *__pyx_v_data, CYTHON_UNUSED int __pyx_skip_dispatch) { + CYTHON_UNUSED PyObject *__pyx_v_m = NULL; + PyObject *__pyx_v_n = NULL; + PyObject *__pyx_v_column_widths = NULL; + CYTHON_UNUSED PyObject *__pyx_v_i = NULL; + PyObject *__pyx_v_row = NULL; + PyObject *__pyx_v_j = NULL; + PyObject *__pyx_v_col = NULL; + PyObject *__pyx_v_result = NULL; + PyObject *__pyx_v_col_width = NULL; + PyObject *__pyx_v_head = NULL; + PyObject *__pyx_v_item = NULL; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *(*__pyx_t_4)(PyObject *); + PyObject *__pyx_t_5 = NULL; + Py_ssize_t __pyx_t_6; + PyObject *__pyx_t_7 = NULL; + PyObject *(*__pyx_t_8)(PyObject *); + PyObject *__pyx_t_9 = NULL; + Py_ssize_t __pyx_t_10; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + int __pyx_t_13; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("ascii_table", 0); + + /* "_util.pyx":45 + * data - list of lists of strings representing data rows + * ''' + * m = len(data) # <<<<<<<<<<<<<< + * n = len(header) + * column_widths = [len(head) for head in header] + */ + __pyx_t_1 = PyObject_Length(__pyx_v_data); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_m = __pyx_t_2; + __pyx_t_2 = 0; + + /* "_util.pyx":46 + * ''' + * m = len(data) + * n = len(header) # <<<<<<<<<<<<<< + * column_widths = [len(head) for head in header] + * for i, row in enumerate(data): + */ + __pyx_t_1 = PyObject_Length(__pyx_v_header); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_v_n = __pyx_t_2; + __pyx_t_2 = 0; + + /* "_util.pyx":47 + * m = len(data) + * n = len(header) + * column_widths = [len(head) for head in header] # <<<<<<<<<<<<<< + * for i, row in enumerate(data): + * for j, col in enumerate(row): + */ + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyList_CheckExact(__pyx_v_header) || PyTuple_CheckExact(__pyx_v_header)) { + __pyx_t_3 = __pyx_v_header; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_1 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_header); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext; + } + for (;;) { + if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_3)) { + if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_3)) { + if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_5 = __pyx_t_4(__pyx_t_3); + if (unlikely(!__pyx_t_5)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_5); + } + __Pyx_XDECREF(__pyx_v_head); + __pyx_v_head = __pyx_t_5; + __pyx_t_5 = 0; + __pyx_t_6 = PyObject_Length(__pyx_v_head); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_column_widths = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; + + /* "_util.pyx":48 + * n = len(header) + * column_widths = [len(head) for head in header] + * for i, row in enumerate(data): # <<<<<<<<<<<<<< + * for j, col in enumerate(row): + * if len(col) > column_widths[j]: + */ + __Pyx_INCREF(__pyx_int_0); + __pyx_t_2 = __pyx_int_0; + if (PyList_CheckExact(__pyx_v_data) || PyTuple_CheckExact(__pyx_v_data)) { + __pyx_t_3 = __pyx_v_data; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_1 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_data); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext; + } + for (;;) { + if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_3)) { + if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_3)) { + if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_5 = __pyx_t_4(__pyx_t_3); + if (unlikely(!__pyx_t_5)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_5); + } + __Pyx_XDECREF(__pyx_v_row); + __pyx_v_row = __pyx_t_5; + __pyx_t_5 = 0; + __Pyx_INCREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_2; + __pyx_t_5 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); + __pyx_t_2 = __pyx_t_5; + __pyx_t_5 = 0; + + /* "_util.pyx":49 + * column_widths = [len(head) for head in header] + * for i, row in enumerate(data): + * for j, col in enumerate(row): # <<<<<<<<<<<<<< + * if len(col) > column_widths[j]: + * column_widths[j] = len(col) + */ + __Pyx_INCREF(__pyx_int_0); + __pyx_t_5 = __pyx_int_0; + if (PyList_CheckExact(__pyx_v_row) || PyTuple_CheckExact(__pyx_v_row)) { + __pyx_t_7 = __pyx_v_row; __Pyx_INCREF(__pyx_t_7); __pyx_t_6 = 0; + __pyx_t_8 = NULL; + } else { + __pyx_t_6 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_row); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext; + } + for (;;) { + if (!__pyx_t_8 && PyList_CheckExact(__pyx_t_7)) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_7)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_9 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_6); __Pyx_INCREF(__pyx_t_9); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_9 = PySequence_ITEM(__pyx_t_7, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_8 && PyTuple_CheckExact(__pyx_t_7)) { + if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_7)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_6); __Pyx_INCREF(__pyx_t_9); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_9 = PySequence_ITEM(__pyx_t_7, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_9 = __pyx_t_8(__pyx_t_7); + if (unlikely(!__pyx_t_9)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_9); + } + __Pyx_XDECREF(__pyx_v_col); + __pyx_v_col = __pyx_t_9; + __pyx_t_9 = 0; + __Pyx_INCREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_v_j); + __pyx_v_j = __pyx_t_5; + __pyx_t_9 = PyNumber_Add(__pyx_t_5, __pyx_int_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_5); + __pyx_t_5 = __pyx_t_9; + __pyx_t_9 = 0; + + /* "_util.pyx":50 + * for i, row in enumerate(data): + * for j, col in enumerate(row): + * if len(col) > column_widths[j]: # <<<<<<<<<<<<<< + * column_widths[j] = len(col) + * + */ + __pyx_t_10 = PyObject_Length(__pyx_v_col); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyInt_FromSsize_t(__pyx_t_10); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_11 = PyObject_GetItem(((PyObject *)__pyx_v_column_widths), __pyx_v_j); if (!__pyx_t_11) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = PyObject_RichCompare(__pyx_t_9, __pyx_t_11, Py_GT); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (__pyx_t_13) { + + /* "_util.pyx":51 + * for j, col in enumerate(row): + * if len(col) > column_widths[j]: + * column_widths[j] = len(col) # <<<<<<<<<<<<<< + * + * for j in range(n): + */ + __pyx_t_10 = PyObject_Length(__pyx_v_col); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyInt_FromSsize_t(__pyx_t_10); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + if (PyObject_SetItem(((PyObject *)__pyx_v_column_widths), __pyx_v_j, __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + goto __pyx_L9; + } + __pyx_L9:; + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "_util.pyx":53 + * column_widths[j] = len(col) + * + * for j in range(n): # <<<<<<<<<<<<<< + * column_widths[j] += 1 + * + */ + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_n); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_n); + __Pyx_GIVEREF(__pyx_v_n); + __pyx_t_3 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) { + __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); __pyx_t_1 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_1 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + for (;;) { + if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_2)) { + if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) { + if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_3 = __pyx_t_4(__pyx_t_2); + if (unlikely(!__pyx_t_3)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_XDECREF(__pyx_v_j); + __pyx_v_j = __pyx_t_3; + __pyx_t_3 = 0; + + /* "_util.pyx":54 + * + * for j in range(n): + * column_widths[j] += 1 # <<<<<<<<<<<<<< + * + * result = '' + */ + __Pyx_INCREF(__pyx_v_j); + __pyx_t_3 = __pyx_v_j; + __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_column_widths), __pyx_t_3); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = PyNumber_InPlaceAdd(__pyx_t_5, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyObject_SetItem(((PyObject *)__pyx_v_column_widths), __pyx_t_3, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "_util.pyx":56 + * column_widths[j] += 1 + * + * result = '' # <<<<<<<<<<<<<< + * for j, col_width in enumerate(column_widths): + * result += '-'*col_width + '-' + */ + __Pyx_INCREF(((PyObject *)__pyx_kp_s_2)); + __pyx_v_result = ((PyObject *)__pyx_kp_s_2); + + /* "_util.pyx":57 + * + * result = '' + * for j, col_width in enumerate(column_widths): # <<<<<<<<<<<<<< + * result += '-'*col_width + '-' + * result += '\n' + */ + __Pyx_INCREF(__pyx_int_0); + __pyx_t_2 = __pyx_int_0; + __pyx_t_3 = ((PyObject *)__pyx_v_column_widths); __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0; + for (;;) { + if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_7); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + __Pyx_XDECREF(__pyx_v_col_width); + __pyx_v_col_width = __pyx_t_7; + __pyx_t_7 = 0; + __Pyx_INCREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_v_j); + __pyx_v_j = __pyx_t_2; + __pyx_t_7 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_2); + __pyx_t_2 = __pyx_t_7; + __pyx_t_7 = 0; + + /* "_util.pyx":58 + * result = '' + * for j, col_width in enumerate(column_widths): + * result += '-'*col_width + '-' # <<<<<<<<<<<<<< + * result += '\n' + * for j, head in enumerate(header): + */ + __pyx_t_7 = PyNumber_Multiply(((PyObject *)__pyx_kp_s_3), __pyx_v_col_width); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_t_7), ((PyObject *)__pyx_kp_s_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + __pyx_t_7 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_7; + __pyx_t_7 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "_util.pyx":59 + * for j, col_width in enumerate(column_widths): + * result += '-'*col_width + '-' + * result += '\n' # <<<<<<<<<<<<<< + * for j, head in enumerate(header): + * result += str_pad(head,column_widths[j]) + ' ' + */ + __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_2; + __pyx_t_2 = 0; + + /* "_util.pyx":60 + * result += '-'*col_width + '-' + * result += '\n' + * for j, head in enumerate(header): # <<<<<<<<<<<<<< + * result += str_pad(head,column_widths[j]) + ' ' + * result += '\n' + */ + __Pyx_INCREF(__pyx_int_0); + __pyx_t_2 = __pyx_int_0; + if (PyList_CheckExact(__pyx_v_header) || PyTuple_CheckExact(__pyx_v_header)) { + __pyx_t_3 = __pyx_v_header; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_1 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_header); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext; + } + for (;;) { + if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_3)) { + if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_7); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_3)) { + if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_7); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_7 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_7 = __pyx_t_4(__pyx_t_3); + if (unlikely(!__pyx_t_7)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_7); + } + __Pyx_XDECREF(__pyx_v_head); + __pyx_v_head = __pyx_t_7; + __pyx_t_7 = 0; + __Pyx_INCREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_v_j); + __pyx_v_j = __pyx_t_2; + __pyx_t_7 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_2); + __pyx_t_2 = __pyx_t_7; + __pyx_t_7 = 0; + + /* "_util.pyx":61 + * result += '\n' + * for j, head in enumerate(header): + * result += str_pad(head,column_widths[j]) + ' ' # <<<<<<<<<<<<<< + * result += '\n' + * for j, col_width in enumerate(column_widths): + */ + __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_column_widths), __pyx_v_j); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_5 = __pyx_f_5_util_str_pad(__pyx_v_head, __pyx_t_7, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __pyx_t_7 = PyNumber_Add(__pyx_t_5, ((PyObject *)__pyx_kp_s_1)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_result, __pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_5; + __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "_util.pyx":62 + * for j, head in enumerate(header): + * result += str_pad(head,column_widths[j]) + ' ' + * result += '\n' # <<<<<<<<<<<<<< + * for j, col_width in enumerate(column_widths): + * result += '-'*col_width + '-' + */ + __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_2; + __pyx_t_2 = 0; + + /* "_util.pyx":63 + * result += str_pad(head,column_widths[j]) + ' ' + * result += '\n' + * for j, col_width in enumerate(column_widths): # <<<<<<<<<<<<<< + * result += '-'*col_width + '-' + * for i, row in enumerate(data): + */ + __Pyx_INCREF(__pyx_int_0); + __pyx_t_2 = __pyx_int_0; + __pyx_t_3 = ((PyObject *)__pyx_v_column_widths); __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0; + for (;;) { + if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + __Pyx_XDECREF(__pyx_v_col_width); + __pyx_v_col_width = __pyx_t_5; + __pyx_t_5 = 0; + __Pyx_INCREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_v_j); + __pyx_v_j = __pyx_t_2; + __pyx_t_5 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); + __pyx_t_2 = __pyx_t_5; + __pyx_t_5 = 0; + + /* "_util.pyx":64 + * result += '\n' + * for j, col_width in enumerate(column_widths): + * result += '-'*col_width + '-' # <<<<<<<<<<<<<< + * for i, row in enumerate(data): + * result += '\n' + */ + __pyx_t_5 = PyNumber_Multiply(((PyObject *)__pyx_kp_s_3), __pyx_v_col_width); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_7 = PyNumber_Add(((PyObject *)__pyx_t_5), ((PyObject *)__pyx_kp_s_3)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_5; + __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "_util.pyx":65 + * for j, col_width in enumerate(column_widths): + * result += '-'*col_width + '-' + * for i, row in enumerate(data): # <<<<<<<<<<<<<< + * result += '\n' + * for j, item in enumerate(row): + */ + __Pyx_INCREF(__pyx_int_0); + __pyx_t_2 = __pyx_int_0; + if (PyList_CheckExact(__pyx_v_data) || PyTuple_CheckExact(__pyx_v_data)) { + __pyx_t_3 = __pyx_v_data; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0; + __pyx_t_4 = NULL; + } else { + __pyx_t_1 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_data); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext; + } + for (;;) { + if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_3)) { + if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_3)) { + if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_5 = __pyx_t_4(__pyx_t_3); + if (unlikely(!__pyx_t_5)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_5); + } + __Pyx_XDECREF(__pyx_v_row); + __pyx_v_row = __pyx_t_5; + __pyx_t_5 = 0; + __Pyx_INCREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_2; + __pyx_t_5 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); + __pyx_t_2 = __pyx_t_5; + __pyx_t_5 = 0; + + /* "_util.pyx":66 + * result += '-'*col_width + '-' + * for i, row in enumerate(data): + * result += '\n' # <<<<<<<<<<<<<< + * for j, item in enumerate(row): + * result += str_pad(item,column_widths[j]) + ' ' + */ + __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_5; + __pyx_t_5 = 0; + + /* "_util.pyx":67 + * for i, row in enumerate(data): + * result += '\n' + * for j, item in enumerate(row): # <<<<<<<<<<<<<< + * result += str_pad(item,column_widths[j]) + ' ' + * result += '\n' + */ + __Pyx_INCREF(__pyx_int_0); + __pyx_t_5 = __pyx_int_0; + if (PyList_CheckExact(__pyx_v_row) || PyTuple_CheckExact(__pyx_v_row)) { + __pyx_t_7 = __pyx_v_row; __Pyx_INCREF(__pyx_t_7); __pyx_t_6 = 0; + __pyx_t_8 = NULL; + } else { + __pyx_t_6 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_row); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext; + } + for (;;) { + if (!__pyx_t_8 && PyList_CheckExact(__pyx_t_7)) { + if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_7)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_12 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_6); __Pyx_INCREF(__pyx_t_12); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_12 = PySequence_ITEM(__pyx_t_7, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else if (!__pyx_t_8 && PyTuple_CheckExact(__pyx_t_7)) { + if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_7)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_12 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_6); __Pyx_INCREF(__pyx_t_12); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_12 = PySequence_ITEM(__pyx_t_7, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + } else { + __pyx_t_12 = __pyx_t_8(__pyx_t_7); + if (unlikely(!__pyx_t_12)) { + if (PyErr_Occurred()) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + break; + } + __Pyx_GOTREF(__pyx_t_12); + } + __Pyx_XDECREF(__pyx_v_item); + __pyx_v_item = __pyx_t_12; + __pyx_t_12 = 0; + __Pyx_INCREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_v_j); + __pyx_v_j = __pyx_t_5; + __pyx_t_12 = PyNumber_Add(__pyx_t_5, __pyx_int_1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_5); + __pyx_t_5 = __pyx_t_12; + __pyx_t_12 = 0; + + /* "_util.pyx":68 + * result += '\n' + * for j, item in enumerate(row): + * result += str_pad(item,column_widths[j]) + ' ' # <<<<<<<<<<<<<< + * result += '\n' + * for j, col_width in enumerate(column_widths): + */ + __pyx_t_12 = PyObject_GetItem(((PyObject *)__pyx_v_column_widths), __pyx_v_j); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_11 = __pyx_f_5_util_str_pad(__pyx_v_item, __pyx_t_12, 0); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyNumber_Add(__pyx_t_11, ((PyObject *)__pyx_kp_s_1)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_11 = PyNumber_InPlaceAdd(__pyx_v_result, __pyx_t_12); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_11; + __pyx_t_11 = 0; + } + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "_util.pyx":69 + * for j, item in enumerate(row): + * result += str_pad(item,column_widths[j]) + ' ' + * result += '\n' # <<<<<<<<<<<<<< + * for j, col_width in enumerate(column_widths): + * result += '-'*col_width + '-' + */ + __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_2; + __pyx_t_2 = 0; + + /* "_util.pyx":70 + * result += str_pad(item,column_widths[j]) + ' ' + * result += '\n' + * for j, col_width in enumerate(column_widths): # <<<<<<<<<<<<<< + * result += '-'*col_width + '-' + * return result + */ + __Pyx_INCREF(__pyx_int_0); + __pyx_t_2 = __pyx_int_0; + __pyx_t_3 = ((PyObject *)__pyx_v_column_widths); __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0; + for (;;) { + if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + __Pyx_XDECREF(__pyx_v_col_width); + __pyx_v_col_width = __pyx_t_5; + __pyx_t_5 = 0; + __Pyx_INCREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_v_j); + __pyx_v_j = __pyx_t_2; + __pyx_t_5 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); + __pyx_t_2 = __pyx_t_5; + __pyx_t_5 = 0; + + /* "_util.pyx":71 + * result += '\n' + * for j, col_width in enumerate(column_widths): + * result += '-'*col_width + '-' # <<<<<<<<<<<<<< + * return result + * + */ + __pyx_t_5 = PyNumber_Multiply(((PyObject *)__pyx_kp_s_3), __pyx_v_col_width); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_7 = PyNumber_Add(((PyObject *)__pyx_t_5), ((PyObject *)__pyx_kp_s_3)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_7)); + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_v_result); + __pyx_v_result = __pyx_t_5; + __pyx_t_5 = 0; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + /* "_util.pyx":72 + * for j, col_width in enumerate(column_widths): + * result += '-'*col_width + '-' + * return result # <<<<<<<<<<<<<< + * + * + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(__pyx_v_result); + __pyx_r = __pyx_v_result; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_12); + __Pyx_AddTraceback("_util.ascii_table", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XDECREF(__pyx_v_m); + __Pyx_XDECREF(__pyx_v_n); + __Pyx_XDECREF(__pyx_v_column_widths); + __Pyx_XDECREF(__pyx_v_i); + __Pyx_XDECREF(__pyx_v_row); + __Pyx_XDECREF(__pyx_v_j); + __Pyx_XDECREF(__pyx_v_col); + __Pyx_XDECREF(__pyx_v_result); + __Pyx_XDECREF(__pyx_v_col_width); + __Pyx_XDECREF(__pyx_v_head); + __Pyx_XDECREF(__pyx_v_item); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_5_util_11ascii_table(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_5_util_10ascii_table[] = "\n header - list of strings representing the header row\n data - list of lists of strings representing data rows\n "; +static PyObject *__pyx_pw_5_util_11ascii_table(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_header = 0; + PyObject *__pyx_v_data = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("ascii_table (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__header,&__pyx_n_s__data,0}; + PyObject* values[2] = {0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__header)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("ascii_table", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ascii_table") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + } + __pyx_v_header = values[0]; + __pyx_v_data = values[1]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("ascii_table", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("_util.ascii_table", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_5_util_10ascii_table(__pyx_self, __pyx_v_header, __pyx_v_data); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "_util.pyx":40 + * return string + ' '*pad + * + * cpdef ascii_table(header, data): # <<<<<<<<<<<<<< + * ''' + * header - list of strings representing the header row + */ + +static PyObject *__pyx_pf_5_util_10ascii_table(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_header, PyObject *__pyx_v_data) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("ascii_table", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_5_util_ascii_table(__pyx_v_header, __pyx_v_data, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("_util.ascii_table", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ +static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_r; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__getbuffer__ (wrapper)", 0); + __pyx_r = __pyx_pf_5numpy_7ndarray___getbuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info), ((int)__pyx_v_flags)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":194 + * # experimental exception made for __getbuffer__ and __releasebuffer__ + * # -- the details of this may change. + * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< + * # This implementation of getbuffer is geared towards Cython + * # requirements, and does not yet fullfill the PEP. + */ + +static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { + int __pyx_v_copy_shape; + int __pyx_v_i; + int __pyx_v_ndim; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; + int __pyx_v_t; + char *__pyx_v_f; + PyArray_Descr *__pyx_v_descr = 0; + int __pyx_v_offset; + int __pyx_v_hasfields; + int __pyx_r; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + int __pyx_t_6; + int __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + char *__pyx_t_9; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__getbuffer__", 0); + if (__pyx_v_info != NULL) { + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + } + + /* "numpy.pxd":200 + * # of flags + * + * if info == NULL: return # <<<<<<<<<<<<<< + * + * cdef int copy_shape, i, ndim + */ + __pyx_t_1 = (__pyx_v_info == NULL); + if (__pyx_t_1) { + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "numpy.pxd":203 + * + * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + */ + __pyx_v_endian_detector = 1; + + /* "numpy.pxd":204 + * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * + * ndim = PyArray_NDIM(self) + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "numpy.pxd":206 + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + */ + __pyx_v_ndim = PyArray_NDIM(__pyx_v_self); + + /* "numpy.pxd":208 + * ndim = PyArray_NDIM(self) + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< + * copy_shape = 1 + * else: + */ + __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_1) { + + /* "numpy.pxd":209 + * + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * copy_shape = 1 # <<<<<<<<<<<<<< + * else: + * copy_shape = 0 + */ + __pyx_v_copy_shape = 1; + goto __pyx_L4; + } + /*else*/ { + + /* "numpy.pxd":211 + * copy_shape = 1 + * else: + * copy_shape = 0 # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + */ + __pyx_v_copy_shape = 0; + } + __pyx_L4:; + + /* "numpy.pxd":213 + * copy_shape = 0 + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") + */ + __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); + if (__pyx_t_1) { + + /* "numpy.pxd":214 + * + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not C contiguous") + * + */ + __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS)); + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = __pyx_t_1; + } + if (__pyx_t_3) { + + /* "numpy.pxd":215 + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + */ + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_6), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "numpy.pxd":217 + * raise ValueError(u"ndarray is not C contiguous") + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") + */ + __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); + if (__pyx_t_3) { + + /* "numpy.pxd":218 + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not Fortran contiguous") + * + */ + __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS)); + __pyx_t_2 = __pyx_t_1; + } else { + __pyx_t_2 = __pyx_t_3; + } + if (__pyx_t_2) { + + /* "numpy.pxd":219 + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * + * info.buf = PyArray_DATA(self) + */ + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_8), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "numpy.pxd":221 + * raise ValueError(u"ndarray is not Fortran contiguous") + * + * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< + * info.ndim = ndim + * if copy_shape: + */ + __pyx_v_info->buf = PyArray_DATA(__pyx_v_self); + + /* "numpy.pxd":222 + * + * info.buf = PyArray_DATA(self) + * info.ndim = ndim # <<<<<<<<<<<<<< + * if copy_shape: + * # Allocate new buffer for strides and shape info. + */ + __pyx_v_info->ndim = __pyx_v_ndim; + + /* "numpy.pxd":223 + * info.buf = PyArray_DATA(self) + * info.ndim = ndim + * if copy_shape: # <<<<<<<<<<<<<< + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. + */ + if (__pyx_v_copy_shape) { + + /* "numpy.pxd":226 + * # Allocate new buffer for strides and shape info. + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< + * info.shape = info.strides + ndim + * for i in range(ndim): + */ + __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * ((size_t)__pyx_v_ndim)) * 2))); + + /* "numpy.pxd":227 + * # This is allocated as one block, strides first. + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + * info.shape = info.strides + ndim # <<<<<<<<<<<<<< + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] + */ + __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); + + /* "numpy.pxd":228 + * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) + * info.shape = info.strides + ndim + * for i in range(ndim): # <<<<<<<<<<<<<< + * info.strides[i] = PyArray_STRIDES(self)[i] + * info.shape[i] = PyArray_DIMS(self)[i] + */ + __pyx_t_5 = __pyx_v_ndim; + for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { + __pyx_v_i = __pyx_t_6; + + /* "numpy.pxd":229 + * info.shape = info.strides + ndim + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< + * info.shape[i] = PyArray_DIMS(self)[i] + * else: + */ + (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(__pyx_v_self)[__pyx_v_i]); + + /* "numpy.pxd":230 + * for i in range(ndim): + * info.strides[i] = PyArray_STRIDES(self)[i] + * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< + * else: + * info.strides = PyArray_STRIDES(self) + */ + (__pyx_v_info->shape[__pyx_v_i]) = (PyArray_DIMS(__pyx_v_self)[__pyx_v_i]); + } + goto __pyx_L7; + } + /*else*/ { + + /* "numpy.pxd":232 + * info.shape[i] = PyArray_DIMS(self)[i] + * else: + * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL + */ + __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(__pyx_v_self)); + + /* "numpy.pxd":233 + * else: + * info.strides = PyArray_STRIDES(self) + * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) + */ + __pyx_v_info->shape = ((Py_ssize_t *)PyArray_DIMS(__pyx_v_self)); + } + __pyx_L7:; + + /* "numpy.pxd":234 + * info.strides = PyArray_STRIDES(self) + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL # <<<<<<<<<<<<<< + * info.itemsize = PyArray_ITEMSIZE(self) + * info.readonly = not PyArray_ISWRITEABLE(self) + */ + __pyx_v_info->suboffsets = NULL; + + /* "numpy.pxd":235 + * info.shape = PyArray_DIMS(self) + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< + * info.readonly = not PyArray_ISWRITEABLE(self) + * + */ + __pyx_v_info->itemsize = PyArray_ITEMSIZE(__pyx_v_self); + + /* "numpy.pxd":236 + * info.suboffsets = NULL + * info.itemsize = PyArray_ITEMSIZE(self) + * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< + * + * cdef int t + */ + __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self)); + + /* "numpy.pxd":239 + * + * cdef int t + * cdef char* f = NULL # <<<<<<<<<<<<<< + * cdef dtype descr = self.descr + * cdef list stack + */ + __pyx_v_f = NULL; + + /* "numpy.pxd":240 + * cdef int t + * cdef char* f = NULL + * cdef dtype descr = self.descr # <<<<<<<<<<<<<< + * cdef list stack + * cdef int offset + */ + __pyx_t_4 = ((PyObject *)__pyx_v_self->descr); + __Pyx_INCREF(__pyx_t_4); + __pyx_v_descr = ((PyArray_Descr *)__pyx_t_4); + __pyx_t_4 = 0; + + /* "numpy.pxd":244 + * cdef int offset + * + * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< + * + * if not hasfields and not copy_shape: + */ + __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); + + /* "numpy.pxd":246 + * cdef bint hasfields = PyDataType_HASFIELDS(descr) + * + * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< + * # do not call releasebuffer + * info.obj = None + */ + __pyx_t_2 = (!__pyx_v_hasfields); + if (__pyx_t_2) { + __pyx_t_3 = (!__pyx_v_copy_shape); + __pyx_t_1 = __pyx_t_3; + } else { + __pyx_t_1 = __pyx_t_2; + } + if (__pyx_t_1) { + + /* "numpy.pxd":248 + * if not hasfields and not copy_shape: + * # do not call releasebuffer + * info.obj = None # <<<<<<<<<<<<<< + * else: + * # need to call releasebuffer + */ + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = Py_None; + goto __pyx_L10; + } + /*else*/ { + + /* "numpy.pxd":251 + * else: + * # need to call releasebuffer + * info.obj = self # <<<<<<<<<<<<<< + * + * if not hasfields: + */ + __Pyx_INCREF(((PyObject *)__pyx_v_self)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); + __pyx_v_info->obj = ((PyObject *)__pyx_v_self); + } + __pyx_L10:; + + /* "numpy.pxd":253 + * info.obj = self + * + * if not hasfields: # <<<<<<<<<<<<<< + * t = descr.type_num + * if ((descr.byteorder == c'>' and little_endian) or + */ + __pyx_t_1 = (!__pyx_v_hasfields); + if (__pyx_t_1) { + + /* "numpy.pxd":254 + * + * if not hasfields: + * t = descr.type_num # <<<<<<<<<<<<<< + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): + */ + __pyx_t_5 = __pyx_v_descr->type_num; + __pyx_v_t = __pyx_t_5; + + /* "numpy.pxd":255 + * if not hasfields: + * t = descr.type_num + * if ((descr.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + */ + __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); + if (__pyx_t_1) { + __pyx_t_2 = __pyx_v_little_endian; + } else { + __pyx_t_2 = __pyx_t_1; + } + if (!__pyx_t_2) { + + /* "numpy.pxd":256 + * t = descr.type_num + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" + */ + __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); + if (__pyx_t_1) { + __pyx_t_3 = (!__pyx_v_little_endian); + __pyx_t_7 = __pyx_t_3; + } else { + __pyx_t_7 = __pyx_t_1; + } + __pyx_t_1 = __pyx_t_7; + } else { + __pyx_t_1 = __pyx_t_2; + } + if (__pyx_t_1) { + + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_10), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_Raise(__pyx_t_4, 0, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; + } + __pyx_L12:; + + /* "numpy.pxd":274 + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" + * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + */ + switch (__pyx_v_t) { + + /* "numpy.pxd":258 + * (descr.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" + */ + case NPY_BYTE: + __pyx_v_f = __pyx_k__b; + break; + + /* "numpy.pxd":259 + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" + */ + case NPY_UBYTE: + __pyx_v_f = __pyx_k__B; + break; + + /* "numpy.pxd":260 + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" + */ + case NPY_SHORT: + __pyx_v_f = __pyx_k__h; + break; + + /* "numpy.pxd":261 + * elif t == NPY_UBYTE: f = "B" + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" + */ + case NPY_USHORT: + __pyx_v_f = __pyx_k__H; + break; + + /* "numpy.pxd":262 + * elif t == NPY_SHORT: f = "h" + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" + */ + case NPY_INT: + __pyx_v_f = __pyx_k__i; + break; + + /* "numpy.pxd":263 + * elif t == NPY_USHORT: f = "H" + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" + */ + case NPY_UINT: + __pyx_v_f = __pyx_k__I; + break; + + /* "numpy.pxd":264 + * elif t == NPY_INT: f = "i" + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" + */ + case NPY_LONG: + __pyx_v_f = __pyx_k__l; + break; + + /* "numpy.pxd":265 + * elif t == NPY_UINT: f = "I" + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" + */ + case NPY_ULONG: + __pyx_v_f = __pyx_k__L; + break; + + /* "numpy.pxd":266 + * elif t == NPY_LONG: f = "l" + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" + */ + case NPY_LONGLONG: + __pyx_v_f = __pyx_k__q; + break; + + /* "numpy.pxd":267 + * elif t == NPY_ULONG: f = "L" + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" + */ + case NPY_ULONGLONG: + __pyx_v_f = __pyx_k__Q; + break; + + /* "numpy.pxd":268 + * elif t == NPY_LONGLONG: f = "q" + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" + */ + case NPY_FLOAT: + __pyx_v_f = __pyx_k__f; + break; + + /* "numpy.pxd":269 + * elif t == NPY_ULONGLONG: f = "Q" + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" + */ + case NPY_DOUBLE: + __pyx_v_f = __pyx_k__d; + break; + + /* "numpy.pxd":270 + * elif t == NPY_FLOAT: f = "f" + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" + */ + case NPY_LONGDOUBLE: + __pyx_v_f = __pyx_k__g; + break; + + /* "numpy.pxd":271 + * elif t == NPY_DOUBLE: f = "d" + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" + */ + case NPY_CFLOAT: + __pyx_v_f = __pyx_k__Zf; + break; + + /* "numpy.pxd":272 + * elif t == NPY_LONGDOUBLE: f = "g" + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< + * elif t == NPY_CLONGDOUBLE: f = "Zg" + * elif t == NPY_OBJECT: f = "O" + */ + case NPY_CDOUBLE: + __pyx_v_f = __pyx_k__Zd; + break; + + /* "numpy.pxd":273 + * elif t == NPY_CFLOAT: f = "Zf" + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< + * elif t == NPY_OBJECT: f = "O" + * else: + */ + case NPY_CLONGDOUBLE: + __pyx_v_f = __pyx_k__Zg; + break; + + /* "numpy.pxd":274 + * elif t == NPY_CDOUBLE: f = "Zd" + * elif t == NPY_CLONGDOUBLE: f = "Zg" + * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + */ + case NPY_OBJECT: + __pyx_v_f = __pyx_k__O; + break; + default: + + /* "numpy.pxd":276 + * elif t == NPY_OBJECT: f = "O" + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * info.format = f + * return + */ + __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_11), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_8)); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); + __pyx_t_8 = 0; + __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_8, 0, 0, 0); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + + /* "numpy.pxd":277 + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * info.format = f # <<<<<<<<<<<<<< + * return + * else: + */ + __pyx_v_info->format = __pyx_v_f; + + /* "numpy.pxd":278 + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * info.format = f + * return # <<<<<<<<<<<<<< + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) + */ + __pyx_r = 0; + goto __pyx_L0; + goto __pyx_L11; + } + /*else*/ { + + /* "numpy.pxd":280 + * return + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< + * info.format[0] = c'^' # Native data types, manual alignment + * offset = 0 + */ + __pyx_v_info->format = ((char *)malloc(255)); + + /* "numpy.pxd":281 + * else: + * info.format = stdlib.malloc(_buffer_format_string_len) + * info.format[0] = c'^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * offset = 0 + * f = _util_dtypestring(descr, info.format + 1, + */ + (__pyx_v_info->format[0]) = '^'; + + /* "numpy.pxd":282 + * info.format = stdlib.malloc(_buffer_format_string_len) + * info.format[0] = c'^' # Native data types, manual alignment + * offset = 0 # <<<<<<<<<<<<<< + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + */ + __pyx_v_offset = 0; + + /* "numpy.pxd":285 + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + * &offset) # <<<<<<<<<<<<<< + * f[0] = c'\0' # Terminate format string + * + */ + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_9; + + /* "numpy.pxd":286 + * info.format + _buffer_format_string_len, + * &offset) + * f[0] = c'\0' # Terminate format string # <<<<<<<<<<<<<< + * + * def __releasebuffer__(ndarray self, Py_buffer* info): + */ + (__pyx_v_f[0]) = '\x00'; + } + __pyx_L11:; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_AddTraceback("numpy.ndarray.__getbuffer__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = -1; + if (__pyx_v_info != NULL && __pyx_v_info->obj != NULL) { + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; + } + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info != NULL && __pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(Py_None); + __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; + } + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_descr); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ +static CYTHON_UNUSED void __pyx_pw_5numpy_7ndarray_3__releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__releasebuffer__ (wrapper)", 0); + __pyx_pf_5numpy_7ndarray_2__releasebuffer__(((PyArrayObject *)__pyx_v_self), ((Py_buffer *)__pyx_v_info)); + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":288 + * f[0] = c'\0' # Terminate format string + * + * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + */ + +static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("__releasebuffer__", 0); + + /* "numpy.pxd":289 + * + * def __releasebuffer__(ndarray self, Py_buffer* info): + * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + */ + __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self); + if (__pyx_t_1) { + + /* "numpy.pxd":290 + * def __releasebuffer__(ndarray self, Py_buffer* info): + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) # <<<<<<<<<<<<<< + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * stdlib.free(info.strides) + */ + free(__pyx_v_info->format); + goto __pyx_L3; + } + __pyx_L3:; + + /* "numpy.pxd":291 + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< + * stdlib.free(info.strides) + * # info.shape was stored after info.strides in the same block + */ + __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_1) { + + /* "numpy.pxd":292 + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * stdlib.free(info.strides) # <<<<<<<<<<<<<< + * # info.shape was stored after info.strides in the same block + * + */ + free(__pyx_v_info->strides); + goto __pyx_L4; + } + __pyx_L4:; + + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":768 + * ctypedef npy_cdouble complex_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1", 0); + + /* "numpy.pxd":769 + * + * cdef inline object PyArray_MultiIterNew1(a): + * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew2(a, b): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":771 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2", 0); + + /* "numpy.pxd":772 + * + * cdef inline object PyArray_MultiIterNew2(a, b): + * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":774 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3", 0); + + /* "numpy.pxd":775 + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":777 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4", 0); + + /* "numpy.pxd":778 + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":780 + * return PyArray_MultiIterNew(4, a, b, c, d) + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5", 0); + + /* "numpy.pxd":781 + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":783 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< + * # Recursive utility function used in __getbuffer__ to get format + * # string. The new location in the format string is returned. + */ + +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { + PyArray_Descr *__pyx_v_child = 0; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; + PyObject *__pyx_v_fields = 0; + PyObject *__pyx_v_childname = NULL; + PyObject *__pyx_v_new_offset = NULL; + PyObject *__pyx_v_t = NULL; + char *__pyx_r; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + PyObject *(*__pyx_t_6)(PyObject *); + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + int __pyx_t_10; + long __pyx_t_11; + char *__pyx_t_12; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("_util_dtypestring", 0); + + /* "numpy.pxd":790 + * cdef int delta_offset + * cdef tuple i + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * cdef tuple fields + */ + __pyx_v_endian_detector = 1; + + /* "numpy.pxd":791 + * cdef tuple i + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * cdef tuple fields + * + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "numpy.pxd":794 + * cdef tuple fields + * + * for childname in descr.names: # <<<<<<<<<<<<<< + * fields = descr.fields[childname] + * child, new_offset = fields + */ + if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; + for (;;) { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + __Pyx_XDECREF(__pyx_v_childname); + __pyx_v_childname = __pyx_t_3; + __pyx_t_3 = 0; + + /* "numpy.pxd":795 + * + * for childname in descr.names: + * fields = descr.fields[childname] # <<<<<<<<<<<<<< + * child, new_offset = fields + * + */ + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); + __pyx_v_fields = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + + /* "numpy.pxd":796 + * for childname in descr.names: + * fields = descr.fields[childname] + * child, new_offset = fields # <<<<<<<<<<<<<< + * + * if (end - f) - (new_offset - offset[0]) < 15: + */ + if (likely(PyTuple_CheckExact(((PyObject *)__pyx_v_fields)))) { + PyObject* sequence = ((PyObject *)__pyx_v_fields); + #if CYTHON_COMPILING_IN_CPYTHON + Py_ssize_t size = Py_SIZE(sequence); + #else + Py_ssize_t size = PySequence_Size(sequence); + #endif + if (unlikely(size != 2)) { + if (size > 2) __Pyx_RaiseTooManyValuesError(2); + else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + #if CYTHON_COMPILING_IN_CPYTHON + __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); + __pyx_t_4 = PyTuple_GET_ITEM(sequence, 1); + __Pyx_INCREF(__pyx_t_3); + __Pyx_INCREF(__pyx_t_4); + #else + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + #endif + } else if (1) { + __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else + { + Py_ssize_t index = -1; + __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_fields)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; + index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_3); + index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed; + __Pyx_GOTREF(__pyx_t_4); + if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = NULL; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + goto __pyx_L6_unpacking_done; + __pyx_L5_unpacking_failed:; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = NULL; + if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_L6_unpacking_done:; + } + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(((PyObject *)__pyx_v_child)); + __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); + __pyx_t_3 = 0; + __Pyx_XDECREF(__pyx_v_new_offset); + __pyx_v_new_offset = __pyx_t_4; + __pyx_t_4 = 0; + + /* "numpy.pxd":798 + * child, new_offset = fields + * + * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") + * + */ + __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + + /* "numpy.pxd":799 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == c'>' and little_endian) or + */ + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L7; + } + __pyx_L7:; + + /* "numpy.pxd":801 + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") + * + * if ((child.byteorder == c'>' and little_endian) or # <<<<<<<<<<<<<< + * (child.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + */ + __pyx_t_7 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_7) { + __pyx_t_8 = __pyx_v_little_endian; + } else { + __pyx_t_8 = __pyx_t_7; + } + if (!__pyx_t_8) { + + /* "numpy.pxd":802 + * + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError(u"Non-native byte order not supported") + * # One could encode it in the format string and have Cython + */ + __pyx_t_7 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_7) { + __pyx_t_9 = (!__pyx_v_little_endian); + __pyx_t_10 = __pyx_t_9; + } else { + __pyx_t_10 = __pyx_t_7; + } + __pyx_t_7 = __pyx_t_10; + } else { + __pyx_t_7 = __pyx_t_8; + } + if (__pyx_t_7) { + + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_14), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L8; + } + __pyx_L8:; + + /* "numpy.pxd":813 + * + * # Output padding bytes + * while offset[0] < new_offset: # <<<<<<<<<<<<<< + * f[0] = 120 # "x"; pad byte + * f += 1 + */ + while (1) { + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!__pyx_t_7) break; + + /* "numpy.pxd":814 + * # Output padding bytes + * while offset[0] < new_offset: + * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< + * f += 1 + * offset[0] += 1 + */ + (__pyx_v_f[0]) = 120; + + /* "numpy.pxd":815 + * while offset[0] < new_offset: + * f[0] = 120 # "x"; pad byte + * f += 1 # <<<<<<<<<<<<<< + * offset[0] += 1 + * + */ + __pyx_v_f = (__pyx_v_f + 1); + + /* "numpy.pxd":816 + * f[0] = 120 # "x"; pad byte + * f += 1 + * offset[0] += 1 # <<<<<<<<<<<<<< + * + * offset[0] += child.itemsize + */ + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + 1); + } + + /* "numpy.pxd":818 + * offset[0] += 1 + * + * offset[0] += child.itemsize # <<<<<<<<<<<<<< + * + * if not PyDataType_HASFIELDS(child): + */ + __pyx_t_11 = 0; + (__pyx_v_offset[__pyx_t_11]) = ((__pyx_v_offset[__pyx_t_11]) + __pyx_v_child->elsize); + + /* "numpy.pxd":820 + * offset[0] += child.itemsize + * + * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< + * t = child.type_num + * if end - f < 5: + */ + __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_7) { + + /* "numpy.pxd":821 + * + * if not PyDataType_HASFIELDS(child): + * t = child.type_num # <<<<<<<<<<<<<< + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") + */ + __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_v_t); + __pyx_v_t = __pyx_t_3; + __pyx_t_3 = 0; + + /* "numpy.pxd":822 + * if not PyDataType_HASFIELDS(child): + * t = child.type_num + * if end - f < 5: # <<<<<<<<<<<<<< + * raise RuntimeError(u"Format string allocated too short.") + * + */ + __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_7) { + + /* "numpy.pxd":823 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings + */ + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_16), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_Raise(__pyx_t_3, 0, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; + } + __pyx_L12:; + + /* "numpy.pxd":826 + * + * # Until ticket #99 is fixed, use integers to avoid warnings + * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" + */ + __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 98; + goto __pyx_L13; + } + + /* "numpy.pxd":827 + * # Until ticket #99 is fixed, use integers to avoid warnings + * if t == NPY_BYTE: f[0] = 98 #"b" + * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" + */ + __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 66; + goto __pyx_L13; + } + + /* "numpy.pxd":828 + * if t == NPY_BYTE: f[0] = 98 #"b" + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" + */ + __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 104; + goto __pyx_L13; + } + + /* "numpy.pxd":829 + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" + */ + __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 72; + goto __pyx_L13; + } + + /* "numpy.pxd":830 + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" + */ + __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 105; + goto __pyx_L13; + } + + /* "numpy.pxd":831 + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" + */ + __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 73; + goto __pyx_L13; + } + + /* "numpy.pxd":832 + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + */ + __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 108; + goto __pyx_L13; + } + + /* "numpy.pxd":833 + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + */ + __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 76; + goto __pyx_L13; + } + + /* "numpy.pxd":834 + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" + */ + __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 113; + goto __pyx_L13; + } + + /* "numpy.pxd":835 + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + */ + __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 81; + goto __pyx_L13; + } + + /* "numpy.pxd":836 + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + */ + __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 102; + goto __pyx_L13; + } + + /* "numpy.pxd":837 + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + */ + __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 100; + goto __pyx_L13; + } + + /* "numpy.pxd":838 + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + */ + __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 103; + goto __pyx_L13; + } + + /* "numpy.pxd":839 + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + */ + __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 102; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; + } + + /* "numpy.pxd":840 + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + * elif t == NPY_OBJECT: f[0] = 79 #"O" + */ + __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 100; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; + } + + /* "numpy.pxd":841 + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: + */ + __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 103; + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L13; + } + + /* "numpy.pxd":842 + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + */ + __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_7) { + (__pyx_v_f[0]) = 79; + goto __pyx_L13; + } + /*else*/ { + + /* "numpy.pxd":844 + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * f += 1 + * else: + */ + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_11), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L13:; + + /* "numpy.pxd":845 + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * f += 1 # <<<<<<<<<<<<<< + * else: + * # Cython ignores struct boundary information ("T{...}"), + */ + __pyx_v_f = (__pyx_v_f + 1); + goto __pyx_L11; + } + /*else*/ { + + /* "numpy.pxd":849 + * # Cython ignores struct boundary information ("T{...}"), + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< + * return f + * + */ + __pyx_t_12 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_12; + } + __pyx_L11:; + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "numpy.pxd":850 + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) + * return f # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_f; + goto __pyx_L0; + + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("numpy._util_dtypestring", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XDECREF((PyObject *)__pyx_v_child); + __Pyx_XDECREF(__pyx_v_fields); + __Pyx_XDECREF(__pyx_v_childname); + __Pyx_XDECREF(__pyx_v_new_offset); + __Pyx_XDECREF(__pyx_v_t); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "numpy.pxd":965 + * + * + * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< + * cdef PyObject* baseptr + * if base is None: + */ + +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { + PyObject *__pyx_v_baseptr; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("set_array_base", 0); + + /* "numpy.pxd":967 + * cdef inline void set_array_base(ndarray arr, object base): + * cdef PyObject* baseptr + * if base is None: # <<<<<<<<<<<<<< + * baseptr = NULL + * else: + */ + __pyx_t_1 = (__pyx_v_base == Py_None); + if (__pyx_t_1) { + + /* "numpy.pxd":968 + * cdef PyObject* baseptr + * if base is None: + * baseptr = NULL # <<<<<<<<<<<<<< + * else: + * Py_INCREF(base) # important to do this before decref below! + */ + __pyx_v_baseptr = NULL; + goto __pyx_L3; + } + /*else*/ { + + /* "numpy.pxd":970 + * baseptr = NULL + * else: + * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< + * baseptr = base + * Py_XDECREF(arr.base) + */ + Py_INCREF(__pyx_v_base); + + /* "numpy.pxd":971 + * else: + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base # <<<<<<<<<<<<<< + * Py_XDECREF(arr.base) + * arr.base = baseptr + */ + __pyx_v_baseptr = ((PyObject *)__pyx_v_base); + } + __pyx_L3:; + + /* "numpy.pxd":972 + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base + * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< + * arr.base = baseptr + * + */ + Py_XDECREF(__pyx_v_arr->base); + + /* "numpy.pxd":973 + * baseptr = base + * Py_XDECREF(arr.base) + * arr.base = baseptr # <<<<<<<<<<<<<< + * + * cdef inline object get_array_base(ndarray arr): + */ + __pyx_v_arr->base = __pyx_v_baseptr; + + __Pyx_RefNannyFinishContext(); +} + +/* "numpy.pxd":975 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + int __pyx_t_1; + __Pyx_RefNannySetupContext("get_array_base", 0); + + /* "numpy.pxd":976 + * + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: # <<<<<<<<<<<<<< + * return None + * else: + */ + __pyx_t_1 = (__pyx_v_arr->base == NULL); + if (__pyx_t_1) { + + /* "numpy.pxd":977 + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: + * return None # <<<<<<<<<<<<<< + * else: + * return arr.base + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "numpy.pxd":979 + * return None + * else: + * return arr.base # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); + __pyx_r = ((PyObject *)__pyx_v_arr->base); + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +static PyMethodDef __pyx_methods[] = { + {__Pyx_NAMESTR("apply_weights_2d"), (PyCFunction)__pyx_pw_5_util_1apply_weights_2d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("apply_weights_1d"), (PyCFunction)__pyx_pw_5_util_3apply_weights_1d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("gcv"), (PyCFunction)__pyx_pw_5_util_5gcv, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("gcv_adjust"), (PyCFunction)__pyx_pw_5_util_7gcv_adjust, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("str_pad"), (PyCFunction)__pyx_pw_5_util_9str_pad, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("ascii_table"), (PyCFunction)__pyx_pw_5_util_11ascii_table, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5_util_10ascii_table)}, + {0, 0, 0, 0} +}; + +#if PY_MAJOR_VERSION >= 3 +static struct PyModuleDef __pyx_moduledef = { + #if PY_VERSION_HEX < 0x03020000 + { PyObject_HEAD_INIT(NULL) NULL, 0, NULL }, + #else + PyModuleDef_HEAD_INIT, + #endif + __Pyx_NAMESTR("_util"), + 0, /* m_doc */ + -1, /* m_size */ + __pyx_methods /* m_methods */, + NULL, /* m_reload */ + NULL, /* m_traverse */ + NULL, /* m_clear */ + NULL /* m_free */ +}; +#endif + +static __Pyx_StringTabEntry __pyx_string_tab[] = { + {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, + {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0}, + {&__pyx_kp_u_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 1, 0, 0}, + {&__pyx_kp_u_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 1, 0, 0}, + {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0}, + {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, + {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0}, + {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 0}, + {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0}, + {&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0}, + {&__pyx_n_s__B, __pyx_k__B, sizeof(__pyx_k__B), 0, 0, 1, 1}, + {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, + {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, + {&__pyx_n_s____import__, __pyx_k____import__, sizeof(__pyx_k____import__), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____pyx_getbuffer, __pyx_k____pyx_getbuffer, sizeof(__pyx_k____pyx_getbuffer), 0, 0, 1, 1}, + {&__pyx_n_s____pyx_releasebuffer, __pyx_k____pyx_releasebuffer, sizeof(__pyx_k____pyx_releasebuffer), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s__basis_size, __pyx_k__basis_size, sizeof(__pyx_k__basis_size), 0, 0, 1, 1}, + {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1}, + {&__pyx_n_s__data_size, __pyx_k__data_size, sizeof(__pyx_k__data_size), 0, 0, 1, 1}, + {&__pyx_n_s__enumerate, __pyx_k__enumerate, sizeof(__pyx_k__enumerate), 0, 0, 1, 1}, + {&__pyx_n_s__header, __pyx_k__header, sizeof(__pyx_k__header), 0, 0, 1, 1}, + {&__pyx_n_s__length, __pyx_k__length, sizeof(__pyx_k__length), 0, 0, 1, 1}, + {&__pyx_n_s__mse, __pyx_k__mse, sizeof(__pyx_k__mse), 0, 0, 1, 1}, + {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, + {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, + {&__pyx_n_s__penalty, __pyx_k__penalty, sizeof(__pyx_k__penalty), 0, 0, 1, 1}, + {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, + {&__pyx_n_s__string, __pyx_k__string, sizeof(__pyx_k__string), 0, 0, 1, 1}, + {&__pyx_n_s__weights, __pyx_k__weights, sizeof(__pyx_k__weights), 0, 0, 1, 1}, + {&__pyx_n_s__y, __pyx_k__y, sizeof(__pyx_k__y), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} +}; +static int __Pyx_InitCachedBuiltins(void) { + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + return 0; + __pyx_L1_error:; + return -1; +} + +static int __Pyx_InitCachedConstants(void) { + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); + + /* "numpy.pxd":215 + * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< + * + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + */ + __pyx_k_tuple_6 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_5)); if (unlikely(!__pyx_k_tuple_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_6); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_6)); + + /* "numpy.pxd":219 + * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) + * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * + * info.buf = PyArray_DATA(self) + */ + __pyx_k_tuple_8 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_7)); if (unlikely(!__pyx_k_tuple_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_8); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_8)); + + /* "numpy.pxd":257 + * if ((descr.byteorder == c'>' and little_endian) or + * (descr.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_k_tuple_10 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_9)); if (unlikely(!__pyx_k_tuple_10)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_10); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_10)); + + /* "numpy.pxd":799 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == c'>' and little_endian) or + */ + __pyx_k_tuple_13 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_12)); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_13); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13)); + + /* "numpy.pxd":803 + * if ((child.byteorder == c'>' and little_endian) or + * (child.byteorder == c'<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_k_tuple_14 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_9)); if (unlikely(!__pyx_k_tuple_14)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_14); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_14)); + + /* "numpy.pxd":823 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings + */ + __pyx_k_tuple_16 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_15)); if (unlikely(!__pyx_k_tuple_16)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_16); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_16)); + __Pyx_RefNannyFinishContext(); + return 0; + __pyx_L1_error:; + __Pyx_RefNannyFinishContext(); + return -1; +} + +static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + return 0; + __pyx_L1_error:; + return -1; +} + +#if PY_MAJOR_VERSION < 3 +PyMODINIT_FUNC init_util(void); /*proto*/ +PyMODINIT_FUNC init_util(void) +#else +PyMODINIT_FUNC PyInit__util(void); /*proto*/ +PyMODINIT_FUNC PyInit__util(void) +#endif +{ + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannyDeclarations + #if CYTHON_REFNANNY + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + #endif + __Pyx_RefNannySetupContext("PyMODINIT_FUNC PyInit__util(void)", 0); + if ( __Pyx_check_binary_version() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #ifdef __Pyx_CyFunction_USED + if (__Pyx_CyFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_FusedFunction_USED + if (__pyx_FusedFunction_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + #ifdef __Pyx_Generator_USED + if (__pyx_Generator_init() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + /*--- Library function declarations ---*/ + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif + /*--- Module creation code ---*/ + #if PY_MAJOR_VERSION < 3 + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("_util"), __pyx_methods, 0, 0, PYTHON_API_VERSION); Py_XINCREF(__pyx_m); + #else + __pyx_m = PyModule_Create(&__pyx_moduledef); + #endif + if (unlikely(!__pyx_m)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_d = PyModule_GetDict(__pyx_m); if (unlikely(!__pyx_d)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + Py_INCREF(__pyx_d); + #if PY_MAJOR_VERSION >= 3 + { + PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyDict_GetItemString(modules, "_util")) { + if (unlikely(PyDict_SetItemString(modules, "_util", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + } + #endif + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (unlikely(!__pyx_b)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if CYTHON_COMPILING_IN_PYPY + Py_INCREF(__pyx_b); + #endif + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) + if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif + if (__pyx_module_is_main__util) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } + /*--- Builtin init code ---*/ + if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Constants init code ---*/ + if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Global init code ---*/ + /*--- Variable export code ---*/ + /*--- Function export code ---*/ + if (__Pyx_ExportFunction("log2", (void (*)(void))__pyx_f_5_util_log2, "__pyx_t_5_util_FLOAT_t (__pyx_t_5_util_FLOAT_t)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("apply_weights_2d", (void (*)(void))__pyx_f_5_util_apply_weights_2d, "PyObject *(PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("apply_weights_1d", (void (*)(void))__pyx_f_5_util_apply_weights_1d, "PyObject *(PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("gcv", (void (*)(void))__pyx_f_5_util_gcv, "__pyx_t_5_util_FLOAT_t (__pyx_t_5_util_FLOAT_t, __pyx_t_5_util_INDEX_t, __pyx_t_5_util_INDEX_t, __pyx_t_5_util_FLOAT_t, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("gcv_adjust", (void (*)(void))__pyx_f_5_util_gcv_adjust, "__pyx_t_5_util_FLOAT_t (__pyx_t_5_util_INDEX_t, __pyx_t_5_util_INDEX_t, __pyx_t_5_util_FLOAT_t, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("str_pad", (void (*)(void))__pyx_f_5_util_str_pad, "PyObject *(PyObject *, PyObject *, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("ascii_table", (void (*)(void))__pyx_f_5_util_ascii_table, "PyObject *(PyObject *, PyObject *, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Type init code ---*/ + /*--- Type import code ---*/ + __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", + #if CYTHON_COMPILING_IN_PYPY + sizeof(PyTypeObject), + #else + sizeof(PyHeapTypeObject), + #endif + 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Variable import code ---*/ + /*--- Function import code ---*/ + /*--- Execution code ---*/ + + /* "_util.pyx":7 + * # cython: profile = False + * + * import numpy as np # <<<<<<<<<<<<<< + * from libc.math cimport sqrt, log + * + */ + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_d, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "_util.pyx":1 + * # distutils: language = c # <<<<<<<<<<<<<< + * # cython: cdivision = True + * # cython: boundscheck = False + */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + if (PyDict_SetItem(__pyx_d, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + + /* "numpy.pxd":975 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None + */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + if (__pyx_m) { + __Pyx_AddTraceback("init _util", __pyx_clineno, __pyx_lineno, __pyx_filename); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init _util"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + #if PY_MAJOR_VERSION < 3 + return; + #else + return __pyx_m; + #endif +} + +/* Runtime support code */ +#if CYTHON_REFNANNY +static __Pyx_RefNannyAPIStruct *__Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); +end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; +} +#endif /* CYTHON_REFNANNY */ + +static PyObject *__Pyx_GetBuiltinName(PyObject *name) { + PyObject* result = __Pyx_PyObject_GetAttrStr(__pyx_b, name); + if (unlikely(!result)) { + PyErr_Format(PyExc_NameError, +#if PY_MAJOR_VERSION >= 3 + "name '%U' is not defined", name); +#else + "name '%s' is not defined", PyString_AS_STRING(name)); +#endif + } + return result; +} + +static CYTHON_INLINE int __Pyx_IsLittleEndian(void) { + unsigned int n = 1; + return *(unsigned char*)(&n) != 0; +} +static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, + __Pyx_BufFmt_StackElem* stack, + __Pyx_TypeInfo* type) { + stack[0].field = &ctx->root; + stack[0].parent_offset = 0; + ctx->root.type = type; + ctx->root.name = "buffer dtype"; + ctx->root.offset = 0; + ctx->head = stack; + ctx->head->field = &ctx->root; + ctx->fmt_offset = 0; + ctx->head->parent_offset = 0; + ctx->new_packmode = '@'; + ctx->enc_packmode = '@'; + ctx->new_count = 1; + ctx->enc_count = 0; + ctx->enc_type = 0; + ctx->is_complex = 0; + ctx->is_valid_array = 0; + ctx->struct_alignment = 0; + while (type->typegroup == 'S') { + ++ctx->head; + ctx->head->field = type->fields; + ctx->head->parent_offset = 0; + type = type->fields->type; + } +} +static int __Pyx_BufFmt_ParseNumber(const char** ts) { + int count; + const char* t = *ts; + if (*t < '0' || *t > '9') { + return -1; + } else { + count = *t++ - '0'; + while (*t >= '0' && *t < '9') { + count *= 10; + count += *t++ - '0'; + } + } + *ts = t; + return count; +} +static int __Pyx_BufFmt_ExpectNumber(const char **ts) { + int number = __Pyx_BufFmt_ParseNumber(ts); + if (number == -1) /* First char was not a digit */ + PyErr_Format(PyExc_ValueError,\ + "Does not understand character buffer dtype format string ('%c')", **ts); + return number; +} +static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { + PyErr_Format(PyExc_ValueError, + "Unexpected format string character: '%c'", ch); +} +static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { + switch (ch) { + case 'c': return "'char'"; + case 'b': return "'signed char'"; + case 'B': return "'unsigned char'"; + case 'h': return "'short'"; + case 'H': return "'unsigned short'"; + case 'i': return "'int'"; + case 'I': return "'unsigned int'"; + case 'l': return "'long'"; + case 'L': return "'unsigned long'"; + case 'q': return "'long long'"; + case 'Q': return "'unsigned long long'"; + case 'f': return (is_complex ? "'complex float'" : "'float'"); + case 'd': return (is_complex ? "'complex double'" : "'double'"); + case 'g': return (is_complex ? "'complex long double'" : "'long double'"); + case 'T': return "a struct"; + case 'O': return "Python object"; + case 'P': return "a pointer"; + case 's': case 'p': return "a string"; + case 0: return "end"; + default: return "unparseable format string"; + } +} +static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return 2; + case 'i': case 'I': case 'l': case 'L': return 4; + case 'q': case 'Q': return 8; + case 'f': return (is_complex ? 8 : 4); + case 'd': return (is_complex ? 16 : 8); + case 'g': { + PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g').."); + return 0; + } + case 'O': case 'P': return sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} +static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { + switch (ch) { + case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(short); + case 'i': case 'I': return sizeof(int); + case 'l': case 'L': return sizeof(long); + #ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(PY_LONG_LONG); + #endif + case 'f': return sizeof(float) * (is_complex ? 2 : 1); + case 'd': return sizeof(double) * (is_complex ? 2 : 1); + case 'g': return sizeof(long double) * (is_complex ? 2 : 1); + case 'O': case 'P': return sizeof(void*); + default: { + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } + } +} +typedef struct { char c; short x; } __Pyx_st_short; +typedef struct { char c; int x; } __Pyx_st_int; +typedef struct { char c; long x; } __Pyx_st_long; +typedef struct { char c; float x; } __Pyx_st_float; +typedef struct { char c; double x; } __Pyx_st_double; +typedef struct { char c; long double x; } __Pyx_st_longdouble; +typedef struct { char c; void *x; } __Pyx_st_void_p; +#ifdef HAVE_LONG_LONG +typedef struct { char c; PY_LONG_LONG x; } __Pyx_st_longlong; +#endif +static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, CYTHON_UNUSED int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); + case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); + case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); +#ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(__Pyx_st_longlong) - sizeof(PY_LONG_LONG); +#endif + case 'f': return sizeof(__Pyx_st_float) - sizeof(float); + case 'd': return sizeof(__Pyx_st_double) - sizeof(double); + case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double); + case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} +/* These are for computing the padding at the end of the struct to align + on the first member of the struct. This will probably the same as above, + but we don't have any guarantees. + */ +typedef struct { short x; char c; } __Pyx_pad_short; +typedef struct { int x; char c; } __Pyx_pad_int; +typedef struct { long x; char c; } __Pyx_pad_long; +typedef struct { float x; char c; } __Pyx_pad_float; +typedef struct { double x; char c; } __Pyx_pad_double; +typedef struct { long double x; char c; } __Pyx_pad_longdouble; +typedef struct { void *x; char c; } __Pyx_pad_void_p; +#ifdef HAVE_LONG_LONG +typedef struct { PY_LONG_LONG x; char c; } __Pyx_pad_longlong; +#endif +static size_t __Pyx_BufFmt_TypeCharToPadding(char ch, CYTHON_UNUSED int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': case 's': case 'p': return 1; + case 'h': case 'H': return sizeof(__Pyx_pad_short) - sizeof(short); + case 'i': case 'I': return sizeof(__Pyx_pad_int) - sizeof(int); + case 'l': case 'L': return sizeof(__Pyx_pad_long) - sizeof(long); +#ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(__Pyx_pad_longlong) - sizeof(PY_LONG_LONG); +#endif + case 'f': return sizeof(__Pyx_pad_float) - sizeof(float); + case 'd': return sizeof(__Pyx_pad_double) - sizeof(double); + case 'g': return sizeof(__Pyx_pad_longdouble) - sizeof(long double); + case 'P': case 'O': return sizeof(__Pyx_pad_void_p) - sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} +static char __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { + switch (ch) { + case 'c': + return 'H'; + case 'b': case 'h': case 'i': + case 'l': case 'q': case 's': case 'p': + return 'I'; + case 'B': case 'H': case 'I': case 'L': case 'Q': + return 'U'; + case 'f': case 'd': case 'g': + return (is_complex ? 'C' : 'R'); + case 'O': + return 'O'; + case 'P': + return 'P'; + default: { + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } + } +} +static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { + if (ctx->head == NULL || ctx->head->field == &ctx->root) { + const char* expected; + const char* quote; + if (ctx->head == NULL) { + expected = "end"; + quote = ""; + } else { + expected = ctx->head->field->type->name; + quote = "'"; + } + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch, expected %s%s%s but got %s", + quote, expected, quote, + __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex)); + } else { + __Pyx_StructField* field = ctx->head->field; + __Pyx_StructField* parent = (ctx->head - 1)->field; + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'", + field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex), + parent->type->name, field->name); + } +} +static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { + char group; + size_t size, offset, arraysize = 1; + if (ctx->enc_type == 0) return 0; + if (ctx->head->field->type->arraysize[0]) { + int i, ndim = 0; + if (ctx->enc_type == 's' || ctx->enc_type == 'p') { + ctx->is_valid_array = ctx->head->field->type->ndim == 1; + ndim = 1; + if (ctx->enc_count != ctx->head->field->type->arraysize[0]) { + PyErr_Format(PyExc_ValueError, + "Expected a dimension of size %zu, got %zu", + ctx->head->field->type->arraysize[0], ctx->enc_count); + return -1; + } + } + if (!ctx->is_valid_array) { + PyErr_Format(PyExc_ValueError, "Expected %d dimensions, got %d", + ctx->head->field->type->ndim, ndim); + return -1; + } + for (i = 0; i < ctx->head->field->type->ndim; i++) { + arraysize *= ctx->head->field->type->arraysize[i]; + } + ctx->is_valid_array = 0; + ctx->enc_count = 1; + } + group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); + do { + __Pyx_StructField* field = ctx->head->field; + __Pyx_TypeInfo* type = field->type; + if (ctx->enc_packmode == '@' || ctx->enc_packmode == '^') { + size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); + } else { + size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); + } + if (ctx->enc_packmode == '@') { + size_t align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); + size_t align_mod_offset; + if (align_at == 0) return -1; + align_mod_offset = ctx->fmt_offset % align_at; + if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; + if (ctx->struct_alignment == 0) + ctx->struct_alignment = __Pyx_BufFmt_TypeCharToPadding(ctx->enc_type, + ctx->is_complex); + } + if (type->size != size || type->typegroup != group) { + if (type->typegroup == 'C' && type->fields != NULL) { + size_t parent_offset = ctx->head->parent_offset + field->offset; + ++ctx->head; + ctx->head->field = type->fields; + ctx->head->parent_offset = parent_offset; + continue; + } + if ((type->typegroup == 'H' || group == 'H') && type->size == size) { + } else { + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } + } + offset = ctx->head->parent_offset + field->offset; + if (ctx->fmt_offset != offset) { + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch; next field is at offset %" CYTHON_FORMAT_SSIZE_T "d but %" CYTHON_FORMAT_SSIZE_T "d expected", + (Py_ssize_t)ctx->fmt_offset, (Py_ssize_t)offset); + return -1; + } + ctx->fmt_offset += size; + if (arraysize) + ctx->fmt_offset += (arraysize - 1) * size; + --ctx->enc_count; /* Consume from buffer string */ + while (1) { + if (field == &ctx->root) { + ctx->head = NULL; + if (ctx->enc_count != 0) { + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } + break; /* breaks both loops as ctx->enc_count == 0 */ + } + ctx->head->field = ++field; + if (field->type == NULL) { + --ctx->head; + field = ctx->head->field; + continue; + } else if (field->type->typegroup == 'S') { + size_t parent_offset = ctx->head->parent_offset + field->offset; + if (field->type->fields->type == NULL) continue; /* empty struct */ + field = field->type->fields; + ++ctx->head; + ctx->head->field = field; + ctx->head->parent_offset = parent_offset; + break; + } else { + break; + } + } + } while (ctx->enc_count); + ctx->enc_type = 0; + ctx->is_complex = 0; + return 0; +} +static CYTHON_INLINE PyObject * +__pyx_buffmt_parse_array(__Pyx_BufFmt_Context* ctx, const char** tsp) +{ + const char *ts = *tsp; + int i = 0, number; + int ndim = ctx->head->field->type->ndim; +; + ++ts; + if (ctx->new_count != 1) { + PyErr_SetString(PyExc_ValueError, + "Cannot handle repeated arrays in format string"); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + while (*ts && *ts != ')') { + if (isspace(*ts)) + continue; + number = __Pyx_BufFmt_ExpectNumber(&ts); + if (number == -1) return NULL; + if (i < ndim && (size_t) number != ctx->head->field->type->arraysize[i]) + return PyErr_Format(PyExc_ValueError, + "Expected a dimension of size %zu, got %d", + ctx->head->field->type->arraysize[i], number); + if (*ts != ',' && *ts != ')') + return PyErr_Format(PyExc_ValueError, + "Expected a comma in format string, got '%c'", *ts); + if (*ts == ',') ts++; + i++; + } + if (i != ndim) + return PyErr_Format(PyExc_ValueError, "Expected %d dimension(s), got %d", + ctx->head->field->type->ndim, i); + if (!*ts) { + PyErr_SetString(PyExc_ValueError, + "Unexpected end of format string, expected ')'"); + return NULL; + } + ctx->is_valid_array = 1; + ctx->new_count = 1; + *tsp = ++ts; + return Py_None; +} +static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { + int got_Z = 0; + while (1) { + switch(*ts) { + case 0: + if (ctx->enc_type != 0 && ctx->head == NULL) { + __Pyx_BufFmt_RaiseExpected(ctx); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + if (ctx->head != NULL) { + __Pyx_BufFmt_RaiseExpected(ctx); + return NULL; + } + return ts; + case ' ': + case 10: + case 13: + ++ts; + break; + case '<': + if (!__Pyx_IsLittleEndian()) { + PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); + return NULL; + } + ctx->new_packmode = '='; + ++ts; + break; + case '>': + case '!': + if (__Pyx_IsLittleEndian()) { + PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); + return NULL; + } + ctx->new_packmode = '='; + ++ts; + break; + case '=': + case '@': + case '^': + ctx->new_packmode = *ts++; + break; + case 'T': /* substruct */ + { + const char* ts_after_sub; + size_t i, struct_count = ctx->new_count; + size_t struct_alignment = ctx->struct_alignment; + ctx->new_count = 1; + ++ts; + if (*ts != '{') { + PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_type = 0; /* Erase processed last struct element */ + ctx->enc_count = 0; + ctx->struct_alignment = 0; + ++ts; + ts_after_sub = ts; + for (i = 0; i != struct_count; ++i) { + ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); + if (!ts_after_sub) return NULL; + } + ts = ts_after_sub; + if (struct_alignment) ctx->struct_alignment = struct_alignment; + } + break; + case '}': /* end of substruct; either repeat or move on */ + { + size_t alignment = ctx->struct_alignment; + ++ts; + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_type = 0; /* Erase processed last struct element */ + if (alignment && ctx->fmt_offset % alignment) { + ctx->fmt_offset += alignment - (ctx->fmt_offset % alignment); + } + } + return ts; + case 'x': + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->fmt_offset += ctx->new_count; + ctx->new_count = 1; + ctx->enc_count = 0; + ctx->enc_type = 0; + ctx->enc_packmode = ctx->new_packmode; + ++ts; + break; + case 'Z': + got_Z = 1; + ++ts; + if (*ts != 'f' && *ts != 'd' && *ts != 'g') { + __Pyx_BufFmt_RaiseUnexpectedChar('Z'); + return NULL; + } /* fall through */ + case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': + case 'l': case 'L': case 'q': case 'Q': + case 'f': case 'd': case 'g': + case 'O': case 's': case 'p': + if (ctx->enc_type == *ts && got_Z == ctx->is_complex && + ctx->enc_packmode == ctx->new_packmode) { + ctx->enc_count += ctx->new_count; + } else { + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_count = ctx->new_count; + ctx->enc_packmode = ctx->new_packmode; + ctx->enc_type = *ts; + ctx->is_complex = got_Z; + } + ++ts; + ctx->new_count = 1; + got_Z = 0; + break; + case ':': + ++ts; + while(*ts != ':') ++ts; + ++ts; + break; + case '(': + if (!__pyx_buffmt_parse_array(ctx, &ts)) return NULL; + break; + default: + { + int number = __Pyx_BufFmt_ExpectNumber(&ts); + if (number == -1) return NULL; + ctx->new_count = (size_t)number; + } + } + } +} +static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { + buf->buf = NULL; + buf->obj = NULL; + buf->strides = __Pyx_zeros; + buf->shape = __Pyx_zeros; + buf->suboffsets = __Pyx_minusones; +} +static CYTHON_INLINE int __Pyx_GetBufferAndValidate( + Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, + int nd, int cast, __Pyx_BufFmt_StackElem* stack) +{ + if (obj == Py_None || obj == NULL) { + __Pyx_ZeroBuffer(buf); + return 0; + } + buf->buf = NULL; + if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail; + if (buf->ndim != nd) { + PyErr_Format(PyExc_ValueError, + "Buffer has wrong number of dimensions (expected %d, got %d)", + nd, buf->ndim); + goto fail; + } + if (!cast) { + __Pyx_BufFmt_Context ctx; + __Pyx_BufFmt_Init(&ctx, stack, dtype); + if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; + } + if ((unsigned)buf->itemsize != dtype->size) { + PyErr_Format(PyExc_ValueError, + "Item size of buffer (%" CYTHON_FORMAT_SSIZE_T "d byte%s) does not match size of '%s' (%" CYTHON_FORMAT_SSIZE_T "d byte%s)", + buf->itemsize, (buf->itemsize > 1) ? "s" : "", + dtype->name, (Py_ssize_t)dtype->size, (dtype->size > 1) ? "s" : ""); + goto fail; + } + if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; + return 0; +fail:; + __Pyx_ZeroBuffer(buf); + return -1; +} +static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { + if (info->buf == NULL) return; + if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; + __Pyx_ReleaseBuffer(info); +} + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_Restore(type, value, tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#else + PyErr_Fetch(type, value, tb); +#endif +} + +static void __Pyx_RaiseArgtupleInvalid( + const char* func_name, + int exact, + Py_ssize_t num_min, + Py_ssize_t num_max, + Py_ssize_t num_found) +{ + Py_ssize_t num_expected; + const char *more_or_less; + if (num_found < num_min) { + num_expected = num_min; + more_or_less = "at least"; + } else { + num_expected = num_max; + more_or_less = "at most"; + } + if (exact) { + more_or_less = "exactly"; + } + PyErr_Format(PyExc_TypeError, + "%s() takes %s %" CYTHON_FORMAT_SSIZE_T "d positional argument%s (%" CYTHON_FORMAT_SSIZE_T "d given)", + func_name, more_or_less, num_expected, + (num_expected == 1) ? "" : "s", num_found); +} + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, + PyObject* kw_name) +{ + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION >= 3 + "%s() got multiple values for keyword argument '%U'", func_name, kw_name); + #else + "%s() got multiple values for keyword argument '%s'", func_name, + PyString_AsString(kw_name)); + #endif +} + +static int __Pyx_ParseOptionalKeywords( + PyObject *kwds, + PyObject **argnames[], + PyObject *kwds2, + PyObject *values[], + Py_ssize_t num_pos_args, + const char* function_name) +{ + PyObject *key = 0, *value = 0; + Py_ssize_t pos = 0; + PyObject*** name; + PyObject*** first_kw_arg = argnames + num_pos_args; + while (PyDict_Next(kwds, &pos, &key, &value)) { + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; + continue; + } + name = first_kw_arg; + #if PY_MAJOR_VERSION < 3 + if (likely(PyString_CheckExact(key)) || likely(PyString_Check(key))) { + while (*name) { + if ((CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**name) == PyString_GET_SIZE(key)) + && _PyString_Eq(**name, key)) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + if ((**argname == key) || ( + (CYTHON_COMPILING_IN_PYPY || PyString_GET_SIZE(**argname) == PyString_GET_SIZE(key)) + && _PyString_Eq(**argname, key))) { + goto arg_passed_twice; + } + argname++; + } + } + } else + #endif + if (likely(PyUnicode_Check(key))) { + while (*name) { + int cmp = (**name == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**name) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**name, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) { + values[name-argnames] = value; + break; + } + name++; + } + if (*name) continue; + else { + PyObject*** argname = argnames; + while (argname != first_kw_arg) { + int cmp = (**argname == key) ? 0 : + #if !CYTHON_COMPILING_IN_PYPY && PY_MAJOR_VERSION >= 3 + (PyUnicode_GET_SIZE(**argname) != PyUnicode_GET_SIZE(key)) ? 1 : + #endif + PyUnicode_Compare(**argname, key); + if (cmp < 0 && unlikely(PyErr_Occurred())) goto bad; + if (cmp == 0) goto arg_passed_twice; + argname++; + } + } + } else + goto invalid_keyword_type; + if (kwds2) { + if (unlikely(PyDict_SetItem(kwds2, key, value))) goto bad; + } else { + goto invalid_keyword; + } + } + return 0; +arg_passed_twice: + __Pyx_RaiseDoubleKeywordsError(function_name, key); + goto bad; +invalid_keyword_type: + PyErr_Format(PyExc_TypeError, + "%s() keywords must be strings", function_name); + goto bad; +invalid_keyword: + PyErr_Format(PyExc_TypeError, + #if PY_MAJOR_VERSION < 3 + "%s() got an unexpected keyword argument '%s'", + function_name, PyString_AsString(key)); + #else + "%s() got an unexpected keyword argument '%U'", + function_name, key); + #endif +bad: + return -1; +} + +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact) +{ + if (!type) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (none_allowed && obj == Py_None) return 1; + else if (exact) { + if (Py_TYPE(obj) == type) return 1; + } + else { + if (PyObject_TypeCheck(obj, type)) return 1; + } + PyErr_Format(PyExc_TypeError, + "Argument '%s' has incorrect type (expected %s, got %s)", + name, type->tp_name, Py_TYPE(obj)->tp_name); + return 0; +} + +static CYTHON_INLINE PyObject* __Pyx_PyObject_GetSlice( + PyObject* obj, Py_ssize_t cstart, Py_ssize_t cstop, + PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice, + int has_cstart, int has_cstop, CYTHON_UNUSED int wraparound) { +#if CYTHON_COMPILING_IN_CPYTHON + PyMappingMethods* mp; +#if PY_MAJOR_VERSION < 3 + PySequenceMethods* ms = Py_TYPE(obj)->tp_as_sequence; + if (likely(ms && ms->sq_slice)) { + if (!has_cstart) { + if (_py_start && (*_py_start != Py_None)) { + cstart = __Pyx_PyIndex_AsSsize_t(*_py_start); + if ((cstart == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; + } else + cstart = 0; + } + if (!has_cstop) { + if (_py_stop && (*_py_stop != Py_None)) { + cstop = __Pyx_PyIndex_AsSsize_t(*_py_stop); + if ((cstop == (Py_ssize_t)-1) && PyErr_Occurred()) goto bad; + } else + cstop = PY_SSIZE_T_MAX; + } + if (wraparound && unlikely((cstart < 0) | (cstop < 0)) && likely(ms->sq_length)) { + Py_ssize_t l = ms->sq_length(obj); + if (likely(l >= 0)) { + if (cstop < 0) { + cstop += l; + if (cstop < 0) cstop = 0; + } + if (cstart < 0) { + cstart += l; + if (cstart < 0) cstart = 0; + } + } else { + if (PyErr_ExceptionMatches(PyExc_OverflowError)) + PyErr_Clear(); + else + goto bad; + } + } + return ms->sq_slice(obj, cstart, cstop); + } +#endif + mp = Py_TYPE(obj)->tp_as_mapping; + if (likely(mp && mp->mp_subscript)) +#endif + { + PyObject* result; + PyObject *py_slice, *py_start, *py_stop; + if (_py_slice) { + py_slice = *_py_slice; + } else { + PyObject* owned_start = NULL; + PyObject* owned_stop = NULL; + if (_py_start) { + py_start = *_py_start; + } else { + if (has_cstart) { + owned_start = py_start = PyInt_FromSsize_t(cstart); + if (unlikely(!py_start)) goto bad; + } else + py_start = Py_None; + } + if (_py_stop) { + py_stop = *_py_stop; + } else { + if (has_cstop) { + owned_stop = py_stop = PyInt_FromSsize_t(cstop); + if (unlikely(!py_stop)) { + Py_XDECREF(owned_start); + goto bad; + } + } else + py_stop = Py_None; + } + py_slice = PySlice_New(py_start, py_stop, Py_None); + Py_XDECREF(owned_start); + Py_XDECREF(owned_stop); + if (unlikely(!py_slice)) goto bad; + } +#if CYTHON_COMPILING_IN_CPYTHON + result = mp->mp_subscript(obj, py_slice); +#else + result = PyObject_GetItem(obj, py_slice); +#endif + if (!_py_slice) { + Py_DECREF(py_slice); + } + return result; + } + PyErr_Format(PyExc_TypeError, + "'%.200s' object is unsliceable", Py_TYPE(obj)->tp_name); +bad: + return NULL; +} + +#if PY_MAJOR_VERSION < 3 +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, + CYTHON_UNUSED PyObject *cause) { + Py_XINCREF(type); + if (!value || value == Py_None) + value = NULL; + else + Py_INCREF(value); + if (!tb || tb == Py_None) + tb = NULL; + else { + Py_INCREF(tb); + if (!PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto raise_error; + } + } + #if PY_VERSION_HEX < 0x02050000 + if (PyClass_Check(type)) { + #else + if (PyType_Check(type)) { + #endif +#if CYTHON_COMPILING_IN_PYPY + if (!value) { + Py_INCREF(Py_None); + value = Py_None; + } +#endif + PyErr_NormalizeException(&type, &value, &tb); + } else { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto raise_error; + } + value = type; + #if PY_VERSION_HEX < 0x02050000 + if (PyInstance_Check(type)) { + type = (PyObject*) ((PyInstanceObject*)type)->in_class; + Py_INCREF(type); + } else { + type = 0; + PyErr_SetString(PyExc_TypeError, + "raise: exception must be an old-style class or instance"); + goto raise_error; + } + #else + type = (PyObject*) Py_TYPE(type); + Py_INCREF(type); + if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto raise_error; + } + #endif + } + __Pyx_ErrRestore(type, value, tb); + return; +raise_error: + Py_XDECREF(value); + Py_XDECREF(type); + Py_XDECREF(tb); + return; +} +#else /* Python 3+ */ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause) { + PyObject* owned_instance = NULL; + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (PyExceptionClass_Check(type)) { + PyObject *args; + if (!value) + args = PyTuple_New(0); + else if (PyTuple_Check(value)) { + Py_INCREF(value); + args = value; + } else + args = PyTuple_Pack(1, value); + if (!args) + goto bad; + owned_instance = PyEval_CallObject(type, args); + Py_DECREF(args); + if (!owned_instance) + goto bad; + value = owned_instance; + if (!PyExceptionInstance_Check(value)) { + PyErr_Format(PyExc_TypeError, + "calling %R should have returned an instance of " + "BaseException, not %R", + type, Py_TYPE(value)); + goto bad; + } + } else { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } +#if PY_VERSION_HEX >= 0x03030000 + if (cause) { +#else + if (cause && cause != Py_None) { +#endif + PyObject *fixed_cause; + if (cause == Py_None) { + fixed_cause = NULL; + } else if (PyExceptionClass_Check(cause)) { + fixed_cause = PyObject_CallObject(cause, NULL); + if (fixed_cause == NULL) + goto bad; + } else if (PyExceptionInstance_Check(cause)) { + fixed_cause = cause; + Py_INCREF(fixed_cause); + } else { + PyErr_SetString(PyExc_TypeError, + "exception causes must derive from " + "BaseException"); + goto bad; + } + PyException_SetCause(value, fixed_cause); + } + PyErr_SetObject(type, value); + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } +bad: + Py_XDECREF(owned_instance); + return; +} +#endif + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected) { + PyErr_Format(PyExc_ValueError, + "too many values to unpack (expected %" CYTHON_FORMAT_SSIZE_T "d)", expected); +} + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + "need more than %" CYTHON_FORMAT_SSIZE_T "d value%s to unpack", + index, (index == 1) ? "" : "s"); +} + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +static CYTHON_INLINE int __Pyx_IterFinish(void) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + PyObject* exc_type = tstate->curexc_type; + if (unlikely(exc_type)) { + if (likely(exc_type == PyExc_StopIteration) || PyErr_GivenExceptionMatches(exc_type, PyExc_StopIteration)) { + PyObject *exc_value, *exc_tb; + exc_value = tstate->curexc_value; + exc_tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; + Py_DECREF(exc_type); + Py_XDECREF(exc_value); + Py_XDECREF(exc_tb); + return 0; + } else { + return -1; + } + } + return 0; +#else + if (unlikely(PyErr_Occurred())) { + if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) { + PyErr_Clear(); + return 0; + } else { + return -1; + } + } + return 0; +#endif +} + +static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { + if (unlikely(retval)) { + Py_DECREF(retval); + __Pyx_RaiseTooManyValuesError(expected); + return -1; + } else { + return __Pyx_IterFinish(); + } + return 0; +} + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + if (unlikely(!type)) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(PyObject_TypeCheck(obj, type))) + return 1; + PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", + Py_TYPE(obj)->tp_name, type->tp_name); + return 0; +} + +#if PY_MAJOR_VERSION < 3 +static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { + #if PY_VERSION_HEX >= 0x02060000 + if (PyObject_CheckBuffer(obj)) return PyObject_GetBuffer(obj, view, flags); + #endif + if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) return __pyx_pw_5numpy_7ndarray_1__getbuffer__(obj, view, flags); + #if PY_VERSION_HEX < 0x02060000 + if (obj->ob_type->tp_dict) { + PyObject *getbuffer_cobj = PyObject_GetItem( + obj->ob_type->tp_dict, __pyx_n_s____pyx_getbuffer); + if (getbuffer_cobj) { + getbufferproc func = (getbufferproc) PyCObject_AsVoidPtr(getbuffer_cobj); + Py_DECREF(getbuffer_cobj); + if (!func) + goto fail; + return func(obj, view, flags); + } else { + PyErr_Clear(); + } + } + #endif + PyErr_Format(PyExc_TypeError, "'%100s' does not have the buffer interface", Py_TYPE(obj)->tp_name); +#if PY_VERSION_HEX < 0x02060000 +fail: +#endif + return -1; +} +static void __Pyx_ReleaseBuffer(Py_buffer *view) { + PyObject *obj = view->obj; + if (!obj) return; + #if PY_VERSION_HEX >= 0x02060000 + if (PyObject_CheckBuffer(obj)) { + PyBuffer_Release(view); + return; + } + #endif + if (PyObject_TypeCheck(obj, __pyx_ptype_5numpy_ndarray)) { __pyx_pw_5numpy_7ndarray_3__releasebuffer__(obj, view); return; } + #if PY_VERSION_HEX < 0x02060000 + if (obj->ob_type->tp_dict) { + PyObject *releasebuffer_cobj = PyObject_GetItem( + obj->ob_type->tp_dict, __pyx_n_s____pyx_releasebuffer); + if (releasebuffer_cobj) { + releasebufferproc func = (releasebufferproc) PyCObject_AsVoidPtr(releasebuffer_cobj); + Py_DECREF(releasebuffer_cobj); + if (!func) + goto fail; + func(obj, view); + return; + } else { + PyErr_Clear(); + } + } + #endif + goto nofail; +#if PY_VERSION_HEX < 0x02060000 +fail: +#endif + PyErr_WriteUnraisable(obj); +nofail: + Py_DECREF(obj); + view->obj = NULL; +} +#endif /* PY_MAJOR_VERSION < 3 */ + + + static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { + PyObject *empty_list = 0; + PyObject *module = 0; + PyObject *global_dict = 0; + PyObject *empty_dict = 0; + PyObject *list; + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_import; + py_import = __Pyx_PyObject_GetAttrStr(__pyx_b, __pyx_n_s____import__); + if (!py_import) + goto bad; + #endif + if (from_list) + list = from_list; + else { + empty_list = PyList_New(0); + if (!empty_list) + goto bad; + list = empty_list; + } + global_dict = PyModule_GetDict(__pyx_m); + if (!global_dict) + goto bad; + empty_dict = PyDict_New(); + if (!empty_dict) + goto bad; + #if PY_VERSION_HEX >= 0x02050000 + { + #if PY_MAJOR_VERSION >= 3 + if (level == -1) { + if (strchr(__Pyx_MODULE_NAME, '.')) { + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_level = PyInt_FromLong(1); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, global_dict, empty_dict, list, 1); + #endif + if (!module) { + if (!PyErr_ExceptionMatches(PyExc_ImportError)) + goto bad; + PyErr_Clear(); + } + } + level = 0; /* try absolute import on failure */ + } + #endif + if (!module) { + #if PY_VERSION_HEX < 0x03030000 + PyObject *py_level = PyInt_FromLong(level); + if (!py_level) + goto bad; + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, py_level, NULL); + Py_DECREF(py_level); + #else + module = PyImport_ImportModuleLevelObject( + name, global_dict, empty_dict, list, level); + #endif + } + } + #else + if (level>0) { + PyErr_SetString(PyExc_RuntimeError, "Relative import is not supported for Python <=2.4."); + goto bad; + } + module = PyObject_CallFunctionObjArgs(py_import, + name, global_dict, empty_dict, list, NULL); + #endif +bad: + #if PY_VERSION_HEX < 0x03030000 + Py_XDECREF(py_import); + #endif + Py_XDECREF(empty_list); + Py_XDECREF(empty_dict); + return module; +} + +static CYTHON_INLINE npy_ulonglong __Pyx_PyInt_from_py_npy_ulonglong(PyObject* x) { + const npy_ulonglong neg_one = (npy_ulonglong)-1, const_zero = (npy_ulonglong)0; + const int is_unsigned = const_zero < neg_one; + if (sizeof(npy_ulonglong) == sizeof(char)) { + if (is_unsigned) + return (npy_ulonglong)__Pyx_PyInt_AsUnsignedChar(x); + else + return (npy_ulonglong)__Pyx_PyInt_AsSignedChar(x); + } else if (sizeof(npy_ulonglong) == sizeof(short)) { + if (is_unsigned) + return (npy_ulonglong)__Pyx_PyInt_AsUnsignedShort(x); + else + return (npy_ulonglong)__Pyx_PyInt_AsSignedShort(x); + } else if (sizeof(npy_ulonglong) == sizeof(int)) { + if (is_unsigned) + return (npy_ulonglong)__Pyx_PyInt_AsUnsignedInt(x); + else + return (npy_ulonglong)__Pyx_PyInt_AsSignedInt(x); + } else if (sizeof(npy_ulonglong) == sizeof(long)) { + if (is_unsigned) + return (npy_ulonglong)__Pyx_PyInt_AsUnsignedLong(x); + else + return (npy_ulonglong)__Pyx_PyInt_AsSignedLong(x); + } else if (sizeof(npy_ulonglong) == sizeof(PY_LONG_LONG)) { + if (is_unsigned) + return (npy_ulonglong)__Pyx_PyInt_AsUnsignedLongLong(x); + else + return (npy_ulonglong)__Pyx_PyInt_AsSignedLongLong(x); + } else { + #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); + #else + npy_ulonglong val; + PyObject *v = __Pyx_PyNumber_Int(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } + #endif + return (npy_ulonglong)-1; + } +} + +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_ulonglong(npy_ulonglong val) { + const npy_ulonglong neg_one = (npy_ulonglong)-1, const_zero = (npy_ulonglong)0; + const int is_unsigned = const_zero < neg_one; + if ((sizeof(npy_ulonglong) == sizeof(char)) || + (sizeof(npy_ulonglong) == sizeof(short))) { + return PyInt_FromLong((long)val); + } else if ((sizeof(npy_ulonglong) == sizeof(int)) || + (sizeof(npy_ulonglong) == sizeof(long))) { + if (is_unsigned) + return PyLong_FromUnsignedLong((unsigned long)val); + else + return PyInt_FromLong((long)val); + } else if (sizeof(npy_ulonglong) == sizeof(PY_LONG_LONG)) { + if (is_unsigned) + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); + else + return PyLong_FromLongLong((PY_LONG_LONG)val); + } else { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + return _PyLong_FromByteArray(bytes, sizeof(npy_ulonglong), + little, !is_unsigned); + } +} + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return ::std::complex< float >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return x + y*(__pyx_t_float_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + __pyx_t_float_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +#if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrtf(z.real*z.real + z.imag*z.imag); + #else + return hypotf(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_powf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + float denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(a, a); + case 3: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, a); + case 4: + z = __Pyx_c_prodf(a, a); + return __Pyx_c_prodf(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_absf(a); + theta = atan2f(a.imag, a.real); + } + lnr = logf(r); + z_r = expf(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cosf(z_theta); + z.imag = z_r * sinf(z_theta); + return z; + } + #endif +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return ::std::complex< double >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return x + y*(__pyx_t_double_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + __pyx_t_double_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +#if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } + #if 1 + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { + #if !defined(HAVE_HYPOT) || defined(_MSC_VER) + return sqrt(z.real*z.real + z.imag*z.imag); + #else + return hypot(z.real, z.imag); + #endif + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_pow(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double r, lnr, theta, z_r, z_theta; + if (b.imag == 0 && b.real == (int)b.real) { + if (b.real < 0) { + double denom = a.real * a.real + a.imag * a.imag; + a.real = a.real / denom; + a.imag = -a.imag / denom; + b.real = -b.real; + } + switch ((int)b.real) { + case 0: + z.real = 1; + z.imag = 0; + return z; + case 1: + return a; + case 2: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(a, a); + case 3: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, a); + case 4: + z = __Pyx_c_prod(a, a); + return __Pyx_c_prod(z, z); + } + } + if (a.imag == 0) { + if (a.real == 0) { + return a; + } + r = a.real; + theta = 0; + } else { + r = __Pyx_c_abs(a); + theta = atan2(a.imag, a.real); + } + lnr = log(r); + z_r = exp(lnr * b.real - theta * b.imag); + z_theta = theta * b.real + lnr * b.imag; + z.real = z_r * cos(z_theta); + z.imag = z_r * sin(z_theta); + return z; + } + #endif +#endif + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsLongDouble(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(unsigned long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (unsigned long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)PyLong_AsUnsignedLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(unsigned long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(unsigned long) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(unsigned long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (unsigned long)PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(unsigned PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(unsigned PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (unsigned PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)PyLong_AsUnsignedLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(long) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (long)PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(signed long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (signed long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)PyLong_AsUnsignedLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(signed long)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(signed long) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(signed long) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (signed long)PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS +#include "longintrepr.h" +#endif +#endif +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_MAJOR_VERSION < 3 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return (signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)PyLong_AsUnsignedLongLong(x); + } else { +#if CYTHON_COMPILING_IN_CPYTHON && PY_MAJOR_VERSION >= 3 +#if CYTHON_USE_PYLONG_INTERNALS + if (sizeof(digit) <= sizeof(signed PY_LONG_LONG)) { + switch (Py_SIZE(x)) { + case 0: return 0; + case 1: return +(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + case -1: return -(signed PY_LONG_LONG) ((PyLongObject*)x)->ob_digit[0]; + } + } +#endif +#endif + return (signed PY_LONG_LONG)PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static int __Pyx_check_binary_version(void) { + char ctversion[4], rtversion[4]; + PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); + PyOS_snprintf(rtversion, 4, "%s", Py_GetVersion()); + if (ctversion[0] != rtversion[0] || ctversion[2] != rtversion[2]) { + char message[200]; + PyOS_snprintf(message, sizeof(message), + "compiletime version %s of module '%.100s' " + "does not match runtime version %s", + ctversion, __Pyx_MODULE_NAME, rtversion); + #if PY_VERSION_HEX < 0x02050000 + return PyErr_Warn(NULL, message); + #else + return PyErr_WarnEx(NULL, message, 1); + #endif + } + return 0; +} + +static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) { + PyObject *d = 0; + PyObject *cobj = 0; + union { + void (*fp)(void); + void *p; + } tmp; + d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__"); + if (!d) { + PyErr_Clear(); + d = PyDict_New(); + if (!d) + goto bad; + Py_INCREF(d); + if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0) + goto bad; + } + tmp.fp = f; +#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) + cobj = PyCapsule_New(tmp.p, sig, 0); +#else + cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0); +#endif + if (!cobj) + goto bad; + if (PyDict_SetItemString(d, name, cobj) < 0) + goto bad; + Py_DECREF(cobj); + Py_DECREF(d); + return 0; +bad: + Py_XDECREF(cobj); + Py_XDECREF(d); + return -1; +} + +#ifndef __PYX_HAVE_RT_ImportModule +#define __PYX_HAVE_RT_ImportModule +static PyObject *__Pyx_ImportModule(const char *name) { + PyObject *py_name = 0; + PyObject *py_module = 0; + py_name = __Pyx_PyIdentifier_FromString(name); + if (!py_name) + goto bad; + py_module = PyImport_Import(py_name); + Py_DECREF(py_name); + return py_module; +bad: + Py_XDECREF(py_name); + return 0; +} +#endif + +#ifndef __PYX_HAVE_RT_ImportType +#define __PYX_HAVE_RT_ImportType +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, + size_t size, int strict) +{ + PyObject *py_module = 0; + PyObject *result = 0; + PyObject *py_name = 0; + char warning[200]; + Py_ssize_t basicsize; +#ifdef Py_LIMITED_API + PyObject *py_basicsize; +#endif + py_module = __Pyx_ImportModule(module_name); + if (!py_module) + goto bad; + py_name = __Pyx_PyIdentifier_FromString(class_name); + if (!py_name) + goto bad; + result = PyObject_GetAttr(py_module, py_name); + Py_DECREF(py_name); + py_name = 0; + Py_DECREF(py_module); + py_module = 0; + if (!result) + goto bad; + if (!PyType_Check(result)) { + PyErr_Format(PyExc_TypeError, + "%s.%s is not a type object", + module_name, class_name); + goto bad; + } +#ifndef Py_LIMITED_API + basicsize = ((PyTypeObject *)result)->tp_basicsize; +#else + py_basicsize = PyObject_GetAttrString(result, "__basicsize__"); + if (!py_basicsize) + goto bad; + basicsize = PyLong_AsSsize_t(py_basicsize); + Py_DECREF(py_basicsize); + py_basicsize = 0; + if (basicsize == (Py_ssize_t)-1 && PyErr_Occurred()) + goto bad; +#endif + if (!strict && (size_t)basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility", + module_name, class_name); + #if PY_VERSION_HEX < 0x02050000 + if (PyErr_Warn(NULL, warning) < 0) goto bad; + #else + if (PyErr_WarnEx(NULL, warning, 0) < 0) goto bad; + #endif + } + else if ((size_t)basicsize != size) { + PyErr_Format(PyExc_ValueError, + "%s.%s has the wrong size, try recompiling", + module_name, class_name); + goto bad; + } + return (PyTypeObject *)result; +bad: + Py_XDECREF(py_module); + Py_XDECREF(result); + return NULL; +} +#endif + +static int __pyx_bisect_code_objects(__Pyx_CodeObjectCacheEntry* entries, int count, int code_line) { + int start = 0, mid = 0, end = count - 1; + if (end >= 0 && code_line > entries[end].code_line) { + return count; + } + while (start < end) { + mid = (start + end) / 2; + if (code_line < entries[mid].code_line) { + end = mid; + } else if (code_line > entries[mid].code_line) { + start = mid + 1; + } else { + return mid; + } + } + if (code_line <= entries[mid].code_line) { + return mid; + } else { + return mid + 1; + } +} +static PyCodeObject *__pyx_find_code_object(int code_line) { + PyCodeObject* code_object; + int pos; + if (unlikely(!code_line) || unlikely(!__pyx_code_cache.entries)) { + return NULL; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if (unlikely(pos >= __pyx_code_cache.count) || unlikely(__pyx_code_cache.entries[pos].code_line != code_line)) { + return NULL; + } + code_object = __pyx_code_cache.entries[pos].code_object; + Py_INCREF(code_object); + return code_object; +} +static void __pyx_insert_code_object(int code_line, PyCodeObject* code_object) { + int pos, i; + __Pyx_CodeObjectCacheEntry* entries = __pyx_code_cache.entries; + if (unlikely(!code_line)) { + return; + } + if (unlikely(!entries)) { + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Malloc(64*sizeof(__Pyx_CodeObjectCacheEntry)); + if (likely(entries)) { + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = 64; + __pyx_code_cache.count = 1; + entries[0].code_line = code_line; + entries[0].code_object = code_object; + Py_INCREF(code_object); + } + return; + } + pos = __pyx_bisect_code_objects(__pyx_code_cache.entries, __pyx_code_cache.count, code_line); + if ((pos < __pyx_code_cache.count) && unlikely(__pyx_code_cache.entries[pos].code_line == code_line)) { + PyCodeObject* tmp = entries[pos].code_object; + entries[pos].code_object = code_object; + Py_DECREF(tmp); + return; + } + if (__pyx_code_cache.count == __pyx_code_cache.max_count) { + int new_max = __pyx_code_cache.max_count + 64; + entries = (__Pyx_CodeObjectCacheEntry*)PyMem_Realloc( + __pyx_code_cache.entries, new_max*sizeof(__Pyx_CodeObjectCacheEntry)); + if (unlikely(!entries)) { + return; + } + __pyx_code_cache.entries = entries; + __pyx_code_cache.max_count = new_max; + } + for (i=__pyx_code_cache.count; i>pos; i--) { + entries[i] = entries[i-1]; + } + entries[pos].code_line = code_line; + entries[pos].code_object = code_object; + __pyx_code_cache.count++; + Py_INCREF(code_object); +} + +#include "compile.h" +#include "frameobject.h" +#include "traceback.h" +static PyCodeObject* __Pyx_CreateCodeObjectForTraceback( + const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_srcfile = 0; + PyObject *py_funcname = 0; + #if PY_MAJOR_VERSION < 3 + py_srcfile = PyString_FromString(filename); + #else + py_srcfile = PyUnicode_FromString(filename); + #endif + if (!py_srcfile) goto bad; + if (c_line) { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + #else + py_funcname = PyUnicode_FromFormat( "%s (%s:%d)", funcname, __pyx_cfilenm, c_line); + #endif + } + else { + #if PY_MAJOR_VERSION < 3 + py_funcname = PyString_FromString(funcname); + #else + py_funcname = PyUnicode_FromString(funcname); + #endif + } + if (!py_funcname) goto bad; + py_code = __Pyx_PyCode_New( + 0, /*int argcount,*/ + 0, /*int kwonlyargcount,*/ + 0, /*int nlocals,*/ + 0, /*int stacksize,*/ + 0, /*int flags,*/ + __pyx_empty_bytes, /*PyObject *code,*/ + __pyx_empty_tuple, /*PyObject *consts,*/ + __pyx_empty_tuple, /*PyObject *names,*/ + __pyx_empty_tuple, /*PyObject *varnames,*/ + __pyx_empty_tuple, /*PyObject *freevars,*/ + __pyx_empty_tuple, /*PyObject *cellvars,*/ + py_srcfile, /*PyObject *filename,*/ + py_funcname, /*PyObject *name,*/ + py_line, /*int firstlineno,*/ + __pyx_empty_bytes /*PyObject *lnotab*/ + ); + Py_DECREF(py_srcfile); + Py_DECREF(py_funcname); + return py_code; +bad: + Py_XDECREF(py_srcfile); + Py_XDECREF(py_funcname); + return NULL; +} +static void __Pyx_AddTraceback(const char *funcname, int c_line, + int py_line, const char *filename) { + PyCodeObject *py_code = 0; + PyObject *py_globals = 0; + PyFrameObject *py_frame = 0; + py_code = __pyx_find_code_object(c_line ? c_line : py_line); + if (!py_code) { + py_code = __Pyx_CreateCodeObjectForTraceback( + funcname, c_line, py_line, filename); + if (!py_code) goto bad; + __pyx_insert_code_object(c_line ? c_line : py_line, py_code); + } + py_globals = PyModule_GetDict(__pyx_m); + if (!py_globals) goto bad; + py_frame = PyFrame_New( + PyThreadState_GET(), /*PyThreadState *tstate,*/ + py_code, /*PyCodeObject *code,*/ + py_globals, /*PyObject *globals,*/ + 0 /*PyObject *locals*/ + ); + if (!py_frame) goto bad; + py_frame->f_lineno = py_line; + PyTraceBack_Here(py_frame); +bad: + Py_XDECREF(py_code); + Py_XDECREF(py_frame); +} + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { + while (t->p) { + #if PY_MAJOR_VERSION < 3 + if (t->is_unicode) { + *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); + } else if (t->intern) { + *t->p = PyString_InternFromString(t->s); + } else { + *t->p = PyString_FromStringAndSize(t->s, t->n - 1); + } + #else /* Python 3+ has unicode identifiers */ + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } + } else { + *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); + } + #endif + if (!*t->p) + return -1; + ++t; + } + return 0; +} + +static CYTHON_INLINE PyObject* __Pyx_PyUnicode_FromString(char* c_str) { + return __Pyx_PyUnicode_FromStringAndSize(c_str, strlen(c_str)); +} +static CYTHON_INLINE char* __Pyx_PyObject_AsString(PyObject* o) { + Py_ssize_t ignore; + return __Pyx_PyObject_AsStringAndSize(o, &ignore); +} +static CYTHON_INLINE char* __Pyx_PyObject_AsStringAndSize(PyObject* o, Py_ssize_t *length) { +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT + if ( +#if PY_MAJOR_VERSION < 3 && __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + __Pyx_sys_getdefaultencoding_not_ascii && +#endif + PyUnicode_Check(o)) { +#if PY_VERSION_HEX < 0x03030000 + char* defenc_c; + PyObject* defenc = _PyUnicode_AsDefaultEncodedString(o, NULL); + if (!defenc) return NULL; + defenc_c = PyBytes_AS_STRING(defenc); +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + { + char* end = defenc_c + PyBytes_GET_SIZE(defenc); + char* c; + for (c = defenc_c; c < end; c++) { + if ((unsigned char) (*c) >= 128) { + PyUnicode_AsASCIIString(o); + return NULL; + } + } + } +#endif /*__PYX_DEFAULT_STRING_ENCODING_IS_ASCII*/ + *length = PyBytes_GET_SIZE(defenc); + return defenc_c; +#else /* PY_VERSION_HEX < 0x03030000 */ + if (PyUnicode_READY(o) == -1) return NULL; +#if __PYX_DEFAULT_STRING_ENCODING_IS_ASCII + if (PyUnicode_IS_ASCII(o)) { + *length = PyUnicode_GET_DATA_SIZE(o); + return PyUnicode_AsUTF8(o); + } else { + PyUnicode_AsASCIIString(o); + return NULL; + } +#else /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */ + return PyUnicode_AsUTF8AndSize(o, length); +#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII */ +#endif /* PY_VERSION_HEX < 0x03030000 */ + } else +#endif /* __PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT */ + { + char* result; + int r = PyBytes_AsStringAndSize(o, &result, length); + if (r < 0) { + return NULL; + } else { + return result; + } + } +} +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { + int is_true = x == Py_True; + if (is_true | (x == Py_False) | (x == Py_None)) return is_true; + else return PyObject_IsTrue(x); +} +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_MAJOR_VERSION < 3 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_MAJOR_VERSION < 3 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_MAJOR_VERSION < 3 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; + } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; +} +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; +} +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif +} +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + if ((val != (unsigned PY_LONG_LONG)-1) || !PyErr_Occurred()) + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; +} + + +#endif /* Py_PYTHON_H */ diff --git a/sklearn/earth/_util.pxd b/sklearn/earth/_util.pxd new file mode 100644 index 0000000000000..c51e091f88314 --- /dev/null +++ b/sklearn/earth/_util.pxd @@ -0,0 +1,19 @@ +cimport numpy as cnp +ctypedef cnp.float64_t FLOAT_t +ctypedef cnp.intp_t INT_t +ctypedef cnp.ulong_t INDEX_t +ctypedef cnp.uint8_t BOOL_t + +cdef FLOAT_t log2(FLOAT_t x) + +cpdef apply_weights_2d(cnp.ndarray[FLOAT_t, ndim=2] B, cnp.ndarray[FLOAT_t, ndim=1] weights) + +cpdef apply_weights_1d(cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] weights) + +cpdef FLOAT_t gcv(FLOAT_t mse, INDEX_t basis_size, INDEX_t data_size, FLOAT_t penalty) + +cpdef FLOAT_t gcv_adjust(INDEX_t basis_size, INDEX_t data_size, FLOAT_t penalty) + +cpdef str_pad(string, length) + +cpdef ascii_table(header, data) \ No newline at end of file diff --git a/sklearn/earth/_util.pyx b/sklearn/earth/_util.pyx new file mode 100644 index 0000000000000..0b081f071a6ad --- /dev/null +++ b/sklearn/earth/_util.pyx @@ -0,0 +1,78 @@ +# distutils: language = c +# cython: cdivision = True +# cython: boundscheck = False +# cython: wraparound = False +# cython: profile = False + +import numpy as np +from libc.math cimport sqrt, log + +cdef FLOAT_t log2(FLOAT_t x): + return log(x) / log(2.0) + +cpdef apply_weights_2d(cnp.ndarray[FLOAT_t, ndim=2] B, cnp.ndarray[FLOAT_t, ndim=1] weights): + cdef INDEX_t i + cdef INDEX_t j + cdef INDEX_t m = B.shape[0] + cdef INDEX_t n = B.shape[1] + for i in range(m): + for j in range(n): + B[i,j] *= sqrt(weights[i]) + +cpdef apply_weights_1d(cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] weights): + cdef INDEX_t i + cdef INDEX_t m = y.shape[0] + for i in range(m): + y[i] *= sqrt(weights[i]) + +cpdef FLOAT_t gcv(FLOAT_t mse, INDEX_t basis_size, INDEX_t data_size, FLOAT_t penalty): + return mse * gcv_adjust(basis_size, data_size, penalty) + +cpdef FLOAT_t gcv_adjust(INDEX_t basis_size, INDEX_t data_size, FLOAT_t penalty): + return 1.0 / ((1 - ((basis_size + penalty*(basis_size - 1))/data_size)) ** 2) + +cpdef str_pad(string, length): + if len(string) >= length: + return string[0:length] + pad = length - len(string) + return string + ' '*pad + +cpdef ascii_table(header, data): + ''' + header - list of strings representing the header row + data - list of lists of strings representing data rows + ''' + m = len(data) + n = len(header) + column_widths = [len(head) for head in header] + for i, row in enumerate(data): + for j, col in enumerate(row): + if len(col) > column_widths[j]: + column_widths[j] = len(col) + + for j in range(n): + column_widths[j] += 1 + + result = '' + for j, col_width in enumerate(column_widths): + result += '-'*col_width + '-' + result += '\n' + for j, head in enumerate(header): + result += str_pad(head,column_widths[j]) + ' ' + result += '\n' + for j, col_width in enumerate(column_widths): + result += '-'*col_width + '-' + for i, row in enumerate(data): + result += '\n' + for j, item in enumerate(row): + result += str_pad(item,column_widths[j]) + ' ' + result += '\n' + for j, col_width in enumerate(column_widths): + result += '-'*col_width + '-' + return result + + + + + + diff --git a/sklearn/earth/earth.py b/sklearn/earth/earth.py new file mode 100644 index 0000000000000..98c52df996558 --- /dev/null +++ b/sklearn/earth/earth.py @@ -0,0 +1,651 @@ +from pyearth._forward import ForwardPasser +from pyearth._pruning import PruningPasser +from pyearth._util import ascii_table, gcv, apply_weights_2d, apply_weights_1d +from sklearn.base import RegressorMixin, BaseEstimator, TransformerMixin +from sklearn.utils.validation import assert_all_finite, safe_asarray +import numpy as np + +class Earth(BaseEstimator, RegressorMixin, TransformerMixin): + ''' + Multivariate Adaptive Regression Splines + + A flexible regression method that automatically searches for interactions and non-linear + relationships. Earth models can be thought of as linear models in a higher dimensional + basis space (specifically, a multivariate truncated power spline basis). Each term in an + Earth model is a product of so called "hinge functions". A hinge function is a function + that's equal to its argument where that argument is greater than zero and is zero everywhere + else. + + The multivariate adaptive regression splines algorithm has two stages. First, the + forward pass searches for terms in the truncated power spline basis that locally minimize + the squared error loss of the training set. Next, a pruning pass selects a subset of those + terms that produces a locally minimal generalized cross-validation (GCV) score. The GCV + score is not actually based on cross-validation, but rather is meant to approximate a true + cross-validation score by penalizing model complexity. The final result is a set of terms + that is nonlinear in the original feature space, may include interactions, and is likely to + generalize well. + + The Earth class supports dense input only. Data structures from the pandas and patsy + modules are supported, but are copied into numpy arrays for computation. No copy is + made if the inputs are numpy float64 arrays. Earth objects can be serialized using the + pickle module and copied using the copy module. + + + Parameters + ---------- + max_terms : int, optional (default=2*n + 10, where n is the number of features) + The maximum number of terms generated by the forward pass. + + + max_degree : int, optional (default=1) + The maximum degree of terms generated by the forward pass. + + + penalty : float, optional (default=3.0) + A smoothing parameter used to calculate GCV and GRSQ. Used during the pruning pass + and to determine whether to add a hinge or linear basis function during the forward + pass. See the d parameter in equation 32, Friedman, 1991. + + + endspan_alpha : float, optional, probability between 0 and 1 (default=0.05) + A parameter controlling the calculation of the endspan parameter (below). The + endspan parameter is calculated as round(3 - log2(endspan_alpha/n)), where n is the + number of features. The endspan_alpha parameter represents the probability of a run + of positive or negative error values on either end of the data vector of any feature + in the data set. See equation 45, Friedman, 1991. + + + endspan : int, optional (default=-1) + The number of extreme data values of each feature not eligible as knot locations. + If endspan is set to -1 (default) then the endspan parameter is calculated based on + endspan_alpah (above). If endspan is set to a positive integer then endspan_alpha + is ignored. + + + minspan_alpha : float, optional, probability between 0 and 1 (default=0.05) + A parameter controlling the calculation of the minspan parameter (below). The + minspan parameter is calculated as + + (int) -log2(-(1.0/(n*count))*log(1.0-minspan_alpha)) / 2.5 + + where n is the number of features and count is the number of points at which the + parent term is non-zero. The minspan_alpha parameter represents the probability of + a run of positive or negative error values between adjacent knots separated by + minspan intervening data points. See equation 43, Friedman, 1991. + + + minspan : int, optional (default=-1) + The minimal number of data points between knots. If minspan is set to -1 (default) + then the minspan parameter is calculated based on minspan_alpha (above). If minspan + is set to a positive integer then minspan_alpha is ignored. + + + thresh : float, optional (defaul=0.001) + Parameter used when evaluating stopping conditions for the forward pass. If either + RSQ > 1 - thresh or if RSQ increases by less than thresh for a forward pass iteration + then the forward pass is terminated. + + + min_searh_points : int, optional (default=100) + Used to calculate check_every (below). The minimum samples necessary for check_every + to be greater than 1. The check_every parameter is calculated as + + (int) m / min_search_points + + if m > min_search_points, where m is the number of samples in the training set. If + m <= min_search_points then check_every is set to 1. + + + check_every : int, optional (default=-1) + If check_every > 0, only one of every check_every sorted data points is considered as + a candidate knot. If check_every is set to -1 then the check_every parameter is + calculated based on min_search_points (above). + + + linvars : iterable of strings or ints, optional (empty by default) + Used to specify features that may only enter terms as linear basis functions (without + knots). Can include both column numbers an column names (see xlabels, below). + + + xlabels : iterable of strings, optional (empty by default) + The xlabels argument can be used to assign names to data columns. This argument is not + generally needed, as names can be captured automatically from most standard data + structures. If included, must have length n, where n is the number of features. Note + that column order is used to compute term values and make predictions, not column names. + + + Attributes + ---------- + `coef_` : array, shape = [pruned basis length] + The weights of the model terms that have not been pruned. + + + `basis_` : _basis.Basis + An object representing model terms. Each term is a product of constant, linear, and hinge + functions of the input features. + + + `forward_pass_record_` : _record.ForwardPassRecord + An object containing information about the forward pass, such as training loss function + values after each iteration and the final stopping condition. + + + `pruning_pass_record_` : _record.PruningPassRecord + An object containing information about the pruning pass, such as training loss function + values after each iteration and the selected optimal iteration. + + + **References:** + Friedman, Jerome. Multivariate Adaptive Regression Splines. Annals of Statistics. Volume 19, + Number 1 (1991), 1-67. + + ''' + + forward_pass_arg_names = set(['endspan','minspan','endspan_alpha','minspan_alpha', + 'max_terms','max_degree','thresh','penalty','check_every', + 'min_searh_points','xlabels','linvars']) + pruning_pass_arg_names = set(['penalty']) + + def __init__(self, endspan=None, minspan=None, endspan_alpha=None, minspan_alpha=None, max_terms=None, max_degree=None, + thresh=None, penalty=None, check_every=None, min_search_points=None, xlabels=None, linvars=None): + kwargs = {} + call = locals() + for name in self._get_param_names(): + if call[name] is not None: + kwargs[name] = call[name] + + self.set_params(**kwargs) + + def __eq__(self, other): + if self.__class__ is not other.__class__: + return False + keys = set(self.__dict__.keys() + other.__dict__.keys()) + for k in keys: + try: + v_self = self.__dict__[k] + v_other = other.__dict__[k] + except KeyError: + return False + try: + if v_self != v_other: + return False + except ValueError:#Case of numpy arrays + if np.any(v_self != v_other): + return False + return True + + def _pull_forward_args(self, **kwargs): + ''' + Pull named arguments relevant to the forward pass. + ''' + result = {} + for name in self.forward_pass_arg_names: + if name in kwargs: + result[name] = kwargs[name] + return result + + def _pull_pruning_args(self, **kwargs): + ''' + Pull named arguments relevant to the pruning pass. + ''' + result = {} + for name in self.pruning_pass_arg_names: + if name in kwargs: + result[name] = kwargs[name] + return result + + def _pull_unknown_args(self, **kwargs): + ''' + Pull unknown named arguments. Usually an exception is raised if any are + actually found, but raising exceptions is the responsibility of the caller. + ''' + result = {} + known_args = self.forward_pass_arg_names | self.pruning_pass_arg_names + for name in kwargs.iterkeys(): + if name not in known_args: + result[name] = kwargs[name] + return result + + def _scrub_x(self, X, **kwargs): + ''' + Sanitize input predictors and extract column names if appropriate. + ''' + no_labels = False + if 'xlabels' not in kwargs and 'xlabels' not in self.__dict__: + #Try to get xlabels from input data (for example, if X is a pandas DataFrame) + try: + self.xlabels = list(X.columns) + except AttributeError: + try: + self.xlabels = list(X.design_info.column_names) + except AttributeError: + try: + self.xlabels = list(X.dtype.names) + except TypeError: + no_labels = True + elif 'xlabels' not in self.__dict__: + self.xlabels = kwargs['xlabels'] + + #Convert to internally used data type + X = safe_asarray(X,dtype=np.float64) + if len(X.shape) == 1: + X = X.reshape((X.shape[0], 1)) + m,n = X.shape + + #Make up labels if none were found + if no_labels: + self.xlabels = ['x'+str(i) for i in range(n)] + + return X + + def _scrub(self, X, y, weights, **kwargs): + ''' + Sanitize input data. + ''' + #Check whether X is the output of patsy.dmatrices + if y is None and type(X) is tuple: + y, X = X + + #Handle X separately + X = self._scrub_x(X, **kwargs) + + #Convert y to internally used data type + y = safe_asarray(y,dtype=np.float64) + y = y.reshape(y.shape[0]) + + #Deal with weights + if weights is None: + weights = np.ones(y.shape[0], dtype=y.dtype) + else: + weights = safe_asarray(weights) + weights = weights.reshape(weights.shape[0]) + + #Make sure dimensions match + if y.shape[0] != X.shape[0]: + raise ValueError('X and y do not have compatible dimensions.') + if y.shape != weights.shape: + raise ValueError('y and weights do not have compatible dimensions.') + + #Make sure everything is finite + assert_all_finite(X) + assert_all_finite(y) + assert_all_finite(weights) + + return X, y, weights + + def fit(self, X, y = None, weights=None, xlabels=None, linvars=None): + ''' + Fit an Earth model to the input data X and y. + + + Parameters + ---------- + X : array-like, shape = [m, n] where m is the number of samples and n is the number of features + The training predictors. The X parameter can be a numpy array, a pandas DataFrame, a patsy + DesignMatrix, or a tuple of patsy DesignMatrix objects as output by patsy.dmatrices. + + + y : array-like, optional (default=None), shape = [m] where m is the number of samples + The training response. The y parameter can be a numpy array, a pandas DataFrame with one + column, a Patsy DesignMatrix, or can be left as None (default) if X was the output of a + call to patsy.dmatrices (in which case, X contains the response). + + + weights : array-like, optional (default=None), shape = [m] where m is the number of samples + Sample weights for training. Weights must be greater than or equal to zero. Rows with + greater weights contribute more strongly to the fitted model. Rows with zero weight do + not contribute at all. Weights are useful when dealing with heteroscedasticity. In such + cases, the weight should be proportional to the inverse of the (known) variance. + + + xlabels : iterable of strings, optional (default=None) + Convenient way to set the xlabels parameter while calling fit. Ignored if None (default). + See the Earth class for an explanation of the xlabels parameter. + + + linvars : iterable of ints or strings or both, optional (default=None) + Convenient way to set the linvars parameter while calling fit. Ignored if None (default). + See the Earth class for an explanation of the linvars parameter. + + ''' + #Format and label the data + if xlabels is not None: + self.set_params(xlabels=xlabels) + if linvars is not None: + self.set_params(linvars=linvars) + X, y, weights = self._scrub(X,y,weights,**self.__dict__) + + #Do the actual work + self.forward_pass(X, y, weights) + self.pruning_pass(X, y, weights) + self.linear_fit(X, y, weights) + return self + + def forward_pass(self, X, y = None, weights = None, **kwargs): + ''' + Perform the forward pass of the multivariate adaptive regression splines algorithm. Users + will normally want to call the fit method instead, which performs the forward pass, the pruning + pass, and a linear fit to determine the final model coefficients. + + + Parameters + ---------- + X : array-like, shape = [m, n] where m is the number of samples and n is the number of features + The training predictors. The X parameter can be a numpy array, a pandas DataFrame, a patsy + DesignMatrix, or a tuple of patsy DesignMatrix objects as output by patsy.dmatrices. + + + y : array-like, optional (default=None), shape = [m] where m is the number of samples + The training response. The y parameter can be a numpy array, a pandas DataFrame with one + column, a Patsy DesignMatrix, or can be left as None (default) if X was the output of a + call to patsy.dmatrices (in which case, X contains the response). + + + weights : array-like, optional (default=None), shape = [m] where m is the number of samples + Sample weights for training. Weights must be greater than or equal to zero. Rows with + greater weights contribute more strongly to the fitted model. Rows with zero weight do + not contribute at all. Weights are useful when dealing with heteroscedasticity. In such + cases, the weight should be proportional to the inverse of the (known) variance. + + + xlabels : iterable of strings, optional (default=None) + Convenient way to set the xlabels parameter while calling forward_pass. Ignored if None + (default). See the Earth class for an explanation of the xlabels parameter. + + + linvars : iterable of ints or strings or both, optional (default=None) + Convenient way to set the linvars parameter while calling forward_pass. Ignored if None + (default). See the Earth class for an explanation of the linvars parameter. + + + Note + ---- + The forward_pass method accepts all other named parameters listed in Earth.forward_pass_arg_names. + Passing these parameters to the forward_pass method sets them only for this call, and does not + change the parameters of the Earth object itself. To change the parameters of the object + itself, use the set_params method. + + ''' + + #Pull new labels and linear variables if necessary + if 'xlabels' in kwargs and 'xlabels' not in self.__dict__: + self.set_params(xlabels=kwargs['xlabels']) + del kwargs['xlabels'] + if 'linvars' in kwargs and 'linvars' not in self.__dict__: + self.set_params(linvars=kwargs['linvars']) + del kwargs['linvars'] + + #Label and format data + X, y, weights = self._scrub(X,y,weights,**self.__dict__) + + #Check for additional forward pass arguments, and fail if someone tried + #to use other arguments + args = self._pull_forward_args(**self.__dict__) + new_args = self._pull_forward_args(**kwargs) + if len(new_args) < len(kwargs): + msg = 'Invalid forward pass arguments: ' + for k, v in kwargs.iteritems(): + if k in new_args: + continue + msg += k+': '+str(v) + ',' + msg = msg[0:-1]+'.' + raise ValueError(msg) + args.update(new_args) + + #Do the actual work + args = self._pull_forward_args(**self.__dict__) + forward_passer = ForwardPasser(X, y, weights, **args) + forward_passer.run() + self.forward_pass_record_ = forward_passer.trace() + self.basis_ = forward_passer.get_basis() + + def pruning_pass(self, X, y = None, weights = None, **kwargs): + ''' + Perform the pruning pass of the multivariate adaptive regression splines algorithm. Users + will normally want to call the fit method instead, which performs the forward pass, the pruning + pass, and a linear fit to determine the final model coefficients. + + + Parameters + ---------- + X : array-like, shape = [m, n] where m is the number of samples and n is the number of features + The training predictors. The X parameter can be a numpy array, a pandas DataFrame, a patsy + DesignMatrix, or a tuple of patsy DesignMatrix objects as output by patsy.dmatrices. + + + y : array-like, optional (default=None), shape = [m] where m is the number of samples + The training response. The y parameter can be a numpy array, a pandas DataFrame with one + column, a Patsy DesignMatrix, or can be left as None (default) if X was the output of a + call to patsy.dmatrices (in which case, X contains the response). + + + weights : array-like, optional (default=None), shape = [m] where m is the number of samples + Sample weights for training. Weights must be greater than or equal to zero. Rows with + greater weights contribute more strongly to the fitted model. Rows with zero weight do + not contribute at all. Weights are useful when dealing with heteroscedasticity. In such + cases, the weight should be proportional to the inverse of the (known) variance. + + + Note + ---- + The pruning_pass method accepts all other named parameters listed in Earth.pruning_pass_arg_names. + Passing these parameters to the pruning_pass method sets them only for this call, and does not + change the parameters of the Earth object itself. To change the parameters of the object + itself, use the set_params method. + ''' + #Format data + X, y, weights = self._scrub(X,y,weights) + + #Check for additional pruning arguments and raise ValueError if other arguments are present + args = self._pull_pruning_args(**self.__dict__) + new_args = self._pull_pruning_args(**kwargs) + if len(new_args) < len(kwargs): + msg = 'Invalid pruning pass arguments: ' + for k, v in kwargs.iteritems(): + if k in new_args: + continue + msg += k+': '+str(v) + ',' + msg = msg[0:-1]+'.' + raise ValueError(msg) + args.update(new_args) + + #Do the actual work + pruning_passer = PruningPasser(self.basis_, X, y, weights, **args) + pruning_passer.run() + self.pruning_pass_record_ = pruning_passer.trace() + + def unprune(self, X, y = None): + '''Unprune all pruned basis functions and fit coefficients to X and y using the unpruned basis.''' + for bf in self.basis_: + bf.unprune() + del self.pruning_pass_record_ + self.linear_fit(X, y) + + def forward_trace(self): + '''Return information about the forward pass.''' + try: + return self.forward_pass_record_ + except AttributeError: + return None + + def pruning_trace(self): + '''Return information about the pruning pass.''' + try: + return self.pruning_pass_record_ + except AttributeError: + return None + + def trace(self): + '''Return information about the forward and pruning passes.''' + return EarthTrace(self.forward_trace(),self.pruning_trace()) + + def summary(self): + '''Return a string describing the model.''' + result = '' + if self.forward_trace() is None: + result += 'Untrained Earth Model' + return result + elif self.pruning_trace() is None: + result += 'Unpruned Earth Model\n' + else: + result += 'Earth Model\n' + header = ['Basis Function', 'Pruned', 'Coefficient'] + data = [] + i = 0 + for bf in self.basis_: + data.append([str(bf),'Yes' if bf.is_pruned() else 'No','%g'%self.coef_[i] if not bf.is_pruned() else 'None']) + if not bf.is_pruned(): + i += 1 + result += ascii_table(header,data) + if self.pruning_trace() is not None: + record = self.pruning_trace() + selection = record.get_selected() + else: + record = self.forward_trace() + selection = len(record) - 1 + result += '\n' + result += 'MSE: %.4f, GCV: %.4f, RSQ: %.4f, GRSQ: %.4f' % (record.mse(selection), record.gcv(selection), record.rsq(selection), record.grsq(selection)) + return result + + def linear_fit(self, X, y = None, weights = None): + ''' + Solve the linear least squares problem to determine the coefficients of the unpruned basis functions. + + + Parameters + ---------- + X : array-like, shape = [m, n] where m is the number of samples and n is the number of features + The training predictors. The X parameter can be a numpy array, a pandas DataFrame, a patsy + DesignMatrix, or a tuple of patsy DesignMatrix objects as output by patsy.dmatrices. + + + y : array-like, optional (default=None), shape = [m] where m is the number of samples + The training response. The y parameter can be a numpy array, a pandas DataFrame with one + column, a Patsy DesignMatrix, or can be left as None (default) if X was the output of a + call to patsy.dmatrices (in which case, X contains the response). + + + weights : array-like, optional (default=None), shape = [m] where m is the number of samples + Sample weights for training. Weights must be greater than or equal to zero. Rows with + greater weights contribute more strongly to the fitted model. Rows with zero weight do + not contribute at all. Weights are useful when dealing with heteroscedasticity. In such + cases, the weight should be proportional to the inverse of the (known) variance. + ''' + + #Format data + X, y, weights = self._scrub(X,y,weights) + + #Transform into basis space + B = self.transform(X) + + #Apply weights to B + apply_weights_2d(B,weights) + + #Apply weights to y + weighted_y = y.copy() + apply_weights_1d(weighted_y,weights) + + #Solve the linear least squares problem + self.coef_ = np.linalg.lstsq(B,weighted_y)[0] + + def predict(self, X): + ''' + Predict the response based on the input data X. + + + Parameters + ---------- + X : array-like, shape = [m, n] where m is the number of samples and n is the number of features + The training predictors. The X parameter can be a numpy array, a pandas DataFrame, or a + patsy DesignMatrix. + + ''' + X = self._scrub_x(X) + B = self.transform(X) + return np.dot(B,self.coef_) + + def score(self, X, y = None, weights = None): + ''' + Calculate the generalized r^2 of the model on data X and y. + + + Parameters + ---------- + X : array-like, shape = [m, n] where m is the number of samples and n is the number of features + The training predictors. The X parameter can be a numpy array, a pandas DataFrame, a patsy + DesignMatrix, or a tuple of patsy DesignMatrix objects as output by patsy.dmatrices. + + + y : array-like, optional (default=None), shape = [m] where m is the number of samples + The training response. The y parameter can be a numpy array, a pandas DataFrame with one + column, a Patsy DesignMatrix, or can be left as None (default) if X was the output of a + call to patsy.dmatrices (in which case, X contains the response). + + weights : array-like, optional (default=None), shape = [m] where m is the number of samples + Sample weights for training. Weights must be greater than or equal to zero. Rows with + greater weights contribute more strongly to the fitted model. Rows with zero weight do + not contribute at all. Weights are useful when dealing with heteroscedasticity. In such + cases, the weight should be proportional to the inverse of the (known) variance. + ''' + X, y, weights = self._scrub(X, y, weights) + y_hat = self.predict(X) + m, n = X.shape + residual = y-y_hat + mse = np.sum(weights * (residual**2)) / m + mse0 = np.sum(weights*((y -np.average(y,weights=weights))**2)) / m + return 1 - (mse/mse0) + + def transform(self, X): + ''' + Transform X into the basis space. Normally, users will call the predict method instead, which + both transforms into basis space calculates the weighted sum of basis terms to produce a + prediction of the response. Users may wish to call transform directly in some cases. For + example, users may wish to apply other statistical or machine learning algorithms, such as + generalized linear regression, in basis space. + + + Parameters + ---------- + X : array-like, shape = [m, n] where m is the number of samples and n is the number of features + The training predictors. The X parameter can be a numpy array, a pandas DataFrame, or a + patsy DesignMatrix. + ''' + X = self._scrub_x(X) + B = np.empty(shape=(X.shape[0],self.basis_.plen())) + self.basis_.transform(X,B) + return B + + def get_penalty(self): + '''Get the penalty parameter being used. Default is 3.''' + if 'penalty' in self.__dict__ and self.penalty is not None: + return self.penalty + else: + return 3.0 + + def __repr__(self): + result = 'Earth(' + first = True + for k, v in self.get_params().iteritems(): + if not first: + result += ', ' + else: + first = False + result += '%s=%s' % (str(k), str(v)) + result += ')' + return result + + def __str__(self): + return self.__repr__() + +class EarthTrace(object): + def __init__(self, forward_trace, pruning_trace): + self.forward_trace = forward_trace + self.pruning_trace = pruning_trace + + def __eq__(self, other): + return self.__class__ is other.__class__ and self.forward_trace == other.forward_trace and \ + self.pruning_trace == other.pruning_trace + + def __str__(self): + return str(self.forward_trace) + '\n' + str(self.pruning_trace) + diff --git a/sklearn/earth/setup.py b/sklearn/earth/setup.py new file mode 100644 index 0000000000000..06382706ec4a4 --- /dev/null +++ b/sklearn/earth/setup.py @@ -0,0 +1,27 @@ +import numpy +from numpy.distutils.misc_util import Configuration + +def configuration(parent_package="", top_path=None): + config = Configuration("earth", parent_package, top_path) + config.add_extension("_basis", + sources=["_basis.c"], + include_dirs=[numpy.get_include()]) + config.add_extension("_forward", + sources=["_forward.c"], + include_dirs=[numpy.get_include()]) + config.add_extension("_pruning", + sources=["_pruning.c"], + include_dirs=[numpy.get_include()]) + config.add_extension("_record", + sources=["_record.c"], + include_dirs=[numpy.get_include()]) + config.add_extension("_util", + sources=["_util.c"], + include_dirs=[numpy.get_include()]) + config.add_subpackage("tests") + + return config + +if __name__ == "__main__": + from numpy.distutils.core import setup + setup(**configuration().todict()) diff --git a/sklearn/earth/tests/__init__.py b/sklearn/earth/tests/__init__.py new file mode 100644 index 0000000000000..e69de29bb2d1d diff --git a/sklearn/earth/tests/earth_regress.txt b/sklearn/earth/tests/earth_regress.txt new file mode 100644 index 0000000000000..368630051f125 --- /dev/null +++ b/sklearn/earth/tests/earth_regress.txt @@ -0,0 +1,51 @@ +Forward Pass +--------------------------------------------------------------- +iter parent var knot mse terms gcv rsq grsq +--------------------------------------------------------------- +0 - - - 1.373069 1 1.401 0.000 0.000 +1 0 1 15 0.813502 3 0.901 0.408 0.357 +2 0 2 -1 0.738195 4 0.854 0.462 0.391 +3 0 8 11 0.702052 6 0.886 0.489 0.367 +4 0 6 -1 0.690954 7 0.913 0.497 0.348 +5 0 5 -1 0.679718 8 0.941 0.505 0.328 +6 0 3 -1 0.670745 9 0.974 0.511 0.305 +7 0 7 -1 0.666258 10 1.015 0.515 0.275 +8 0 0 -1 0.666124 11 1.067 0.515 0.238 +--------------------------------------------------------------- +Stopping Condition 2: Improvement below threshold + +Pruning Pass +-------------------------------------------- +iter bf terms mse gcv rsq grsq +-------------------------------------------- +0 - 11 0.67 1.067 0.515 0.238 +1 10 10 0.67 1.015 0.515 0.275 +2 9 9 0.67 0.974 0.511 0.305 +3 8 8 0.68 0.941 0.505 0.328 +4 7 7 0.69 0.913 0.497 0.348 +5 6 6 0.70 0.886 0.489 0.367 +6 5 5 0.72 0.871 0.475 0.379 +7 4 4 0.74 0.854 0.462 0.391 +8 3 3 0.81 0.901 0.408 0.357 +9 1 2 0.92 0.979 0.329 0.301 +10 2 1 1.37 1.401 0.000 0.000 +-------------------------------------------- +Selected iteration: 7 + +Earth Model +------------------------------------- +Basis Function Pruned Coefficient +------------------------------------- +(Intercept) No 1.17194 +h(x1-0.949246) No 2.00084 +h(0.949246-x1) No -0.630635 +x2 No 0.305197 +h(x8-1.38526) Yes None +h(1.38526-x8) Yes None +x6 Yes None +x5 Yes None +x3 Yes None +x7 Yes None +x0 Yes None +------------------------------------- +MSE: 0.7382, GCV: 0.8535, RSQ: 0.4624, GRSQ: 0.3908 \ No newline at end of file diff --git a/sklearn/earth/tests/forward_regress.txt b/sklearn/earth/tests/forward_regress.txt new file mode 100644 index 0000000000000..41d8931bf8780 --- /dev/null +++ b/sklearn/earth/tests/forward_regress.txt @@ -0,0 +1,27 @@ +(Intercept) +h(x1-0.949246) +h(0.949246-x1) +x2 +h(x8-1.38526) +h(1.38526-x8) +x6 +x5 +x3 +x7 +x0 + +Forward Pass +--------------------------------------------------------------- +iter parent var knot mse terms gcv rsq grsq +--------------------------------------------------------------- +0 - - - 1.373069 1 1.401 0.000 0.000 +1 0 1 15 0.813502 3 0.901 0.408 0.357 +2 0 2 -1 0.738195 4 0.854 0.462 0.391 +3 0 8 11 0.702052 6 0.886 0.489 0.367 +4 0 6 -1 0.690954 7 0.913 0.497 0.348 +5 0 5 -1 0.679718 8 0.941 0.505 0.328 +6 0 3 -1 0.670745 9 0.974 0.511 0.305 +7 0 7 -1 0.666258 10 1.015 0.515 0.275 +8 0 0 -1 0.666124 11 1.067 0.515 0.238 +--------------------------------------------------------------- +Stopping Condition 2: Improvement below threshold diff --git a/sklearn/earth/tests/test_basis.py b/sklearn/earth/tests/test_basis.py new file mode 100644 index 0000000000000..b6238f6a6ea23 --- /dev/null +++ b/sklearn/earth/tests/test_basis.py @@ -0,0 +1,117 @@ +''' +Created on Feb 17, 2013 + +@author: jasonrudy +''' +from nose.tools import assert_true, assert_false, assert_equal +from pyearth._basis import Basis, ConstantBasisFunction, HingeBasisFunction, LinearBasisFunction +import numpy +import pickle +import os + +class BaseTestClass(object): + def __init__(self): + numpy.random.seed(0) + data = numpy.genfromtxt(os.path.join(os.path.dirname(__file__),'test_data.csv'), + delimiter=',', skip_header=1) + self.y = numpy.array(data[:,5]) + self.X = numpy.array(data[:,0:5]) + +class TestConstantBasisFunction(BaseTestClass): + + def __init__(self): + super(self.__class__,self).__init__() + self.bf = ConstantBasisFunction() + + def test_apply(self): + m,n = self.X.shape + B = numpy.empty(shape=(m,10)) + + assert_false(numpy.all(B[:,0] == 1)) + self.bf.apply(self.X,B[:,0]) + assert_true(numpy.all(B[:,0] == 1)) + + def test_pickle_compatibility(self): + bf_copy = pickle.loads(pickle.dumps(self.bf)) + assert_true(self.bf == bf_copy) + +class TestHingeBasisFunction(BaseTestClass): + def __init__(self): + super(self.__class__,self).__init__() + self.parent = ConstantBasisFunction() + self.bf = HingeBasisFunction(self.parent,1.0,10,1,False) + + def test_getters(self): + assert self.bf.get_reverse() == False + assert self.bf.get_knot() == 1.0 + assert self.bf.get_variable() == 1 + assert self.bf.get_knot_idx() == 10 + assert self.bf.get_parent() == self.parent + + def test_apply(self): + m,n = self.X.shape + B = numpy.ones(shape=(m,10)) + self.bf.apply(self.X,B[:,0]) + assert_true(numpy.all(B[:,0] == (self.X[:,1] - 1.0) * (self.X[:,1] > 1.0))) + + def test_degree(self): + assert_equal(self.bf.degree(),1) + + def test_pickle_compatibility(self): + bf_copy = pickle.loads(pickle.dumps(self.bf)) + assert_true(self.bf == bf_copy) + +class TestLinearBasisFunction(BaseTestClass): + def __init__(self): + super(self.__class__,self).__init__() + parent = ConstantBasisFunction() + self.bf = LinearBasisFunction(parent,1) + + def test_apply(self): + m,n = self.X.shape + B = numpy.ones(shape=(m,10)) + self.bf.apply(self.X,B[:,0]) + assert_true(numpy.all(B[:,0] == self.X[:,1])) + + def test_degree(self): + assert_equal(self.bf.degree(),1) + + def test_pickle_compatibility(self): + bf_copy = pickle.loads(pickle.dumps(self.bf)) + assert_true(self.bf == bf_copy) + +class TestBasis(BaseTestClass): + def __init__(self): + super(self.__class__,self).__init__() + self.basis = Basis() + self.parent = ConstantBasisFunction() + self.bf = HingeBasisFunction(self.parent,1.0,10,1,False) + self.basis.append(self.parent) + self.basis.append(self.bf) + + def test_add(self): + assert_equal(len(self.basis),2) + + def test_translate_and_scale(self): + m,n = self.X.shape + numpy.random.seed(1) + B = numpy.empty(shape=(m,self.basis.plen())) + self.basis.transform(self.X,B) + B_ = numpy.empty(shape=(m,self.basis.plen())) + mu = numpy.mean(self.X,axis=0) + sigma = numpy.std(self.X,axis=0) + coeff = numpy.random.normal(size=B.shape[1]) + X_ = self.X * sigma + mu + coeff_ = coeff.copy() + self.basis.translate(sigma,mu) + self.basis.scale(sigma,mu,coeff_) + self.basis.transform(X_,B_) + assert_true(numpy.all((numpy.dot(B,coeff) - numpy.dot(B_,coeff_))**2 < 1e-12)) + + def test_pickle_compat(self): + basis_copy = pickle.loads(pickle.dumps(self.basis)) + assert_true(self.basis == basis_copy) + +if __name__ == '__main__': + import nose + nose.run(argv=[__file__, '-s', '-v']) diff --git a/sklearn/earth/tests/test_data.csv b/sklearn/earth/tests/test_data.csv new file mode 100644 index 0000000000000..81ded171c0d05 --- /dev/null +++ b/sklearn/earth/tests/test_data.csv @@ -0,0 +1,101 @@ +,x1,x2,x3,x4,y +0,43.599490214200372,168.01752905539175,0.54966247787870914,5.3532239261827685,1.1297150506376397 +1,42.036780208748901,665.30797852674027,0.2046486340378425,7.192709663506637,1.2713369428242232 +2,29.965467367452312,561.56026190867692,0.6211338327692949,6.2914209427703902,1.4850975083257041 +3,13.457994534493356,964.65939760630852,0.18443986564691528,8.8533514781667346,1.4953000345937923 +4,85.397529263948883,933.06293121890087,0.846561485357468,1.7964547700906099,1.4631020455675685 +5,50.524609012170394,232.31757947498625,0.42812232759738944,1.9653091566061256,1.1007702782292474 +6,12.715997170127746,1100.523659094282,0.22601200060423587,2.0694568430998297,1.5197173280758225 +7,22.03062070705597,697.14978338305832,0.46778748458230024,3.0174322626496535,1.5033445601444178 +8,64.040672521491487,914.82020234450215,0.50523672001854913,4.8689265111855935,1.4331168743198677 +9,79.363745444157701,1073.1748771988184,0.16229859850231387,8.0075234660715626,1.1432487611454192 +10,96.455108008925521,942.49145512022062,0.88952006394614491,4.4161365267110968,1.4562484984016864 +11,56.714412762770927,824.11483997236769,0.436747263026799,8.7655918499710026,1.414510544111284 +12,53.560417349765629,1683.72388440954,0.54420816014810214,1.820949222750248,1.5124095787831815 +13,36.634240167502043,1515.6370663391237,0.40627504304795081,1.2720236589484959,1.5113725053014444 +14,24.717723899735333,235.35264229889736,0.99385201142127289,10.705803133771735,1.4655130013848647 +15,80.02583511325868,1108.8091147978175,0.76495986045168152,2.6922544658417795,1.4767263034461056 +16,29.302323181943979,981.79412176895062,0.3566242811227589,1.4567896524540005,1.4873012780322354 +17,98.315344535721266,846.67353972446074,0.50400043937915262,4.2354131753469879,1.3443519921907898 +18,25.974475274713704,757.69792530898212,0.83201689963450087,8.3674705628711301,1.5296175850152098 +19,37.921056694163745,146.92919419462237,0.79740493903259357,3.6938879759630119,1.2577693248791448 +20,58.268488852903452,167.40444477138499,0.66220201926832578,4.8752342587328146,1.0868547000197621 +21,49.707379873451259,803.46557407006787,0.35087190130164048,6.509779053244193,1.3962687049291784 +22,97.29106898748249,309.89810937521673,0.31325852842971358,1.4179770981531006,0.78429139704278905 +23,73.839975862090029,1199.7944712348387,0.21463574639995364,5.1675344019533709,1.2915519005124272 +24,64.384193414819507,1206.278241921543,0.17047713348377069,9.8165223574854856,1.2673762639361186 +25,77.800815980846821,344.49507542459531,0.86891662643207879,8.4877787827685438,1.3165122722672742 +26,79.858565409908095,1013.287786221621,0.22083791506146189,10.184586465896006,1.2280106041472256 +27,59.208457766637636,691.28771196765126,0.26377852928001977,10.13915477165132,1.2568334102951819 +28,41.973546130682074,1008.1357886623166,0.60844215780504962,9.2624982843415786,1.5024742715099091 +29,62.356318456213074,414.34567303306642,0.59125735265354584,5.8926616699485912,1.3215571295292234 +30,54.790778009037666,1268.4203030312453,0.24581116390413071,2.8662714558648021,1.3968435575605214 +31,11.058314779616108,573.3746240396913,0.010250039399590904,7.2935972282958215,0.48848512011765227 +32,29.517230521974248,431.62028327847486,0.095288052260803724,3.8375580746525464,0.948291052430141 +33,21.492438413069525,592.2340141355902,0.47140985746967901,6.4949682108840801,1.493964996060547 +34,84.511311557470165,1740.5210094161948,0.048868086229351348,3.3211825143616394,0.78860895398958175 +35,64.331142724823522,389.4400333896524,0.8701458933690015,3.1740242630502591,1.3831880046821949 +36,74.175503888344892,1192.4564185889287,0.79888551150462961,1.312475622652616,1.4930896449101998 +37,22.957402874434518,1276.7630450157669,0.087562509001122835,1.3058948319431931,1.368261016889893 +38,35.713493369956076,1089.1481873897621,0.052222727384160228,1.6566366620637754,1.0101147923717795 +39,4.3501186059715646,771.19312047180301,0.66842704601605774,2.9802711181616961,1.5623576569691324 +40,87.626645170415912,832.02671712936331,0.61964146370996465,3.9042674293498836,1.4024404901819352 +41,61.525457346427629,1683.5894947019638,0.44801471652408964,3.0704983825331427,1.4894072650971031 +42,42.536729190538644,851.9327531051822,0.50761748667196138,6.2573324981095793,1.4727508306732644 +43,4.2429191882546125,394.26335861902976,0.45022717961737324,8.0797117061892081,1.5468981531588779 +44,77.758790830553366,1395.1610647361344,0.50277875250922144,10.567475933072476,1.460393868002404 +45,33.187371253987585,912.1873275789045,0.74837399934103632,9.5783951843951396,1.5222195816705415 +46,41.446005513291148,1512.0986444671671,0.44457094175070921,8.1574708428635425,1.5092202298531809 +47,0.84483635788197287,166.83346202488673,0.94045049354208854,2.0213794823119349,1.5654116764743224 +48,66.196779043970764,588.40317224341504,0.20084234377544541,4.8833418211475914,1.0601903754929445 +49,92.590159650849927,1057.2797254435752,0.91671461195788251,8.0226424081972496,1.4755551186558762 +50,50.121645168708696,952.42141882934163,0.21882078632937274,1.0466352273504989,1.3347814583500877 +51,41.783624400271577,1046.0107958571264,0.87656186842332706,7.7758484022790944,1.5252569521812418 +52,84.233304610347119,1638.6668835657422,0.94111587363362226,9.1601915192439396,1.5162307488602251 +53,13.139460547944381,691.9282666193011,0.2085024945255225,9.6738153715652349,1.4799705457454786 +54,79.233021930625796,695.80262118445432,0.56914053205563542,9.0513154025570159,1.373325112134129 +55,83.316124473397622,461.85405604761195,0.7306802005261156,9.0341416415944895,1.3287501970473858 +56,4.3129036353362737,300.76807022306298,0.43508364985882764,3.208812218607441,1.537849657136791 +57,88.062206616568076,1301.3655484690632,0.713007293546981,8.6985965699270196,1.4761731652796777 +58,33.074702616940478,499.12785574456325,0.62634395920102637,5.1447924952538919,1.4653918027366943 +59,93.678107223418593,1175.192081886714,0.3869003430123682,9.5511966080419057,1.3676095804869888 +60,38.079258371620803,416.9556655484522,0.78165942566608138,5.7220858741580143,1.4544863401972903 +61,25.948040440427711,1256.7866259336176,0.98048507899877846,3.4625358896778984,1.5497421662642135 +62,79.024380259404523,1371.0360436135713,0.12003979217741401,9.3890259455900065,1.1231452260421266 +63,46.173890475653167,331.14371718490827,0.53634347309606856,3.9651275079462902,1.3164476345244571 +64,17.57241932567306,255.10941472150532,0.19889909182949916,5.2958861905641381,1.2374029218521734 +65,64.181176362883164,268.40879494821309,0.71573058777096521,2.0174481096338206,1.2483635075582606 +66,17.559907090882188,1290.9659113904681,0.88526367441048914,10.831383610430724,1.5554324559039934 +67,65.290695070121458,906.10727496154846,0.087787554884994456,6.5895079469727671,0.88349792606034916 +68,18.115022940864645,966.00540791086814,0.60893014893439157,9.3321249012260417,1.540010225121146 +69,32.375058225614652,1741.0966877926312,0.99495025996779318,9.2615081943979671,1.5521094914523137 +70,69.41525454251834,1324.2073630319194,0.8752688098046626,10.515101483457324,1.5109773403955418 +71,85.226292659755117,1172.7191296517713,0.073498384714436593,7.2338471429583864,0.79103662938713226 +72,35.321389178551854,394.85070848243845,0.89316618656704339,9.2489048120667938,1.4709741466986235 +73,52.663842385283331,882.76747093432482,0.48930128812712559,3.60720019719452,1.4494708771682183 +74,40.263792313314738,839.01992696466721,0.015056134248370046,9.9290588307871577,0.30401221390383193 +75,2.9149317847511735,734.83202953690954,0.09587331469277216,2.969643203500385,1.5294442092384655 +76,94.242061239714317,732.18275455239154,0.72900080182147697,2.2616010862902147,1.3960352705744583 +77,25.128292170720933,1565.274520614033,0.90329615048901546,3.87635258215888,1.5530259502567871 +78,96.711313151229632,1217.0896077711188,0.50300677353432655,4.7800240864855548,1.414118748214515 +79,33.73682942964583,1680.8952215019413,0.69333382858922288,6.3410170007333724,1.5418562287011579 +80,4.3489697936277434,530.06979251124858,0.94317072266720825,6.568601662432533,1.5620976675187246 +81,35.751823235523204,141.1021036455474,0.25354826722492296,3.5422669015053678,0.78571091574943486 +82,17.068552603402608,689.23268976152656,0.20264905134772382,1.6290154018084104,1.4491942594415783 +83,9.7960395886258596,937.13175163872779,0.069660590412445433,10.351535633514883,1.4218482165198603 +84,20.609763517058365,884.0140824788291,0.41466825710663691,3.9133771843298231,1.5146325379560737 +85,32.352851482004418,471.33548120389071,0.28026828777019874,2.1710503569658961,1.3306112118673223 +86,68.925187477754406,1178.5798517678015,0.31152940334298462,9.802989561574968,1.3852319082884261 +87,38.637572509456085,1123.9564075595154,0.52316932617519518,4.2505680361012992,1.5051826484433741 +88,92.979042306516263,1511.3094300825874,0.84112294801990795,10.542886365563277,1.4977834382425299 +89,0.24824262680964715,929.60333613098521,0.93791311906460373,2.3442675982313901,1.5705116078990755 +90,24.499413841416974,950.74709217600264,0.67842150982188265,4.3275995761694919,1.5328314042906843 +91,30.636467159000723,1393.0290357968324,0.032853938228447621,8.8579786252172905,0.98089726746506534 +92,42.85402814602093,1153.2312807768033,0.70550302490679973,1.9846862942141765,1.5181733452638007 +93,90.384616487488657,1469.0165275332865,0.37538143725374984,2.9479432849585923,1.4083347621930655 +94,6.280543805583938,629.8159444446452,0.71319196060205603,9.1318171617989297,1.5568149793762627 +95,32.658830121723945,485.53547264576639,0.32739418364654083,10.643668363057484,1.3681645174548087 +96,9.6090700177030914,390.61115652266483,0.69423911895276047,2.3976349904776564,1.5353763989585334 +97,26.662589262979463,1437.7544447801224,0.30061178385836629,6.9701654887125475,1.5091848395920116 +98,57.281228776535677,559.29964147614896,0.24873428889263027,3.8967549066201626,1.1802018969155548 +99,87.594007242403123,156.30754331038852,0.09163641211230289,4.4120995915425212,0.16207038454185166 diff --git a/sklearn/earth/tests/test_earth.py b/sklearn/earth/tests/test_earth.py new file mode 100644 index 0000000000000..84665c217bf1e --- /dev/null +++ b/sklearn/earth/tests/test_earth.py @@ -0,0 +1,144 @@ +''' +Created on Feb 24, 2013 + +@author: jasonrudy +''' +import numpy +from pyearth._basis import Basis, ConstantBasisFunction, HingeBasisFunction, LinearBasisFunction +from pyearth import Earth +import pickle +import copy +import os +from testing_utils import if_statsmodels, if_pandas, if_patsy +from nose.tools import assert_equal, assert_not_equal, assert_true, assert_false, \ + assert_almost_equal, assert_list_equal + +class TestEarth(object): + + def __init__(self): + numpy.random.seed(0) + self.basis = Basis() + constant = ConstantBasisFunction() + self.basis.append(constant) + bf1 = HingeBasisFunction(constant,0.1,10,1,False,'x1') + bf2 = HingeBasisFunction(constant,0.1,10,1,True,'x1') + bf3 = LinearBasisFunction(bf1,2,'x2') + self.basis.append(bf1) + self.basis.append(bf2) + self.basis.append(bf3) + self.X = numpy.random.normal(size=(100,10)) + self.B = numpy.empty(shape=(100,4),dtype=numpy.float64) + self.basis.transform(self.X,self.B) + self.beta = numpy.random.normal(size=4) + self.y = numpy.empty(shape=100,dtype=numpy.float64) + self.y[:] = numpy.dot(self.B,self.beta) + numpy.random.normal(size=100) + self.earth = Earth(penalty=1) + + def test_get_params(self): + assert_equal(Earth().get_params(), {'penalty': None, 'min_search_points': None, + 'endspan_alpha': None, 'check_every': None, + 'max_terms': None, 'xlabels': None, 'max_degree': None, + 'minspan_alpha': None, 'linvars': None, 'thresh': None, + 'minspan': None, 'endspan': None}) + assert_equal(Earth(max_degree=3).get_params(), {'penalty': None, 'min_search_points': None, + 'endspan_alpha': None, 'check_every': None, + 'max_terms': None, 'xlabels': None, 'max_degree': 3, + 'minspan_alpha': None, 'linvars': None, 'thresh': None, + 'minspan': None, 'endspan': None}) + + @if_statsmodels + def test_linear_fit(self): + from statsmodels.regression.linear_model import GLS, OLS + self.earth.fit(self.X, self.y) + self.earth.linear_fit(self.X, self.y) + soln = OLS(self.y, self.earth.transform(self.X)).fit().params + assert_almost_equal(numpy.mean((self.earth.coef_-soln)**2), 0.0) + + weights = 1.0 / (numpy.random.normal(size=self.y.shape) ** 2) + self.earth.fit(self.X, self.y) + self.earth.linear_fit(self.X, self.y, weights) + soln = GLS(self.y, self.earth.transform(self.X), 1.0 / weights).fit().params + assert_almost_equal(numpy.mean((self.earth.coef_-soln)**2), 0.0) + + def test_weights(self): + group = numpy.random.binomial(1,.5,size=1000) == 1 + weights = 1 / (group * 100 + 1.0) + x = numpy.random.uniform(-10,10,size=1000) + y = numpy.abs(x) + y[group] = numpy.abs(x[group] - 5) + y += numpy.random.normal(0,1,size=1000) + model = Earth().fit(x,y,weights = weights) + + #Check that the model fits better for the more heavily weighted group + assert_true(model.score(x[group],y[group]) < model.score(x[numpy.logical_not(group)],y[numpy.logical_not(group)])) + + #Make sure that the score function gives the same answer as the trace + assert_almost_equal(model.score(x,y,weights=weights), model.pruning_trace().rsq(model.pruning_trace().get_selected())) + + #Uncomment below to see what this test situation looks like +# from matplotlib import pyplot +# print model.summary() +# print model.score(x,y,weights = weights) +# pyplot.figure() +# pyplot.plot(x,y,'b.') +# pyplot.plot(x,model.predict(x),'r.') +# pyplot.show() + + def test_fit(self): + self.earth.fit(self.X, self.y) + res = str(self.earth.trace()) + '\n' + self.earth.summary() +# with open('earth_regress.txt','w') as fl: +# fl.write(res) + with open(os.path.join(os.path.dirname(__file__),'earth_regress.txt'),'r') as fl: + prev = fl.read() + assert_equal(res,prev) + + def test_score(self): + model = self.earth.fit(self.X, self.y) + record = model.pruning_trace() + rsq = record.rsq(record.get_selected()) + assert_almost_equal(rsq,model.score(self.X,self.y)) + + @if_pandas + def test_pandas_compatibility(self): + import pandas + X = pandas.DataFrame(self.X) + y = pandas.DataFrame(self.y) + colnames = ['xx'+str(i) for i in range(X.shape[1])] + X.columns = colnames + model = self.earth.fit(X,y) + assert_list_equal(colnames,model.xlabels) + + @if_patsy + @if_pandas + def test_patsy_compatibility(self): + import pandas + import patsy + X = pandas.DataFrame(self.X) + y = pandas.DataFrame(self.y) + colnames = ['xx'+str(i) for i in range(X.shape[1])] + X.columns = colnames + X['y'] = y + y, X = patsy.dmatrices('y ~ xx0 + xx1 + xx2 + xx3 + xx4 + xx5 + xx6 + xx7 + xx8 + xx9 - 1',data=X) + model = self.earth.fit(X,y) + assert_list_equal(colnames,model.xlabels) + + def test_pickle_compatibility(self): + model = self.earth.fit(self.X, self.y) + model_copy = pickle.loads(pickle.dumps(model)) + assert_true(model_copy == model) + assert_true(numpy.all(model.predict(self.X) == model_copy.predict(self.X))) + assert_true(model.basis_[0] is model.basis_[1]._get_root()) + assert_true(model_copy.basis_[0] is model_copy.basis_[1]._get_root()) + + def test_copy_compatibility(self): + model = self.earth.fit(self.X, self.y) + model_copy = copy.copy(model) + assert_true(model_copy == model) + assert_true(numpy.all(model.predict(self.X) == model_copy.predict(self.X))) + assert_true(model.basis_[0] is model.basis_[1]._get_root()) + assert_true(model_copy.basis_[0] is model_copy.basis_[1]._get_root()) + +if __name__ == '__main__': + import nose + nose.run(argv=[__file__, '-s', '-v']) diff --git a/sklearn/earth/tests/test_forward.py b/sklearn/earth/tests/test_forward.py new file mode 100644 index 0000000000000..0c5ca99a905ef --- /dev/null +++ b/sklearn/earth/tests/test_forward.py @@ -0,0 +1,55 @@ +''' +Created on Feb 16, 2013 + +@author: jasonrudy +''' +from pyearth._forward import ForwardPasser +from pyearth._basis import Basis, ConstantBasisFunction, HingeBasisFunction, LinearBasisFunction +import numpy +import os +from nose.tools import assert_true, assert_equal + +class TestForwardPasser(object): + def __init__(self): + numpy.random.seed(0) + self.basis = Basis() + constant = ConstantBasisFunction() + self.basis.append(constant) + bf1 = HingeBasisFunction(constant,0.1,10,1,False,'x1') + bf2 = HingeBasisFunction(constant,0.1,10,1,True,'x1') + bf3 = LinearBasisFunction(bf1,2,'x2') + self.basis.append(bf1) + self.basis.append(bf2) + self.basis.append(bf3) + self.X = numpy.random.normal(size=(100,10)) + self.B = numpy.empty(shape=(100,4),dtype=numpy.float64) + self.basis.transform(self.X,self.B) + self.beta = numpy.random.normal(size=4) + self.y = numpy.empty(shape=100,dtype=numpy.float64) + self.y[:] = numpy.dot(self.B,self.beta) + numpy.random.normal(size=100) + self.forwardPasser = ForwardPasser(self.X,self.y,numpy.ones(self.y.shape),max_terms = 1000, penalty=1) + + def test_orthonormal_update(self): + numpy.set_printoptions(precision=4) + m,n = self.X.shape + B_orth = self.forwardPasser.get_B_orth() + v = numpy.random.normal(size=m) + for i in range(1,10): + v_ = numpy.random.normal(size=m) + B_orth[:,i] = 10*v_ + v + v = v_ + self.forwardPasser.orthonormal_update(i) + assert_true(numpy.max(numpy.abs(numpy.dot(B_orth[:,0:i+1].transpose(),B_orth[:,0:i+1]) - numpy.eye(i+1))) < .0000001) + + def test_run(self): + self.forwardPasser.run() + res = str(self.forwardPasser.get_basis()) + '\n' + str(self.forwardPasser.trace()) +# with open('forward_regress.txt','w') as fl: +# fl.write(res) + with open(os.path.join(os.path.dirname(__file__), 'forward_regress.txt'),'r') as fl: + prev = fl.read() + assert_equal(res,prev) + +if __name__ == '__main__': + import nose + nose.run(argv=[__file__, '-s', '-v']) \ No newline at end of file diff --git a/sklearn/earth/tests/test_pruning.py b/sklearn/earth/tests/test_pruning.py new file mode 100644 index 0000000000000..84df70454fd68 --- /dev/null +++ b/sklearn/earth/tests/test_pruning.py @@ -0,0 +1,13 @@ + + +class Test(object): + + def __init__(self): + pass + + def test(self): + pass + +if __name__ == '__main__': + import nose + nose.run(argv=[__file__, '-s', '-v']) \ No newline at end of file diff --git a/sklearn/earth/tests/test_record.py b/sklearn/earth/tests/test_record.py new file mode 100644 index 0000000000000..680454b3dc6ab --- /dev/null +++ b/sklearn/earth/tests/test_record.py @@ -0,0 +1,68 @@ +from pyearth._record import ForwardPassRecord, ForwardPassIteration, PruningPassRecord, PruningPassIteration +from pyearth._util import gcv +from nose.tools import assert_true, assert_equal, assert_list_equal + +class TestForwardPassRecord(object): + + def __init__(self): + #Create a record + self.num_samples = 1000 + self.num_variables = 10 + self.penalty = 3.0 + self.sst = 100.0 + self.record = ForwardPassRecord(self.num_samples, self.num_variables, self.penalty, self.sst) + self.record.append(ForwardPassIteration(0, 3, 3, 63.0, 3)) + self.record.append(ForwardPassIteration(0, 3, 14, 34.0, 5)) + self.record.append(ForwardPassIteration(3, 6, 12, 18.0, 7)) + self.mses = [self.sst,63.0,34.0,18.0] + self.sizes = [1,3,5,7] + + def test_statistics(self): + mses = [self.record.mse(i) for i in range(len(self.record))] + mses_ = [self.mses[i] for i in range(len(self.record))] + gcvs = [self.record.gcv(i) for i in range(len(self.record))] + gcvs_ = [gcv(self.mses[i], self.sizes[i], self.num_samples, self.penalty) for i in range(len(self.record))] + rsqs = [self.record.rsq(i) for i in range(len(self.record))] + rsqs_ = [1 - (self.mses[i] / self.sst) for i in range(len(self.record))] + grsqs = [self.record.grsq(i) for i in range(len(self.record))] + grsqs_ = [1 - (self.record.gcv(i) / gcv(self.sst, 1, self.num_samples, self.penalty)) for i in range(len(self.record))] + assert_list_equal(mses,mses_) + assert_list_equal(gcvs,gcvs_) + assert_list_equal(rsqs,rsqs_) + assert_list_equal(grsqs,grsqs_) + + +class TestPruningPassRecord(object): + + def __init__(self): + #Create a record + self.num_samples = 1000 + self.num_variables = 10 + self.penalty = 3.0 + self.sst = 100.0 + self.record = PruningPassRecord(self.num_samples, self.num_variables, self.penalty, self.sst, 7, 18.0) + self.record.append(PruningPassIteration(2, 6, 25.0)) + self.record.append(PruningPassIteration(1, 5, 34.0)) + self.record.append(PruningPassIteration(3, 4, 87.0)) + self.mses = [18.0,25.0,34.0,87.0] + self.sizes = [7,6,5,4] + + def test_statistics(self): + mses = [self.record.mse(i) for i in range(len(self.record))] + mses_ = [self.mses[i] for i in range(len(self.record))] + gcvs = [self.record.gcv(i) for i in range(len(self.record))] + gcvs_ = [gcv(self.mses[i], self.sizes[i], self.num_samples, self.penalty) for i in range(len(self.record))] + rsqs = [self.record.rsq(i) for i in range(len(self.record))] + rsqs_ = [1 - (self.mses[i] / self.sst) for i in range(len(self.record))] + grsqs = [self.record.grsq(i) for i in range(len(self.record))] + grsqs_ = [1 - (self.record.gcv(i) / gcv(self.sst, 1, self.num_samples, self.penalty)) for i in range(len(self.record))] + assert_list_equal(mses,mses_) + assert_list_equal(gcvs,gcvs_) + assert_list_equal(rsqs,rsqs_) + assert_list_equal(grsqs,grsqs_) + +if __name__ == '__main__': + import nose + nose.run(argv=[__file__, '-s', '-v']) + + \ No newline at end of file diff --git a/sklearn/earth/tests/test_util.py b/sklearn/earth/tests/test_util.py new file mode 100644 index 0000000000000..84df70454fd68 --- /dev/null +++ b/sklearn/earth/tests/test_util.py @@ -0,0 +1,13 @@ + + +class Test(object): + + def __init__(self): + pass + + def test(self): + pass + +if __name__ == '__main__': + import nose + nose.run(argv=[__file__, '-s', '-v']) \ No newline at end of file diff --git a/sklearn/earth/tests/testing_utils.py b/sklearn/earth/tests/testing_utils.py new file mode 100644 index 0000000000000..0ebacc4bb0f36 --- /dev/null +++ b/sklearn/earth/tests/testing_utils.py @@ -0,0 +1,41 @@ +from functools import wraps +from nose import SkipTest + +def if_statsmodels(func): + """Test decorator that skips test if statsmodels not installed. """ + + @wraps(func) + def run_test(*args, **kwargs): + try: + import statsmodels + except ImportError: + raise SkipTest('statsmodels not available.') + else: + return func(*args, **kwargs) + return run_test + +def if_pandas(func): + """Test decorator that skips test if pandas not installed. """ + + @wraps(func) + def run_test(*args, **kwargs): + try: + import pandas + except ImportError: + raise SkipTest('pandas not available.') + else: + return func(*args, **kwargs) + return run_test + +def if_patsy(func): + """Test decorator that skips test if patsy not installed. """ + + @wraps(func) + def run_test(*args, **kwargs): + try: + import patsy + except ImportError: + raise SkipTest('patsy not available.') + else: + return func(*args, **kwargs) + return run_test diff --git a/sklearn/setup.py b/sklearn/setup.py index 5710cea923e5b..924f4368c5dcc 100644 --- a/sklearn/setup.py +++ b/sklearn/setup.py @@ -46,6 +46,8 @@ def configuration(parent_package='', top_path=None): config.add_subpackage('metrics/tests') config.add_subpackage('metrics/cluster') config.add_subpackage('metrics/cluster/tests') + config.add_subpackage('earth') + config.add_subpackage('earth/tests') # add cython extension module for hmm config.add_extension( From 6e9fe4e0249d37dead47c94d00adc8f5efa6bba6 Mon Sep 17 00:00:00 2001 From: Jason Rudy Date: Tue, 23 Jul 2013 21:57:33 -0700 Subject: [PATCH 04/19] Added documentation. Still need to figure out how to deal with citations. --- doc/images/hinge.png | Bin 0 -> 22885 bytes doc/images/piecewise_linear.png | Bin 0 -> 21516 bytes doc/images/simple_earth_example.png | Bin 0 -> 40513 bytes doc/modules/classes.rst | 20 ++++++ doc/modules/earth.rst | 102 ++++++++++++++++++++++++++++ doc/modules/earth_bibliography.bib | 63 +++++++++++++++++ doc/supervised_learning.rst | 1 + 7 files changed, 186 insertions(+) create mode 100644 doc/images/hinge.png create mode 100644 doc/images/piecewise_linear.png create mode 100644 doc/images/simple_earth_example.png create mode 100644 doc/modules/earth.rst create mode 100644 doc/modules/earth_bibliography.bib diff --git a/doc/images/hinge.png b/doc/images/hinge.png new file mode 100644 index 0000000000000000000000000000000000000000..8c420c45fce97b6ac1fe4e5fdeee2fb70ba41ae8 GIT binary patch literal 22885 zcmeEuXIoQUw{-v&6~QhRiX{lBfJ*P!4M-6bq>D7^NR^JFU(@jw+PAJd#yFg7-PIWw}j=gdjq~=zy#8(oRk% zrNP;y!)Z2gtne@>ROo_?@#Z(E<0)*&H$ywOxNZKxC@_!<`6iHKPYVn3jWY|Y9P&3x zR7Hgy`MY-Oc33X_DMPXFZhpi4-;1#R-$nj!PyT=GIE_f-d`5i%_B9+#H*-$dGW6gIqc=2L;qO9xb&T;{@=!Xj<^^=`>$qIa7>j#e<$sq6t7-eK+te8m4 z%Iddg=@I7@n4Rj<{ccKwq^*xih&dAR@}9Zy>ZE`TuXHsQ)B!dyZ7rc=QuZzHFPKaC zE<4NHGip|8lyv<y4UqdVHLe zLuP-aCnZYHB)^hO2<6pzzVqOnLM!#@-cqqns`$l=i&KTf%m+VSEj(6u6&l*{V(+O) zEY_tt`D>)Gj$6Nb=ctboJZ-UEX9s<{ciP;KLBH$l{AIwOF@3p44G0lU;RRYBZ7*GU_7)?a0lEvboYWB(!`a;pfjY z!otD?D*T?U+9vMW@>Nw`ZEfuD7_mG(Q$JclQt}`0n8~>4gVzX(oQOyLU6R1qehf+GIPeL98Z$N`X7-V;9zCx1hFc-;WAp z%{H#=$i9<-wK*INUla3>U3^!cZmxL{o)a~x|I~R(pj@%*?G}vpo)ilQCz&q&$D|sgPTdfjJno29FwQ^~CDdIR^l7U^Irk~zXq;W{g%}Y--TO^&$W_Kc%sBVSwhLi=iUw_^$>~=@xMJZX zn&yuNY-HZeiY|8=tY*!FLlQ+ER7$Et!E3=H)RnwiZYk}%Jf~127ze9TK7HcE-|Sg| zyu1@vg1d-Lq|}$N7e@{rjIw?krm%1`N%AnP8|+fSc}OLfEMY_Xo~`xaX}N8CrthGS zkx>G?dZn~xU1X4eLiL4l$)Sd_b@NPe&gNBV3u-3aDRt}z+c}xn89!_{(^rm7y3}wvW|2+nX~p%$ zRxhR8Yp)MsBeRC>;?lNp@jUe0C+|L)>Q3pXr_d&8ou+yrT)eN=V@IUf2hP9YVcfob zJ5w*uB-ES`#vg+gF)GvI;1)eMSKL$LaJE&#ov66~Ank2#Y~WIt>^l2W*sA zndDhDCuB4y%J+uZ4OEq1597;$Q#&Ieai=brQwL1MwW@T=l=GNW+u#OWno-4MTogMd z?brr}C4kw<$=SZK&T#+teaBlk{u3uo^x%C;y%)zn=%j0mde5e7CU^V_KQ$dLv{JtC z`z*(@1*HG6IsWYc22wnxd(sHQ7xwSpPgSV#U2y^PD7+N3Z7f#YdTRK>g$u|pJG1r8 z`F)1pO5dtG-*{Bgc4QKpdoTanIlWxuz-1qNe^J=sHs103maSjdyt?erTM~Qe(j_Yk3ya)<0C>~wPuIJR z9r8Nu_?2UbO-}#5zofew7CkiMllREJIXmB$p_68I*vi@2IVo{vYGZvifZTm)$s0dr zy0O5GELJt@%-FvluU!+8l>@5vt9`wYADY(q%Qm-X>x*~Ze4|YDY@r@|#ERO!%MGB$ z)(U!$on>5_((+J{0x?Ly<&i5I1ucyHBb@lSU*9v*J zyNK!q9b4xD#3XGHrEga~Yu7fpJ)C zbgI!6rzWQ9+~ioilP(x}drd$9qpznJ+1fL@+3$yCV~kv0@&&9ticQP#9Q2bWl!K{a zun^qu)cCI(kqa5FBG@)~7cMnbNJi!!f52M)Pw5k#~k0GpFe+&DcIQat{-g6rR`B2r}RVE>z;h`8@YBl z2E}KHDn>?)rmyS~o%QjGpXpBm!LBxtMb2;4EmxV< za_Rei&5?3dyxC#d0eRH%IRw#ewe2m*dHVEe(c}3C>$JRpVm31^t#^EWi?{n955F}i zv5);$S2s;QXIOFz>&9GPB3GECYb2saxx_UUX^~2dDRITQS~fZ7p}=jNM^oYGDYZ}7 zRyqzHJ(_tox9swc9XnRR2L<%M=BCR3WGu~gf)5CcCWY`EI+OF# zi(x88qYc{%tu^5&0@jB4Wm#jC6ISxLj~&a3cdWoDugzTvy}j%0F=<^3i&SF*TuIV< z@nL0FVn0MQ*BqXi`NwxEJsc7hyb9hYhq{gY+Uw9?aTiNtj}}b!)!wbR_zp6xi-IF{ ztO=VP@M*0A51aZ9%`4-qB33o`G}V>SS3tC^0l$M7oAscE_-%pdqegnVm1A*zX^_It zTqfwxvL43-ZR5nE5uk=GzPJucK6vmT?$Pj1;gcsXH^hi_1~3_>4B3}2U-ndb=AomO zU+hKIKEH-oB;p2eRDZy#X^7_;?8*sXZg>c`69@a(z%r*JZkB-gAKVB?%r__WgxU2JWrXs`KIojU7fc@i_*#_o^X)OX;TcQ;n+xoN1RQ|- zOrL(Rnb4Uts;6#*wk62A9@xA0_7ssIq23SRY_co=)5()37r$|cJ^cCRhymWac>O)V zh6w5~2^p6k83*{@!rd@R{kV{^#^S%DYoE6bGlRtMZTWc_8 zW9#<)`}ReKhkp<;EV+q=gpBNIH^)VINYcisu3Y2FDVsg0z}oA`e#e;|mh+f;kHuma z`&@|`5Ja%qX5Ux(1H2&J?%cgw@7Aq1CO*@WUU(DvAu;2MJ8)=TN_mjK4a!|`GgVX# zFd#|2lmFo0R(ed606JM54weJ>0olo>>x&uPJYaP~(8rjS`DMLo z%hs*JXf&EgI7oAiNS&K=mbB~0zBgNV-dD*q*M<|hB33}njhyJ2>A$|Z)ufL9ms8dJ zPoDm{p`rU2Z9v5B>6-k2k21h6R!1T7hiCu!H%8RV!Yuv5v^4ejGz6I;ky9~1 zUpu$AXeFd`w!c!Z7eLWWZ=)s96KpEP@5&b9eCOkm@@@!*su&DfVR&xAsV&+?*< zVY8J_q6GyT0IX%@RcpJsxrGuAS%p@h{UDgh0SX2~W81Cpj%*HLb*0WvRrOUzw!W*z zY@U!6xCa>Os7wjq6Htb#a?t!*Zf3l#x= zfsN6~!(lq08H9j%AQX*k*Y_8DFRJT^RWCotrMiwa=7-z|)UI!4W;RK}y#~H^qE&)6 zPvGZXJ_@&tB9aUFeJ0y7j1qqXt@&(R=>czsIPdgw_X^FkPTHX-a@KsU?)Ul{Z~xOG zr$G}SKEy}a+Bns6-Ceu6xH`J>%`FcHgL}L;?+So5dDEvdMn)`*{b=pB-37Q%KE+Ja zfc3lJwvv*?TEzzlpTd;l&PFD`&d^C$#U}YKV2nMwEmxFsQ-~sf;<+ewA-jpLs@E{T zDT56AtYrr5$0VTFJ3t{2Z``r}^k)cxD@sa2LO1#S7Q^xHlLjR_jdT`2vY>J|({ZnP zm}1((XafaqMfw`VK0O?4HvaRNQzKOtqE!TXdH`QpOJR^NFyt4zE6LqtO$PZ$o^hqF zxK-n?C45BL~$%jxr5vIKH&L(cM zGZH|f0az<(Lj;fjAj-;b+Cm;;l{@H(0!@fCG+bd471> zu=Z}|9Sqpe{rpLGluQ_6E+v3>0DB=}UHi_R$Xl&#fRSC?mkS#F)k@ahry+sa_S>@^ z*aF?MW~EYj#u;FH^K|oVyAG$ouf`5vRtDY;Bn|WD&z}m2*{>G))~OArPMxAE@bmCw z+vS#D{|}pxm0Ls5hx3bav%_&0%!7lucr(rFf)V_%qT~TU+j}x2-EFM#h$2KWTi^@2 z+4nw7wrAPZV+FjpTs1J5KR^s{KrwprtPcl+UJ$&SKNpsIaQVoA@5+OU${WhRZ+7sX zU$|)7CIl9Pc)|0Ebk9r4hLFt=!mnB|vu|#$Za2BCzYkz(d)Xs%VA#gK^FO?*g98S9 zFRcy61et+a*_mhKc!@^PGir}$Ns>X8>2-GWSbQ}7oBw=sf$-*tc_^=Z#~Prn*XyhPaO*@MPhJr1xR<-K zaw~qrQ&$a#%DW``OyFV=rUiI+R8Fst=+O50Hqfwqrn;Ql_#8tpS>o=BzuPbvMh(vA0B|ldAg9 zwHN3~ca~lr&*1*>@bEEMv2O=CN5AkVqCCjjkWvekn)zE!ojmE1XjowJ(hE>hJYo-k zhd7MIK_2@ZeLr1(8MSka<_+}6rO$=EtVIbRD<`kq9mwn%e%Zh-z5hPvb_4uB@;<<~ zL8Md&px1Oyu{=exkk~Eq@Uff6#s^|)zlUMy3ZWYz`367~Kji6?zJ2?40DKor_btEj zfYMBIgztv~R6o&rULx(2K(yQM`7&)i^?H-n-vozS6J)-ouDLRlY4)Boj@gmP{K1q=sP zc?OsdFq~hmID6C+vwZo;7$P0h}-N5e%fqpCS3cmq&X+5oyqg52ZF zW~0B}r>&#o4lZH`0fl=c45|Uvdt09Dvx-aGRVVbv&SQe~V`d9Pn@f<8++UjTgM=PP zz4wDx=)^{idz70@vb2*)s96Q@bdf(4M4WeKmm62PU@;qQZDnN(UJlm!F1PI8P9T%t z`7*t7jcJfVGi+MZWF2pe%s&Pm5PrGeA5;jG%Fz9AnIWEKwoZjw=hJn^l68NV6C6&Y?)cl64&u5*5{es9v!;nFSDEvDm&_8!G`)8t0LV zSK+O#AnmmmS`#ntc2@@K1>&l$=dc)l5eNb$kG=v?Cb~T84LoWfDKwDlK)6jDlJS5r zwST^S3W1p1#%|$$17vEwg!SU}7U)0X48EDA8TIkJw*51deS`^*G-VPt)~Vs27y| zR<5kT2q|0w9eDrgTP>j2O#8$nizKL#K-Zme<^ysE;9-2EJ_4Hx#)#?QXDMqx3fI%B z*wgalBm&WZ87UzQD8|?$7G%z8*8sk16L5@vK**CFIq?Xnu`{3N%EnJNf5Rh>6$eLC|ZjVGr;mFb!SXsZ%G|lH+U*9Gl1cm;zRB zuqL1e==z;2jaQJultZ=6wq7fYIO*p~kCE4!E(G|`RCZu4u)kPZ& zDQLISXFvw02`f`9cvo^W{ZVi^;%qo}7G5D%=Gv^dbu&Wo;MhUg>;&?54kH^}$p`}M z;IZ61%QuejYtVN%5ITsMVlH(f&>z49f;s8#_k@r#nvi1IZaJ;1X*R!s9J+TJ$0_+$ zfcS6+M03RMpcW8=W|)vCCMFEN+KVJ=4L2MWmEhHaDKab`4k(0!DTn`B+va1LO|T$`Fy8KGSa(LZwkUH$8H& z+K&dNHHr8nC^u-~*=zrre-2)X$zGY=@EVUX^)Cm&srO)(6D}O+3K#w{2YB@%LcBJH zz6P}ekp`@$Iq1*GL1-Ss2y7n-DU$YGUw-Aa;?%f(s=WYwBlzUqyFEX?e?P!fhijpn zx3bDPbFIDp0aypWu}bkC3BO@+_*_sn8xvR`Xq-htil)|5pkZ(bXke_V9`D=Q)d4+b#tezyuPyMZtds6haOs7Ba` zh`WGbUAe~m;WX(UbVsCW8b}Jd+xO)10#SH3Cueb;7X&|e)m=^=87+VUxoMioxoV>2 zSFw@r-lcdBc%@%8k@ry%Gp+W0X|x}Cd*zp#JX%+QG`E85r?atheTKAvFepHH2<63) z!11%-)Edt3g6)3T6en2$lH+Sy9GF%oED)`KWukDm7vdjUau5eDF9VHquNR2<43(!9 zrJod9&(ckPajQ3q%ql2lcmr&5JtwMn2O*@voX3#B(Ae1MT7d)-l&3kDoYr<;d5<>4 zd&tQF111@YLPA0}hMEW3H^|D&jQxTd4?(j*q+9_@&TwV!jT1AwoHo5v43ZcNiA1{d z;qq4CKWc_0_P4KIz51czFX)HSgyGu{A3n^tD+Ae}*pJ}>gk%De>W^wZ5f9f1lCUU`MLaLhIYdYxRLOeEuwi#85EUP7+Ry zw%DpkfhSh7Th>rhYfZTnB;midye}hYv)Uc$-*}0=`P=zjmR44oaHQUVRVASKgs^OO zE}j;U9J63IGC>K>G{IN+DkVc@AzI8d7t*B8S-spMJr81I;~nR@a%S0Hq--8Y3X>gI zIk6mYtHfzA7m7aP@lMsZ4GiKyNxch2K;Z4Spq{V_*-LIZBJaPw0Pf>0CoC;2#!Gq~ zTg8bApWvRqDYQeBj)#D}RMpkttxZJ;$@exyw#DcfC$V ztcW&rybYV%R^njT54A*Ws-h2F=;B3fANtg7MEQ=XS-ZA(?_L4=DhM}9$(o3AtNoyJ zD_m+w6o3LM*z6`2Xj6I!pZ868Lo1XLi#%sdKov$Lsfw8jN?Xb$HmKHKzY)rV>0Iyu1hD|Vk09u* z)dWd8_T2+KV z1&N~n5rG%6XtZ6p42EpEEW6p!A+-KJh->7lGSO#t0Dn}@?XzuXZVnW`vjAfv_#29K z(>@6dJ=>b8f(G=a!J`t6vC6$;5BQ}7=?Q8HMP_x|MDz=;+Su4s{0%;aRC1tv@o=m$ z7Mtyp?9^ML4vwiTM%!#M0dE0FaSe2eVz&ux*xOqW9R2`Yl7Om*dYl9Xw2)G6``(&> z8iZg#buR%*ps>NN-~0gD%&qt$>z?VaEQTT`0@@Juqr|a46NIWvtEM=llH>m4px!uS zKV1kDzEA5vU`ZIA?MWS^HY)1d<`hcv~g*nsZ+>I7&)U`KaA8a>F(osI|);3-I% z{NDe?A)n+_3E=s00|E|cX2hZ z8pd@}MDi(+?hpJ(Qq(4dl0-^x7Fx*~b84+ZNJkCT;NsB`x#aGFHw$IyX1_BiiQKm@ zd!3y>QX|=;2%XY)B882mmQ0m3hKmS&x~1d2?miJ`mpWoWxrg^Ak#O3N%L73(|L4Epi+5BeC;a@K(;qO?(PV9e+rkWK}&2@f>xN&MY@TG$Nkt zEzq@bu+meFS8ik%SySPJh{-J(_GWJ6RloRJvUGDM?+ZXOJ$J9<)@17qIp40HJgrM{ z7q3;&bge0@s`8tcQ&lY}oq&#{Ko&Ie ziW36Y0Nur1I7PX)G}EzX>9Y_#*6)4Db>`R?$H&KcmaanP5!xZ|sj6ojC7z&6i!8d& z@|UOV-Lg6qY5$v=1g5D(T(471C|@xhoIg!H!kgw&BARmUV-Q!F5kx0wArN@E^&f0T z{RMT<5VFmtHk=2(d?@l){LACKlh>_w6e$@vi8Fa%51#3yr?Rl6#)=n)(xznQ?CV^wF36j^F#PDr#P8u@oeUQ}3 zjOc-UhYpP)cRIcYhtsDvg>V8=r*zRe)hHd9w?}0Sj|C=d9}jG}@E!7ILe@G1r;(Tn z!Bvj_eSgP#)2UO5nLAbdArh4FTN{J^NWrmwUZI43~K~F^5y-FNBGhhJj1gFXU0EUk&vU z+QcN%_m}#FB!7d|A-0z_vusa-WMM6TF2Rmi7kcKkeF`b^Dl9h5O_1;^Xv<43bY~Hg zV}d5D(pt0 zJ}OI(m&3P$@d^oQmfaaTq_@(l zPF3OV_H9BFb-VR5c!fmXx9lu4Dt8&3f*jz+eiqV&Mt7-Z#ouicA^h3vL-!{Fn0gfq zNAM)A0_0F36?XR`{S9CCK~{do@Bii7O0{2y|LAYhRJV4FD4bl%2y!mvz}kEm<9|MJ z=|XG}ExPtPm5Ucnr@sQW=9z1X+exrBP*%*H_!ST}Y(lL2M z?m#MN|7Au<@n#yZr#upi%JwuTgwNEN9=(XR!_f_$igj)Cbep<+Pzk2UnTtYk;7ITZ z45Cc%=E7DdXtHzNOq5r1!b28)DVTahJoU?YaB62Wh* zdSg{DD@YVmY>OH6Jw>CC?Tt~Q=UC)4*eLIE3Q(#U=CuHQIfVC6u(`VL~YV--gyTYs2us?dxoVj6xjss8=z(Dc>eCE2jorj@(!Yi-pvt+=Kw7r?7 zt6$g0GDHNh5%}WOD~RQQK875R93frVt)Eqpo^D9!DJ>m~FLj_iv_ToY0d9oa%acGG zo}_tix@3a7Hg<8TM(wPg6>lZee}dL|gv2#8gnbPGlb18T#z_ePD)C)4{&jE zx+9+P&iH!p;#{3}jlcfiwclrR9OeGc~}>#bXNdYH^@ z&cN1WjDV9{#t;S9iOidx1F;92dy5Ol;`cYR9N^}4JC3sNuV^1|>?_Mh0+N;oE=|?5 zU!W-=*4@74xZOQ@Y7VHuo$&PMsgdeYhep zTZ-^)_h{`dJ_`7mmq@KLHY6fLms|}`*6;vj^pL`V9;L!Eu zk|2{=`V^Av-ewk5naT#kG)rw}H(A6`mC^|dOi)H*1&}RACvc;voO zgxgSS(nwayfr83IfVsOKv7?3*po{WVSd5fI0X--Phlxmi!UnFV(*5O9`avdLniac`KK8J(n z3B@BhI1>8g+}w%)!f#fjm>cWJ6Q?{&P!L`p<|kEofoJb}cUmLzKUQgZ%oRfBDpXjJ z_BD()H0^CCL#%o?=wGO7J6P}oIdMIcaL7i>HHIh+B+4T#O+CF1Jw=ZY*H8_E1irBj z)vlcN-%+?Q<>(4`R|r<`zVo=%76ZDr{a-`c?h79NDNGgbZTXz4CKlC^b1H$&dAHnn zpql0Gap+(1KrYDITkWR}X>YP!p8y6Cr=XvCr@p)bHAF<Juv5BcPt0sr@6r0F|Nw zZD`yGNrT!pS{SNNo7d(6DXJ;n`Z+b__{0hs_v7^r@@5O>&}Ean&H+*A)kA!44{$`> zpHDgG9pgIkA#6kH;^O5I;Y963O!8g0!-IqgrU*ph5t~6J07=;^qyC+yV(RhNJ9$*@ zgAzV;8BxV|lBvX;6Vn^cd@|3vU%}V72c6K$fnsZIbnlkKrmH|PiUAumLQ-T|F1_&u5cIt}vza1Gqo)dFs zlzWMC9evar{80*Px*RD7hLkM>)$ZmR>F?u(CD5nB<=hJn1yEmy#Z)s*Di%};zgYwK z-GGDpJ$Ok|UEPvT4wceqP}XvkRBiRPn4jkyel=6VDd_<3w7ml)XyoP~%-0PJlsY9N zd+Yqy(&A>AqLusaFrNI-A3yY6iTqwye|y}}MhQu7zB==6!@vMEA8o$cY<;70v9reD zbK=afM+kq5Wpg$uVq zFX7VL0_>!#Qg5F4Q3XcFN}R)L#e)QyfslTh@<4iaPgPGRwDq3^VrXK9;kP)(OHrYTWSYR z1N&la|8NCyH==T~`#Gh7qojefx32CifxQ6KxPj`Rw!6hk=`UR{t?ujDy|Z8}i5M?< z?S{PJF%V*xF0mWEfrPl-Lfl$)ouQVlX~<~LGAz}!8yxskfT}G#uI=={$13%e1gWLz&hfc)I+++J~0!(tVABd2CCewD$t8GJq-m4 zS-tJx&!A&CR*G251Tg&|_(0Y~sqRM*2WU{p>6Fcd@^rOJn396)6#8MFF*8I}#%&L+i~ zMZU6sc~H#=E=3i1wm_#f;(}VImwidDL`;9B8X;7lAd0_ZP{skRqX`iUlyaK@LE-7KK8{DDua<&Hn(LkHYb?@NVA&Ei2(yfodlxgBllO ze7Y&wY5G{Ogkyq)PsyF~0!Yy+`Y;>CdX*mNxM~O_BQnsOkXku|b*$D`)hG$Qn{iUa z0Ij%^>aHe>b6|1ftvh8cJ>UVLH5oziTavsBPNzo!CTBkg? zZ{)QtZpT$3&+0V~D7lWkK_Z-LP~-udUwbAhD5-d#9CI*)S-dr;d)Qm|A_bIC1VpYq z#|zlqK#&Ujcdzg#gjw?&9r?M&IM2bT$+kz}6G9a5F_v!;4y-9eGLke@QdBi#u7^g- zc{J`Mo0%c;NG)bxGfS2|3((KS(rzbDk|%u3UkhEoAkq zU&U$w$9Lwy;#WpVj9Eh_2g(`Ijsii-fi9yEV7z6C0DsBKo0y<)IQ;rsY&9d)nG5B3 zjU5gNYO~R30HE?lJ5aSv`}X5NgUPG@E$2}$(BTJY*%g+p@)cS3aVQ$y2;+-F-_0>- zM^e0_q+dllFOjb~gsb?_3xFt4jZVbp=2?(sib+R!#aC}w>X!*R%hm(ulT=h&l1fL>8Te2Bc& zRcsf7H!gKFChr6o>PX;`cc05cP|3g|Bg)QFhh8){F#gtB%DM6Br1~|cFx6VQy z?@?X{PMg_|CZHK80T7C|1VSrIZ!bhNq4+~$(cVkZBvSTznmX<|hrl*n7L|#wdpwV$ zrl7!&y;JUD38+90oMz~<;TM(3_OoXbJg3j(n5fIJ2a=G0+y}Ep(_G%4uD?Yvoby+| zjq-L`W!IlQOvWIPtE?h6l?epG&A_NeK`9LUAOck&hr_z}*#v8gdkoLM6Y9yL&!5Q{ za-)XU5UB2=ys`WVudc!#SYX~O1pq`?;78AFzhRt|`p%sQ?W6o$RsLNN7faSaa z$IUIS-a3h|Z_CSE)V*LPb;MdT#+tm46xCq))JIKF|yLkKjQg4S<2mys9f3NlKo zhgbfzu}@BsV`8x>zM{x2 z=*WDocu7 zaNkpe;nW~8zn-3F{yd!l{pAQ*6T%1!lTt2`a!OUxHS`GvrO_REF-N660M`V%ZoYc3 z#uSUx;h-XdFv}FQeb;g0N6#0VC%&r=@s=Nd zsTk%)soQ82DX+$WaOTdtv|Hh6nlaz%5_5K=hN|wTa{wEJlD`@j>bX3*5R!R7)&W~K z^^bMWzIzrVEu5Mt5{3dR5vCnTs0%xT+L8%5^xELs-@fyyf=Tam^G+wQp{=xN8;iiy)U z3l_qse*(uq&HOCWul@00gIQX(8TWUfQqF@6PF1Hw+W^`=bXq+Q-IN4&j7s1ILH7sr z!>2+2sDOX~bd2b_u%o!uG@@s!4GoHfC|%IN!0(5awD||{JFpfi2G02~j|4LmIyzBU z>_6c3fos`D!jeu&AUdyoDRSfm6V!T)JnR~aF_w!@VH`30s>gWJ`wJk(kv7&l;0mcf zUgLm-w`f^I+s~Fm2wsm~-ym=JfQZs(25JaImeGd7P|%tH7u>;D0OCTi0{^f50e#9- z(-DH2ND1J0B~ERVL(I(I9R7((4gg6Ql>qvB;A^n&T4PxDhSx+!dbR^5Q@_<og!GwvF4Ocf9D0$E1Mqo; z3XCWai+JG$Ks7Q>e=lb^nNED)VOQf~i5&J!KjK|lt8myx*-&=g427cS0EE!>q4yey zaZyI(I~C+9`4I|+;K$~hYM^hxluAeb03Ii-lWNbj*@jBF3W0eOJaU_8W7}|Qx-!zc zCZ2PH+KxN}^)eIh;}Ty)KlC5#fGmH&kcO50KcGqZ$p*}w;KAk zvY<8*ZJ3IXTwrZmIZ`(zYmiXRgEopR$LO$AjmY}66Y$V$95(%OfYOG(A#53$_<$w{ z4C&9O8wizB<%b1LU6>f~5ynKbwvW;p7$TD;pd9~HyU@)oE7^J-iGM>r=lvN~C z*GFRtLpk|Ho03E;gZPFp?C^%cddX|KBXfgi*w0eRNe&JOyCn|71cz(kQ zTLmChp?{ z6*GuTDIlg@L}Or5C}6tZ=e?1oAN$$Ce`KDGp(c9^p{_Z}6!^WMX%cOAhJ zM%n7uSYN&fd$AyK=v$D1aN1tB1D8_X5mYZdJbrmADf3y&dzGsvKK|9N-7a+c#0YDB z^DX9KkAiY6r8%~rNcL(LCs&cDVh3k5q^OBYinHZ{P-4s~HibUJ^0{vucD?HA>MM=b zN`>vzNL8GXXTN)_qK^mGq9x^0aS}9&1So-iY-82&}>V(j042(@@B-29SI*<;q{)N8k4r)3$OPYRlhu|3*T8 zhCIEB+S~xMObMoI|F~lnyj*hp;BMuUnOPU1AK|U|b$=A<@GSDV0FANYf*~*qX;s(S z+tah~Qq%V&^t;xB6_qR-`AiqR68TqbM0`LLV=u4CCfI{ zf#-~rD_?oNM#78TS$K~Uphq{>$&X?fs~q4D)1YO4LL4v!&;G62C1|0ev|17di!L8Jcki7`dBT`gkZH>J>f%JiYtafJnDZI1hnCHC7iiIK|K^2V z>mOVQn$^On7zY`3AcD{BA?gOtqpL9e(u{65n>p?K^ydXQ3nQ30 z>h)W53Sjj54j&u*rK71Bb|JRB7E4v}Q9Y{tVHDEz7K--YJ<->(@rqv3wFnd+_ zc>bS(p^lEunJCpH--Y@F=m`ghHneqBjcgc&uO9RxC!gNlh5RtTb0Q)lHge?Gzb|vU>XXQW?S|9pRlc2X(PLIvL0ov4|11|yH zE`MQdE=0Kz#-3bYbZRVAe&!~~wGn8T-q)#K#EDHWP(`3&Du(#y7r3YF#`4>`m22Dr z;?_IKD2YR0_}}OL*4a^%*C#Y7_jb%#L6;mBI<7~T{AZUgf}*^OSFWgJmW_W|MQNp8 zv!leiDXzGIxYXq2FOIqBJXC9}r1wex%WhEv!%d5#be&HECY>!ENlx%BQ3yr;#YS5s_u;j(aLj>oHblsT?ba0J!clEyfDBz z0Uh3_HIu3u$hNSUJBhm-CrFd@OY8zLos;12?FWoJvHebl+pSNm2f9CAdwmgl4bb(1 zO7kyyD;)N#coz8kEp!u4n=*QWOUy$tz`l=2eD-%|sm;BJ;gNU&Lq1J**Fo8*UMW4LQx46fb%1@7zYLVOmhJgZGM&+KBw5#H@VVUFJgBuu&7VAPR(*DPb_h7f6G3htEHJ=!bNJ3OAeT4O$-ATA87bSDVldQ;g>EvT&Kj zw@-I;Sp0l5QbEaFl4B2?xv3JeE#G%#p=T9lHgyQ9fw^uF+R~uMtsEMLD8{NWm6&WWW~yg{=S4;@zH&5I;2u3KRdSnc{B9I+finH$?{<7E$v(| zO1=5qKc%a0&uV*AR?cKy?6YuM8|VlJ(8qJ%^A?AjcMWJD-Tg1!QFtkBt zGI)b@-}$9tyNDh8vEsyACIR>!DHn@^hvAeamK2zAI2w4Q?+F()H8!rTP^rWG%(4NT zeN1|?MyTAG^1s2H4iSQa%FCA)N=n-ymIqR{hS3DQMwSyu(KRp8C&yAYvlB{w6)sh;iI8d&JqR? z{$sN)QVa2e==7vGKrX>0HLF>ZdzM((kmN1FsyN<)lJjn1=RAr|V1qd$&Fa-c=E`6~%dDx7>j~=K3JB zy`%pD=XeX?4tM}-7*s+&Pl2LKm~5}Vp&WNBuINMpzw51qU#9?lPYJQ`?rh%jsJ3Gl zzmfuSHXx@^DW=SdhGZsp&F2B4?^q+JL-K~(!XPto7hm7#C`zSnf6IrVEpGP>MaxI9 z64KIS4%6k!F-o(%p6DAq;R^J7?vRQjn9E@nJw>TGIcjPwflz7+c}h|EZmhyCRSYf9 zmN1@J4t=e5o<3a>J-rbeqMw@^t6eOM9mZQMzCN{>>QdZTM78AX7}s(}#vUEkp*Hk1ept)7-ye1B_|eUO+?Fvo}%k* z(i5X0&`y!?q_a^LtBWJVjdNaqpNEoFtC{N~eXbE{X~ucHsLx=pL-5ffiRdHe@2kXB z?cY}N_q};&ea%`!4ZLe&1u$R~VtX+87TfI=N8|lsd-tNhue%kUPPgr44CvvX_x!mr z`|}%1Ao$_|lZ-p6a3Bow&Z=_g4IO1YiNJMwNx=}D^B z->N#6TVClUE5-ErI9+_$;wX9)brV6_#U&-DG0@4WM^+8Iju=wFdS^hBSqN`5@??z| z!Nf>-fIg32hhD$XSwE*?!_SL|=S5P=T44tSAA%Z5XHbIoQ(T^6G9(4TGy^777v@aiVw{2JdY zuJEGV@PPbBV6eCudUTKlL*j)k1a`5UaM1XJQb#Zh1tE+vyTb#C67a6Of@#>P7%%2 zdOrvgP11sF>>f=^EG>5-It);gmPY=D@I#5)@1o`J$b^86l?jmg@M@nz_P4O4e7$=n z>YPcH40II#h5?<0PyFjb0PtkT-kSrndDrJ$$C+{GOgS`@i^IE{s{J?CMo#f#qDA{# z=wZzFMsBwsta7Btd&9^JH9cT8-Rr|J{Qw35SI|p40v`twzRcm#@9X#+Xbl_e=-$g_|!en!CEX+t_4?CU#2q5A;-zjd7CC#i`=t zzUr1IM5-QBcFb_F=3n|=9v2@`QZh;EsTd{XO!xMXNCopA1%G8rOWfMp2a>W)nPUwV z?!BIUCDplj{Awk|zO}O})PAcOC4Q zt#i0Ou@i11J@D8Z2^VYh(wdxNAg6y3=IXNe=SF9~ocBJKL`O3yuugR5nc^F|9AFYP z0mx%ViSk1D2)&nbPwR=>mT=x3biuqS!6Sns>SWx3|9eta(^$#{@qTuWjsqVCf8>fL67dsMdxt?fUn$NnQTcn9 zTeq$cAw(k4^pv6ZxtInUCnqAH18JW=?cNglbm(v?nP+->8Y4ARJ6>hqQ<7uuv6z47 zj3q=DFBoE$_U4@_?leI@sivo=hu+A+J8-{h+X1a`ABV{t?F_ni^?ZQzm)D_knLV!6 zHZnEjB%g&pVg3>j%w7C;o(*ii^kh{yra>QMc_a?aYL9d7WM=!%( z$=Ba5tk?CHUV^!1VwTas`Myf(Fulm3B2qQJG{>}N-jXZce|NlSVn};UHz})=&R>bk zvvcTw9KFz-h&41E?DjL1bG#89+Bw}3owGhw+SXC&>3*^7YfywI-j4cVNmF6|Dt!7{ zJ`yAhr`koLRO4y7_-?HIKwYu8nl?T=aX{l2QUU12QVkZ~u@44tQ(@bkt%rQKA zxw>-6iSj;Fji*G4XQK&BhT0otsYVuwY54Hoz|gR@qa(Vcq@>52ToNrET;V{u7@Jc( z+vt;@!;5^3(`IPRR2(7t~RErD-2&} zkhlq3oc@3a>VkkELc|ZC1ExZniogJ8)d6J#p|ojqrJ{TkI>}TP1i3;gf(0fY!N#j` z)CdYVoofJF7;K1q6zA-Ue6(Q{Cyv6N)3Ibf+`s+wXK#DXxxMGy_kEw|ecwkeQpxw! zdfDfh=DzEwD=I(r#LMQ_@WFKR%SnHBSXkKZf>jk@HP94*z=(!Ii6P%j;iF{5?RqzW zqJ|^b{B15}POx}lSolYoz1~gFR{m14Iq}e5)K%;tQQE;qeiS{n$q1Onq=lMY2r7kn zXZ7fG3Nl~K`G_mW(XKYEMWXJ)eS6j>w0-QQKZIBjaL?tj*wumg>y6#(f@T^b^`MTr zJ{@`0H#f#@TO0+v^7xQnrO#(4k4DISzjtyBQA>5;#$pV}&NNpN9AD<2mP{u>Lqo%D z{k=4R8xlzX0Rn6^=`v{`2Zv!P#>KE=Kive&a_`gyk;2FZ%=r=bSd(e`n4;1vVXLgz zh#t$j`p)KC>j=#>j+-kcxCB&TIBhnKv}ut=+{zSo+H~s0G_jkVh@pgkhSf&XNr=AU zcxwU`7(iqU`nO?ut(8YHHo0juKf6od`b1mRk!t>fBI!ipjC--O_P{~@dnBXH_)j+W ziXpl2o04Y{5PJ&W;tK4<7Uc?s!hyj-Uvw7FJ>boSI(gRC_vG2zB_NMXUYeE2^e3cP z=1mJZgffb5D4FgG4hB8RgUfAm;egQqmT{f|k_cKN@c<#5E#&!W`di^DQaVaDrV0d@r-2N9y4u#RD)B^Cw515O$xg=! zzkmQu1LR(b^?@ep_IW@cWCLdlYU>Kn7S9<Ln8U(M;q9({-kKqX}S#X@`E_ z_VM*=gR)P==UR|(#~SPm^HJapA_W>R~SDH^)|!oOLedUzSEU+vAp~%NplHyCjs3js+pD- z1Ij|Ooi_^=Q^fTmgb9zHq#ObyAZW0eaC&KkB|H51#$ng5FNbBQb}l^trbW~OEDV53 zRZT&D$?Xv@S4s;E>IG~-GVW;>q)P=zyib(-^#j6d8cf>~#a=#}RP9P9~fg)e+O;b93M38v@PiZy=M75bk0jeWPNCmMKtj78FIdbTS!Xkmu8 zP#P&6iy>hRU4w0chZ2cI4#7FuKNPLy8TLHSCn%8|45M%QM1KJ~OTJBi|6bIQ_%Hu? z&`nauP`qYKM~CusXwX2QO?3y3dext~<59f?r0_tdQ0Wo%A6eZ#6 zo?}q<*?l;cK1Lh1e6&$ump>Xl66LrdXO0-Uw84EN@qhIVZgqfn8)q9n_Wo^-^qL3Lv$>`tmrf<(WXFp3iz5yI?BIQbVm71->HGIbEOc^=0q3dsxG3z1F(d{eG(;CvoJ^*+Uo%<_K2ut|A6Q zK7qlIEg#qqpJZO5;DrC%YkeE5d;tEr9MF3MzaO-aRI|olsGp$!k$n+MHpF05_U7>qo@Y|i2*jey@=J2b$p*!tC2>jw z+9bosJ+KH^-C~gz=?4r`JURM-=F|aLJN$b|wnvck!xIk=D)fUm?f*Qo|Nnmk}GN#bDxTKYLMOS|>Y_J4+p{H(bh1!f%-N zUgF?LYmGJTNRqw$Fjd*VWo6il`c&^ybc4`*>F3@&W8<+O@10gURc)t!rD&QHzfmxb zJu=B#7;@R}96CZX4kxo!QG5ZT>Y+MIXab=DS3lZz2#7ZufBBDA#FX{o4$#kwqF zk1&dAQcyGe>QvRqa3!uz{;gxQH?tnDBpa~BYx(&21ho)4hQE2SvTHQy{|tHmgmzyh z&Y&gMs67GeId|P|<`FDbWaXFAMtMuDh%>MIj*I@YXGW_tJ}(U)(kw@71zzu> zZ+%a3UT$rP|MKoEpA?9wqwTXq%k<81Hn|WM*Ts4^0qqLMrDrR1143gBxB#)8_0nk( z4YRnF$J1RI9ZfffG{5NhXFSTfZQPaK1_ooj)kuapRJj-PvdoKuI?{H!i|(?($#@+W43|Eg-^CZhe1R2n~RScE>_Tgv*tqb6Y z;W}=XvGZVkjdpQ#=A~`ChpYYGz2jq(i~caXnVZX-0LKB-i@cUuhlZt z^Y#oR-+g;53Fb>v$&l&bZAz35k9_^)gK1wrUq?rWb!ki0E6N!BRnuPH4qn+M;(WzT z-KS4)YwNhUloma2`()h}7#(fWh0_^==}fxPBOI5SZbrcXfB*g+|6SvI$IN-A`)bZT z-%|qRI$lFL1I4!2RdL!{@p1RQMqD?D%rnMQIf})(I*vyeEUr8vr=a46?ddrF2{pm< znfCs=qL!VoF&ZE??zAgtJM{qu#_PDd=1=FF4H&6psPl~xo-n#^P9`_cIxSDUCm0J5 zj~zd*%fN3@$=lT0vN^Q7vu46K)16g)MKx2?KTe~XrxD~N(C0c+Crq@aH(4C3Zyx2; zD(1!akztzOQ3+xkDqkO=%QePxf%P4syCKseN=z@`7^mCVcB2=tx{I6w{+DM>kkhhm z;yWKhIK`>{gFw06vb{FsK7TIY%=P==J9Pn!_{4B+r)G7Tj$f@G@5FFDAvDM2ne<$P zao#bCX{%~G>if5xq^Hl|E?>V5f6)-mt*WW1nb~5A*Rsb34Z81c3mZp>IOm65QTz1e z%cYvyTB#teqOoJ4oEj=Y*|r5b?%TFaabh~1X{vaCdLdq$iB^*U$MuCL89Ei(LCPSU z?bSZ>MdG#-sAMTU@k^dj=jE|^I|JuGKSQ0?2JDwgaZhNcy0bpB7`A=7_p`Avgk`|8 zj{fJ5AFZGoo0^lV(K)YSQ#ySG=BnOQ^tomOf=vqp#vxC3a1Dqfz0yb^eCkU!U}rIotm*<~w`` zb{aERvFp~Eq9g&bw#k&2lk4g)vbGjBt&Z(nXcn5+i%NC<{rwAUIt9gEvyE=>P ztdE|L3mrZ~)z;RwxfHjX-kvBeeP}y9ZhP>itP(7(^Y3UKt6I)JK-E)RniE@db$(|) z2Z(N7>YENr;I7zG)N$L;kHu*OaaC+BS`Y5W1X2`KoX23IqXrI^O(sQIl{EpxH0?if z7TKw6B=1%EI8oEcq)vS^p! z6OP-RO2gfNQ4AVCyq}Mx{Ouw*0h)7{q;UQAV&D0gRz2sj>d)@f~y{+idH<;jk5KD_2=1>D>CdgLO}~eoySpLI~r9 zJT?#`??9LcnZ6(ck-JT7cS9cA9>%F*voL%M+n%nL6A~SL&Z;l z88Q*qn$x|uB<1DtAZ=DP!g^oiP4i5^b8OIfQxw6kPpm}4tcVp~m#$q_%;2{E1l#_e zS%Mb=hzp)sE$7h8+&UOjI<@G!I5>5~k|@|r35#K!KYdRo2k3U`jMMfC-rCg{ zy+~UpN#+b;9pcw7^NQ_@*t248rC_ij2Cf3^0JSWWuj$Mbl$Di9GUrm8<|Cog)HWro%U+!`Re5O|D`}ZR*wJl-rZ`z4GC|XVwGrWaZ$sN0y?)QXGiekH4 zIV>p>0Su{1$^I;V3J(>SHbwFY><{ffe3n--SuREqI8u^)T;}@vy35eoG_IlxU}w>l zn8PT<%zTH@eJksFnZxeRcJJ3GUPiyZe1sFjR25~+# zE>cx-yITg>E}Orl-AZ3r4FRGzG9`j?#6Rg}Tyf_D%eT|E2EkgF$^!oB(Y^-TNvhcT z!(AlW6)Z0rF&eJ_`pLw2lzEt58NSw^o&#I_x0cS=g|4E1kZ3*L*al!^JDZ0WtO(Cx z1<^r>0E~|=2VmB$n28W`FF$qVQQ)ZU>hyk0v>0Ry4&sW6LC3#Z2~pdCteobG2ry}_ z-J5qLf*;VAR{2?%J-rnB58R*`=K-@pI3 zI@@R9Yzh%yz1YSuzt5dGTM(3xZ`$`vh_PHLSq=dD(7`uH&hje2o=^zPP|LZWWH=RL zKiCFROv%=7c%81trDl9W^M};$ZyZ(bV6(-$J48OS{=&euE*Rc+yfH#JE={}4sdy?i zjRgx4xZ|4_Mc&hzLqMJ6K}8*4mS4Vqzsspv*gBan-Q_sG`g3))g~+(O?#(h?7OmRN zZSpP7w#1p?^yy^4(y<;-9B}T;vQ>4{{=&A63)OCM15VQ!Q$0D!5VGm*`;RXExvM>Y z9V7mY2CSMK@F4-<8=IY!WjFN;3&bq?6t{LdiaKo)j1P&cvoTDq<*vkYjLATrg2uK+ zOB55OoPe7kg`Ii*5zt9wx%EyYpK;h!R|cJxj*tr?xEo`^8<_)cnSfIhJqB^W$TL9a zMqTMC$#HJ#9m(=7`EO!awnwPl1NCNaan(=u%0^tfXV4sNDL85OK`^T9hssyC?afJu zRP8Sh9#_tKdarC}b9$=nv$vv>QcRzop5F7>-n^g$Sep?rp;XPH?3~tKo!w1U)wQC0 zonWm|V2dB$9%mDzEFZAxkZle>D_|QsJ0t-V4{SOOvK%FVXCHt6t^xa@3sQX!CGqxv9L7#vyjWPUpKPTw4IVa7VGk9e5CtCQ89f9tfrZ6%QF50CR-D$jyXYj_ z*4DNAb2fBa6%fE|px6*{ismbChPlOOhU$P7#o+k>AzbiQ5b6la2id=-78*uMVXrdY7zp94FiPV&`S?)&zCOw?>|gSW7QYu zwuuc|`EyJAg*@&+dB%3mTzjJL=Gr_CLVFryZIQx`*&QO`A+wapzIoY>a`VBkqsyYA zqB?O)zkVriLyqh7?p;&9oj9OAq?9|G_=;3xd}gGOeI|%LEjiXninul(9F!v8mCgoj<0EIIlim8gJT{ z+QZ|wM@0222r3oAPV_0r8O3DQ0uJ#_pLiX?AhdF8&5T}{&CV?=^1Z{=w7a?S?phIE*h)pdceF z+sRqb|LGmw%~ar)MRt9V8K!M45z_SPgEm1pwi|!KjUhn|vT}=qbo4dUoftZ@bR{~| z)s*7gcZzaw%bw&EzaTc46g2((c_`vHhniBMYKA&1cAt7~2E@my){kC*e0!fpvxa$Nh~4kO{L=!nK763Ho$K$}DB0dTv`PFbvb9i+(vG2dRVgW- zvp3Ds0l*QL3rYa15-Q+SO7hG34Q?=CTSsp%nf+oBK>h=6t+lB8V+p9M7?i}d{ulVh zM`WG=owm*ATd>N?Av+Mj(qK2|NAcRu8P+DahhKqI1uk{^-j<770fXUpZX@VVwkJX@ zrUYVed_qEkbyshS5}Ry{AfH}3Y-`4o3iApT?v6rQt0w5O{*^_b&t!I>1TT=B@4mZp z_L|-s7&CPA>GNG;#V*~V10*P6dfQ%Zy}5=0qJ&TPd`~bk;vg1GdNaBy7#XF?bbuSI z@R@Y;02k16j(z#^rHOAIVk3JS09o!L!gN_BeZp@52=)0jHQVN*U zO8VI+c3fyUQ@c!^QzKs)n345Xj}0(_mb!8pLqkI+U>dnjD@NFlF>N`j3St^y*LO~d zPlJt3;c@d@13NLIi$9o)fqiu58g`u18G?9W<+26E6+z1NeK`d)Le7@AoXJY8{`@qA z#26VT%j9HoTvz-puf>5*(QsJtx#`Pafa`Nyzpg|ryx@_lii;(fe*XM<1sq&xJ_m9t z@AO}TUmh?+Pm6V)p{4<2T zx5OUD^6E;zEijJh;^|DvB3Hl)8m@Nb?GmDjHT+Rwp~^CMyXnu-~;o zXI%OEZ^|>TM@lnEWgsZ3#Z>h1g|jPNY;nzA8ijJ=Ss}Z0^?Z|v(bK1pL+8B6FRM|9 zp`$Cq!@(A1Q8@t!cLK!Qafhh%^eastt}>6=>?5v#X9)C#Gp3}ZT-GYi1#gHR9sQGE zVZRX00%br%hs{d=-p6+F{(VyYI%a8QtS(75D%X6dT-aQ9Uf9AexhLP@?^77=4j*KR z_FAf%maiauB!ha521^~!>o8%va*5#jMnmPUQ=q6HT!#UhlncxTc%M}5H8}bs`kav6 zOtkITvKme$BNCoWg3@Iw#K-2#tEd9bt@RtawR$S z^Iu;cG>cASJSeL#SYi}px^Ja`B>`^=$2epV4x{ksWqqBsVfCF>s)2ainIMiO3V`e zHf~8lzX~mNSEljYb;NU`E{`Dpdk8VgN`$RMD)h1u_o`&PfRc;OcA$b6 zWj@d><_Ls~ZH-VjXObJFJ^1_@G6)UZ$@Y76H_eoxI2sxl7>{TgXsEM3nC)S?i=)VD zw{DSWd0B<4n_!>fMEC{WTE8}6D7iM1iiDN3uRm_COiyPwa4Es!ft6AVP!6BG3!%9- zfKg|dNQPN_yayvZQgd1d)#Df)hCN+|3;+|LQV9Qzr{T({{M@0gG(OXl!~G=|>U$9} zLiRUYMdPefV0{9H?FoT>veEo)nq^Kaj$-mgMn?HrP~W`H%*@=kPO2#y??zv{cCE4Y z9bFVuNqG-5Ck#^23w}T~1xG*FNrXGGZ>SMKHP*g~U{!tO<_CBzT`|#TvkYfRCLtHH(_tJ#y!faioT{VK1W#UbTO7kK`EX=fX!k+siBdV3lY^sSt0QhlPZWyJgi=#0tL&a)TVoi= zx;6e*^E#A?nt-jNA`h5Eqn#Mhnir~%OQ~(V8EZ39=H-SenVJG)W!+HbvWAq$aj*bY zGN8`fn4X@lX&&5XFaWjG?kwGLNC?gEOGrdPJ=@uH3Ovkza%rP6H#c|B05!(K?ZAYG zw;ym^85tSg>CQ9*E}ioJS*zg}kndLtLo!!xE@s?y1?>==RAB#rWDX=m*DqiGX#!F~ zrNDv)c3z-EHy{!iLk9QjOvzmFbTdbM98O+z<9oEItJ6o(ae$)62cPdpfOuzsntT+s zGgHB7o7RH2KItl7cM-LQgim150FF0KpKJA1f8g3h$NOAdoWjHR2T#*&^_YF)?|ZZL zebo!hW@Q-ZMVxX$rv$5qnEq@qwj*b*-GzFYZ_cF;s;GL1#bP074Bm4re?@uP2*%tT z3ziQF3i<>ky(uV}Dnce@UAm1bkf8GkPYMQ$Q$-wHqPttxh!>wveucsKP?6CWVt`vg zUVn|PX;!7>e0DU@Jz zO@Nv#C|6ph5}- z7|Kbpimwix40-?lfgX+;)-K-W3ny`v4Kf`ePiRpE7tX};oY%}yiCt`K!OJ=d>N`e_ zAFfJCN-B8mKVnnQ8vaGUA&kVj@R>1$(Yo*7C(PZ6Q7ncK&YB%S6%Qdpkc|~qgG!wu zRC0XBR*<+09S%%XIttp&d_b`q)y4t(5lZGkv?OeHWoV=U=)&Pb2<+rDd~OWcvN}{i zk;TC_reP9|^3#DRiL*AbZ-#7Qyvp?fQh??iaf;?@blL<;nS#(_p`sF=03h}SPMHvU zQO|vTwEa9IWWK0W00dkO&XGO?Yh;b%-ZhBWOR;?Dv%hBK zoZMOj#55Lu&cA*8mY~W6-+O$mxnb-fq4(^W)SHO%18|MUXb`yW4cOf&u82MuUV49fucgh4Ja!u~y$mu(0iNG$?)FYXZ>CWE^5|1817vVM{A)FMAMk%Hp}nIcM)%)#NxT0~52STKeExr3 z$G_$MpOXxqBUvA5!UJ>h5)u+6|C?|;NLKd$*e~Ya^rU@2eoNqofK?*}+r*qWi8k?# zvU(qG0(DFUP)Wkrwp96}Ns_F!-k1r>T|C@Lm2MGa)`d2_|&%V7s` zIA^z(L83jaq!N~^>z(`TU9O$!aLbTeFjtv!Z~4INA&3S1^}zx|I|V}tV|pnzlfD{kBzvU@q1vp_1}5Me3bRTEs;UZ$NrePP-V9gI z4{44D!+M33Ee?mdK-=pANMcxs3^~E!LP7DjwD`9{nue-TTh*b_)wpo&%UMet3hPLZ zA)Fdr0-~0`Uy{bP2#w`39k^`T{aC9jLufa%kp6qr&F~kSdoez=q-|3Pf;D;k=De=7 zxuR;gy(vyR^!3{zLPW%d^Woy(;tm(UvMNv5gP0gAhNj#oycbrc6FD`~%^clYPg0bU z>`|$o4D&{Fa#BUYrQ_msw&mv)!g!OS+fDPg??TV=!ONf-6XJhq-mCX&X-iHvz(4HljYfv=)A)i+@?ldKzke1tOkd}(KmXdimu0p;Vz=&% zPxkEs`pQ|J!FbP3PKtjHw^!bhfb6E~j(X(D(pk>Nnc0Tb`IcSX?{ykV9Z|gRBX8vG zn6$rSqB^09yhbYQN(uy9I8+pb#u`n%B=*?>y0hQ$nR(4e*N97Nw29IbRrVG%IE`@Y z?__(C$?zP$gUV%Dx^>9qPJC2KPVa1Qp&G68|1-aH^75mOHu$A8P5SkN+&uCHWYtF@ zxOBqvAAVC|#Lxfu8Duw`U9}d;=gG7)jZ>-H(tP?feR$y0y@^DlhcEa&mJmKvX`6DWs40iaOx zC9es2o30< z+%YGwM$IkcilOZ{uWE;!XNs+BgBY3{2zNs+Kl~{m3PBLrp+cctT>dG8zU-PqLw2-7 z+4rR6TZVMkT~sK9+1Zyh|4MV`Ws+mK5gtE)LKq1%79tyEj60VzG%|o|dX5g1Eba0? zc%bODUxmiJ_g66sEA|MTl%?f8RWXd_VI&JsjE99mWcxR-k0X8MTbpS>4tDE&{PV$J zzR!x$@jhO$!Myhcr-B9r*62~Fgd?YlFOa;wtnO<##hOFEIn^aOHPqd2n90yk zcvzq)bwN;Y!E%L=%((}%5Zx$~#_YDr@H^_J21hDELdGvor;xsCRyy?ZJq;nuFbbjp z3;Q_Tqe4Uf0Ooou=|^@s4wu-y(zcuVx_T07*w7)cJKCAT%xBI}nEU(*XLs$+2xeIJ zKdsX2Y`GZ+EaZ?Ex^8T*y)e~!#-X8N)YW)s*pAk`OXjjt(t-{-rc&g;$A`=P4jU5W zrmgH22J;#sUuy?)HoT~*lRk3xrJ2?Ee0T(isN+rC zCg$LL$}KSNGSv0=Ej~<3;4@yt zpIqBW*j&lj{^r#}X5K2Es`8GC9~1u^Nf{hS+|JNYg{`0JH;1aayS%*EnroWMk%3R? zj@HJz3ol=O!qH(oq5;tY_}#V&tu^6%?KB4&#y(m=*S5+_XmlD+Fz;O6TuHoPn$VSz zA>9xL#txl_$B}VB;ndb24kkuGiwetfvAI|~fmx^+DnM!b1_h-H}U z3JpaiC7cEnPjkV+dgY^**!B>1#UiWB(0v#WgY|wcOl8sRP{oiyCKSy8KE>_WBh@f{rx7Iw*kJfl1e>8Ko|NKi(dyy1&X% zGkSR{t({to29{T-0KAi$A7TItI}}DOEiJiJ$>aIe%loGy&3jMK8V_l24wI)?>aI=g z!7v2@zzPpT0W>J#<;%U{9Apap35i(u4c}i`x=hh^wNl&_S2)%0@>5{qdD`GnCO*E0 zK~NB%w_?Tk1n+LuO-14~PSY9>^iD#nU{90EHQfAA4@jA$MUyNJlZA1Tb;;+5%)%#GBCo>`|j(=#{p!;4hm@UDi8 z9;n09r%ze1XU?4AQr*L(sQ*lz5L#deT6yrGYlF}bejM$Z7V;Ga1qfrwFsI2~# ziAN>be|d+fh|iqs+=szrL-#AnSHy2cB%Q2^;-fr5upctDZ8}H*NFf<7Akm5M<*q6; zaW}bnR6f7vH4OSyR^n_+hVdvxT8`H&vhsQR_WfOPia?=`5YbIZDXBw82wwZK(|9E9 z1NH#0L;>schrJD9wgsY4(^&*(h^>boP$S!WCaCXs2IWlXAI}q zGn`-Toj6jR7;&9kH}tZaM(WDsD6+QUEo8x;Pz#RbKVE-;BF^nHpXu4N&E{pDQ;}%B z3n(8us_!MoBw`l#_)vVefQ{tT(9oe#Zz?t2KMm3yN!aVp9)bTs_ybNLd_h!nP(V&z z-X0vy3@XybQYG|_tO!upXCI~&Bg4FO4yAVotnKhy`F*!b#u?qOxUQZVIR{zAEeas_ zJYh=sQdREBxLuYHFs@!L%T`FB*cYzA#aB%8w2nA9hi+= zn`AEAzVQvV@f*clgxk>G#R_E!NsEQ}lZ|2T zHyV@%hHY({0CdezTJ-gW(6B4|wX%qm0a8r>Jx8h9KK)3~%#HWVo`1_-Gcq0j{G98A zD*{!NC_92KE5SM_{#c>sEQdW{(rsQIm8?&ld=;}dipK%_PoU?3e-rr6pZ^9q=NN?+ zTp_R!MRP(m2800N)q;zHO0wEpI_KHG+L=tp3OAB-RK>MG1u+^576;su*kz+Gva-H< zy`*6tdc%YX1nFUooTn1XmeG)2)3{kpM^g1!QB9Jum4|-)}{H&wF9-p#` z{}o4;Qs{|-)n1$7-v>nT!u-)|^X3_?r2XA{`|q3h33}n@woP6Ia%sv~=ub~9cO6Kh zguIOLKft*-AM#t7HRjx_T9i%N`)^pPH!a?t@?#YHtLyeI|8#x z&i}@LrMqe}Sx!tKr`V%g=7gOuWqz3Q8=(W{7)aqbRODU>I4Pgy5uX|mqG@gj4Nj8F zJN23w>DvMc7zz>pN)sMyE`MLyw1~9tYiIYdhIf#rCTs&}K zZAjXSLR!dve{Hc{=%Bk!s!|<_gqUX1dZAuiIoZ+v<$+>2m#2mHrDlh`~d;s+U^69 zQzR48M*Ia<;gj>HA<>gOQ8sFiF1?_nQj+Amv!tLW{_zv|9TXaC9;inyhgV3_3jwb& zNnaM*W!~Ppjzn?y6k0|%863Jm4FT$)MVdzya#e6)bEQh^1zbE`N$-}wQ9$DzG9IWw z{d-#Lldu1eu=nRhc1wR{YB5Da3Z^R^hKQ2*7@G1fDm6vJJrV>OX=FaNn=4(1W;s;% z*Q)1!Eglco8dp~XA)Vfbl4r!w`$SF~g z)cPEKlf>!wx(%m{U#;pl?9r8te5AExH%n6e@Kb~`cj2rOs$3E*KYnJf@>I-Zi}T++ zY>Zoan05e+JAQpcXTw8cFNKYYg*V=Gi0cT$mF;Dv$LY7ojdhmboGarBtV^ z$>_C1Ls`pK!txe0EchAue*WVd7@zATIndiw^V~k=M_&3A&t>?7X0l{{4_s%s0EVXJ znnx1YOUj*4YE%;z*gdDM8`=K-t>V)7$B`{?t2|@mZI~N7iSU3(O^gQ>cTbK)G0|)? z4Yx-(&j|W(uy`#3$>By2=RImi5wp}XvJa4F{o}86HQ+DT?y48~BiIT&u5Rfe!Ba!8 zo#kF(GhfyoE#R4D)QM=bS#fzG6#yOER@Ri;`wTa23~LXkJiTW>4OQ`lvuL5Mwo{9_M!Q)#5c`I((47_T$($CXM9k?IXr-$s>;)$*8g_SZ zyf$BQ4dfrsyrxT^?J)XfL4p><7*KVgnv(K(kk9t#AzO(aRMrrxas-5c6H(e~$m)m!eW) z9YgTWf;Y*pcXsRzM{bj3`2ZO*xb3~kaGeBj?4~Gkmix?tj7_N)|P1C)z#F%DWZl?7(U6wA*I5uSL-v}rF8{x{C zGws$b*x5c1kBr}P6=i!6D~hF<0u-5Fn06`9cHtn3rm5@$?+p~)QZVXiCs`B%`NM(} zg)|Wn?G4--O5L*-3@2GdRzh-JNRf)^9BBj(|D`;ruHiPa^*ys7(X?*r%eN)@S@bI; zu)Q`XLWa1@RwIA?%M#$ig7m*M0aJAZE%F6!3!_|L$Xqw%&AD$KN?!Da91w~W7 z`R+E-N&&7 zcuc_p)fMnu!;z}WZq{%FovK=YR35_ae{iEA*IhgVIOuKmUYDI5uumLsx>LOYX?AZO zNkBN1G|&*@s`HJ*!339Q3p}%W^AfSa3C1{EWP_L!=Yak$FqIe&lH3*Yihu4pd=G5A zQrBuK5}(d48-2-kevYJ+e{K29z>kJ(!*kt45JFc@1E=wznCUm%_jmZQc3K#0yQ?WL z8-`bSgXqq;pR+Z=hEnsTx*4r*c6gToLDEiHP%`)(8Vy<0`ZA!qq)77!*XtM|5Pt=c zi-*KxnXC}d{f4^*K?%@Zmapb(@l9)K*urgX0J3DXM~@$fL>~}}4~H7)A1Q?pM8Ys9 zbdZZmVzH3R1Sl8THq94#lgOMU@;OWg@13MV=IpWj+r$KHyDgp+i!fZ*K%l6XqgJgZ zhRSIS%E*IG9K`Z*yMN3}p%ht5MX24Y>S3AO{)*6*<<9d!f3Tj{P7*P z*7BjswdF9ai55HL+ExBS+%GQm@vhx|G-jAM)k^U_G}$0UQM zfx7+R_?qn6GaP*&(E}tHU<~QXL}>$t30Wh>SIOvtbRBcsCe`!>=V6Y7H# z8@TOBLpV@?V~|h8d*haECL;_I>}L0j2w#>uE26HR=Yzn_V+$ENhJJY=*D2425Ywe% zm=8x6nT~z=B$UONqd1N6{r)PvQD(B{bVeq4%ID9C$+6kZB5Y_E!!G{`YD9PG8I(@| zi}vV3`BW+Ckwz*242D3Gwv45{j!M|_T7?D_+6kg@ywCjpbAQZff20nm)Ij5X@gwZt zTL%J}JwR{rlwq4wNoql2BYckJb}!fz)3~ zH6deO;jlUzJXfv}i4yH(|GeAI;asF$dHlGC4A9v}i1PbMk&cig*_?c7N-Dw~Zz*Fu zDm-8mY>>-{Q*8g{cX@PHR5McGI*&?T>hhp-d(+JlloDcmD4+-7!xC{@&~-DH<BZdo1)%Sw)Hn2Q(s8zgZ(fP9B8lV_=~;_^G7RS+ z0X})TP=gVTNeyN0Cv(sP*KE13{prWeRSiTK)`rM+Zw~0m8sb!%NI*ui@v464SBM^k zt3)8RF@9Hdr(v?mUSskR;j0fKdF%gUe;#zOlP6q-UUK3U7I4dfoIafFwt}P}j$KL{d8Ven41e={1_>(b2@eqlxC_B&k-q+O&G|6d1HH5DKBqoJ-}m z7F1icmX6Q?mC@mHUGRhkRT7oKd_(iitwFvD%>biMSqGt>E3%z?vKCz$i;418i_<{GSbuy`~bR8K0qYf<89od=s_s zw1e&tjVQS#P5XeT+T_ADy7p}Se}e)Zi_>10?Kn6Az2RX`Xt`8R4BjvSHi>8@oHZuN zyjL%aU4gJ2nTB`R<%6&WSWECkwy`$&g{6{Q3Zi0Cb7f7{*%CUrm;U3c*}?o5TM|47|@I5aC3|D%?ZS#=5jxFu!* zELohEa*#a6gJEGB*FO9WdENda>DEoS!YYzJJScCY(ZDC5-3+wrfKbpy$*AWVZ*;&} z)(mY~lwNogfT>r}(l2|&2qm7slkkd?{D1LE5{hA7A<@;Y&JWF>gZ?SVkNbgLzC74v zXZURdI*koy)lm?DCI(2V{J>5%gHD`0nTQ-wv#F-Qxd2h7$J4Qsk1?3zVd%X8w;re4 znZmUfFf>yBiMezLS%w{4FvKdt#WCn?Z0OV!PBN6$GVi*=8;t^#89fS6nD>y%($qp{ z1`8ItBe+zp{?7EV4Oj>8+M7L2zkkH=_ua|O>Hh{b0(hlf*toF!*(kDIf)N^?K90CR zZFbw~-+CF*dV9VJLq70F%BRbd98tF%1B%*ImC!*~)v2BilAn0^vM=^od3g7b4a~2V zXkyzUu2xS)Qg|}chpfaz9qJ@`^Zhn`7*Z7FC!#w zAO4z!dLPx zYwg~=8mqUpfs(hd#%B+|GUF~0x<1di)I2j|S1@45ZQVRa2##*Fj_rxrwjH+_cOf`7 z3+!?Lz*j0?UU4cLoV?(X@-VIQ@R1|>4i5b0P90H;{njnE#R*=Uv*y9_u9qEmHvX2c zl_no;4iL(;hOAV)?aVFjJ=1e@&1Vdv-?N~0L~SE&o>Gt3-oeH=S+2sz!qMD1u`ct@ z^~?b%f3V=$BY2{}Z)j&##To8K(5LG;xv$@`>NTu4EqJ$9MjWW`kY@uPcz70r;epel z6aDZa1C3c|inRS2v_0Ds>@q1`??_;U>v5mWEqIFlgpIXH1Rs~1FmZ(dbFuk1)jm8! zt1s^hxK&&KC!B4TEnIA^e@sG5syCAg+`BRGsLiE9Xx|lpd(HBSen*$foP%+0c}Hub zMoKHhHdYIQ>lly?4_h3ZP_P&n7!ZJq`oS#Rr3<&AE$)whXSShIww#$Z*~HX=%96vN6gS zTu`e2O?nT;l7a3l)p>b@KO2`7%! zgn@zj6+9c9m>@2*RDVD)~ufZ1He*5-K1zqLv-Xg9zEtbvmafNp=G~>!{I4)ul#0oZn1n%ak zo8~z?QO#D&QF61y?bs|v4f(CnySrEsV(K>tEe~HovS5PNM@vU%oM+(lHqWW-Xcay^ zg0@+V*fTbn{0bQTrDJGea48{URpx%Hj!V|j?~G2*OXol62JLRdjk(T81ssACiyodA zRIF_bt3YP62!J>6fL5T!hxUPF%@o?zVgAz=mW>GB)b`wG}p zbz+1UDjkN}B-q5(Z!LbL=DZ7C6O|*RhdVn%q1|*mS!~;Ib93`zzbcMRYy-R4RUmhm z5Uv#_yyS=Ut*?-RpI(tWO?IxoIY#I@FK@2Su0MS}AD(4xNNjNJ^-W%`l+_Vx?#G@m zaQcA>g{NXfHC-v9KmDjHBk_?{pK1NH&QK8)Jv{Ch_y~oxN^`R^?m8^C1^9a}F$c)Z zmEf`v4k(Dq9iw1f^3~zxipzH;ItJpWl8vbqLtwrM=uX)RucW*uVh zSgi9|r2&!{Z-N;2P>V%tI_fX}_JxVJ9*-^>!Y!LjF7Sale(bpu{b{(1Y|*X!bHZ4a zOqp`xz}R9#uvB7B9`I1>x)b)73Yq;S&C2rH+=hr}@qEyIiNsn{3-gMX#lm${=6Fgd z%zx!Sh~Al_fI*!S7;!S#@HJ>m{|VihLR#SOJayod?}xVM?BT|qEV|ueUwi`A;9o=q z8}OnQ{Qx(E_`wUHy*!2s@Q37lEa;M1lA~N5ynV#B@GLx^31D-qtgI|!6__{$oTOvM zy*xm}9oOCN!g)3Z;|u+AtZe{CMwGCiuh65VaO^&u*F3g7-ujWnFCH-b_r>@-*u&J+ z1#m*eIsF*A(kfkO;7dEW*{iFBsZ+McMu$i z{Cje*QJy;7s0<~wRbEkn=PIFxS`mj2Momv&AHiPtG!LUq#lfcF00`EOaFg`yI{LQh z_;=QNxVI^Un)Y~f5b(jJsk~l^bC!4iNeB9GSb2nn`;E9E1@HnZ$1L3gC?&1oFNkC> zbf9)-?D#u#7hSHBne2YowSkQm_nnT( z>_=5jf?6003y@J|KXC=;9>da;r7Lm6tp5Y}&qb`9*!Hrf!^o>5X!^E>3z$hb94=Tt z`z6SA4`?~V&fVRef}=+#PrYek;<@n|I=ZO8o1oRH6{q6jV#O4wL(I-jno+NnS8qgQ zW@a8fd^iDz;|`Td?2s3z3<24tb{f^z)+%PGB%8M6nlEnWsdGYfw(T2?oy*t8B`c;R zl$4a@+1T33K8nl4!KPfbD_@A3 zUl9p)B8DAc3nRlIcUMj|ynaMHiir;cddg9Dp z_DcD3C~Qpc@na@0FR$ZfeSN6YpA&xeE*k_Zo^)R;uD#bWr&>qYYlZUuhKjk9q*6vW?lsru)s_dW0G#pCg*^Wp_f zrWHjpo%ZpG$p+&Ri-Yh=myN2^912@@p|ySkK@{D8@wB1E)<6%yaiVZiewnFgjzSp6b7Q{vp(>~g=)`(bkWY#9{<6P@s&lQp!~K!uf`XfH6I73aLzi8>zZ&yZGM8exM%0M{^R+dSs0#1w(eW3Y`jW1m zcX?=Q{HBoRN$K|@u9rMlkK<{-kz@E>z<1<=w&f151N~sv+4!lN4RnviQ0w=pQ$c{_ zkDK|G>Geq#evT2AnJk-T&T&V5x54p;O`J>Yb{`{y*T}L;TJr`W|jI z37poldEmB794gqHhx?qu>%(4?kdOf6BDt=?Wt$j|5LRi34i<+2(`RCA+OcP7X(a)m z!{MD7{cx`r-a;bpwzCw+W~j;fhn#U;+zb+nD{yP8!f=6SXlC-xLH_;pn8&N|8nmf& zjRG$0BHRrchim^RNG-t?Ll#5L-c`8pBcG_Kb}YOr!NJ5*VGrUAje`(=KEQ47tEV+B zZUM5Rz^I(oX=88ChK08#1w~so3t(rg+s;6kBy}`fk9O+@G@)fj!^@|Lv#Rh`ii-dd z($_3^DNp%;SjkXK9>1TV(hvpG?uVC_ffv{Y=b!F^K$czXf%EK$?{mcd69OG&GE zH(ss`&%^b&NS2HTOYU2vj75t-IjrGr5iEv{nkU-TB+>l9G(;L6{9K6zo$DYA;xedK<2O9*fbOd;# z8nh`zS+(6eov4zg4{v4JfcHdvXmOphKEuE;XOVY>b#?jUe}9@;v9sBQ`C(cx5Qb)g z7*PcGesbV4>0v6Wi&(df2Ay$q*M&`5|LswT?5M}}1D%ll9J<>RG!`7UrH2H`g3VKx zm6w+psKvG{L?J&& z23~`09~g*H&j=eF9Mp80Oe|V%mlo1wmwpe{Y0-{l`$IqPAOW!%;7CyG{~B}4=;fwxpNFo9Yg3=0^* mTOl+cyDvti24iSE_|L$;T1D7WRR^@^hr!d;&t;ucLK6VSjJZev literal 0 HcmV?d00001 diff --git a/doc/images/simple_earth_example.png b/doc/images/simple_earth_example.png new file mode 100644 index 0000000000000000000000000000000000000000..17f572d3c34473332f66d00255834788e679a405 GIT binary patch literal 40513 zcmeFZ^;=b4*fmN@C@mleY`VJ}q>)k@N$KwHl8}~e6#?n)7L*3*?vn1VGdIusp6mQ@ z{)6w^mt49xYtJ?3J?|Lzm}43KPEi^Sl@JvM1_n)5MnV||2A&iK22K-pIyb;5~}HjFuA&48}+35A08od&O#dkbFPs^^)H$5W}S zsS+Qtf6J7Aoo6rjz@%5ly^32~8&&&iJn&^t@vN(M(Zik*#MY{1Pkljmf$6}=OREOQ z{(bG_bVU84B^KGNA(Ogx9Kq+XcO(9k@F@c?IJPdkdCU&t(|gx1e1%B_zwkK?rE-w* znF(**-g^rt+01d1KfNTE33uQzvA`>?LL4^i>Gd)S?&%XOIzmL!r>m4XQAH)7uOH?w z{hzLp8KH%NehVw^`+J!G87c?n=^Ba8QvY|Lo}aabzfpCV@fkEqiFU+$?dNRjRva7L zS3co~+`J1(=-*hqI~|7XbiS%dV$u%j-!SZsCKmUhB`22!rZ$!c?_Qhtd%Vx^I%pvB zSdU9cN@BMdr4+vIRdPI^&^WzXi!m#<(^5ZK(ya8kb=6_kh&A*TIFOgi4jzk6*qhqH&Z%rYfiT+T5`uKyMk7q8#!ma$xUOG^I! z3K6dmfnm|EjkFlc+weJPJ{@A%sd#}@YlCr478Yjw4)_MepPh*!kDKlMR3R_!-N_Q8 zU%@B@!*0&bggX`aNN6@@|Cz^aFe_|)PK;%r7*=dCS z9h|>-DEe{Bp-)U&8ew05e=3(1p2$@PhNIr)^;Wi$;-SZOZgPr%8*^e}qI-)TbK^g9 zJ&%n<;g(^ZCGU8X{v6qP>1k-epz4#DbIp4PJXs8znYp_LSiDD z%`9i@Nn%;K)l_N5`PkCspQzW@cUvOEandBIcOC*N&6W8U69Dov#R(W+X%;tFe)PvP>VNy(0*z;rP#M zzKdxiItGTdE*z!x5oyTajK`CkU2&cj@=YgRf%`YnJW9otvBc2aB^`~SWeJy4rTVcwVr0KbK5l^KLaktv6bb;jIZy_CQamkVApof-F7ok=6=#k z<8gP~eLY|%9Dn-3#>QrRVq)doQ>)q>%j@!B!|(CZ5BfWCIl1Th*L@nup`B1~ASH~d z^gOpLtzSje^FEe**tC0~HuH-Sx_AZMf@D2UI;b(yxoy5TG^Ey8O`U*XT0On?^nMHw z^|vZ*2st@%WNui;&Qr{M%lb6@LT8`Ip&70XsMjujoqoTI;Q?g273BE zj$y$uTRS@?;W|)&nyRbEg@LKqFKS%(Kg?A!fz%$xtRQ zdG40fnrK}#y6k@G7rt7CZ>p>uEiEjpN&Hi#csckot zWHJNd`l6(6G3|0G#_w(|(#CavHu1R1Uhs5)!&O!`{Jy5lr)2rI^|1B!grwV{o7hY# zTexM}fqzcl=X`=dB%5c^y_1B;HpAx^3eDNh{cNpGHps`&iBy{Oqqc4>G`X2spY~A1 zOoN*N7pho0uD}2D+HN|O*fm90SJ$TPa?y)mx3;cs4s6|^$3mun+bnRrNFT7l_}+dq zB2ACi*^jahS-OtBRIZfRvcg+;=tJ2eB1W&b+-86|!fCR4+z%GL4r_n~S(=Z2MQ+F? zGeh4j`QGlYS2AhWPTSVal@=6KJl;&TnHE3JI}OiJQBm=gF_E*!f@0khb^@JXJdKi~ zFJ={Ezc6^ae|@?&7bEiEK6JByNXnetzgTOdJ;XhhuT-bYoZJG;l(97=a3~0Nh;yy8 z^7PI8*6D`O=IM|C3(a&7zCWXW>wGO^|HBG~Uy7T^l)hh!jaCwL;p;xanK=H=mn;IY zJ43QGna0B@Y!pVRr>#xTKYQZ%gY>kx*yiUqJuG}{U8XnYuwOGZ3#@(Ee5$y3>9*V+5V>*e zJ`dd`=y-LDo(yJwz)}0JJp|hNowkMswM0l_<~YoT22i+95J`s)M;`B&9yfeg^zT;j z_dx~PAgT)M5gmESh(++8xoM9bTJC0RtSl@nK7w(qr^^GNSAsun(7fC-MEtY3ctD%{ zBE=|rWxsA|vwBRi-{Zgta{CG-ao`ag9w+OOTbl!^@s}<`LYF!quXY!ewa(f&o`Lj* z&<_6HXH&P3blMybU+Hmb8ZGj06?iMl1FA@^&D>;>3#@v{hu@!Z8LrkKk22cYuaDgY zuQR&WdYcAQ&9Y{8@3&M`R62pTJ0&S)^5f3c&eYjKfWv8)U0wo6aY={bbA7VWe6<>J zciZ+T0JHRPQI{&Yy&lGU6na>cx&yb6JuC&)3G6i z(*m2AnAn5C)dyhCwT)!`A+HxR9*RQ`LtqQQ6#qb1P|;1IeRR*?W;QJHDA;zpaOju? z;L0U{E!H!YpP+HL>?t+%n4~K|p&J z)7`lxe95QhckeQ9%L7fM*={Y_k9S*)n&tjb+~9G#$>y{vk1ld&50D!$jmbiziv)RG z#(v|i(C$G4fD;=&wqJdR4_a>z0(W0*9;Swc0jx}L3@%UBbtNckd*ENXUAzR<$fgV~ zHsAt8?uKrw*QM>(t*qBWr)4b{gxObJG|w)UJ&zu44^Oi}{AW0i%0jn`&utIl`R`lc zT=bcg+iPy?<%6cfJWwPjC)Gi9R}wl`9r9edKX8Lqb7%#tsi`3t-k+_BaM_*2-Ec=* zy&R}yoSmCHjTQ_Kd%>N!f*bd~^P1HJ$~&;C}nAIaD59W}E|7d#kfHt~mO zD}fyiv6;KuUwW`nJgNW@BdoCYRzq2t{U60E$ZueFt$KShl9p^6NRvJK*4~(p@9d(=sL|RCP%WTi+p@r>==d(T!QmHaD14ylJ~0v~vfS zvnSn8`Q78s)!M9qcsi``KHzCRMgtzhGj9+7?H%pbwK-?n-g|O#_E(&UauQOJQLlL% zffp+4>JHABWoODS`s|j}K}Y(xx3>;(C^;G$8sxg>hU2s2h$OzlS`^R8dc2Y&DD+h> zyXqufdu#xlq9DKt+4=$WaPluFhTZSMTll;{$pJthM^JnWwD3T}Lx-Z3+l&3RP7IN~ zbGH4tIu<*zrksk3xV313XxVt`<6IV>aAMANYP$QfOyY9=NZSxuH3bikE1 zY!bFde!oA<7uhJT8Zun@^{M%0r>K`G@wIJzK$-7(QHEn5osQ>rZvBGohYug7n>{!H zv~gGr34us{Tk42lX-xsq&H)x?I+W21O(7sj{O$_Jae`a+wzRSW>%Y49RTMmyfZ}jV zOUtm|hI`W$LBMl4KO3y0_pz*Y!A;oC^ z9a`r4WjH*h4_)6SBiL&z7#R*Tw+{}~@n`e$x1LPe&s28=b%YrtQ@U+qIB2Dg+u<>ci=o?Kf4Si1wBRzea(U|k zKru}HW||e~0ze7QfM!r=+TwHCEO*>^OX73(ezI6=Y}d#oIzRvNi;}oF{FIIpn%les zl9J#t0zko>oSgPhplvl-thc|_$56H&pM6L9_;C0*1WKL<0Nbxbd<6kQc>x8v8afV= z*^3cjGWwbq?-Y_qzGeA6cmVSTHV@webT~*W-2m#BZT-qKu;H{!OdBAb2|gY}9^>{l z8Od{kob>AVYv<~pS~`2FdGN_+52sDTF*nh{0^=&+8+~r-1V{Uf##Y zM@oABIZHEU_HZ{vjG%IH=S!@(_utF-*vQE{6Qx9N3P5S4hE+mBm>rSS zXZ_e+6SPFxxAR-PJ3n)-fVBpMF6TSJugeeQj;cLVS*A4-&{}%;Qyz;PraEv$Hb{wPvrny81IwX=!Oi zm`bx@k}TgFi#&yNDG!fp($?otwq`pfIvTy!ZfVF&_>@46d!Gi86y5+}6&-*-??BJm zUAu35gc&a3IO);|yY-wEIszVxo?tx^1C-=}%oM5>)t~e+fK^FRg6|rG4nZR4JvxbC zN`~i#{O`AyplGo>tadezmE|dAqo?TqTZ<9#wa0KzXn45U)oS&=eh2vz_B~tc@!!^@ z+fC|ujIXUv{(o{np^8510i}tSg~jad>KNMC78cU$`Ce~ioO9dG z_w3D7ogQ?iX1M?)?X**nkG^vp%?S8`neIPX6z&1qW#0aN>_8;1mnX;t=p2NJDoSW4 zSSankK0Ob;!IUDpAGnbgscRh@F7`Wf+7)7mr5mYNh@=$ZOBhy@qO9hv^vF=t#9>Ln z_Skd!`93Uv&qe&8J$PACvRMK3mmcKrFvh&I6%>!i(z?W|YN>}sg#$+aeMbU(C($mL z0@MG-^XPhDO4PtSS^=7#eq{eaJBO8l{UpWv()qtp^1vwk7n=1)Vu-JwHhhN`h9KJa z!HM^L{F^Z9(}1w~ME^f*ZAgxo&wrGy6z_)r3-PTz_t<{OqNG6(1|x$ST2bzA@3M7g z=l}%YUV`5vrHZN;lf4$p$68-2cVVbszzlD1^)YppcmthDSfprLAeXgP@X^W^tPG|6 z5$yHrmrs!qiHRy2!WBV%M~&?8(()bPFM(UanWIjYn+0Mv<02Hc<@`52f)Q{VIoC;} z2;5tIOmlr!N@t1;3kt_;hX(|6X^dmgp$L565)CM0df`sJ!JmUhd zM(EOB-~fYC)V=<-k`WhSfN47DNTStS#`acatYY3ag@3~P@HnMxCyNuw%W5$tz zd)Hf8^y&}NWBM~`YwA?R4ZO!>4d1r)e%**7tomI8I%0@FSW#)|kbG`nvq~Xc2j94+ zb}xQ#uo$+qG$G_A|Pijp|=Skb61WKh9BV7cnS3UGiB5 zgxRKiB5J6LkPs?zf^U=*Ts?0>?KlD@1~>69jS7L9;acvnZUszbtpa*2s5O;2*FtV! ze!OnUq@Ngt%gjWmNA*`@q?V#ntop^fHjO8Y>i0VbfnWU%qiJnK_n3AO)TUuC_@n$^ zm|dTUoT!x*7Rf0VpxWcU?=wH+R{6qBh;2qx^ecHe=AIVU+59FEdi_f<_m$$JdD}`F zfRIO{5I3a{m|sYx=rF2~+k8ao7j|NwwplVCm~NN8PLA~NeL}GT zW)fqsxxp*obFzbSx=|>DelEd|Y35xb`wa&{80RR^9gKVP6=t2H5%dN24LZ;UlW*8& zu{kw@xiJg{hnm%4RU(N|>ldg#H;;xw3G0K%>KT$9eDe0vm9FdG={Q3_e}*f|5hjD0 zgahbg-(ubb|-Qn1BSP*rW`&RJ%wh z)^p{vqkR-%#O5pd)VYo!Hcs>3=7kp;_#iCZOx9h2W@7N0c&MWkH#j)>ANYo&k|z(l zJisw*3>brA&5A(KDm41B%&H89aCnZ)qTXHvEGd13YrV#>plE+A zl7FGAVODEnqxSv3NTQAMKN|zsP81Lh{mCo<+hkzHZf=_H?C!>QAhmzO*9!x@2cV+~ zn&JC-Jh6~5Gp@Cgv=Gy9|Kza8wdj zM&$0QTf`Kc``n$1JUT6IE%{vP!cZ$^Wt`3f6nMQHgmIINq%7k(<=hWf#>3?q$4!sD zd}#gyg$IjWTAcCM1p){1s0wx?y>U2jEEy3x01;cfE*(LKV-J47E_XHWLV@A3gB1BF zIH@ox<}et|e~NS$Q$-LN{gqz^QCot0(Z$lz+Us_jKE?l4Ba?$}lQ10Bx66@1o~42J z(!{?(U!-lH2`FM1^0>W|y1z3ssTGRCfcO&vkc*%nk6EV&z>Vh+O}Fs10DqL1A3hAc zED1s)BgtRj4@C8Xd~6n_4>hsc)AY6`ld(ByReie2pRkD{jVjOcok$bVA&EP4=7hq< z3L}3KgPwdr8yrBFQYX8)x?)F3d4P`U*t4a#Kx0U?*cmXk%%JCowgcXo8~w>p1bDH( zJQ@_)*f`(iu;pM=LeK(JZZo@}c9kzAtzxd|sFsfX@JpT}v8a;WNxv`_x(P-St*_ht zK-SvYymOv%2)P#HTy52BaT!Ra+oH$bLQ^ty_ZqCXhBBdzyQ;dnBWN-!{2qM)w`ChG zbfF2w+RZBE8DuS>FU>tvDfeXXK~={S!T1}TeddkX`N#IINflj|H>1fxEzuKNmV16` zBn(^SWE2{p!Sq);5@IQ)vVQ{P6qHl5ZQQ0lXxJhFvFC9yW7ahI_{w=3x1z64Sx8)v z1dd9-SB0SesN^mhMTZ=#N|*b;iY3DWkOT~rORS?2mrS|7rnpr5GK^DCESWL)1AultVXYoD_&JO#RxNR+<}wON{KtL;__ z>5l|O!-OvjY%SFoK5^+;m=RSjIBij}z+N`bn zP1kM{e;0(pS|2+0rIy5Fx*tS`ntit;*V}8)6Yk}{H+%X^`1IzqXan2 zZIQMm%Jk&aWur7J8ocmQ8k_d-bgH3chHj>gO$&)U-~Z>*XmBYc8-v9AuWDnZ&5U zjQL`8qL?)^LJbg3F?Xy^4i*-s=rT8)ObWxmN^#$Q3{wRGb;ViK5=N1FZXgD0uE&@Z zJE5gsPO!Me>zOXY@;{~B!|wFo#ljSmET($uYrJc#cr09NUF*YlwB-C_+MIzW~a z4JjUnT5&r9gu~Q0(ikDoNmKb0TW{*2Gy}8BmO+hkBrJx>lbriI#RHRq@z3m{tY-V4JO+sR8}tcSV%@5aL*Y@B6V!B$1=}@-ux_(jS4m& z$_2N3sq$@@qevrtm`+KEtGb&9l@=zhmBHDJRKHSv7UF>Rrc(ONYNQcW|B)BTTSUT+ zuf0qo8FJvJbhX~uW@+i)s>T>2q(Tp-rBJ|q-9Gh=Zlr%typSd;P79h^c;kxspC)P@sMkusT0&ZS$#aiCZB~mpM$LeXRp>kEJwQ z(=LK>9v5wnD*D6khJz^eLYlZd3A;Tnko%V^r3OlitxsW5O^i%cW%so7i(==S%b?qE0=bho1Ezm43O}5VB!$BIYm|zx^yuvcM7)KGef2Wv z-L?m}VEez5x8lFXPwfbeN=L>&?J|ID{LH7Q(PS!+iL*aD! z4Mn8rf{~2S9)D4zbw|gyt(RhZFPK;WwTuSLBuB$De8J~d`HhU+^SwnhVq#VsLfkoh zDtW%^JY7j2n$yr|bl-DD2MnL;5oBPJZ+QW_W92aR4akbT#60g$qJq2j9P;?p^$9V# zdD55R2c~>o1YZI_z$$6rK}1qS?CKnO8BwKGyAb9AOB#{t0AV zpYz{+aVLd|zzdjqZp#zgDRKPrh1jo;ul-K966~S)qGjz;oHNaHZ~n?zSPsUQgj51; zW~`JEo6|EL<*UU!yd-p|bcquZQxE(5*q!*`V1Jelncv{#7K?`KMdTgjUI}5OhHiV1 zU2nSP#gw}XKJh4##7s;DGnfX#81iWeBd0l^s(N|$>EEjFX=6>Qg%{}XU(?pzsr0nO>f~-wQC5Nr;(g%?m$RLWELcE zs+*Br#BSP@JH%Ay1uqy%5ZnwaT88p6hPUOjngUw=K$%%=3_cNxR)rsID_X$#LuR~$ zS$^v9HUhc9rVafS*lGf=jFU#&x@$sY${=irU1cJn^;_0#t^pCA_usi_3c4OifdcCH zSh_IrwvSj6vqI^TqRAp@S1sAg9n07(GXyGvF!O0ukRJC=ZoicbsxDYt$qmIGN$ODq zmldru`#=Li7j(JEptGufqX0Fdn-71ZcAK0fzq)Ic7*6oj_J^fig$-}s5859m z=nw` zVmqZZaDH1;cfti8*4$1>ZNd=_tDoIXh!YzO$9`k7^@)Tx*0XP-s}qU2H$9raf9~zy zQ`yt@jX?MLy|tCl^Xrc=bTDx%EU)A@f;I7Acj+yWD5bFpXo$CT#9~&wCcQKT+_Di;AjXpB(EP>$NDVsIjrVqu5)y zj#?DubQR*FDh{SvdqoMD2z;~6tZ7%<0zD9G1gYM_?niGR^$XT%7CmqOYTmnmag6SnZ}1srv)`z}*CWBTX3jRNNF z*giB1t01?9H_X=}Tx;D?M*XHvPD<=VU)}l^{2e(|_`OA0DMX*~G8gg=$>zym-VlFOH6NT@3 zsOvf#qLS~0mLgUEve9zFkyAv(>l~bK3Yy^M4sUZ(khQi6S_EPg?XIsKrzENkYeVPu z_V7_n*|4%_ZcgFhnWzoZ!)NJJYx6ZKd4a@60zL`oGRObMrbTZYi;BbV?=MqJxng3! z9cTyGL+@w5NuhRi9m7+A^p4&}Fll}1BR{0?*u{8&2Yg5@-_6G{8GqMd%7sWGF#r=O z;+-mcEYV-u+|ifj-B!@aYR`N}5gBCsx*$a7B;wmf_yUy5NY(4o1tzAe4^vf9sa*u2 zl0@m)Z+W|3>@vY|Jw9`Z__E8dJCf@TU7rT20UXlS`bdqn)?fr+eQGKtU$LmKi^q$v zj-$Gzy~HgHOI(zMo(Y8rEgiT7A7LFf4%?~(rqjx4${zh}98W095{B>j3X*B0j$-oI zr22Fniw6<~W(K^kW&?Z9A?6TfG45h0F*Dn#WafH}x2(Bvc0nmtjM<((bWoaX46zl^ z)lv}|vOS9X7ky0}KVP&^{aKhInU94@(D2~{YL*}z>{uNpw$|&^o26XmwD#{mtP0g# zvC~v$%bH-Il=Cwsh#46#)0@h{qXV*c=P{cBPAy7G1{&m^BNhk}Ql*Xj9PA^rY5X2P zHk=V)1f48CGg3BPxJ4@K5Rp4v#qn+2_|K2}Qc>~q0pq=tYt=%3$7)wq%~>}qobpSv z!+`6GUV&q^uW!7z51yDE1lu|)0=p7PEWcLEJ$IKO0=9zna&`4VKKk?5__()A-&$5~ z<|(VsmY*#jb-FkL6hW7?r-eQ^n73mxS#8CN$ZR9vhEILfUcBqfU~463Q?z>%3sf}( zGjOmfhXR;Af?AT~y$G?Sko*wRJV874Y)mh>*2JY=1+nJ{1G?B|pOdj$VM(UG>BbV{Ai(CfoNxC z0z5QVy&Sbe;O9$Md@L)qm=cBrcQ&LqE?9IR(JmPQ9+*5QbS$=K_fsW%RdF$+%P%VxSuDXAA|h;^RYNjiike`gpt5(B9yd|#LyAs9m)BogN%T)MgT-dVA>4Ql zpf~!xjrM%P-Ch$2P$QX#GKTi%W0UYWq~<22ysW5%r_{y534WZ2F{)Q#mZMbbnM^KK zN}^aohb<75^&zdBme)91zAQ1bx-w^X66hd*^UDpcoa)lW84aQig6p5^KZ!BicL@8# z%7iyKY;WV0T$G3C@q+R*L>J1MmY@{5xAVe=neo!Qy+&%DM-y(>Axe^TlhViDg0O%IxrG63zCa`lt@`{Zdl;C9tGeX?2gGU$_%Oh);O z-d-p}9;sk2r@mGT)=?&*_Po$0gpI2p^NOZ3R;@?nywfifmD=!}K1Q$U&|lH_KrhzI zoTEWdrWy7g28)&XxIMKoq=+N9-jLLoc5sL)%$N~VQj2E$o%(9|aQQD;Ri%?I3j+r( zo7%DE^eBjXv}<|`(Let_Iek9SXzoty(fPoaX7Ec|WlPx-8Qc2aee+!@;cGDRnbM8R zOq>f7lgsaN0%_NpqC)zgOQ)Eyw}%68b0P3Z1DAR%oSd{ruQowuG7@hkT;A3lAFHh%YZxNi&xHz=2&P55@7eLSF={X38OU5Y5Dg6QA!YP#4crj?1L zHKrXia!x#!=B$WD`~nJap5mR$E%*fBB^{kK*8PPXLiWZ7bflK#{V2%Qu~=Vs<>xd&<_#k3K@g5K3|Zo?bqcoytfx2MBa; zZf=Z^VC{kW2WWKNfhZ_sl{FV4yVgO<$!)60!lhIESuZKA3iVUI>$%}9;Dma9CS``E zy4uLM$#3cu=I;-*xNbF-Ua$|VgaA_W{tO8Ep@INl-L|9qL%(dOUdHb#)DOmBs#LeS zw$>5I^S7+s{t%dz1NDg^q*V0bt!B$S(DKc1IP}{ny1uK2$at@9=EpS5V@$m6p1V{peVSp&U+wWn^ z&vB4z3g!rW1jh=5k{SDe?;Zd`7Ewk#6_TEJ|8_IuO3Btlb%_Tj9Ra~DuNIB4whuo( z=~*zhpdc)Bqv=R#_`pXazmN+mMFpt(zXQRKZU#Nf$>7ydvWfk@h! zIgB({`$iD`_F`lR)!W)sV2m~&Cx)2p)!7MtYtOUV6oiJo0^Jt#YD!RY==nS#O>X&x zjn29l4CZpX_F335`8Mfg_VN(yS(7Vem{BF5)f=Bo`|oUWQqX zq>w<%b;d3cq~n<>ZCxCvjFD3Kgr3PNDPdeKhe0YxqLNv-%MlyHbNUPd!(ry?qw@1< zK1ff}{1#7_Kb5t$wQqa|D@0*?U@Xkdmw|R|0}%f5iY<A@iGW9hFP{qDFAgzhpHKp z`+s)}U$FhZRQue2R6Fyby71nb_K{E#Aly+=01BKn*+)jc08a6f%ZJ%7S(EWk z5QcCMkfQM&cj3TtkXM=x61pDDr|KMnXG|zwqB_i&B;)S8=Vp&8dCMiW&zNn=_oAw2 zN6hg{xMEiJ=>>yRnh12FcZq=8BUrfe9ecq_#Qo^H=ik?746{Nbs`4}1yCXFD9-+r6 zb3Cf)y_`z<&A&9O(vOc1_t1x2h@1x4_7+>xLrFZt3|M7=3J(alVZ3kWmNv~qZV7;D zQy7T0h@t5Z#LXtq4(3%II(vJAQdZ0D_Eue&c!bIJZ3!*gy#FW3j8`O+_H3XD zZ&%AJmUeR5e0XX&q~ep3jH8hZ@^rQEtY-q34ilyaTMuoXF#X?EhSiR~cVoyh5T9*1 z{a+i7$57E^+v9B;INRJ9NMQ>y%kl^T1%PrYo!tZ#`WO$84b3}`DFDH_5cEl+y{h5D zn+cf&ySM5Z-S(p@dh_p8qSe0kQF2V>iqG7mDEdxJr<>gfgchwywCi<@k4oUgmZ+nBofN zZxf}z$ltucP`J|iZTKBcUv8g9-!2vj!pTQXfMWn4bjUk>sol)2%;xS=D-%h?l!Cr( zl`?C~;u3`Y()Sp1A^USGu+pt3P3(n$C;ve+6eh`Qeemyx+-m|9)q9Hbs>QDTX9Cyx zCfH-T3YYl@n?GXmcvl_bjlMStfv6|?5i@yNyXH=6P$*nmm%f~HCjM(humkB$U@lFr zlsw~eL$*`?!9hz--e=%Zxoz2RAJ$`4azPK#x%zuXpuF7SJ)!qthE9j|+PP^dUd*lp zsNS98Zd0v#KWXn{!J)?9a;HK9DTF8IF*i4*$<=kog|x~u>BcnbEohlWSI&lAI)qPyO{lOQ`BPhmr2q}dC z5e;qA%dAgLEwSMZ68$)PA02dpB8{a|Im?yUx+)cbX+nnNu3Rcq{Ypw2C~h8A{-2Th zYgkHP%Pcrk1or7Eu3&hbd*tgt9eooD7tIDZ9vQo{wcwPWd|9J^ce`k*yeNNEZ+A;r z3CC$)cYb4U0ahFL^t#_pD^+{*`eSp7RaWL*8jiPrsw)wCdV6l`;@NF1n>ZgSdC>35 zFy)YR^9!6V`?a|TXVW8xqpv7}H}O}14r9l>QGu%~jaDWHvCP{co#TbOKZ*6JPVM`3 z3V^-F<<4qN9|q{zn{webgAK=MsY)#36s1p3UfWAQD6dc2Z^%!gy#^N5`zm8foJwYU6dt308smA>BV1T`apAASN zE6z5bX{yJrUX~1NTTaPMt2VubY-bBESWhjYN8nL0$XFI0PXp;oT*tVJG8)X){y;l36TudIvtcw{Y+L=rzRD<9O=#5fnwoZ&xy2c&)KySrdq#zDG~=iKVFDFj(hjBH3y z_3nGROf6iJZ^7b>4rSEk?j>+&+i_B&VD$Yi;^jjbR&*XVaP%yX`Gu|LiCCpeI{5Op zsZ<)bdIJGsz!B7jnerfn2pMGn4>5iw6N>$Zom&JaqmDV+ywf?}c@WYG!t&YY_@(#e z<3gD2`ZF17miQT#8gGVaT;k1Q;z z;nMJLb^VEph1Hwiz{j=G_g)!pW5e_&aVeXKl+T{ji7N&viHTu0u8%ecY(&TMyjmZR zXL+xfiZ>j94FtF#f4FUwmRrr*@jb-l>F>I>bykn z3o&`OnOC_9qb?QYjPZ;=H-kZofxnH0IEFK{a4=3U=pP}jyWy(BD2GU3VgT|S!3!Uz z>~wBJ?A%BxICqO~6yX;UuWX&-%A4R`a?t>7ZL19Ao01Z*e)B6qk~=|BoT%x9SUxIE z3JAMBcv|U2k|<2Ab+4c{{#*Is9USas`q_d30<;Roh}jcjC`XKFsR%S?K5;@~ZSD@0 zZ*zvLGO6#@eFduv3bq?F_@>yhl_cN)SOP=6lyf6CJv~QpXbAI+`C~&2H}LoJz4RMa zoxz|HhNFf$3r5hyqRO>xZ+K&*Qk=om)IiTMQ8nU)c3`>n+>km*Q>Q9Qv`_ViB|O35 zgiM7oO`d>SIZ*(Ns)jiEM-m$Bce)DBGaBVSHRJNrne&3S$>mIJ#3HD|5)za#X9g=P zp$a)~XbfOD#4vhY#8zZITn$03y^j~1%5e3S zy~g*3i@wRIv6O2RX$PKMnK8hh;M~5C#MO0^Wq9{8eZ$3tU>6BH%DQ|9`F*_3LhZNj zXX3N@*@h&VN!PQJrp)XDt|{GdVViCqQ^pqRc`J4=cxGINjf?Y#;^-&ro-w6at+DDr9K~+bIy1)S-F zRbPK}y@(OriN-fi(E**q(Y3+j!?;mQw~pVat>yJSW;AhNF%gZ^EjgIQHdm zt0W};K#MvbAq+9`rWK`OV}{5b>tK=aK$C?+)OK9@``(Hsa{9lQiyG{kpyYv*yA6*f zZMPLMoN`7T6GE629#LDKthnX3y+cQ_TFXKmYup&vWDHr0_>jp#z)X;3NZ(r{Bh1!cv5y&qyhQ zV^C+!W8~R&ZRchORAxFi(6>s}tr)@pMSD zBIo86HDn`ccK)WMl`TCuPVrJhoR~S*vUB#u+1wWkX<`5u=O1Fv!(txgX z2$r?Q2px3lyNvZ6eaRRX*RvHgs*KImt)gNSx5%{6ivr4^T3_AYmqm?@s;$T=q!Rcz zSaER-ULQ)9V#>~##4Z@+m*W~uRTDpH={(TFqRMwD4BwkuaZE*qJlpWu1EXJ>uOh* zPRlrFp7%~|b&|g!bu@9*1*%eC=^M17v-y}kUs7^N0C*z(1&vT5|JiLv;?{6&Rs6r; zoXWRnfgISYTLE`DuZMO&b*Adh0{CUzGqkarroQXOHDb&{p??I+9iFzvk+1CHydLfP zvoY}nHpsf2vaKrzds~@J+8)(BSH~YdRyv8L9j!$)ClziT3}75=pM#dhUGA_06qQg& z^wK@4LU=B;okBMBiecqx%vk=!Sj%A z_;~7$G_LA7Tz6RvG5NOGlG~zVwY?#tj}Bw`PPnw3Tf%`IP~%^ZtSH|=Jz@=FfEzUrt9PHcMv@(i~% z1|*el^`jP{9zGTU%86>-_u9#fHVhK^(oHMfCABOe-Kpv#>=+c~*;)4dE7PSrOY>Lb zb>!bEo#R&W@<~bWulJtIe5f?|dZIsFe(zoTC%W^GN!p6y6^x)-D$1vsvgAyJGE0C1 z#TkS~nu{9MDreO`tbzcU{v*#WEn+=y8)5E26|91?L!e^oQkqN-PS@F$P4r`Tb_d(4 zpUcGVnbuDvG`eCL5giDHhCQ1v@WG{BNjcV3K$VpE%p#y)R)Pkgdp*PPJmk?%{n%uc z0J3l0tQT?dOr$tE56?@mLB+Pp&X#Wqd+QuGr3VJE%IwOxg~M4?Ed;g}biK+gY;#d2 z0SlV-!A5^1OKWh|OW2n#Iich)JWUgkt%=Fb<~uc9T(4SeQ#gZ`%@E6!zfF6`$DWAaI1nTM z`s0mc&mm6^IsFC$IeUG^XElSNV;Jq)@|GNaE6McVS*CD0Cbp!KIeAm@Ht9}YN{G^x zMND}}%!LWG@DeKJ5>l1kD&Iy=#VSMkb0Y3F6)>EID!=H9k1wxchTjwo-r(XE6lfmT zhwIQYsB}Ko+DwK^Da5WK&^C&K=NU<|F=}ms+=(9N>PAPK(@#z;(TU$KP@H%&!J)N< z;AInBBZm&+#K~N$lo8FKY=5PzWnTuq8cE$^Zfve1hG-Kki#8JkWLWBBO6A&?3exk= z8ylOYT257|Zbay2laX~cI6r=rd!uDTks=Za&*}$R^|s@y-vaPFOnF7V;KzL zjHwUJn)pmWbrEYvZzK1-YYnK-sqd;CISmfD)HKqk$y@#*8w~X-l0Z_t(G}toKSEQv zIZpV?tSzft%TA8Th)en}fc`>EDf?11$ba>!@@}N_l&M8IDwqhXj z{&9It%dq=#(@I=C`*{+02o$82oKH?8sG%H(?zu%pw~u=Ze)c+UK99FsS{`m2(~F6+ z!5c6g6)n4*qSOkjFmVAWbmF$}XBX+oXn#h#*rzD=a*{ds#ng7Xp)yt9(VC>lv7kxU zI;;jrIL#T-x~0j#HhdG$>EPL5;5GH0Xe%_4o@b=gp?IO@VqQeps~WJy6D)E?`eogb z(u)gK-Q5fpm(9al_c@ytClYw3njdf8JB>9NZtCk=*l-1O+tj^b&R-UnFfQek$*pnd zN#aovF#fAUVR?mTJvT9~rOWt5Qi6+=y#KfAIpp2_@=TlGcbYP};8#WoVJl@Q9w8;0 zWe?%oX_sW=>}`P@B09;&luCE3?P@Y;3iL9vsQy)<7VIO9OFPc;3Kh}|79XcdBD zH9WU;_$69My99pZ>FX=H;{`8VYZ{Vmn6!pI;3IH5%f{x*6wPoud(6_r2k15pxC#lq zZTliA4vfn%LJ1K|jlPT<5FvS`ifrJ}e5StlK+GEsTjj}~=?O%YsTqggqxT;ukQ&0{ zj(J9BQP+&NXsb{o*tL7VtW@rtDrTg3E}`-pV~wJQg^lm*QBKXi2^8!|#7suMKa2Z+ z*!#+_s-mu6l#=d{=155?oq}|ObazREbP3X-z#*j!Qo6hQP)Z8YUDDm$b$s6Uj(3bZ z?muwHJs>-UTdzo<}cTw2Eb*pphtVZl{>!NvlfHc zK#|(|Vw^`r68dk11wHjl- zrL4N(aH|!+6uuBiP*ZntPZjMuzdT& z1C-w6$C)2$+1RYsv){a|JNv?-00@TAB)aJ!&+)t+hrz|F~AZ2Iv24L)4^(WZ+jK19CkSaCeOLKe!* z%*hMg#T#3n+msBL(LmnX%TxoItqm+|_UBu1^vXc({TZifDgUcOmtEQ9@HK2rP`1~I z(OB=3=#%FurUwf<`;wActWN7@7D!)wu~AS=y22tGDCMLXt=K4kwL#q)D_8I){ye=F zVXd41TNK_idrP|0c#5?s5^hZK>zgi5Mo8tZ_d#k`7lQ-3;+^z&gezg*i^{J?^4*6E zLWYn}n`p|%;LC{xD3X$7t`z(pL$|M9Za&j)4r~=+IkmaFWAC@%!hR!Z0X>}ZB#fR+ z!#XhCx1_F9hbTLs|0O&@YPm2)rmp-50tK`m**g3(2)B=;C;p7}*gM5-rY`mmHnZ^8 z&8P_O=r$vB`ynKnNTljoGuIb)ryNxAUh%TrvTgXfy=+)atV> z^6!TQ9zi{>S;W4MTGK5>R7agdyjNnqV>_kAis-Mcwt%_F5?s^a;N(jV%nsIp-v$fZ zK;w^nt>f%7nHXoFRIhZL7i4cf6bJS2ewMQ4N(33UcT_>IHra~E2tUTAiw{EaC_L1y zh@MwUKHHp5i;CO!qIMsz0XoU=F5mDl-%mV}mQ3rYrA-aFIVfv;xq>4fbYPgQsb0px zuk%3s#FD_Ty2aJ1s7YQX$x_m=+-l1SSl3)${R;TWRyWs4q;1eqpq_vEyRNlIQ`@iy z4j>)Z*0o>-k{Ee?xM;m-ftvxm043`T5&tx}3LWm#0r&V}B>TjE_#kP4a@!MIi}g!b z{ia}M%*?T_E@Aunox5*Sg2e{faWQ>|&AaNhSmOO>(sqbs*eysQD!G zz+kKE^I?ICe-x1CSJ`TwER3CEU{-pI92Bw^C_zP14ojfv6c{Mx zoNaX66CpO*xKr(u>Ed68PzSAa1qgc@ByG zAbM6+Gg)0wIN_$q$Tm@{RFF>cf^dLCkUz9*-}Vq!(IIokUuFA8UnCA*C8D-w|^pF+%%G!1l}G+J*9!Poj$73V{KD(&vDA5CWKi#DQM0bZt9&hn`t!3psS7 zPk;AIQ6OLB3&k1^u<z($A+W~jU+8-hpT^Qz2jgQR;|oAQsH;9`LM7c-~2Lj zNz9$9GKlpWa{3bP?g3mBKJ%xdUTy~5Tere(VJ0=TE1VWZ*xPQ8y+vb|mrX@ZzvEQA zzw@E;I}|G(@c9dz!X7aZqPzckT9i}bH5<|ZB-J){c0~v0Q<4K(i zeACo+)3o2-9;nYsJg-);CUV%0xUau(Oza8VH%{IQgKzIAX&Y@Dxs6KgL!ZgmQuzX? z-e9nDuFP+p#r@acy*>9AjaykG{vtq{&%Olz_vGCWL}_$tvvIrniY!jHzEn=}$9<$U zOM2dT4NlH@&5c5?L0!wdFmY^?qg~OJudnY`8$E=R#ovEpm>K%{xP_j~-H-`&VQRo} zU|?w9-zNS-MOWCZ)#IM{4jm?XH!kV|^kXiEOJeAuk7w(gHV=TU!xcy}S*`fu;N0n)Pi>G;fqYDc^fjyk+#athCKn4i; z?~GzqEX0)F^}k3dGTbU>T{P&d^>vwPvMam4;ybtc6j;D@#H1-ExuGZQxS(&FY-2~C zuyMyye+-2v^vS}ut8>8d3;v(NVCb=|6Wu&LUBROn0Z+Kd8>;u0rj>tK>*n4KHdBHGdNV0j zGJ8^$=Gn8CZ(H(P2ctz9ef;K-Xib!{n+X+jnIm8ZY0_-cf`&r*BhGShj9s;IUs)gu z-%!>7En)*e?qAQ(5BxTTHr<_<^F_{{|8w#HgL4E7GRgxU?$i2OmNs3#-caBOA0ohI zQ*bg$zRK4P7UL^)_+0}Ri4zY$NVGC6Q0xHmwXU86PXcLH6&okr1SEUpH8q;3R6(|2 z58qc(jfN^~Z833lG&}TiJG-osMs3Ts2C9#}IRj0keuy>l$AW~#3_Nw314&%yVbsZY+N$9Xh;fQz z+agg;#VVmaXuKU;KjhkuRgAu}miZLgbV4fM4Ikfi7^m#x)5=3LcX>Kc;a3SG_Qz|C zV5K#kH;eNm>2&~Al+*rcriRRUH8{0mE0joLz7>@EaHjt`sM7VgVLidR* z4@6>R7mk8h>3rICM;|{f=`=k(XbRS_cycH|uE?CMDH3jYU0Z;Nw%S&x%QR89HCY%D z@p|>*2ktia=|%eAr@8nUEHbij*@LelsQ6H`Ajj`qzldD#}Q*-lJzvs76xetX_-w}Gu_H6qx%Y33>oU4=m;3t^A zT2!`9?(-LInULlmsFmEEp;K&X(ZZu zn;qq+xBfS57z67wlkv~5ucKj{8&0VAGj`x*3s*X!*kmSzyB89GmEO*yn@e{GKadS!b2O8q_5xrx^29DNTrPx z0UO{7CVDfA{neT3lisPlPv?ZcTOn3G>bHFuIg(!>i z%1JBfFWM8Eaa2LFil7jdK@A%%BZ7}{WIRGwG`=^31oIt5Ly4~WXUgLXLZl`?8bV>k z&w-oN#*{tcqcTTxlR(T_xeb+gMzL~+?)1-JmO0fQRGCwSqa?zIlH~Ao@2zIuW*sl! z-?y6O;J-*%)?=!-%AM3-KU^69cZb!F!LdSL82d`N;heBw3oU3{#{^2R`Os|tyShqM zF9deXmvA~LzoQ}e;I+E+3^~;R)y?g5@6$JJ1K$%>pt|GW1$$YQ8br+PMw_BVMu zwM5=I;w$$q2U-eV)YM7nlNTG8&2T~ma)2X=ZZla9zr{Ps9JP)FRE!kj>k2tnxY~Fg zTt)YfJ$YEzkS)r~_F+OD%4t}M+gw+Ufwx0f%W|G6@-BqaPVW&Ow5Oya{5`|?TeAwO zWNwcfYU@D~_enL2TylzTI~Ss51IzY;uL_A~JfU0wSqiUvoP|LOaaCrafmEJO^V-i! zm(DUk1Is&4U**Q`6y`=K4m~SGp`M%^f3kYI{3d4-i83<8hGbzpd*vO}8yw6flZhV= z%We)BJ$a=QA*NmE3H_l0l6W>j1ECSmh2{mY`$q}fJ5cNAej2HB{T_R)UnkCPO*Q7` z3iSq3Iq>ZO>tgXo^0{FI<0sy(cF#oUUnV0%VDFYnd@wN;?a&)C-&dO+s-6#+^z|uS6TNM0kWGM} zadUhAeoT^mZD%(uAuuDWlaHuU4ol|616kJYY4&7OetIh{1moGI(2j8?6JcT70~UIZ z1Npi2qTGBj&T*ptRGOLVufy`IowoMxkKLf&a4+a&sy>c}nOCnEaF3MfW@h{M8q+oA zP28gKInJ#X9e!FSTG3Y4hu+1YjK46iI23o8?Nt_mbs&1ncb7A1Q@!kviQyezF4QR& z**vuw*K%?m8M=G(s1eo-4+;t?BoT8S`om}v3=;HD3Y7YotD;`{zDWy(nUS0ekr`xe z?Ux?7Sf}%telhidn;@XV*Gx`?~RLtr}u3p#>-ua z5#}5sN2d#|q{{mnGaY&QwG$|`RECMTsldZX(!%=*8a}6xz1nY=oksH{_I5||A74P! zPh`!ti{uV}@N{sic45{KcGO~tp)R{>QOu{+pXv6>t)I&ceY<9`H-1OL!ufREhmVX$ z?31miWSVrsh?K?liL!yTG_Wfx6zl8=wwQY#|1qBNLmR34h)=8l-iI0JPDjyK`6+yx zn5Bc6>$Azl(Q*d^PqW#zFHUiu9S=eaodP~n_XOCYC}cV6mYkDqv$fl$noL7I57Lqh z-@$&Sd)*m?wCLYK+_JZ~F=si;JDyjSN6JHW@#<|6ON?xl;-=?tn-aZ0Go^s?f+5ND zh^6bAK*lXw4NHo8uDVYVi{2h#sy2MN<(5^A7yEtuIPs<4>!PMMKH4y7*z>8dFOQ=s zPj)ut$B*q?&FK=tN@0UTu2E8?WSmuxjC_Z40^HnfI4fa(t{JvJUXj9a%Y?$~&|M}U2h+U0(jtxB4jPXrID$vuoVBh1d$xLhg zRCw_)5AVc+Ej6RZn;IkbJeiV)tQI6p z1_U_gjRS-CYDnnw&|i`n!oUuf51-WGh0BIP2rXVcA z2RnJ=_qy0bBHbgYF_Ask<*-KmNY!t$mgS~&W>IR8NH2cuw+$`n4is`66pFbq3y$(v!OM?=?1R)?^2OWa?-=YuA7Qt zJJX*VUWs7;DgF~4F(m4AE+dGgUl-<4jhOO7GwuF9s0%|XXB$3#$HWS8T$?q@Ne-K;kT)xb@U6byLL9 zQ!r+*W8P1H9`|HzXQ&Ht%om4rlLiBjTTEdv=LQdodruUbTHRQJiTsg+xbpbXQYFh# zKq_Ggd`Cpem5E|S`?uasHsd_qd75X^2E`Ihs2ZdqNh>N;x3&T^g~$)A8EohwETN*v z$4ecyh2I;9MZoaC!S|c{JauQ=*;DDV{I*k7 z+p^)$G<2_SpFGXa-WMQ19FvyGPtk%@#v^G9{|2WBlV7s;nu<%R#wQigulRSvI=D0V zRZFJc8M^9A67v8o29i`%tz1COH2RC(R>kihKwx8xY81fktDtaqD2|6lz0dc0v4Qr# zxd6JuGW0JiT%2vt{=jl~GaIX`KL?tRGgKWfJCS{lMu0@8!H0eQcq|VEg`spz&=0eY zUV1`MyUv^UZ~VtKrKrC9yGfR&)zv~AJT$IMLfP3c3w&&fKt+_MwuD!At7o&zV=`^2 z{9DL(+1cghsP^-=8|RV`2BN=9V!0AgtY+{PoYdbIG&-YqGkwY5(=F9~{4D9#HCAfD zP=@seBdS^%Q#!k4eu%V!Rp|{eTH5XfZ6u`>ESs9Ggoy>dwW z%`+V138_5%w+2XfeQ9fqy-Liu<&Zz)@ISrXEEOM!GMf%EcRBBi+a#(Th*) zkGof==M+SFJG7brI-}z>R@y${eHjeI2q(Uq5A(hISBDrWRViCCCFw|#uI_^UtXl+&W|)spM_3!BQ?7q$foOmVOxYky z6@&4Fs=TR7o5Y$^)lia{63pF7PHw>?CpQSe+Ay%fwS-dMomQ)!68zG4rHH#7WS-#h5*xh_aw>94osi!B2vqICv?jNX6ykk4;u5#leCSKl(n@H zKUhzT>l{KM5;447!+w>T*hCr8tTylgwoKoV>}AOdP1~!@>0A^!*%wqNc+6n(r%|&+ z%+m77UshDB^{y#LzJ8|l#&Mh!CaLi~bj4>81?<>AmJBTV)zFh8WU~oAoA}FWPf3pY zpg4u4O?{b4yKKxq#FOoIZhUW0BKnl{B}fMcHOqga4;{ohtv~D4v8=atXqt}{p#BmQ z({EQNX(0zspk<$_6E<3LF6F%_`Wv&3zr2+Cw*u!(^WbCOaOAX`;Q0^tGFHv|^Lj+Y z$wg{1RBC^IhRX;IWx2fZ0%gf$Zg{}>q?j*~Q=lFK zwk^5a2+33TAcFA=3!#d6-+W`#tn;i<@o~5o0ADRze!$XOxr>l^~Ntyj-mdlP)iwr5JD1CmHlOXg+R!3$w;qYt+V1vc@oUHfSEpHa(7+e`e)KeBN-A9 zw`AkQDBu(1w;j~p%W%mwhOX6J>_>>6P|CUEDQ@9C3Wf+~k5o3Wzlc+-1Tj@@LSK2; z?1r{&eedoQT5bD+Sph0)SW!cSk2V(iz{q_m>pTNkrZXD)T3$OzGHnEqLEyZB2mN#S z)mbFO`hG4rBf^5cNGk#Pwhi5UCVY{x2% z0Z2+?-uX}I0_~2wqV-Z(C444=i|K{zFFFO`eAYqhuSuOKCJmKeW($PJJ5IC)1K9oT zb3;azG%?3e@jE1dDDrBTII{fu)bmZ_I4?sxKa&wZFDAp`!=n&3Hu)laT~m0N1N$WwJ>z}t6cNrS9U;HY23&`hgG-b$H!>00AMZiN`1VPJC&Q! zYoZMb8q!J%w|9Aq% z^Yb;x^-!3ksza&QqevtqZSm{vXNH#tJI>-S87(723Z5T*jOiSFQG``66x(k#&#mW< zfu?81LBJSZGc#P=TKS&3a2r<_xco&#WV|?ta)g-v?3B+<(}WsehSzHRPOEVE4pD%vPEeu0GBI}rp)Wq5@-(Wb}tfLJmTM8mSGt9R%ieY@6Sjyg6&J@ zB4tD2FS=ogKQBS0+#?%O_t)`y1vQZK{`L}|BYv$=tmn^lA{(ghCxSZp@4TX3&N_#_74i+KPPLz1En} zI$P_p(t+Zj8awg_kqB5+9&a-Q;@V?3Jo_WJU^UK#hWNSaJMCp-wC#g%iP1J1^_?Q9}yDV>Mqa^{Z=<&qmnv?AW`>g@gE1g47w+aK_LF5^F9oq77m;OE!?gL2$5XO+K< zjJxH!pZ;wWtP)-jvS3$Qr7No6hs0kctjR5XO^Rc4fJlFUBoW0br57>=Equgps6dj;#y|9}rrTn68-O$HS7pHnFhq|JlmkAqX zB_#xuOQ){PkWX)s!Tpt9X|o0;456YjqEAwKxJFP~$gSdt8$cxaWxOpkdFJIAT{(^I zXOWt6@iDPd|8O7GUtKxaq{=o`q8kN=w9~n=0!%%qqgv~gq=jDfV@?U{pBc+=hhboX z^~}kui#$RS0(`9a-2N|6<=EOYVrX8veZ9W*X7@MoK+F^n%*tQR(+5dC{o=1BwaM9b zD_XX?nzsN8Xv*!Wjz-xD#@YHS;R=3FnlNx^1O|IzeA!9D@3Bh?9I)sSk~JT~Zh<}d z;lf30%J=WIt*5y!ju-=u8E>~_L{|{0FA;LD!?q!n86oan$7*^AyiTPkv`73s$vh0x zPmpL4vj)Z% z#8*R;Eah{FckBpp({^0!D-`|vNex>{Qv5B@?}FwoPJXN8kDR+o$uu!BF-ImRdGP!Y z;2n2z#% zI6uGel%TIJkTv zZ)bZ{%v5hFHOUMmy#@X{`x12}Tu=1v=%l zMd5vXod1CmN0Bhdny6}Vu`T~D$~WrtC3zUGet824<2@Qdi2bZpYfMZbIaDK*D8kbt z?Q1L)FCku&DUQll@Fgync!_h@j`;v zu2d2StAHFjfzE=9GhyGY+=l-|L~&qpZCg7Oz+iE%GEjyA0*oiLRJNKE3kRkY2WPhwFmXR!SCuG2oxe!dylmmD zA$w`8Ne(eZUTNiSnf~&S5Z@HF6mp`O=nTQy&;(>julXBqJG*iD^oXGdwQ{RvxRoXV z7@JSW6cBC)+io!!RlXoC!F|5v=Gc#ZvmMtjviP z$5@h>d^RkBv4~A|s)Wn?+Q?tVnlZ+eYoUGn{(V3=MEx_B`A4%sGMy@vpBWrCKKI_T z48z5EnKY#a_XjO6CVz>59DE7Uz$aTYP_4ly#j>MNv)m@(s!3adQ^ZI=m=3~;l`Qm! z`xTly=p%9rz^O+jnhRcrQ$3Zepx1ydyonG3AYvH9?W&!(MreU+CiV45_~p!0t8`Nx z1=Z3zAsi1ae1xYfH#8EuvnToZUBk}aYg2DJ{M!0u{9H+nyO^E+@A)l;d#XLtwGJzr z&w5GegXYPAd^_5pu8iUN<%zk<@n;zNHvl!|6UFIz0Y}07nt6Du65z<6;4MOir~5m| z@S}aYVN*ss^OMg>aZLTY1Zy*OT6SWu&uG*p|Hxfm#`Y)kg$r-R)2OhgAla(d1kNNk z?bI?rHpSp6E=EaHlOSnn&E(v9h#SW{3h-i0^m2bIEB{0SV!E&H~u%c&3u7re3t4c*A>4mDK8 zu2n3lo^$7|=RXqdB=Z(1=OPH1o)@5SOY)II(`7@n-S@TX7G3OGjgR^Qmf`y0*MxGd zRtUH|c)nsb!u0wuzv*(*4=CUD$qPmaEELk8vR7QP_1>46ckYz4xfK(-Kl}1v1BI+`Y?Xn=H8t}O~p)wImOYaI4~0jO4T-}(q&IRf`kU4iL~$fKD>8@ zkR{JNi&oGnB%1I)uqUtlvy`AzWXR|ed!-B8wEiMZ#A|2>ct-F%zjB(VafL#-ixuQg zVZ$w_<^-&YzY=KrnFMBb9zLm|?Y9{hK@`Mv3N;0>BqXdjuZ~u`uiKO&N$;y!oGX|T zqH87kawk6|Rmo+K{R)l9Km{c+FbbyH8KBg@i?*0Cp990M#Rs5JTK4jTGN=YN+(oAZ zV23+s2jjFee?38_)@V(ZgK|i1rStL_N#WtyJcb`46~qohPC&&=Q1cD9eBQy}r|}Be zbT`(QQhN*SonFm?xT=h~7lq@i#S^oYPc_?G3-9xr0`Q;$dGH05o7d4CP6lrM zjN&Q#GdMq`003t59p9&`EVPVm)ZU>ZyH38!Ed7b0`f|*G%ih&)_RYKO557tr-l>`+ zP~MxvvUlDrtnxJkP-J)+$>RAjDza&ZtTkhXur2|pL(zkiFm61XLnpg`OIjWm=i{Wue=d}6&&>N-b!(jyL12aqh4$`L z6EQA1IWo&CcZ)U71_^ngu2rM(XG$@KNV_n9^j&ns5XmI`m0PMS^|aod+gh{GSeNu= zDe5RiNIey5!~rR#NPdmxbHQQWPuM!!YcKEa_PgsA+-b=KWQ^TJdtk_uSZ8+xP$^kZ zpnxd+aoa(@-SaU_;Vg=9W*_0`_uG4M_Bh>n4rfACd*iD^`iHpC$HEsG4KK>|pvu^; z!Vl875-79!CvFX>F6cr^BOD^wMcNXcby`A_7Nh@;>uSWjIU@jy$r$p{(?ejY0+33l zmiW1KS&2ygnOK=%u+w9u;uHTC0FAx%yJFTGJo&gh38 z{^y+hY}94giPfy?q*(`_B3RWx(MK}5Y6)GA0kC=JJjf-p>#IYGLv+@3WdsE$yfmd; z>3$kdGsDYm_j#3ip$_Q>#;hpY+yL;@CwP!Zgy;)6GGxSlN=2X}E6E$)_I>tWH@D7S zFTPS^V%S0!2q~fMLRa!#0Px9#u@p{e;SZSi23ZM202{E$G(k%Yny-EPi(;T2swZy^ zR)jJVZBMHx-S|D#N%Oe}LG$VP4*arT;Ln`Y9k8O$s+_ZDF|#NE@%df%{kh}MroRzq z55eAFJbS1Z%7mZ=N|P+2m#IZ)d zB>utjdx$?qx8N{LBqm17SZJ0Z_3lMw&P(d?`-9NIJdNV_0fmEjP*$^_C6A)JYm;Y!{bbi^H;K_`WOL&z`;$6+*E1jH>~1<4$$G>D73m`IrGmfj#E-U zcqeOS3O(95NFuOF4RJ`PVaNYaX;Yw3AuA}LxG?|vjE66a@Of<;vWMFv+Oj?F#|mKc z6Mqhzp77Jellnoost;I7xcJK%PZKwBz#?8G`c*Uq+brrp1-WRNeXGbNLW+hnO7?l94^PW!^n2pYDI#A)4%7zAbxo;Z-+8NgwDS=zq<+G&nFn-W*=4Ub=6BO-`a3! zpW{$*v(R1nxwkQYAc)HIS(p%>zEwx?+oiH&wn7LLj<9B2!`s3o$3;1F3+P{2+`MHdo zR|9n&FlC8wCxb|nd_J{YJ!F_|Cf(1nh=xLYC7h#jyEuu^>ke!@_&0X$w%+OVsbJ-MX^q@Y zkM}A%!CPhTLR@`V$|6-25Q1Rx9GSX!_cyf;MSH*3)N_)aY&zQ<&D)Jtm=Q90+?l!? zFW5$0xO+|S`aYlF89K7Z61rpZtvX;}-D5V*WSH{hBXAWVzOe%oCSg#2co<)m;+Oz4*9&_wC%PYCK^{jSc6!l&}X}0 z(&a5n`FHL#=;;c7M^Ba_^fKdK2v9y!L5#smH4t`$M2(KlXyhn{eN4}L;T};=vzBVj z9B?$nRjjK%`fGhL3{YL7g|I}x69{lw z=GVg5=H?ssP&|H@tVW0`dqVan5sEPia|{WBY|-<*qKRNkY^|?2RsmcB+eV5dHeI%= zV>TyWOK$VWE3Esi40{c$2)Q|vO`J{Y8~wkV?AUSVs7h*)!eb$9t(m~T45h2dcJViF z#beHj=S`2Mdn+QF`ub?oLy2R`>5o}ckALrIKK!8?^h+x|D}8YH+80Pjt~Eu(#8M)h z&hHD5^YA0M_h_N-c9Te+<2@twql2YuHI!yenw+fvq&ST z#do;>#?Lb{O>VQu`b+AQM6=xS?<~}+e<>QG)n1CP#u#@5SQnZDQUwG2R0F%R(Wu|c zeABcqS@efcw=(CjEND#*SI9HW=$;@SmtXZo%4VB_#>+r?Z7s{&4}lL4TYo(?sr?Y@ z2?tfno2-c6Fm2&NiQr}Hh>Wl0XzTY0J}-LEVdZQ&>WNbQpT@rKA+^Ss&vR6?c-J4_ zUdbz=qr3qbYY^r`RP^89x1ya*hGHSEb6+kQm#mNpArPz|Pk?FLPZgcz+J~G4YDEO_ zY>`{K?O3}^om3v0D(4-9PEPZJZR5Z0GRuP8nHHi3xr1<=8!}t?{p>yZDn8HPfyDLM zzx8s3fr4_ciMQATSd@EIg*^V5){_ zE{~$`#c`m!&<*N?3iERFaGUUS*@@D6er$mCvkuUz@KTojJ91P;7F&%edkG@qN=YUI zV{U-Oh&Cr&E220y4I@3Po7XaQ;rEK8aG-;&B2$NjDj>1ABKaQpD&Z_z<Ui zm=s1x9uj3t{ks1AwvL>8-o)&GUhSdTgf6E@BZl|d`9}#_Mc|XW_1TIOW2c`cohU`P zwR@Iv$m69nNnWW2*Lt$Kh3cbsdU|;zii)0aEfy#IlpvY*E1+kw5)>%qoY0B$^iR$C z7}*Lsm_q`n%)$js_Yn{%tK=lbG?EmU0ZUKDJt;rGFUQflh>?x0-23D-IMO7J0aB?5 z7fC@kPD(Es@vTN^-o$iAsO5+}`9Nx36T0jAhht!tL?gD~O}og1i~>fYe8;NGwgP5c zKT=GW%h0svi+TG^Wdb0!m&J1Lzy~#o<(j`|%436;QPud%6zq740|^CKU9pXP3X4Au^1`ok4$+HZtk0;xDStj8_<={Z9STZEWvME zKB?bsO+Fh>$G4g7t-y3wl!s4xR*Hb5v%R`>Ge@8R{2F69`t^VzRa6)BVLK8Kx>9M9 zA%{btU6G0 z_apZ;ZDOGGQrSz-NF2(P-(IBKR5V1u(BZrvNn)H?-VVv!1dRs&XZ{5eNaGdloT1w$ zTF;KXr|X;`Ua7~6ha}~(u?ZG{Uk8|=>@}28Qqwg>yq2u^93A0N!%~uYz~BblKlZ&? zV6tVSYE8|uPLqEZ`m4N`ulnDfm2OW2dp$@qfZ}TV-9-ZXU63#uS-zn|(LUdFOOZj? z=;#KfJmG&wk(DKCBz`U3d46wv&ZqC7d?t_MW@zYCvP7Ps{SF2-DPjm7*F@KaQx3+% zE1TiI?hx09_mrrDf`xrQ9=n0U4RAsR>4Jna?$V#CNo>t^PIk8Mq1!xS5l(?LCPA_O zH{UckT_xpnBL%V5Pw2*g0!Vh4`PC6gM>(tOU5!>6^l#C~-6KpST4kYD80?9tX?uK5V0VbwOc-@$-T zbr4)3qAC`u+ZD-W52RN!aTS;M)O`ng%b$moEbXF4R+fZMI6n;>^8 zy}|jQ%w^zg(OvB9=C0&l3~q@{?@_8usQ3p!q8~T#JL)lT?m%w-Yk08oJ)BB!s|z1b zmy80{$7hIHLM7HFRbS3`hUh`0rijJ_eLTDS`r-TezK;D$8Se!Uaem<~O!(bVbj5_v zC$;m92uOjwvxwrnt3i7h6cm)pHAYc6=A^8)wy%r#dy5-zUBk9UYk350B8c(67ArWI zKNH90?b4ma3HcADY)&!Ru>q)pf!U5M7*Uyv@*>9@CS;!mobcGxrsk|;^S+JE2RcY) z=W|eO293G-7a#5~u6DHB20(*I#CGc24(daohsuP@JS^W(sslOkPm(wbl=vKP;heZ; zHG+6i-90npY3Td8cm6Y)PN%5+tDb?{$9Sy#B%n-^OIYlE4B81*f-dwT_eZfRb0o2S zSJQnWy}ttPT>;e6gDfnF2VJM_vOHbJO^!)|7nl&bNweGhggUZL-cEGF6|l&g>y>Jy zASgotfb#D0&~$8@8^{Jr8UlbS20{1^^jdNO$EiUXPrmBfmGX2#U4YK8+OYQiXYa z)8t&|7nb3?6JW5Fx7B)W;JFjI175Wq`sCNI+7AfQn7=qrnL{ zNq&g2x&i=}3ILZ#)2!U#I1_v8uG$anC} zHZ%LPkI;0c67b6K-gW$BIbyhhU% z8z(!0Hv|A90h0lrVGFit>c%a6d8k&?4AiWEgbrpPyk{-Y-~dU?VrqTa8>W%P#a~Se zXY30=AH=pa8X3X*tON2cFb2E58?y&uA-JHeRCkPm6@8B0Q+B zD*A6gK%cQ|08L;ocdbPSA8vm=lv@rGpYP8P_9rlI9~>BObrIm{iU0Ex)~6I3Zs$nLXe&II>Kd-a*l@1GMlQiw4I#b8uMF__xjFvJ}6bQ|LMl!uz4rWNQby81sySJ@CW7 zb6zeBslC^uP|8ozZ&@1kiqjF@EPNV=d zRS#?$9WUM=VSuh`eLPbJ>aGFYWb5!g*oVtq7;YB-h5{;v~P@x9s%~F9uaua;D z=U-;jLPo>g{*;`26)0<;_%DFwzZkEboDQlV*a{lq0Qfa-GR41P{@<7UuR+=ehPJ>~ znElk0RgQ%h;p)@kB^GE4&sE|eBq(TA?eyYoK%wVY2s|gePy5!1$YlpkCFuXg>oCKO z*9{*o*a`&_1aH7L9BFE5?O+%oL^*ha`&P*|fH)n!2xPT6GY^SuWHq7E*QTr|87q3ee&4BRx z_Ij%AOZ|iI;tdtx_>8^;4ig~KRj^LE&xeXcVBq7AX2~ zBKmcDAG|lXpxFR4tAn?42jl|`Ke%zX|A8;{!*$t1BX0P={&$tY3~1;L9ezh8tHD&} zCAx_&G1%dFX0frckGE9<((=FfL`gzA!bNXQ;k=#-tKqaz{(t>(p~(4!#ZQ@220zBe zPWhePQ%(H&(+|2Y!L4+Ygqd>r~>KC%nG=_5Pd-?r;uoDGl6< z;d)WKg<{H`0A@HT@DN4@0UUE~X|>F|L8N6YtFDuH()+Ae^qpFg?0NO;N{skcftdk45a43y*V>y7 zr|}p7VeUU+IiR4p&+hQp?Uvo|lz}^JUZp(v;j36S%i2)+Lm2ogJ93k`YnK`AEdc9a z_gHEXziGf&aesI?-xp=rxsFA=Jdwz7p<$wNe*GMiARzGj$_s8fDXej#D6@1M^@-dM zY7*%JbwdSp2}IHo8_lji~N^xzN~=2K3|+uPeUFvpXCy~AJ>5leS}zZ^H&r^LiW(p^hO zcjYg_&!e&;+S=MeLP8?4nBIZ>FTpoeHyDK3DEZuY%faM+(AAudj!sg8ImyD(Qn!&O zy6OF0Blr~&5s_oi1Trd%3H~Os{X;`T$FgN`y!UFREI?mXcrbHuae;pOMpIB)TKjr4 znFp-YqvPXv;K~d;-Rg3n(z-4>r3Iz~nXHMRJV zurT;9fF0mY#Oil_XQy~YU0q74VUs+l@s5(Y+EHTDXyw$_YDvdXJm=uxSXo^)e}@1X z9pE}SIgQ%ZTM63Fo89yrla$t%+ksVe(S&=qUy|!4OkfPjc&W4)HF8>S5#Fc=vG;6 z+YOc2@bK{96B5$B@;#rJ`mDQ}m7Ps5ENsx(*-1x3({A#qp@s?-mjyn;+rLZF!F!Vh zG4>-$9B|i;1}_LS6D6N0Dk|y$k=xA7Z0Jv^Ci;^nao~Wm{er7%!^Pb_=?Cy_0PMn^Z8AxK$wg7(H(!T;<*8N`feO(-) zRn&95K3HMagYMey1)`xvRCqXWhLf0cIa@ld91_#KK$sc|fZ(X2ySXAQ#8 z%1{*Al{8vL%CVg&atte{Sfh4xoF-ABqREb9X_*vihn!ET#vzB~6ca}H?$>_b_y70% z=1=o_JkN6DY!O+lQwMU)F1M8Vowy=s$vuccWVKyOEnT#40POL=R#pv? z4jCR^#<#Kwggu&?oolP7Y5B0grr@c5&WEVA6jsfu9Lx%N`RCcc5gm4YM@NT}fq~52 z=$nRUjPP$=SuSq_`y{ax2B^H&aX6US+1Zq-`{wMhm8`Cu{8sO4X=(g^0ozI6lUrNj z(SRUe=bop*+5oci6Wq_e5|Wa+?c+NX6pC5873m(H+i35ree@Cp5CtVwE@1=vf=olh z!Um__J#85ebhz(0LTh?(_ujqS%1Y-o>=L)B6bk8`E)}$m2wW>cU465dj0RH6m19Hs zAtfcn1AJ8NhE4h-K3;^FhE%+vAB)LUK$Hv(We*=d+{5;=|3lRG>{%6r2dTgy)P+Bx zo!xcDX*z0c880Cr;o#r^Le}L}n1gN)_yNIMBeIRI?aLaXrLVX4dAjXU{s9`NB*=%El8XPW%y``Og7h*vRvq5)Ve1 zp_-cLWx+fLvVx9p#~w&%232mwPQuZzL>-QUUU@~u`OrG2+r+HSZ~!p=hd0?oF{q>J z2VW*%XE4P6eF6dH%o$}7aa`i?@R=)R^lTRweLoxPrXpg8Z_u6n9ju?)Zv~l>o)zft zRafV{JzulU%ggKYhZ=lR9zvz1%q}b>)YOIi8c9-usLK1~rC!o(D$?DXwgq&fIk4C=QPW!)v7>qjvqk&gbwePG6DzCrdQO@v$s3YsikJNYbX%?w-+qEr~o zW<0O7D&m_`pZ1x#H|F1|sU>8sSi8C^LK2UE@xoF{T6%l}uC?&dBdf?rvzs?>X1d4+ zfI}%NDrSS7rKAuf-;U{9>U8SVRyQ{{WmQ#zmXxVPSBs$k_3PIzo z@0)X8X3?`x`fZilw+SY!h?P<_aS952K1dS_Au%yA8l8P&b#LFw(`dBD=4J!R@=&U| z@h|bP<4l<14_QARGS58ZWhxU+*&g+MR#q;A|LyW}8Niyv6!)@ zbfgO{3fp(v*iVBd(vKBaSL4jT%?Jw#3l9trZ-~xX=|&&%X;bd64wVE`&CJc|SEW{! z;q?7>NK40MXUnZHTz`F%p?>%7UFwTO?9A7%<M)!Ss zK^QK$!aMnD{oj?UTFBXGD--dlF%`M;J#K7RbTM@y?dUDHJ;=#%40)RCdVLEi9iY+fD# zbrFb*21pFIJAF&s>qO>1_e%Em_A;kFD%fUdk$?PABL7I%=`WmjMJL%vbQMWOPfr3c zBR4k}Le1jv;mvJrZ78PPxFNNo{~R(jfU1L&Q#|N{OaSt3(+Cll@U`&pvXI5Tdj0zM zV|T2s!mn@NzWr)SN?KCV7X4uFlOH0Ni>rZ%4vvhd?oG1+>SReKzsiYP^|@fK{}3qo zcLoLqd3%ytGgvHEYvhQN^)ac-H2YC64-b#hjI7T4Ko??TH_Xn@OPQFM>@tf8DKM7* z#$H@p+=;Wc$Ga^pEeS5e1*TnBU3@Wck zAg~7zi}g;5XC3B0-wAI*%NA_bHqjmH&*;gEE3H3s#sGH!iYbDPt!;__fJI1n_`zbQ zy6$dSU{~oh5azw5?_z5Rof)RRyZdgd6uFJ^^70y#(oOH*zpo4!68V$O)_f<2#ge?% z*ZB-;>xo)FKT$FGBhd{{lykAsg34O9wmYccb@#EtY!PD>K3JTP$ zQWaDB`ue=y+X2+jarJIXPr+-vBjB3s7m#cUF)<5h^EU<6}0v4#*!m4ho*zZEA`GJ^43tTIg%C z>I6bM4c-)V#Thfjf$J0&79JpzH;QcC84aMaZ&?7G_@Ir=79k-a|M51J%Ony>Vfxv^ zdS-_BC8c&;h}}f_>wl@4*9nK$o$xu}OZ!a(akCfP3f^T9e6~t}dCHwbk&a zd>c#4t_1Wh%6ee36VmZamt<&ILGI>%`67e>|JvE%7B;Q|ZpDL*Pqr(=p;guoO~}yt z8P(R&1>%av8dx_3Mi#MIcpPpkvS;sJy+Q!&A)sge7ccsCN5bx&_#?Z)YVG5Ji_o2) zfj$JaJ^$#Tqesa;KI%Zc8JFeV-QE3zgRLnPIYslxB340uejeoJp@!5b#bTJeoyJ2Q zvFYneSvMZgvFCIJ6CRHjU0Ztq3iB=M>gte{{MocS5Z^tI-Gx_|M)6PpoQA7Abm-85 zbLTWH4j$BnCiQ59Hn`~Ti|Wo`K8?{gISq-}?;d-%5&*3}O@MmQ&ixmZlaiAI_@9m& z?cYzF_}bRqj+$+Fco;?3_5%9`sGA0OyqW4LA-EIFf1N*Kv&=t%ky3n5UWt%L|Dm8g zx2UM-6$!FY0+Y$iGKP5Zdw~X0-%B_|5|BZIDm5Ze8c@vOCu``nrYtI=W|W2WW)!s= z@kh8|VS0Otl}A1ub}bhGw}^h&1B@0ZRNzPFjH1_jpVxcQ8~*3J|2bm+kA)a(!rmj@ Uw&zt%Y!UbzCfiv)vY^KN3!*p$(*OVf literal 0 HcmV?d00001 diff --git a/doc/modules/classes.rst b/doc/modules/classes.rst index 2dc6ae7b1c042..a9a3952c577f0 100644 --- a/doc/modules/classes.rst +++ b/doc/modules/classes.rst @@ -1080,6 +1080,26 @@ Low-level methods tree.export_graphviz +.. _earth_ref: + +:mod:`sklearn.earth`: Earth +=========================== + +.. automodule:: sklearn.earth + :no-members: + :no-inherited-members: + +**User guide:** See the :ref:`earth` section for further details. + +.. currentmodule:: sklearn + +.. autosummary:: + :toctree: generated/ + :template: class.rst + + earth.Earth + + .. _utils_ref: :mod:`sklearn.utils`: Utilities diff --git a/doc/modules/earth.rst b/doc/modules/earth.rst new file mode 100644 index 0000000000000..899e67cfd1037 --- /dev/null +++ b/doc/modules/earth.rst @@ -0,0 +1,102 @@ +.. _earth: + +======================================== +Multivariate Adaptive Regression Splines +======================================== + +.. currentmodule:: sklearn.earth + +Multivariate adaptive regression splines, implemented by the :class:`Earth` class, is a method for supervised +learning that is most commonly used for feature extraction and selection. Earth models can be thought of as linear models in a higher dimensional +basis space. Earth automatically searches for interactions and non-linear relationships. Each term in an Earth model is a +product of so called "hinge functions". A hinge function is a function that's equal to its argument where that argument +is greater than zero and is zero everywhere else. + +.. math:: + \text{h}\left(x-t\right)=\left[x-t\right]_{+}=\begin{cases} + x-t, & x>t\\ + 0, & x\leq t + \end{cases} + +.. image:: ../images/hinge.png + +An Earth model is a linear combination of basis functions, each of which is a product of one +or more of the following: + + 1. A constant + 2. Linear functions of input variables + 3. Hinge functions of input variables + +For example, a simple piecewise linear function in one variable can be expressed +as a linear combination of two hinge functions and a constant (see below). During fitting, the Earth class +automatically determines which variables and basis functions to use. +The algorithm has two stages. First, the +forward pass searches for terms that locally minimize squared error loss on the training set. Next, a pruning pass selects a subset of those +terms that produces a locally minimal generalized cross-validation (GCV) score. The GCV +score is not actually based on cross-validation, but rather is meant to approximate a true +cross-validation score by penalizing model complexity. The final result is a set of basis functions +that is nonlinear in the original feature space, may include interactions, and is likely to +generalize well. + + +.. math:: + y=1-2\text{h}\left(1-x\right)+\frac{1}{2}\text{h}\left(x-1\right) + + +.. image:: ../images/piecewise_linear.png + + + + + + + +A Simple Earth Example +---------------------- + + +:: + + import numpy + from pyearth import Earth + from matplotlib import pyplot + + #Create some fake data + numpy.random.seed(0) + m = 1000 + n = 10 + X = 80*numpy.random.uniform(size=(m,n)) - 40 + y = numpy.abs(X[:,6] - 4.0) + 1*numpy.random.normal(size=m) + + #Fit an Earth model + model = Earth() + model.fit(X,y) + + #Print the model + print model.trace() + print model.summary() + + #Plot the model + y_hat = model.predict(X) + pyplot.figure() + pyplot.plot(X[:,6],y,'r.') + pyplot.plot(X[:,6],y_hat,'b.') + pyplot.xlabel('x_6') + pyplot.ylabel('y') + pyplot.title('Simple Earth Example') + pyplot.show() + +.. image:: ../images/simple_earth_example.png + + +Bibliography +------------ +.. bibliography:: earth_bibliography.bib + +References :cite:`Hastie2009`, :cite:`Millborrow2012`, :cite:`Friedman1991`, :cite:`Friedman1993`, +and :cite:`Friedman1991a` contain discussions likely to be useful to users of py-earth. +References :cite:`Friedman1991`, :cite:`Millborrow2012`, :cite:`Bjorck1996`, :cite:`Stewart1998`, +:cite:`Golub1996`, :cite:`Friedman1993`, and :cite:`Friedman1991a` were useful during the +implementation process. + + diff --git a/doc/modules/earth_bibliography.bib b/doc/modules/earth_bibliography.bib new file mode 100644 index 0000000000000..70da708722b66 --- /dev/null +++ b/doc/modules/earth_bibliography.bib @@ -0,0 +1,63 @@ +@book{Bjorck1996, +address = {Philadelphia}, +author = {Bjorck, Ake}, +isbn = {0898713609}, +publisher = {Society for Industrial and Applied Mathematics}, +title = {{Numerical Methods for Least Squares Problems}}, +year = {1996} +} +@techreport{Friedman1993, +author = {Friedman, Jerome H.}, +institution = {Stanford University Department of Statistics}, +title = {{Technical Report No. 110: Fast MARS.}}, +url = {http://scholar.google.com/scholar?hl=en\&btnG=Search\&q=intitle:Fast+MARS\#0}, +year = {1993} +} +@techreport{Friedman1991a, +author = {Friedman, JH}, +institution = {Stanford University Department of Statistics}, +publisher = {Stanford University Department of Statistics}, +title = {{Technical Report No. 108: Estimating functions of mixed ordinal and categorical variables using adaptive splines}}, +url = {http://scholar.google.com/scholar?hl=en\&btnG=Search\&q=intitle:Estimating+functions+of+mixed+ordinal+and+categorical+variables+using+adaptive+splines\#0}, +year = {1991} +} +@article{Friedman1991, +author = {Friedman, JH}, +journal = {The annals of statistics}, +number = {1}, +pages = {1--67}, +title = {{Multivariate adaptive regression splines}}, +url = {http://www.jstor.org/stable/10.2307/2241837}, +volume = {19}, +year = {1991} +} +@book{Golub1996, +author = {Golub, Gene and {Van Loan}, Charles}, +edition = {3}, +publisher = {Johns Hopkins University Press}, +title = {{Matrix Computations}}, +year = {1996} +} +@book{Hastie2009, +address = {New York}, +author = {Hastie, Trevor and Tibshirani, Robert and Friedman, Jerome}, +edition = {2}, +publisher = {Springer Science+Business Media}, +title = {{Elements of Statistical Learning: Data Mining, Inference, and Prediction}}, +year = {2009} +} +@book{Stewart1998, +address = {Philadelphia}, +author = {Stewart, G. W.}, +isbn = {0898714141}, +publisher = {Society for Industrial and Applied Mathematics}, +title = {{Matrix Algorithms Volume 1: Basic Decompositions}}, +year = {1998} +} +@misc{Millborrow2012, +author = {Millborrow, Stephen}, +publisher = {CRAN}, +title = {{earth: Multivariate Adaptive Regression Spline Models}}, +url = {http://cran.r-project.org/web/packages/earth/index.html}, +year = {2012} +} diff --git a/doc/supervised_learning.rst b/doc/supervised_learning.rst index eb5395fc7ad4c..18b23504db22d 100644 --- a/doc/supervised_learning.rst +++ b/doc/supervised_learning.rst @@ -21,3 +21,4 @@ Supervised learning modules/label_propagation.rst modules/lda_qda.rst modules/isotonic.rst + modules/earth.rst From 3091cbcae030d559143b1d7d2a45899ff231c3cf Mon Sep 17 00:00:00 2001 From: Jason Rudy Date: Thu, 25 Jul 2013 22:03:10 -0700 Subject: [PATCH 05/19] Working on examples --- doc/modules/earth.rst | 40 ++++++++++++++++++++---------- examples/earth/README.txt | 6 +++++ examples/earth/classifier_comp.py | 13 ++++++++-- examples/earth/pyearth_vs_earth.py | 19 ++++++++------ examples/earth/sine_wave.py | 18 +++++++++++--- examples/earth/v_function.py | 18 +++++++++++--- sklearn/earth/_forward.pyx | 2 +- sklearn/earth/earth.py | 18 +++++++------- 8 files changed, 96 insertions(+), 38 deletions(-) create mode 100644 examples/earth/README.txt diff --git a/doc/modules/earth.rst b/doc/modules/earth.rst index 899e67cfd1037..c8070bccc3329 100644 --- a/doc/modules/earth.rst +++ b/doc/modules/earth.rst @@ -7,8 +7,8 @@ Multivariate Adaptive Regression Splines .. currentmodule:: sklearn.earth Multivariate adaptive regression splines, implemented by the :class:`Earth` class, is a method for supervised -learning that is most commonly used for feature extraction and selection. Earth models can be thought of as linear models in a higher dimensional -basis space. Earth automatically searches for interactions and non-linear relationships. Each term in an Earth model is a +learning that is most commonly used for feature extraction and selection. ``Earth`` models can be thought of as linear models in a higher dimensional +basis space. ``Earth`` automatically searches for interactions and non-linear relationships. Each term in an ``Earth`` model is a product of so called "hinge functions". A hinge function is a function that's equal to its argument where that argument is greater than zero and is zero everywhere else. @@ -20,7 +20,7 @@ is greater than zero and is zero everywhere else. .. image:: ../images/hinge.png -An Earth model is a linear combination of basis functions, each of which is a product of one +An ``Earth`` model is a linear combination of basis functions, each of which is a product of one or more of the following: 1. A constant @@ -28,7 +28,7 @@ or more of the following: 3. Hinge functions of input variables For example, a simple piecewise linear function in one variable can be expressed -as a linear combination of two hinge functions and a constant (see below). During fitting, the Earth class +as a linear combination of two hinge functions and a constant (see below). During fitting, the ``Earth`` class automatically determines which variables and basis functions to use. The algorithm has two stages. First, the forward pass searches for terms that locally minimize squared error loss on the training set. Next, a pruning pass selects a subset of those @@ -89,14 +89,28 @@ A Simple Earth Example .. image:: ../images/simple_earth_example.png -Bibliography ------------- -.. bibliography:: earth_bibliography.bib - -References :cite:`Hastie2009`, :cite:`Millborrow2012`, :cite:`Friedman1991`, :cite:`Friedman1993`, -and :cite:`Friedman1991a` contain discussions likely to be useful to users of py-earth. -References :cite:`Friedman1991`, :cite:`Millborrow2012`, :cite:`Bjorck1996`, :cite:`Stewart1998`, -:cite:`Golub1996`, :cite:`Friedman1993`, and :cite:`Friedman1991a` were useful during the -implementation process. +.. topic:: Bibliography: + + 1. Friedman, J. (1991). Multivariate adaptive regression splines. The annals of statistics, + 19(1), 1–67. http://www.jstor.org/stable/10.2307/2241837 + 2. Stephen Milborrow. Derived from mda:mars by Trevor Hastie and Rob Tibshirani. + (2012). earth: Multivariate Adaptive Regression Spline Models. R package + version 3.2-3. + 3. Friedman, J. (1993). Fast MARS. Stanford University Department of Statistics, Technical Report No 110. + http://statistics.stanford.edu/~ckirby/techreports/LCS/LCS%20110.pdf + 4. Friedman, J. (1991). Estimating functions of mixed ordinal and categorical variables using adaptive splines. + Stanford University Department of Statistics, Technical Report No 108. + http://statistics.stanford.edu/~ckirby/techreports/LCS/LCS%20108.pdf + 5. Stewart, G.W. Matrix Algorithms, Volume 1: Basic Decompositions. (1998). Society for Industrial and Applied + Mathematics. + 6. Bjorck, A. Numerical Methods for Least Squares Problems. (1996). Society for Industrial and Applied + Mathematics. + 7. Hastie, T., Tibshirani, R., & Friedman, J. The Elements of Statistical Learning (2nd Edition). (2009). + Springer Series in Statistics + 8. Golub, G., & Van Loan, C. Matrix Computations (3rd Edition). (1996). Johns Hopkins University Press. + + + References 7, 2, 1, 3, and 4 contain discussions likely to be useful to users. References 1, 2, 6, 5, + 8, 3, and 4 are useful in understanding the implementation. diff --git a/examples/earth/README.txt b/examples/earth/README.txt new file mode 100644 index 0000000000000..6633b22fec6d5 --- /dev/null +++ b/examples/earth/README.txt @@ -0,0 +1,6 @@ +.. _earth_examples: + +Earth examples +---------------- + +Examples concerning the :mod:`sklearn.earth` package. diff --git a/examples/earth/classifier_comp.py b/examples/earth/classifier_comp.py index 3a2701e3c80f4..935b8e20e5970 100644 --- a/examples/earth/classifier_comp.py +++ b/examples/earth/classifier_comp.py @@ -1,14 +1,21 @@ ''' +==================================== +Classification comparison with Earth +==================================== + + This script recreates the scikit-learn classifier comparison example found at http://scikit-learn.org/dev/auto_examples/plot_classifier_comparison.html. -It has been modified to include an Earth based classifier. +It has been modified to include an :class:`Earth` based classifier. The Earth based classifier is made up of a Pipeline +that uses an Earth model as a transformer and a LogisticRegression model as a predictor. ''' # Code source: Gael Varoqueux # Andreas Mueller # Modified for Documentation merge by Jaques Grobler # License: BSD 3 clause -# Modified to include pyearth by Jason Rudy +# Modified to include Earth by Jason Rudy +from __future__ import print_function import numpy as np import pylab as pl from matplotlib.colors import ListedColormap @@ -23,6 +30,8 @@ from sklearn.lda import LDA from sklearn.qda import QDA +print(__doc__) + h = .02 # step size in the mesh from sklearn.earth import Earth diff --git a/examples/earth/pyearth_vs_earth.py b/examples/earth/pyearth_vs_earth.py index c1e2fb36fe247..f98910816099c 100644 --- a/examples/earth/pyearth_vs_earth.py +++ b/examples/earth/pyearth_vs_earth.py @@ -1,10 +1,16 @@ ''' +============================= +Comparison with the R package +============================= + + This script randomly generates earth-style models, then randomly generates data from those models and -fits earth models to those data using both the python and R implementations. It records the sample size, +fits earth models to those data using both the python (:class:`Earth`) and R implementations. It records the sample size, m, the number of input dimensions, n, the number of forward pass iterations, the runtime, and the r^2 -statistic for each fit and writes the result to a CSV file. +statistic for each fit and writes the result to a CSV file. This script requires pandas, rpy2, and a +functioning R installation with the earth package installed. ''' - +from __future__ import print_function import numpy import pandas.rpy.common as com import rpy2.robjects as robjects @@ -12,13 +18,14 @@ import pandas from sklearn.earth import Earth +print(__doc__) + class DataGenerator(object): def __init__(self): pass def generate(self, m): pass - class NoiseGenerator(DataGenerator): def __init__(self, n): self.n = n @@ -64,7 +71,6 @@ def __init__(self, n, max_terms=10, max_degree=2): self.max_terms = max_terms self.max_degree = max_degree - def generate(self, m): X = numpy.random.normal(size=(m,self.n)) num_terms = numpy.random.randint(2,self.max_terms) #Including the intercept @@ -124,7 +130,6 @@ def compare(generator_class, sample_sizes, dimensions, repetitions, **kwargs): generator = generator_class(n=n) for m in sample_sizes: for rep in range(repetitions): - print n, m, rep X, y = generator.generate(m=m) y_pred_r, time_r, iter_r = run_earth(X,y,**kwargs) rsq_r = 1 - (numpy.sum((y-y_pred_r)**2))/(numpy.sum((y-numpy.mean(y))**2)) @@ -140,7 +145,7 @@ def compare(generator_class, sample_sizes, dimensions, repetitions, **kwargs): rep = 5 numpy.random.seed(1) data = compare(RandomComplexityGenerator,sample_sizes,dimensions,rep,max_degree=2,penalty=3.0) - print data + print(data) data.to_csv('comparison.csv') \ No newline at end of file diff --git a/examples/earth/sine_wave.py b/examples/earth/sine_wave.py index 0b0e52a748684..417479d3eba76 100644 --- a/examples/earth/sine_wave.py +++ b/examples/earth/sine_wave.py @@ -1,22 +1,34 @@ +''' +===================================== +Fitting an Earth model to a sine wave +===================================== + +In this example, a simple sine model is used to generate an artificial data set. An :class:`Earth` model +is then fitted to that data set and the resulting predictions are plotted against the original data. + +''' +from __future__ import print_function import numpy from sklearn.earth import Earth from matplotlib import pyplot +print(__doc__) + #Create some fake data numpy.random.seed(2) m = 10000 n = 10 X = 80*numpy.random.uniform(size=(m,n)) - 40 -y = 100*numpy.abs(numpy.sin((X[:,6])/10) - 4.0) + 10*numpy.random.normal(size=m) +y = 100*numpy.abs(numpy.sin((X[:,6])/10) - 4.0) + 20*numpy.random.normal(size=m) #Fit an Earth model model = Earth(max_degree = 3,minspan_alpha=.5) model.fit(X,y) #Print the model -print model.trace() -print model.summary() +print(model.trace()) +print(model.summary()) #Plot the model y_hat = model.predict(X) diff --git a/examples/earth/v_function.py b/examples/earth/v_function.py index eaf74712b3b02..bda0867314e65 100644 --- a/examples/earth/v_function.py +++ b/examples/earth/v_function.py @@ -1,22 +1,34 @@ +''' +============================================= +Fitting an Earth model to a v-shaped function +============================================= + +In this example, a simple piecewise linear model is used to generate an artificial data set. An :class:`Earth` model +is then fitted to that data set and the resulting predictions are plotted against the original data. + +''' +from __future__ import print_function import numpy from sklearn.earth import Earth from matplotlib import pyplot +print(__doc__) + #Create some fake data numpy.random.seed(2) m = 1000 n = 10 X = 80*numpy.random.uniform(size=(m,n)) - 40 -y = numpy.abs(X[:,6] - 4.0) + 1*numpy.random.normal(size=m) +y = numpy.abs(X[:,6] - 4.0) + 5*numpy.random.normal(size=m) #Fit an Earth model model = Earth(max_degree = 1) model.fit(X,y) #Print the model -print model.trace() -print model.summary() +print(model.trace()) +print(model.summary()) #Plot the model y_hat = model.predict(X) diff --git a/sklearn/earth/_forward.pyx b/sklearn/earth/_forward.pyx index fe20f4474cb57..a80f2b2862e0e 100644 --- a/sklearn/earth/_forward.pyx +++ b/sklearn/earth/_forward.pyx @@ -40,7 +40,7 @@ cdef class ForwardPasser: self.penalty = kwargs['penalty'] if 'penalty' in kwargs else 3.0 self.check_every = kwargs['check_every'] if 'check_every' in kwargs else -1 self.min_search_points = kwargs['min_search_points'] if 'min_search_points' in kwargs else 100 - self.xlabels = kwargs['xlabels'] if 'xlabels' in kwargs else ['x'+str(i) for i in range(self.n)] + self.xlabels = kwargs['xlabels_'] if 'xlabels_' in kwargs else ['x'+str(i) for i in range(self.n)] if self.check_every < 0: self.check_every = (self.m / self.min_search_points) if self.m > self.min_search_points else 1 self.sst = (np.dot(self.y,self.y) - (np.dot(np.sqrt(self.weights),self.y) / np.sqrt(np.sum(self.weights)))**2) / self.m diff --git a/sklearn/earth/earth.py b/sklearn/earth/earth.py index 98c52df996558..0b25dd72c87db 100644 --- a/sklearn/earth/earth.py +++ b/sklearn/earth/earth.py @@ -143,7 +143,7 @@ class Earth(BaseEstimator, RegressorMixin, TransformerMixin): forward_pass_arg_names = set(['endspan','minspan','endspan_alpha','minspan_alpha', 'max_terms','max_degree','thresh','penalty','check_every', - 'min_searh_points','xlabels','linvars']) + 'min_searh_points','xlabels_','linvars']) pruning_pass_arg_names = set(['penalty']) def __init__(self, endspan=None, minspan=None, endspan_alpha=None, minspan_alpha=None, max_terms=None, max_degree=None, @@ -211,20 +211,20 @@ def _scrub_x(self, X, **kwargs): Sanitize input predictors and extract column names if appropriate. ''' no_labels = False - if 'xlabels' not in kwargs and 'xlabels' not in self.__dict__: + if 'xlabels' not in kwargs and 'xlabels_' not in self.__dict__: #Try to get xlabels from input data (for example, if X is a pandas DataFrame) try: - self.xlabels = list(X.columns) + self.xlabels_ = list(X.columns) except AttributeError: try: - self.xlabels = list(X.design_info.column_names) + self.xlabels_ = list(X.design_info.column_names) except AttributeError: try: self.xlabels = list(X.dtype.names) except TypeError: no_labels = True - elif 'xlabels' not in self.__dict__: - self.xlabels = kwargs['xlabels'] + elif 'xlabels_' not in self.__dict__: + self.xlabels_ = kwargs['xlabels'] #Convert to internally used data type X = safe_asarray(X,dtype=np.float64) @@ -310,7 +310,7 @@ def fit(self, X, y = None, weights=None, xlabels=None, linvars=None): ''' #Format and label the data if xlabels is not None: - self.set_params(xlabels=xlabels) + self.set_params(xlabels_=xlabels) if linvars is not None: self.set_params(linvars=linvars) X, y, weights = self._scrub(X,y,weights,**self.__dict__) @@ -368,8 +368,8 @@ def forward_pass(self, X, y = None, weights = None, **kwargs): ''' #Pull new labels and linear variables if necessary - if 'xlabels' in kwargs and 'xlabels' not in self.__dict__: - self.set_params(xlabels=kwargs['xlabels']) + if 'xlabels' in kwargs and 'xlabels_' not in self.__dict__: + self.set_params(xlabels_=kwargs['xlabels']) del kwargs['xlabels'] if 'linvars' in kwargs and 'linvars' not in self.__dict__: self.set_params(linvars=kwargs['linvars']) From e25cbd06198e272362790e39ab6ea8517d7d88cf Mon Sep 17 00:00:00 2001 From: Jason Rudy Date: Thu, 25 Jul 2013 22:20:43 -0700 Subject: [PATCH 06/19] Updated the earth code from latest pyearth --- sklearn/earth/_basis.c | 5414 ++++++++--------- sklearn/earth/_forward.c | 4428 +++++++------- sklearn/earth/_forward.pxd | 2 +- sklearn/earth/_forward.pyx | 20 +- sklearn/earth/_pruning.c | 1326 ++-- sklearn/earth/_record.c | 4506 ++++++-------- sklearn/earth/_record.pxd | 2 + sklearn/earth/_record.pyx | 9 +- sklearn/earth/_util.c | 470 +- sklearn/earth/earth.py | 221 +- sklearn/earth/tests/earth_linvars_regress.txt | 47 + sklearn/earth/tests/test_basis.py | 2 +- sklearn/earth/tests/test_earth.py | 62 +- sklearn/earth/tests/test_forward.py | 4 +- sklearn/earth/tests/test_record.py | 6 +- sklearn/earth/tests/test_util.py | 2 +- 16 files changed, 7566 insertions(+), 8955 deletions(-) create mode 100644 sklearn/earth/tests/earth_linvars_regress.txt diff --git a/sklearn/earth/_basis.c b/sklearn/earth/_basis.c index 3f607997078e4..10a7708be48fe 100644 --- a/sklearn/earth/_basis.c +++ b/sklearn/earth/_basis.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19 on Sat Jul 20 23:46:45 2013 */ +/* Generated by Cython 0.19.1 on Thu Jul 25 22:12:25 2013 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS @@ -261,6 +261,17 @@ #define CYTHON_INLINE #endif #endif +#ifndef CYTHON_RESTRICT + #if defined(__GNUC__) + #define CYTHON_RESTRICT __restrict__ + #elif defined(_MSC_VER) + #define CYTHON_RESTRICT __restrict + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_RESTRICT restrict + #else + #define CYTHON_RESTRICT + #endif +#endif #ifdef NAN #define __PYX_NAN() ((float) NAN) #else @@ -295,8 +306,8 @@ static CYTHON_INLINE float __PYX_NAN() { #define _USE_MATH_DEFINES #endif #include -#define __PYX_HAVE___basis -#define __PYX_HAVE_API___basis +#define __PYX_HAVE__sklearn__earth___basis +#define __PYX_HAVE_API__sklearn__earth___basis #include "string.h" #include "stdio.h" #include "stdlib.h" @@ -731,7 +742,7 @@ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; * ctypedef cnp.intp_t INT_t * ctypedef cnp.ulong_t INDEX_t */ -typedef __pyx_t_5numpy_float64_t __pyx_t_5_util_FLOAT_t; +typedef __pyx_t_5numpy_float64_t __pyx_t_7sklearn_5earth_5_util_FLOAT_t; /* "_util.pxd":3 * cimport numpy as cnp @@ -740,7 +751,7 @@ typedef __pyx_t_5numpy_float64_t __pyx_t_5_util_FLOAT_t; * ctypedef cnp.ulong_t INDEX_t * ctypedef cnp.uint8_t BOOL_t */ -typedef __pyx_t_5numpy_intp_t __pyx_t_5_util_INT_t; +typedef __pyx_t_5numpy_intp_t __pyx_t_7sklearn_5earth_5_util_INT_t; /* "_util.pxd":4 * ctypedef cnp.float64_t FLOAT_t @@ -749,7 +760,7 @@ typedef __pyx_t_5numpy_intp_t __pyx_t_5_util_INT_t; * ctypedef cnp.uint8_t BOOL_t * */ -typedef __pyx_t_5numpy_ulong_t __pyx_t_5_util_INDEX_t; +typedef __pyx_t_5numpy_ulong_t __pyx_t_7sklearn_5earth_5_util_INDEX_t; /* "_util.pxd":5 * ctypedef cnp.intp_t INT_t @@ -758,42 +769,42 @@ typedef __pyx_t_5numpy_ulong_t __pyx_t_5_util_INDEX_t; * * cdef FLOAT_t log2(FLOAT_t x) */ -typedef __pyx_t_5numpy_uint8_t __pyx_t_5_util_BOOL_t; +typedef __pyx_t_5numpy_uint8_t __pyx_t_7sklearn_5earth_5_util_BOOL_t; -/* "_basis.pxd":2 +/* "sklearn/earth/_basis.pxd":2 * cimport numpy as cnp * ctypedef cnp.float64_t FLOAT_t # <<<<<<<<<<<<<< * ctypedef cnp.intp_t INT_t * ctypedef cnp.ulong_t INDEX_t */ -typedef __pyx_t_5numpy_float64_t __pyx_t_6_basis_FLOAT_t; +typedef __pyx_t_5numpy_float64_t __pyx_t_7sklearn_5earth_6_basis_FLOAT_t; -/* "_basis.pxd":3 +/* "sklearn/earth/_basis.pxd":3 * cimport numpy as cnp * ctypedef cnp.float64_t FLOAT_t * ctypedef cnp.intp_t INT_t # <<<<<<<<<<<<<< * ctypedef cnp.ulong_t INDEX_t * ctypedef cnp.uint8_t BOOL_t */ -typedef __pyx_t_5numpy_intp_t __pyx_t_6_basis_INT_t; +typedef __pyx_t_5numpy_intp_t __pyx_t_7sklearn_5earth_6_basis_INT_t; -/* "_basis.pxd":4 +/* "sklearn/earth/_basis.pxd":4 * ctypedef cnp.float64_t FLOAT_t * ctypedef cnp.intp_t INT_t * ctypedef cnp.ulong_t INDEX_t # <<<<<<<<<<<<<< * ctypedef cnp.uint8_t BOOL_t * */ -typedef __pyx_t_5numpy_ulong_t __pyx_t_6_basis_INDEX_t; +typedef __pyx_t_5numpy_ulong_t __pyx_t_7sklearn_5earth_6_basis_INDEX_t; -/* "_basis.pxd":5 +/* "sklearn/earth/_basis.pxd":5 * ctypedef cnp.intp_t INT_t * ctypedef cnp.ulong_t INDEX_t * ctypedef cnp.uint8_t BOOL_t # <<<<<<<<<<<<<< * * cdef class BasisFunction: */ -typedef __pyx_t_5numpy_uint8_t __pyx_t_6_basis_BOOL_t; +typedef __pyx_t_5numpy_uint8_t __pyx_t_7sklearn_5earth_6_basis_BOOL_t; #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; @@ -816,13 +827,13 @@ typedef __pyx_t_5numpy_uint8_t __pyx_t_6_basis_BOOL_t; /*--- Type declarations ---*/ -struct __pyx_obj_6_basis_Basis; -struct __pyx_obj_6_basis___pyx_scope_struct__piter; -struct __pyx_obj_6_basis_BasisFunction; -struct __pyx_obj_6_basis_PicklePlaceHolderBasisFunction; -struct __pyx_obj_6_basis_LinearBasisFunction; -struct __pyx_obj_6_basis_HingeBasisFunction; -struct __pyx_obj_6_basis_ConstantBasisFunction; +struct __pyx_obj_7sklearn_5earth_6_basis_Basis; +struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction; +struct __pyx_obj_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction; +struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction; +struct __pyx_obj_7sklearn_5earth_6_basis___pyx_scope_struct__piter; +struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction; +struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction; /* "numpy.pxd":762 * ctypedef npy_longdouble longdouble_t @@ -859,100 +870,84 @@ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; * cdef inline object PyArray_MultiIterNew1(a): */ typedef npy_cdouble __pyx_t_5numpy_complex_t; -struct __pyx_opt_args_6_basis_13BasisFunction_apply; -struct __pyx_opt_args_6_basis_21ConstantBasisFunction_apply; -struct __pyx_opt_args_6_basis_18HingeBasisFunction_apply; -struct __pyx_opt_args_6_basis_19LinearBasisFunction_apply; +struct __pyx_opt_args_7sklearn_5earth_6_basis_13BasisFunction_apply; +struct __pyx_opt_args_7sklearn_5earth_6_basis_21ConstantBasisFunction_apply; +struct __pyx_opt_args_7sklearn_5earth_6_basis_18HingeBasisFunction_apply; +struct __pyx_opt_args_7sklearn_5earth_6_basis_19LinearBasisFunction_apply; -/* "_basis.pxd":45 +/* "sklearn/earth/_basis.pxd":45 * cpdef INDEX_t degree(BasisFunction self) * * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) # <<<<<<<<<<<<<< * * cpdef cnp.ndarray[INT_t, ndim=1] valid_knots(BasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] values, cnp.ndarray[FLOAT_t,ndim=1] variable, int variable_idx, INDEX_t check_every, int endspan, int minspan, FLOAT_t minspan_alpha, INDEX_t n, cnp.ndarray[INT_t,ndim=1] workspace) */ -struct __pyx_opt_args_6_basis_13BasisFunction_apply { +struct __pyx_opt_args_7sklearn_5earth_6_basis_13BasisFunction_apply { int __pyx_n; int recurse; }; -/* "_basis.pxd":62 +/* "sklearn/earth/_basis.pxd":62 * cpdef BasisFunction get_parent(self) * * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) # <<<<<<<<<<<<<< * * */ -struct __pyx_opt_args_6_basis_21ConstantBasisFunction_apply { +struct __pyx_opt_args_7sklearn_5earth_6_basis_21ConstantBasisFunction_apply { int __pyx_n; int recurse; }; -/* "_basis.pxd":86 +/* "sklearn/earth/_basis.pxd":86 * cpdef INDEX_t get_knot_idx(self) * * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) # <<<<<<<<<<<<<< * * cdef class LinearBasisFunction(BasisFunction): */ -struct __pyx_opt_args_6_basis_18HingeBasisFunction_apply { +struct __pyx_opt_args_7sklearn_5earth_6_basis_18HingeBasisFunction_apply { int __pyx_n; int recurse; }; -/* "_basis.pxd":98 +/* "sklearn/earth/_basis.pxd":98 * cpdef INDEX_t get_variable(self) * * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) # <<<<<<<<<<<<<< * * */ -struct __pyx_opt_args_6_basis_19LinearBasisFunction_apply { +struct __pyx_opt_args_7sklearn_5earth_6_basis_19LinearBasisFunction_apply { int __pyx_n; int recurse; }; -/* "_basis.pxd":102 +/* "sklearn/earth/_basis.pxd":102 * * * cdef class Basis: # <<<<<<<<<<<<<< * '''A wrapper that provides functionality related to a set of BasisFunctions with a * common ConstantBasisFunction ancestor. Retains the order in which BasisFunctions are */ -struct __pyx_obj_6_basis_Basis { +struct __pyx_obj_7sklearn_5earth_6_basis_Basis { PyObject_HEAD - struct __pyx_vtabstruct_6_basis_Basis *__pyx_vtab; + struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *__pyx_vtab; PyObject *order; }; -/* "_basis.pyx":507 - * return self.__class__ is other.__class__ and self._getstate() == other._getstate() - * - * def piter(Basis self): # <<<<<<<<<<<<<< - * for bf in self.order: - * if not bf.is_pruned(): - */ -struct __pyx_obj_6_basis___pyx_scope_struct__piter { - PyObject_HEAD - PyObject *__pyx_v_bf; - struct __pyx_obj_6_basis_Basis *__pyx_v_self; - PyObject *__pyx_t_0; - Py_ssize_t __pyx_t_1; -}; - - -/* "_basis.pxd":7 +/* "sklearn/earth/_basis.pxd":7 * ctypedef cnp.uint8_t BOOL_t * * cdef class BasisFunction: # <<<<<<<<<<<<<< * '''Abstract. Subclasses must implement the apply, translate, scale, and __init__ methods.''' * */ -struct __pyx_obj_6_basis_BasisFunction { +struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction { PyObject_HEAD - struct __pyx_vtabstruct_6_basis_BasisFunction *__pyx_vtab; - struct __pyx_obj_6_basis_BasisFunction *parent; + struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *__pyx_vtab; + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *parent; PyObject *child_map; PyObject *children; int pruned; @@ -961,63 +956,79 @@ struct __pyx_obj_6_basis_BasisFunction { }; -/* "_basis.pyx":281 +/* "sklearn/earth/_basis.pyx":281 * return result * * cdef class PicklePlaceHolderBasisFunction(BasisFunction): # <<<<<<<<<<<<<< * '''This is a place holder for unpickling the basis function tree.''' * */ -struct __pyx_obj_6_basis_PicklePlaceHolderBasisFunction { - struct __pyx_obj_6_basis_BasisFunction __pyx_base; +struct __pyx_obj_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction { + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction __pyx_base; }; -/* "_basis.pxd":88 - * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) +/* "sklearn/earth/_basis.pxd":50 * - * cdef class LinearBasisFunction(BasisFunction): # <<<<<<<<<<<<<< - * cdef INDEX_t variable - * cdef str label + * + * cdef class ConstantBasisFunction(BasisFunction): # <<<<<<<<<<<<<< + * + * cpdef INDEX_t degree(ConstantBasisFunction self) */ -struct __pyx_obj_6_basis_LinearBasisFunction { - struct __pyx_obj_6_basis_BasisFunction __pyx_base; - __pyx_t_6_basis_INDEX_t variable; - PyObject *label; +struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction { + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction __pyx_base; +}; + + +/* "sklearn/earth/_basis.pyx":507 + * return self.__class__ is other.__class__ and self._getstate() == other._getstate() + * + * def piter(Basis self): # <<<<<<<<<<<<<< + * for bf in self.order: + * if not bf.is_pruned(): + */ +struct __pyx_obj_7sklearn_5earth_6_basis___pyx_scope_struct__piter { + PyObject_HEAD + PyObject *__pyx_v_bf; + struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self; + PyObject *__pyx_t_0; + Py_ssize_t __pyx_t_1; }; -/* "_basis.pxd":65 +/* "sklearn/earth/_basis.pxd":65 * * * cdef class HingeBasisFunction(BasisFunction): # <<<<<<<<<<<<<< * cdef FLOAT_t knot * cdef INDEX_t knot_idx */ -struct __pyx_obj_6_basis_HingeBasisFunction { - struct __pyx_obj_6_basis_BasisFunction __pyx_base; - __pyx_t_6_basis_FLOAT_t knot; - __pyx_t_6_basis_INDEX_t knot_idx; - __pyx_t_6_basis_INDEX_t variable; +struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction { + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction __pyx_base; + __pyx_t_7sklearn_5earth_6_basis_FLOAT_t knot; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t knot_idx; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t variable; int reverse; PyObject *label; }; -/* "_basis.pxd":50 - * - * - * cdef class ConstantBasisFunction(BasisFunction): # <<<<<<<<<<<<<< +/* "sklearn/earth/_basis.pxd":88 + * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) * - * cpdef INDEX_t degree(ConstantBasisFunction self) + * cdef class LinearBasisFunction(BasisFunction): # <<<<<<<<<<<<<< + * cdef INDEX_t variable + * cdef str label */ -struct __pyx_obj_6_basis_ConstantBasisFunction { - struct __pyx_obj_6_basis_BasisFunction __pyx_base; +struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction { + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction __pyx_base; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t variable; + PyObject *label; }; -/* "_basis.pyx":13 +/* "sklearn/earth/_basis.pyx":13 * import numpy as np * * cdef class BasisFunction: # <<<<<<<<<<<<<< @@ -1025,59 +1036,65 @@ struct __pyx_obj_6_basis_ConstantBasisFunction { * def __cinit__(BasisFunction self): */ -struct __pyx_vtabstruct_6_basis_BasisFunction { - int (*has_knot)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - int (*is_prunable)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - int (*is_pruned)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - int (*is_splittable)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - int (*make_splittable)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - int (*make_unsplittable)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - PyObject *(*get_children)(struct __pyx_obj_6_basis_BasisFunction *); - PyObject *(*_set_parent)(struct __pyx_obj_6_basis_BasisFunction *, struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - PyObject *(*_add_child)(struct __pyx_obj_6_basis_BasisFunction *, struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - struct __pyx_obj_6_basis_BasisFunction *(*get_parent)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - PyObject *(*prune)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - PyObject *(*unprune)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - PyObject *(*knots)(struct __pyx_obj_6_basis_BasisFunction *, __pyx_t_6_basis_INDEX_t, int __pyx_skip_dispatch); - __pyx_t_6_basis_INDEX_t (*degree)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - PyObject *(*apply)(struct __pyx_obj_6_basis_BasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_6_basis_13BasisFunction_apply *__pyx_optional_args); - PyArrayObject *(*valid_knots)(struct __pyx_obj_6_basis_BasisFunction *, PyArrayObject *, PyArrayObject *, int, __pyx_t_6_basis_INDEX_t, int, int, __pyx_t_6_basis_FLOAT_t, __pyx_t_6_basis_INDEX_t, PyArrayObject *, int __pyx_skip_dispatch); +struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction { + int (*has_knot)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + int (*is_prunable)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + int (*is_pruned)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + int (*is_splittable)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + int (*make_splittable)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + int (*make_unsplittable)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*get_children)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *); + PyObject *(*_set_parent)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*_add_child)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *(*get_parent)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*prune)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*unprune)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*knots)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, __pyx_t_7sklearn_5earth_6_basis_INDEX_t, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_6_basis_INDEX_t (*degree)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*apply)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_7sklearn_5earth_6_basis_13BasisFunction_apply *__pyx_optional_args); + PyArrayObject *(*valid_knots)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, PyArrayObject *, PyArrayObject *, int, __pyx_t_7sklearn_5earth_6_basis_INDEX_t, int, int, __pyx_t_7sklearn_5earth_6_basis_FLOAT_t, __pyx_t_7sklearn_5earth_6_basis_INDEX_t, PyArrayObject *, int __pyx_skip_dispatch); }; -static struct __pyx_vtabstruct_6_basis_BasisFunction *__pyx_vtabptr_6_basis_BasisFunction; +static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *__pyx_vtabptr_7sklearn_5earth_6_basis_BasisFunction; -/* "_basis.pyx":281 - * return result - * - * cdef class PicklePlaceHolderBasisFunction(BasisFunction): # <<<<<<<<<<<<<< - * '''This is a place holder for unpickling the basis function tree.''' +/* "sklearn/earth/_basis.pyx":427 + * b[i] *= tmp * + * cdef class LinearBasisFunction(BasisFunction): # <<<<<<<<<<<<<< + * def __init__(self, BasisFunction parent, INDEX_t variable, label=None): #@DuplicatedSignature + * self.variable = variable */ -struct __pyx_vtabstruct_6_basis_PicklePlaceHolderBasisFunction { - struct __pyx_vtabstruct_6_basis_BasisFunction __pyx_base; +struct __pyx_vtabstruct_7sklearn_5earth_6_basis_LinearBasisFunction { + struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction __pyx_base; + PyObject *(*translate)(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_6_basis_FLOAT_t (*scale)(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_6_basis_INDEX_t (*get_variable)(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *, int __pyx_skip_dispatch); }; -static struct __pyx_vtabstruct_6_basis_PicklePlaceHolderBasisFunction *__pyx_vtabptr_6_basis_PicklePlaceHolderBasisFunction; +static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_LinearBasisFunction *__pyx_vtabptr_7sklearn_5earth_6_basis_LinearBasisFunction; -/* "_basis.pyx":427 - * b[i] *= tmp +/* "sklearn/earth/_basis.pyx":330 + * return '(Intercept)' * - * cdef class LinearBasisFunction(BasisFunction): # <<<<<<<<<<<<<< - * def __init__(self, BasisFunction parent, INDEX_t variable, label=None): #@DuplicatedSignature - * self.variable = variable + * cdef class HingeBasisFunction(BasisFunction): # <<<<<<<<<<<<<< + * + * def __init__(self, BasisFunction parent, FLOAT_t knot, INDEX_t knot_idx, INDEX_t variable, bint reverse, label=None): #@DuplicatedSignature */ -struct __pyx_vtabstruct_6_basis_LinearBasisFunction { - struct __pyx_vtabstruct_6_basis_BasisFunction __pyx_base; - PyObject *(*translate)(struct __pyx_obj_6_basis_LinearBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch); - __pyx_t_6_basis_FLOAT_t (*scale)(struct __pyx_obj_6_basis_LinearBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); - __pyx_t_6_basis_INDEX_t (*get_variable)(struct __pyx_obj_6_basis_LinearBasisFunction *, int __pyx_skip_dispatch); +struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction { + struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction __pyx_base; + PyObject *(*translate)(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_6_basis_FLOAT_t (*scale)(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_6_basis_INDEX_t (*get_variable)(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_6_basis_FLOAT_t (*get_knot)(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); + int (*get_reverse)(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_6_basis_INDEX_t (*get_knot_idx)(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); }; -static struct __pyx_vtabstruct_6_basis_LinearBasisFunction *__pyx_vtabptr_6_basis_LinearBasisFunction; +static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction *__pyx_vtabptr_7sklearn_5earth_6_basis_HingeBasisFunction; -/* "_basis.pyx":286 +/* "sklearn/earth/_basis.pyx":286 * pickle_place_holder = PicklePlaceHolderBasisFunction() * * cdef class ConstantBasisFunction(BasisFunction): # <<<<<<<<<<<<<< @@ -1085,15 +1102,15 @@ static struct __pyx_vtabstruct_6_basis_LinearBasisFunction *__pyx_vtabptr_6_basi * self.prunable = False */ -struct __pyx_vtabstruct_6_basis_ConstantBasisFunction { - struct __pyx_vtabstruct_6_basis_BasisFunction __pyx_base; - PyObject *(*translate)(struct __pyx_obj_6_basis_ConstantBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch); - __pyx_t_6_basis_FLOAT_t (*scale)(struct __pyx_obj_6_basis_ConstantBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); +struct __pyx_vtabstruct_7sklearn_5earth_6_basis_ConstantBasisFunction { + struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction __pyx_base; + PyObject *(*translate)(struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_6_basis_FLOAT_t (*scale)(struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); }; -static struct __pyx_vtabstruct_6_basis_ConstantBasisFunction *__pyx_vtabptr_6_basis_ConstantBasisFunction; +static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_ConstantBasisFunction *__pyx_vtabptr_7sklearn_5earth_6_basis_ConstantBasisFunction; -/* "_basis.pyx":479 +/* "sklearn/earth/_basis.pyx":479 * b[i] *= X[i,self.variable] * * cdef class Basis: # <<<<<<<<<<<<<< @@ -1101,37 +1118,31 @@ static struct __pyx_vtabstruct_6_basis_ConstantBasisFunction *__pyx_vtabptr_6_ba * common ConstantBasisFunction ancestor. Retains the order in which BasisFunctions are */ -struct __pyx_vtabstruct_6_basis_Basis { - PyObject *(*translate)(struct __pyx_obj_6_basis_Basis *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); - PyObject *(*scale)(struct __pyx_obj_6_basis_Basis *, PyArrayObject *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); - struct __pyx_obj_6_basis_BasisFunction *(*get_root)(struct __pyx_obj_6_basis_Basis *, int __pyx_skip_dispatch); - PyObject *(*append)(struct __pyx_obj_6_basis_Basis *, struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - __pyx_t_6_basis_INDEX_t (*plen)(struct __pyx_obj_6_basis_Basis *, int __pyx_skip_dispatch); - struct __pyx_obj_6_basis_BasisFunction *(*get)(struct __pyx_obj_6_basis_Basis *, __pyx_t_6_basis_INDEX_t, int __pyx_skip_dispatch); - PyObject *(*transform)(struct __pyx_obj_6_basis_Basis *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); - PyObject *(*weighted_transform)(struct __pyx_obj_6_basis_Basis *, PyArrayObject *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); +struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis { + PyObject *(*translate)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); + PyObject *(*scale)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, PyArrayObject *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *(*get_root)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, int __pyx_skip_dispatch); + PyObject *(*append)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_6_basis_INDEX_t (*plen)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, int __pyx_skip_dispatch); + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *(*get)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, __pyx_t_7sklearn_5earth_6_basis_INDEX_t, int __pyx_skip_dispatch); + PyObject *(*transform)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); + PyObject *(*weighted_transform)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, PyArrayObject *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); }; -static struct __pyx_vtabstruct_6_basis_Basis *__pyx_vtabptr_6_basis_Basis; +static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *__pyx_vtabptr_7sklearn_5earth_6_basis_Basis; -/* "_basis.pyx":330 - * return '(Intercept)' +/* "sklearn/earth/_basis.pyx":281 + * return result * - * cdef class HingeBasisFunction(BasisFunction): # <<<<<<<<<<<<<< + * cdef class PicklePlaceHolderBasisFunction(BasisFunction): # <<<<<<<<<<<<<< + * '''This is a place holder for unpickling the basis function tree.''' * - * def __init__(self, BasisFunction parent, FLOAT_t knot, INDEX_t knot_idx, INDEX_t variable, bint reverse, label=None): #@DuplicatedSignature */ -struct __pyx_vtabstruct_6_basis_HingeBasisFunction { - struct __pyx_vtabstruct_6_basis_BasisFunction __pyx_base; - PyObject *(*translate)(struct __pyx_obj_6_basis_HingeBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch); - __pyx_t_6_basis_FLOAT_t (*scale)(struct __pyx_obj_6_basis_HingeBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); - __pyx_t_6_basis_INDEX_t (*get_variable)(struct __pyx_obj_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); - __pyx_t_6_basis_FLOAT_t (*get_knot)(struct __pyx_obj_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); - int (*get_reverse)(struct __pyx_obj_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); - __pyx_t_6_basis_INDEX_t (*get_knot_idx)(struct __pyx_obj_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); +struct __pyx_vtabstruct_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction { + struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction __pyx_base; }; -static struct __pyx_vtabstruct_6_basis_HingeBasisFunction *__pyx_vtabptr_6_basis_HingeBasisFunction; +static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction *__pyx_vtabptr_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction; #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif @@ -1212,6 +1223,12 @@ static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*pr static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname); +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static void __Pyx_WriteUnraisable(const char *name, int clineno, + int lineno, const char *filename); /*proto*/ + static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact); /*proto*/ @@ -1290,9 +1307,6 @@ static CYTHON_INLINE int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* o __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); -static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ - static void __Pyx_RaiseDoubleKeywordsError(const char* func_name, PyObject* kw_name); /*proto*/ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], \ @@ -1319,6 +1333,8 @@ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); #include +static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ + typedef struct { Py_ssize_t shape, strides, suboffsets; } __Pyx_Buf_DimInfo; @@ -1480,9 +1496,6 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); -static void __Pyx_WriteUnraisable(const char *name, int clineno, - int lineno, const char *filename); /*proto*/ - static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ #define __Pyx_Generator_USED @@ -1514,8 +1527,6 @@ static int __Pyx_PyGen_FetchStopIterationValue(PyObject **pvalue); static int __Pyx_check_binary_version(void); -static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ - #if !defined(__Pyx_PyIdentifier_FromString) #if PY_MAJOR_VERSION < 3 #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) @@ -1577,118 +1588,118 @@ static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ -/* Module declarations from '_util' */ -static __pyx_t_5_util_FLOAT_t (*__pyx_f_5_util_log2)(__pyx_t_5_util_FLOAT_t); /*proto*/ -static PyObject *(*__pyx_f_5_util_apply_weights_2d)(PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); /*proto*/ +/* Module declarations from 'sklearn.earth._util' */ +static __pyx_t_7sklearn_5earth_5_util_FLOAT_t (*__pyx_f_7sklearn_5earth_5_util_log2)(__pyx_t_7sklearn_5earth_5_util_FLOAT_t); /*proto*/ +static PyObject *(*__pyx_f_7sklearn_5earth_5_util_apply_weights_2d)(PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); /*proto*/ /* Module declarations from 'libc.math' */ -/* Module declarations from '_basis' */ -static PyTypeObject *__pyx_ptype_6_basis_BasisFunction = 0; -static PyTypeObject *__pyx_ptype_6_basis_ConstantBasisFunction = 0; -static PyTypeObject *__pyx_ptype_6_basis_HingeBasisFunction = 0; -static PyTypeObject *__pyx_ptype_6_basis_LinearBasisFunction = 0; -static PyTypeObject *__pyx_ptype_6_basis_Basis = 0; -static PyTypeObject *__pyx_ptype_6_basis_PicklePlaceHolderBasisFunction = 0; -static PyTypeObject *__pyx_ptype_6_basis___pyx_scope_struct__piter = 0; -static __pyx_t_6_basis_FLOAT_t __pyx_v_6_basis_ZERO_TOL; -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t = { "FLOAT_t", NULL, sizeof(__pyx_t_6_basis_FLOAT_t), { 0 }, 0, 'R', 0, 0 }; -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_6_basis_INT_t = { "INT_t", NULL, sizeof(__pyx_t_6_basis_INT_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_6_basis_INT_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_6_basis_INT_t), 0 }; -#define __Pyx_MODULE_NAME "_basis" -int __pyx_module_is_main__basis = 0; - -/* Implementation of '_basis' */ +/* Module declarations from 'sklearn.earth._basis' */ +static PyTypeObject *__pyx_ptype_7sklearn_5earth_6_basis_Basis = 0; +static PyTypeObject *__pyx_ptype_7sklearn_5earth_6_basis_BasisFunction = 0; +static PyTypeObject *__pyx_ptype_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction = 0; +static PyTypeObject *__pyx_ptype_7sklearn_5earth_6_basis_ConstantBasisFunction = 0; +static PyTypeObject *__pyx_ptype_7sklearn_5earth_6_basis___pyx_scope_struct__piter = 0; +static PyTypeObject *__pyx_ptype_7sklearn_5earth_6_basis_HingeBasisFunction = 0; +static PyTypeObject *__pyx_ptype_7sklearn_5earth_6_basis_LinearBasisFunction = 0; +static __pyx_t_7sklearn_5earth_6_basis_FLOAT_t __pyx_v_7sklearn_5earth_6_basis_ZERO_TOL; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t = { "FLOAT_t", NULL, sizeof(__pyx_t_7sklearn_5earth_6_basis_FLOAT_t), { 0 }, 0, 'R', 0, 0 }; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_INT_t = { "INT_t", NULL, sizeof(__pyx_t_7sklearn_5earth_6_basis_INT_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_7sklearn_5earth_6_basis_INT_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_7sklearn_5earth_6_basis_INT_t), 0 }; +#define __Pyx_MODULE_NAME "sklearn.earth._basis" +int __pyx_module_is_main_sklearn__earth___basis = 0; + +/* Implementation of 'sklearn.earth._basis' */ static PyObject *__pyx_builtin_NotImplemented; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_NotImplementedError; static PyObject *__pyx_builtin_super; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_RuntimeError; -static int __pyx_pf_6_basis_13BasisFunction___cinit__(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_2__reduce__(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_4_get_root(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_6_getstate(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_8_get_parent_state(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_10_set_parent_state(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, PyObject *__pyx_v_state); /* proto */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_12__setstate__(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, PyObject *__pyx_v_state); /* proto */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_14_eq(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, PyObject *__pyx_v_other); /* proto */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_16__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_method); /* proto */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_18has_knot(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_20is_prunable(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_22is_pruned(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_24is_splittable(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_26make_splittable(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_28make_unsplittable(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_30_set_parent(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, struct __pyx_obj_6_basis_BasisFunction *__pyx_v_parent); /* proto */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_32_add_child(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, struct __pyx_obj_6_basis_BasisFunction *__pyx_v_child); /* proto */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_34get_parent(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_36prune(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_38unprune(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_40knots(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, __pyx_t_6_basis_INDEX_t __pyx_v_variable); /* proto */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_42degree(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_44apply(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_b, int __pyx_v_recurse); /* proto */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_46valid_knots(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_variable, int __pyx_v_variable_idx, __pyx_t_6_basis_INDEX_t __pyx_v_check_every, int __pyx_v_endspan, int __pyx_v_minspan, __pyx_t_6_basis_FLOAT_t __pyx_v_minspan_alpha, __pyx_t_6_basis_INDEX_t __pyx_v_n, PyArrayObject *__pyx_v_workspace); /* proto */ -static int __pyx_pf_6_basis_21ConstantBasisFunction___init__(struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_2_get_root(struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_4_get_parent_state(CYTHON_UNUSED struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_6_set_parent_state(CYTHON_UNUSED struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_state); /* proto */ -static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_8degree(struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_10translate(struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_ConstantBasisFunctionself, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts, int __pyx_v_recurse); /* proto */ -static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_12scale(struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_ConstantBasisFunctionself, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts); /* proto */ -static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_14_set_parent(struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self, struct __pyx_obj_6_basis_BasisFunction *__pyx_v_parent); /* proto */ -static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_16get_parent(struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_18apply(struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_b, int __pyx_v_recurse); /* proto */ -static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_20__str__(CYTHON_UNUSED struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self); /* proto */ -static int __pyx_pf_6_basis_18HingeBasisFunction___init__(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self, struct __pyx_obj_6_basis_BasisFunction *__pyx_v_parent, __pyx_t_6_basis_FLOAT_t __pyx_v_knot, __pyx_t_6_basis_INDEX_t __pyx_v_knot_idx, __pyx_t_6_basis_INDEX_t __pyx_v_variable, int __pyx_v_reverse, PyObject *__pyx_v_label); /* proto */ -static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_2__reduce__(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_4_getstate(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_6__setstate__(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self, PyObject *__pyx_v_state); /* proto */ -static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_8has_knot(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_10translate(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts, int __pyx_v_recurse); /* proto */ -static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_12scale(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts); /* proto */ -static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_14__str__(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_16get_variable(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_18get_knot(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_20get_reverse(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_22get_knot_idx(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_24apply(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_b, int __pyx_v_recurse); /* proto */ -static int __pyx_pf_6_basis_19LinearBasisFunction___init__(struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_self, struct __pyx_obj_6_basis_BasisFunction *__pyx_v_parent, __pyx_t_6_basis_INDEX_t __pyx_v_variable, PyObject *__pyx_v_label); /* proto */ -static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_2__reduce__(struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_4_getstate(struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_6__setstate__(struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_self, PyObject *__pyx_v_state); /* proto */ -static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_8translate(struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_LinearBasisFunctionself, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts, int __pyx_v_recurse); /* proto */ -static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_10scale(struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts); /* proto */ -static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_12__str__(struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_14get_variable(struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_16apply(struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_b, int __pyx_v_recurse); /* proto */ -static int __pyx_pf_6_basis_5Basis___init__(struct __pyx_obj_6_basis_Basis *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6_basis_5Basis_2__reduce__(struct __pyx_obj_6_basis_Basis *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6_basis_5Basis_4_getstate(struct __pyx_obj_6_basis_Basis *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6_basis_5Basis_6__setstate__(struct __pyx_obj_6_basis_Basis *__pyx_v_self, PyObject *__pyx_v_state); /* proto */ -static PyObject *__pyx_pf_6_basis_5Basis_8__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_method); /* proto */ -static PyObject *__pyx_pf_6_basis_5Basis_10_eq(struct __pyx_obj_6_basis_Basis *__pyx_v_self, PyObject *__pyx_v_other); /* proto */ -static PyObject *__pyx_pf_6_basis_5Basis_12piter(struct __pyx_obj_6_basis_Basis *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6_basis_5Basis_15__str__(struct __pyx_obj_6_basis_Basis *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6_basis_5Basis_17translate(struct __pyx_obj_6_basis_Basis *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts); /* proto */ -static PyObject *__pyx_pf_6_basis_5Basis_19scale(struct __pyx_obj_6_basis_Basis *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts, PyArrayObject *__pyx_v_beta); /* proto */ -static PyObject *__pyx_pf_6_basis_5Basis_21get_root(struct __pyx_obj_6_basis_Basis *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6_basis_5Basis_23append(struct __pyx_obj_6_basis_Basis *__pyx_v_self, struct __pyx_obj_6_basis_BasisFunction *__pyx_v_basis_function); /* proto */ -static PyObject *__pyx_pf_6_basis_5Basis_25__iter__(struct __pyx_obj_6_basis_Basis *__pyx_v_self); /* proto */ -static Py_ssize_t __pyx_pf_6_basis_5Basis_27__len__(struct __pyx_obj_6_basis_Basis *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6_basis_5Basis_29get(struct __pyx_obj_6_basis_Basis *__pyx_v_self, __pyx_t_6_basis_INDEX_t __pyx_v_i); /* proto */ -static PyObject *__pyx_pf_6_basis_5Basis_31__getitem__(struct __pyx_obj_6_basis_Basis *__pyx_v_self, __pyx_t_6_basis_INDEX_t __pyx_v_i); /* proto */ -static PyObject *__pyx_pf_6_basis_5Basis_33plen(struct __pyx_obj_6_basis_Basis *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_6_basis_5Basis_35transform(struct __pyx_obj_6_basis_Basis *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_B); /* proto */ -static PyObject *__pyx_pf_6_basis_5Basis_37weighted_transform(struct __pyx_obj_6_basis_Basis *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_B, PyArrayObject *__pyx_v_weights); /* proto */ +static int __pyx_pf_7sklearn_5earth_6_basis_13BasisFunction___cinit__(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_2__reduce__(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_4_get_root(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_6_getstate(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_8_get_parent_state(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_10_set_parent_state(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self, PyObject *__pyx_v_state); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_12__setstate__(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self, PyObject *__pyx_v_state); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_14_eq(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self, PyObject *__pyx_v_other); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_16__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_method); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_18has_knot(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_20is_prunable(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_22is_pruned(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_24is_splittable(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_26make_splittable(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_28make_unsplittable(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_30_set_parent(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self, struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_parent); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_32_add_child(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self, struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_child); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_34get_parent(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_36prune(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_38unprune(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_40knots(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self, __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_variable); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_42degree(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_44apply(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_b, int __pyx_v_recurse); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_46valid_knots(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_variable, int __pyx_v_variable_idx, __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_check_every, int __pyx_v_endspan, int __pyx_v_minspan, __pyx_t_7sklearn_5earth_6_basis_FLOAT_t __pyx_v_minspan_alpha, __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_n, PyArrayObject *__pyx_v_workspace); /* proto */ +static int __pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction___init__(struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_2_get_root(struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_4_get_parent_state(CYTHON_UNUSED struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_6_set_parent_state(CYTHON_UNUSED struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_state); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_8degree(struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_10translate(struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *__pyx_v_ConstantBasisFunctionself, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts, int __pyx_v_recurse); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_12scale(struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *__pyx_v_ConstantBasisFunctionself, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_14_set_parent(struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *__pyx_v_self, struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_parent); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_16get_parent(struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_18apply(struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_b, int __pyx_v_recurse); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_20__str__(CYTHON_UNUSED struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *__pyx_v_self); /* proto */ +static int __pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction___init__(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *__pyx_v_self, struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_parent, __pyx_t_7sklearn_5earth_6_basis_FLOAT_t __pyx_v_knot, __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_knot_idx, __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_variable, int __pyx_v_reverse, PyObject *__pyx_v_label); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_2__reduce__(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_4_getstate(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_6__setstate__(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *__pyx_v_self, PyObject *__pyx_v_state); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_8has_knot(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_10translate(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts, int __pyx_v_recurse); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_12scale(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_14__str__(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_16get_variable(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_18get_knot(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_20get_reverse(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_22get_knot_idx(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_24apply(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_b, int __pyx_v_recurse); /* proto */ +static int __pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction___init__(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *__pyx_v_self, struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_parent, __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_variable, PyObject *__pyx_v_label); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_2__reduce__(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_4_getstate(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_6__setstate__(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *__pyx_v_self, PyObject *__pyx_v_state); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_8translate(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *__pyx_v_LinearBasisFunctionself, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts, int __pyx_v_recurse); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_10scale(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_12__str__(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_14get_variable(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_16apply(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_b, int __pyx_v_recurse); /* proto */ +static int __pyx_pf_7sklearn_5earth_6_basis_5Basis___init__(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_2__reduce__(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_4_getstate(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_6__setstate__(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self, PyObject *__pyx_v_state); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_8__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_method); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_10_eq(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self, PyObject *__pyx_v_other); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_12piter(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_15__str__(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_17translate(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_19scale(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts, PyArrayObject *__pyx_v_beta); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_21get_root(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_23append(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self, struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_basis_function); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_25__iter__(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self); /* proto */ +static Py_ssize_t __pyx_pf_7sklearn_5earth_6_basis_5Basis_27__len__(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_29get(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self, __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_i); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_31__getitem__(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self, __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_i); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_33plen(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_35transform(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_B); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_37weighted_transform(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_B, PyArrayObject *__pyx_v_weights); /* proto */ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ -static PyObject *__pyx_tp_new_6_basis_BasisFunction(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_6_basis_ConstantBasisFunction(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_6_basis_HingeBasisFunction(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_6_basis_LinearBasisFunction(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_6_basis_Basis(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_6_basis_PicklePlaceHolderBasisFunction(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_6_basis___pyx_scope_struct__piter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7sklearn_5earth_6_basis_Basis(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7sklearn_5earth_6_basis_BasisFunction(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7sklearn_5earth_6_basis_ConstantBasisFunction(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7sklearn_5earth_6_basis___pyx_scope_struct__piter(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7sklearn_5earth_6_basis_HingeBasisFunction(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7sklearn_5earth_6_basis_LinearBasisFunction(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static char __pyx_k_1[] = "(Intercept)"; static char __pyx_k_2[] = ""; static char __pyx_k_3[] = "h(%s-%G)"; @@ -1797,6 +1808,7 @@ static char __pyx_k__variable_idx[] = "variable_idx"; static char __pyx_k__is_splittable[] = "is_splittable"; static char __pyx_k__minspan_alpha[] = "minspan_alpha"; static char __pyx_k__NotImplemented[] = "NotImplemented"; +static char __pyx_k____pyx_vtable__[] = "__pyx_vtable__"; static char __pyx_k____pyx_getbuffer[] = "__pyx_getbuffer"; static char __pyx_k__make_splittable[] = "make_splittable"; static char __pyx_k___get_parent_state[] = "_get_parent_state"; @@ -1833,6 +1845,7 @@ static PyObject *__pyx_n_s____len__; static PyObject *__pyx_n_s____main__; static PyObject *__pyx_n_s____pyx_getbuffer; static PyObject *__pyx_n_s____pyx_releasebuffer; +static PyObject *__pyx_n_s____pyx_vtable__; static PyObject *__pyx_n_s____setstate__; static PyObject *__pyx_n_s____test__; static PyObject *__pyx_n_s___add_child; @@ -1921,20 +1934,20 @@ static PyObject *__pyx_k_tuple_19; static PyObject *__pyx_k_tuple_21; /* Python wrapper */ -static int __pyx_pw_6_basis_13BasisFunction_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_6_basis_13BasisFunction_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_1__cinit__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__cinit__ (wrapper)", 0); if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { __Pyx_RaiseArgtupleInvalid("__cinit__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__cinit__", 0))) return -1; - __pyx_r = __pyx_pf_6_basis_13BasisFunction___cinit__(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_13BasisFunction___cinit__(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":15 +/* "sklearn/earth/_basis.pyx":15 * cdef class BasisFunction: * * def __cinit__(BasisFunction self): # <<<<<<<<<<<<<< @@ -1942,7 +1955,7 @@ static int __pyx_pw_6_basis_13BasisFunction_1__cinit__(PyObject *__pyx_v_self, P * self.children = [] */ -static int __pyx_pf_6_basis_13BasisFunction___cinit__(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self) { +static int __pyx_pf_7sklearn_5earth_6_basis_13BasisFunction___cinit__(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -1951,7 +1964,7 @@ static int __pyx_pf_6_basis_13BasisFunction___cinit__(struct __pyx_obj_6_basis_B int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__cinit__", 0); - /* "_basis.pyx":16 + /* "sklearn/earth/_basis.pyx":16 * * def __cinit__(BasisFunction self): * self.pruned = False # <<<<<<<<<<<<<< @@ -1960,7 +1973,7 @@ static int __pyx_pf_6_basis_13BasisFunction___cinit__(struct __pyx_obj_6_basis_B */ __pyx_v_self->pruned = 0; - /* "_basis.pyx":17 + /* "sklearn/earth/_basis.pyx":17 * def __cinit__(BasisFunction self): * self.pruned = False * self.children = [] # <<<<<<<<<<<<<< @@ -1975,7 +1988,7 @@ static int __pyx_pf_6_basis_13BasisFunction___cinit__(struct __pyx_obj_6_basis_B __pyx_v_self->children = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "_basis.pyx":18 + /* "sklearn/earth/_basis.pyx":18 * self.pruned = False * self.children = [] * self.prunable = True # <<<<<<<<<<<<<< @@ -1984,7 +1997,7 @@ static int __pyx_pf_6_basis_13BasisFunction___cinit__(struct __pyx_obj_6_basis_B */ __pyx_v_self->prunable = 1; - /* "_basis.pyx":19 + /* "sklearn/earth/_basis.pyx":19 * self.children = [] * self.prunable = True * self.child_map = {} # <<<<<<<<<<<<<< @@ -1999,7 +2012,7 @@ static int __pyx_pf_6_basis_13BasisFunction___cinit__(struct __pyx_obj_6_basis_B __pyx_v_self->child_map = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "_basis.pyx":20 + /* "sklearn/earth/_basis.pyx":20 * self.prunable = True * self.child_map = {} * self.splittable = True # <<<<<<<<<<<<<< @@ -2012,7 +2025,7 @@ static int __pyx_pf_6_basis_13BasisFunction___cinit__(struct __pyx_obj_6_basis_B goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_basis.BasisFunction.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.BasisFunction.__cinit__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -2020,17 +2033,17 @@ static int __pyx_pf_6_basis_13BasisFunction___cinit__(struct __pyx_obj_6_basis_B } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_13BasisFunction_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_6_basis_13BasisFunction_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_13BasisFunction_2__reduce__(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_2__reduce__(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":22 +/* "sklearn/earth/_basis.pyx":22 * self.splittable = True * * def __reduce__(self): # <<<<<<<<<<<<<< @@ -2038,7 +2051,7 @@ static PyObject *__pyx_pw_6_basis_13BasisFunction_3__reduce__(PyObject *__pyx_v_ * */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_2__reduce__(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_2__reduce__(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -2049,7 +2062,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_2__reduce__(struct __pyx_obj_6 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce__", 0); - /* "_basis.pyx":23 + /* "sklearn/earth/_basis.pyx":23 * * def __reduce__(self): * return (self.__class__, (), self._getstate()) # <<<<<<<<<<<<<< @@ -2085,7 +2098,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_2__reduce__(struct __pyx_obj_6 __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_basis.BasisFunction.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.BasisFunction.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2094,17 +2107,17 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_2__reduce__(struct __pyx_obj_6 } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_13BasisFunction_5_get_root(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_6_basis_13BasisFunction_5_get_root(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_5_get_root(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_5_get_root(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_get_root (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_13BasisFunction_4_get_root(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_4_get_root(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":25 +/* "sklearn/earth/_basis.pyx":25 * return (self.__class__, (), self._getstate()) * * def _get_root(self): # <<<<<<<<<<<<<< @@ -2112,7 +2125,7 @@ static PyObject *__pyx_pw_6_basis_13BasisFunction_5_get_root(PyObject *__pyx_v_s * */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_4_get_root(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_4_get_root(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -2122,7 +2135,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_4_get_root(struct __pyx_obj_6_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_get_root", 0); - /* "_basis.pyx":26 + /* "sklearn/earth/_basis.pyx":26 * * def _get_root(self): * return self.parent._get_root() # <<<<<<<<<<<<<< @@ -2144,7 +2157,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_4_get_root(struct __pyx_obj_6_ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_basis.BasisFunction._get_root", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.BasisFunction._get_root", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2153,17 +2166,17 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_4_get_root(struct __pyx_obj_6_ } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_13BasisFunction_7_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_6_basis_13BasisFunction_7_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_7_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_7_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_getstate (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_13BasisFunction_6_getstate(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_6_getstate(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":28 +/* "sklearn/earth/_basis.pyx":28 * return self.parent._get_root() * * def _getstate(self): # <<<<<<<<<<<<<< @@ -2171,7 +2184,7 @@ static PyObject *__pyx_pw_6_basis_13BasisFunction_7_getstate(PyObject *__pyx_v_s * 'children': self.children, */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_6_getstate(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_6_getstate(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self) { PyObject *__pyx_v_result = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -2183,7 +2196,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_6_getstate(struct __pyx_obj_6_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_getstate", 0); - /* "_basis.pyx":29 + /* "sklearn/earth/_basis.pyx":29 * * def _getstate(self): * result = {'pruned': self.pruned, # <<<<<<<<<<<<<< @@ -2197,7 +2210,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_6_getstate(struct __pyx_obj_6_ if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__pruned), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "_basis.pyx":30 + /* "sklearn/earth/_basis.pyx":30 * def _getstate(self): * result = {'pruned': self.pruned, * 'children': self.children, # <<<<<<<<<<<<<< @@ -2206,7 +2219,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_6_getstate(struct __pyx_obj_6_ */ if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__children), ((PyObject *)__pyx_v_self->children)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "_basis.pyx":31 + /* "sklearn/earth/_basis.pyx":31 * result = {'pruned': self.pruned, * 'children': self.children, * 'prunable': self.prunable, # <<<<<<<<<<<<<< @@ -2218,7 +2231,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_6_getstate(struct __pyx_obj_6_ if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__prunable), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "_basis.pyx":32 + /* "sklearn/earth/_basis.pyx":32 * 'children': self.children, * 'prunable': self.prunable, * 'child_map': self.child_map, # <<<<<<<<<<<<<< @@ -2227,7 +2240,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_6_getstate(struct __pyx_obj_6_ */ if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__child_map), ((PyObject *)__pyx_v_self->child_map)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "_basis.pyx":33 + /* "sklearn/earth/_basis.pyx":33 * 'prunable': self.prunable, * 'child_map': self.child_map, * 'splittable': self.splittable} # <<<<<<<<<<<<<< @@ -2241,7 +2254,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_6_getstate(struct __pyx_obj_6_ __pyx_v_result = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "_basis.pyx":34 + /* "sklearn/earth/_basis.pyx":34 * 'child_map': self.child_map, * 'splittable': self.splittable} * result.update(self._get_parent_state()) # <<<<<<<<<<<<<< @@ -2266,7 +2279,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_6_getstate(struct __pyx_obj_6_ __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "_basis.pyx":35 + /* "sklearn/earth/_basis.pyx":35 * 'splittable': self.splittable} * result.update(self._get_parent_state()) * return result # <<<<<<<<<<<<<< @@ -2284,7 +2297,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_6_getstate(struct __pyx_obj_6_ __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_basis.BasisFunction._getstate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.BasisFunction._getstate", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_result); @@ -2294,17 +2307,17 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_6_getstate(struct __pyx_obj_6_ } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_13BasisFunction_9_get_parent_state(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_6_basis_13BasisFunction_9_get_parent_state(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_9_get_parent_state(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_9_get_parent_state(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_get_parent_state (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_13BasisFunction_8_get_parent_state(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_8_get_parent_state(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":37 +/* "sklearn/earth/_basis.pyx":37 * return result * * def _get_parent_state(self): # <<<<<<<<<<<<<< @@ -2312,7 +2325,7 @@ static PyObject *__pyx_pw_6_basis_13BasisFunction_9_get_parent_state(PyObject *_ * */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_8_get_parent_state(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_8_get_parent_state(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -2321,7 +2334,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_8_get_parent_state(struct __py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_get_parent_state", 0); - /* "_basis.pyx":38 + /* "sklearn/earth/_basis.pyx":38 * * def _get_parent_state(self): * return {'parent': self.parent} # <<<<<<<<<<<<<< @@ -2340,7 +2353,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_8_get_parent_state(struct __py goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_basis.BasisFunction._get_parent_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.BasisFunction._get_parent_state", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2349,17 +2362,17 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_8_get_parent_state(struct __py } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_13BasisFunction_11_set_parent_state(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ -static PyObject *__pyx_pw_6_basis_13BasisFunction_11_set_parent_state(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_11_set_parent_state(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_11_set_parent_state(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_set_parent_state (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_13BasisFunction_10_set_parent_state(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self), ((PyObject *)__pyx_v_state)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_10_set_parent_state(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self), ((PyObject *)__pyx_v_state)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":40 +/* "sklearn/earth/_basis.pyx":40 * return {'parent': self.parent} * * def _set_parent_state(self, state): # <<<<<<<<<<<<<< @@ -2367,7 +2380,7 @@ static PyObject *__pyx_pw_6_basis_13BasisFunction_11_set_parent_state(PyObject * * */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_10_set_parent_state(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, PyObject *__pyx_v_state) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_10_set_parent_state(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self, PyObject *__pyx_v_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -2376,7 +2389,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_10_set_parent_state(struct __p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_set_parent_state", 0); - /* "_basis.pyx":41 + /* "sklearn/earth/_basis.pyx":41 * * def _set_parent_state(self, state): * self.parent = state['parent'] # <<<<<<<<<<<<<< @@ -2385,18 +2398,18 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_10_set_parent_state(struct __p */ __pyx_t_1 = PyObject_GetItem(__pyx_v_state, ((PyObject *)__pyx_n_s__parent)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->parent); __Pyx_DECREF(((PyObject *)__pyx_v_self->parent)); - __pyx_v_self->parent = ((struct __pyx_obj_6_basis_BasisFunction *)__pyx_t_1); + __pyx_v_self->parent = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_1); __pyx_t_1 = 0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_basis.BasisFunction._set_parent_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.BasisFunction._set_parent_state", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2405,17 +2418,17 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_10_set_parent_state(struct __p } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_13BasisFunction_13__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ -static PyObject *__pyx_pw_6_basis_13BasisFunction_13__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_13__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_13__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_13BasisFunction_12__setstate__(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self), ((PyObject *)__pyx_v_state)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_12__setstate__(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self), ((PyObject *)__pyx_v_state)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":43 +/* "sklearn/earth/_basis.pyx":43 * self.parent = state['parent'] * * def __setstate__(self, state): # <<<<<<<<<<<<<< @@ -2423,7 +2436,7 @@ static PyObject *__pyx_pw_6_basis_13BasisFunction_13__setstate__(PyObject *__pyx * self.children = state['children'] */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_12__setstate__(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, PyObject *__pyx_v_state) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_12__setstate__(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self, PyObject *__pyx_v_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -2435,7 +2448,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_12__setstate__(struct __pyx_ob int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate__", 0); - /* "_basis.pyx":44 + /* "sklearn/earth/_basis.pyx":44 * * def __setstate__(self, state): * self.pruned = state['pruned'] # <<<<<<<<<<<<<< @@ -2448,7 +2461,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_12__setstate__(struct __pyx_ob __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->pruned = __pyx_t_2; - /* "_basis.pyx":45 + /* "sklearn/earth/_basis.pyx":45 * def __setstate__(self, state): * self.pruned = state['pruned'] * self.children = state['children'] # <<<<<<<<<<<<<< @@ -2464,7 +2477,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_12__setstate__(struct __pyx_ob __pyx_v_self->children = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "_basis.pyx":46 + /* "sklearn/earth/_basis.pyx":46 * self.pruned = state['pruned'] * self.children = state['children'] * self.prunable = state['prunable'] # <<<<<<<<<<<<<< @@ -2477,7 +2490,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_12__setstate__(struct __pyx_ob __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->prunable = __pyx_t_2; - /* "_basis.pyx":47 + /* "sklearn/earth/_basis.pyx":47 * self.children = state['children'] * self.prunable = state['prunable'] * self.child_map = state['child_map'] # <<<<<<<<<<<<<< @@ -2493,7 +2506,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_12__setstate__(struct __pyx_ob __pyx_v_self->child_map = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "_basis.pyx":48 + /* "sklearn/earth/_basis.pyx":48 * self.prunable = state['prunable'] * self.child_map = state['child_map'] * self.splittable = state['splittable'] # <<<<<<<<<<<<<< @@ -2506,7 +2519,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_12__setstate__(struct __pyx_ob __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->splittable = __pyx_t_2; - /* "_basis.pyx":49 + /* "sklearn/earth/_basis.pyx":49 * self.child_map = state['child_map'] * self.splittable = state['splittable'] * self._set_parent_state(state) # <<<<<<<<<<<<<< @@ -2532,7 +2545,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_12__setstate__(struct __pyx_ob __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_basis.BasisFunction.__setstate__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.BasisFunction.__setstate__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2541,17 +2554,17 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_12__setstate__(struct __pyx_ob } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_13BasisFunction_15_eq(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ -static PyObject *__pyx_pw_6_basis_13BasisFunction_15_eq(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_15_eq(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_15_eq(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_eq (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_13BasisFunction_14_eq(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self), ((PyObject *)__pyx_v_other)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_14_eq(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self), ((PyObject *)__pyx_v_other)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":51 +/* "sklearn/earth/_basis.pyx":51 * self._set_parent_state(state) * * def _eq(self, other): # <<<<<<<<<<<<<< @@ -2559,7 +2572,7 @@ static PyObject *__pyx_pw_6_basis_13BasisFunction_15_eq(PyObject *__pyx_v_self, * return False */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_14_eq(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, PyObject *__pyx_v_other) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_14_eq(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self, PyObject *__pyx_v_other) { PyObject *__pyx_v_self_state = NULL; PyObject *__pyx_v_other_state = NULL; PyObject *__pyx_r = NULL; @@ -2567,12 +2580,13 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_14_eq(struct __pyx_obj_6_basis PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; int __pyx_t_3; + int __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_eq", 0); - /* "_basis.pyx":52 + /* "sklearn/earth/_basis.pyx":52 * * def _eq(self, other): * if self.__class__ is not other.__class__: # <<<<<<<<<<<<<< @@ -2586,9 +2600,10 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_14_eq(struct __pyx_obj_6_basis __pyx_t_3 = (__pyx_t_1 != __pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (__pyx_t_3) { + __pyx_t_4 = (__pyx_t_3 != 0); + if (__pyx_t_4) { - /* "_basis.pyx":53 + /* "sklearn/earth/_basis.pyx":53 * def _eq(self, other): * if self.__class__ is not other.__class__: * return False # <<<<<<<<<<<<<< @@ -2605,7 +2620,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_14_eq(struct __pyx_obj_6_basis } __pyx_L3:; - /* "_basis.pyx":54 + /* "sklearn/earth/_basis.pyx":54 * if self.__class__ is not other.__class__: * return False * self_state = self._getstate() # <<<<<<<<<<<<<< @@ -2620,7 +2635,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_14_eq(struct __pyx_obj_6_basis __pyx_v_self_state = __pyx_t_1; __pyx_t_1 = 0; - /* "_basis.pyx":55 + /* "sklearn/earth/_basis.pyx":55 * return False * self_state = self._getstate() * other_state = other._getstate() # <<<<<<<<<<<<<< @@ -2635,7 +2650,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_14_eq(struct __pyx_obj_6_basis __pyx_v_other_state = __pyx_t_2; __pyx_t_2 = 0; - /* "_basis.pyx":56 + /* "sklearn/earth/_basis.pyx":56 * self_state = self._getstate() * other_state = other._getstate() * del self_state['children'] # <<<<<<<<<<<<<< @@ -2645,7 +2660,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_14_eq(struct __pyx_obj_6_basis if (unlikely(!__pyx_v_self_state)) { __Pyx_RaiseUnboundLocalError("self_state"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } if (PyObject_DelItem(__pyx_v_self_state, ((PyObject *)__pyx_n_s__children)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "_basis.pyx":57 + /* "sklearn/earth/_basis.pyx":57 * other_state = other._getstate() * del self_state['children'] * del self_state['child_map'] # <<<<<<<<<<<<<< @@ -2655,7 +2670,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_14_eq(struct __pyx_obj_6_basis if (unlikely(!__pyx_v_self_state)) { __Pyx_RaiseUnboundLocalError("self_state"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } if (PyObject_DelItem(__pyx_v_self_state, ((PyObject *)__pyx_n_s__child_map)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "_basis.pyx":58 + /* "sklearn/earth/_basis.pyx":58 * del self_state['children'] * del self_state['child_map'] * del other_state['children'] # <<<<<<<<<<<<<< @@ -2665,7 +2680,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_14_eq(struct __pyx_obj_6_basis if (unlikely(!__pyx_v_other_state)) { __Pyx_RaiseUnboundLocalError("other_state"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } if (PyObject_DelItem(__pyx_v_other_state, ((PyObject *)__pyx_n_s__children)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "_basis.pyx":59 + /* "sklearn/earth/_basis.pyx":59 * del self_state['child_map'] * del other_state['children'] * del other_state['child_map'] # <<<<<<<<<<<<<< @@ -2675,7 +2690,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_14_eq(struct __pyx_obj_6_basis if (unlikely(!__pyx_v_other_state)) { __Pyx_RaiseUnboundLocalError("other_state"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } if (PyObject_DelItem(__pyx_v_other_state, ((PyObject *)__pyx_n_s__child_map)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "_basis.pyx":60 + /* "sklearn/earth/_basis.pyx":60 * del other_state['children'] * del other_state['child_map'] * return self_state == other_state # <<<<<<<<<<<<<< @@ -2693,7 +2708,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_14_eq(struct __pyx_obj_6_basis __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_basis.BasisFunction._eq", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.BasisFunction._eq", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_self_state); @@ -2704,8 +2719,8 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_14_eq(struct __pyx_obj_6_basis } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_13BasisFunction_17__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_arg_method); /*proto*/ -static PyObject *__pyx_pw_6_basis_13BasisFunction_17__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_arg_method) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_17__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_arg_method); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_17__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_arg_method) { PyObject *__pyx_v_method = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -2717,17 +2732,17 @@ static PyObject *__pyx_pw_6_basis_13BasisFunction_17__richcmp__(PyObject *__pyx_ __Pyx_GOTREF(__pyx_v_method); goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_basis.BasisFunction.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.BasisFunction.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_6_basis_13BasisFunction_16__richcmp__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other), ((PyObject *)__pyx_v_method)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_16__richcmp__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other), ((PyObject *)__pyx_v_method)); __Pyx_XDECREF(__pyx_v_method); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":62 +/* "sklearn/earth/_basis.pyx":62 * return self_state == other_state * * def __richcmp__(self, other, method): # <<<<<<<<<<<<<< @@ -2735,7 +2750,7 @@ static PyObject *__pyx_pw_6_basis_13BasisFunction_17__richcmp__(PyObject *__pyx_ * return self._eq(other) */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_16__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_method) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_16__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_method) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -2747,7 +2762,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_16__richcmp__(PyObject *__pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__richcmp__", 0); - /* "_basis.pyx":63 + /* "sklearn/earth/_basis.pyx":63 * * def __richcmp__(self, other, method): * if method == 2: # <<<<<<<<<<<<<< @@ -2759,7 +2774,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_16__richcmp__(PyObject *__pyx_ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "_basis.pyx":64 + /* "sklearn/earth/_basis.pyx":64 * def __richcmp__(self, other, method): * if method == 2: * return self._eq(other) # <<<<<<<<<<<<<< @@ -2784,7 +2799,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_16__richcmp__(PyObject *__pyx_ goto __pyx_L3; } - /* "_basis.pyx":65 + /* "sklearn/earth/_basis.pyx":65 * if method == 2: * return self._eq(other) * elif method == 3: # <<<<<<<<<<<<<< @@ -2796,7 +2811,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_16__richcmp__(PyObject *__pyx_ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_2) { - /* "_basis.pyx":66 + /* "sklearn/earth/_basis.pyx":66 * return self._eq(other) * elif method == 3: * return not self._eq(other) # <<<<<<<<<<<<<< @@ -2826,7 +2841,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_16__richcmp__(PyObject *__pyx_ } /*else*/ { - /* "_basis.pyx":68 + /* "sklearn/earth/_basis.pyx":68 * return not self._eq(other) * else: * return NotImplemented # <<<<<<<<<<<<<< @@ -2846,7 +2861,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_16__richcmp__(PyObject *__pyx_ __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_basis.BasisFunction.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.BasisFunction.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2854,7 +2869,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_16__richcmp__(PyObject *__pyx_ return __pyx_r; } -/* "_basis.pyx":70 +/* "sklearn/earth/_basis.pyx":70 * return NotImplemented * * cpdef bint has_knot(BasisFunction self): # <<<<<<<<<<<<<< @@ -2862,8 +2877,8 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_16__richcmp__(PyObject *__pyx_ * */ -static PyObject *__pyx_pw_6_basis_13BasisFunction_19has_knot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static int __pyx_f_6_basis_13BasisFunction_has_knot(CYTHON_UNUSED struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_19has_knot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static int __pyx_f_7sklearn_5earth_6_basis_13BasisFunction_has_knot(CYTHON_UNUSED struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -2879,7 +2894,7 @@ static int __pyx_f_6_basis_13BasisFunction_has_knot(CYTHON_UNUSED struct __pyx_o else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__has_knot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_13BasisFunction_19has_knot)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_19has_knot)) { __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -2891,7 +2906,7 @@ static int __pyx_f_6_basis_13BasisFunction_has_knot(CYTHON_UNUSED struct __pyx_o __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_basis.pyx":71 + /* "sklearn/earth/_basis.pyx":71 * * cpdef bint has_knot(BasisFunction self): * return False # <<<<<<<<<<<<<< @@ -2906,7 +2921,7 @@ static int __pyx_f_6_basis_13BasisFunction_has_knot(CYTHON_UNUSED struct __pyx_o __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_WriteUnraisable("_basis.BasisFunction.has_knot", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("sklearn.earth._basis.BasisFunction.has_knot", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -2914,17 +2929,17 @@ static int __pyx_f_6_basis_13BasisFunction_has_knot(CYTHON_UNUSED struct __pyx_o } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_13BasisFunction_19has_knot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_6_basis_13BasisFunction_19has_knot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_19has_knot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_19has_knot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("has_knot (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_13BasisFunction_18has_knot(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_18has_knot(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":70 +/* "sklearn/earth/_basis.pyx":70 * return NotImplemented * * cpdef bint has_knot(BasisFunction self): # <<<<<<<<<<<<<< @@ -2932,7 +2947,7 @@ static PyObject *__pyx_pw_6_basis_13BasisFunction_19has_knot(PyObject *__pyx_v_s * */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_18has_knot(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_18has_knot(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -2941,7 +2956,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_18has_knot(struct __pyx_obj_6_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("has_knot", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->has_knot(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->has_knot(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2951,7 +2966,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_18has_knot(struct __pyx_obj_6_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_basis.BasisFunction.has_knot", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.BasisFunction.has_knot", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2959,7 +2974,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_18has_knot(struct __pyx_obj_6_ return __pyx_r; } -/* "_basis.pyx":73 +/* "sklearn/earth/_basis.pyx":73 * return False * * cpdef bint is_prunable(BasisFunction self): # <<<<<<<<<<<<<< @@ -2967,8 +2982,8 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_18has_knot(struct __pyx_obj_6_ * */ -static PyObject *__pyx_pw_6_basis_13BasisFunction_21is_prunable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static int __pyx_f_6_basis_13BasisFunction_is_prunable(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_21is_prunable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static int __pyx_f_7sklearn_5earth_6_basis_13BasisFunction_is_prunable(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -2984,7 +2999,7 @@ static int __pyx_f_6_basis_13BasisFunction_is_prunable(struct __pyx_obj_6_basis_ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__is_prunable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_13BasisFunction_21is_prunable)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_21is_prunable)) { __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -2996,7 +3011,7 @@ static int __pyx_f_6_basis_13BasisFunction_is_prunable(struct __pyx_obj_6_basis_ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_basis.pyx":74 + /* "sklearn/earth/_basis.pyx":74 * * cpdef bint is_prunable(BasisFunction self): * return self.prunable # <<<<<<<<<<<<<< @@ -3011,7 +3026,7 @@ static int __pyx_f_6_basis_13BasisFunction_is_prunable(struct __pyx_obj_6_basis_ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_WriteUnraisable("_basis.BasisFunction.is_prunable", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("sklearn.earth._basis.BasisFunction.is_prunable", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -3019,17 +3034,17 @@ static int __pyx_f_6_basis_13BasisFunction_is_prunable(struct __pyx_obj_6_basis_ } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_13BasisFunction_21is_prunable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_6_basis_13BasisFunction_21is_prunable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_21is_prunable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_21is_prunable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("is_prunable (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_13BasisFunction_20is_prunable(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_20is_prunable(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":73 +/* "sklearn/earth/_basis.pyx":73 * return False * * cpdef bint is_prunable(BasisFunction self): # <<<<<<<<<<<<<< @@ -3037,7 +3052,7 @@ static PyObject *__pyx_pw_6_basis_13BasisFunction_21is_prunable(PyObject *__pyx_ * */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_20is_prunable(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_20is_prunable(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3046,7 +3061,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_20is_prunable(struct __pyx_obj int __pyx_clineno = 0; __Pyx_RefNannySetupContext("is_prunable", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->is_prunable(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->is_prunable(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3056,7 +3071,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_20is_prunable(struct __pyx_obj goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_basis.BasisFunction.is_prunable", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.BasisFunction.is_prunable", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3064,7 +3079,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_20is_prunable(struct __pyx_obj return __pyx_r; } -/* "_basis.pyx":76 +/* "sklearn/earth/_basis.pyx":76 * return self.prunable * * cpdef bint is_pruned(BasisFunction self): # <<<<<<<<<<<<<< @@ -3072,8 +3087,8 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_20is_prunable(struct __pyx_obj * */ -static PyObject *__pyx_pw_6_basis_13BasisFunction_23is_pruned(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static int __pyx_f_6_basis_13BasisFunction_is_pruned(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_23is_pruned(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static int __pyx_f_7sklearn_5earth_6_basis_13BasisFunction_is_pruned(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3089,7 +3104,7 @@ static int __pyx_f_6_basis_13BasisFunction_is_pruned(struct __pyx_obj_6_basis_Ba else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__is_pruned); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_13BasisFunction_23is_pruned)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_23is_pruned)) { __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -3101,7 +3116,7 @@ static int __pyx_f_6_basis_13BasisFunction_is_pruned(struct __pyx_obj_6_basis_Ba __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_basis.pyx":77 + /* "sklearn/earth/_basis.pyx":77 * * cpdef bint is_pruned(BasisFunction self): * return self.pruned # <<<<<<<<<<<<<< @@ -3116,7 +3131,7 @@ static int __pyx_f_6_basis_13BasisFunction_is_pruned(struct __pyx_obj_6_basis_Ba __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_WriteUnraisable("_basis.BasisFunction.is_pruned", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("sklearn.earth._basis.BasisFunction.is_pruned", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -3124,17 +3139,17 @@ static int __pyx_f_6_basis_13BasisFunction_is_pruned(struct __pyx_obj_6_basis_Ba } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_13BasisFunction_23is_pruned(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_6_basis_13BasisFunction_23is_pruned(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_23is_pruned(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_23is_pruned(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("is_pruned (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_13BasisFunction_22is_pruned(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_22is_pruned(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":76 +/* "sklearn/earth/_basis.pyx":76 * return self.prunable * * cpdef bint is_pruned(BasisFunction self): # <<<<<<<<<<<<<< @@ -3142,7 +3157,7 @@ static PyObject *__pyx_pw_6_basis_13BasisFunction_23is_pruned(PyObject *__pyx_v_ * */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_22is_pruned(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_22is_pruned(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3151,7 +3166,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_22is_pruned(struct __pyx_obj_6 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("is_pruned", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->is_pruned(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->is_pruned(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3161,7 +3176,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_22is_pruned(struct __pyx_obj_6 goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_basis.BasisFunction.is_pruned", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.BasisFunction.is_pruned", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3169,7 +3184,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_22is_pruned(struct __pyx_obj_6 return __pyx_r; } -/* "_basis.pyx":79 +/* "sklearn/earth/_basis.pyx":79 * return self.pruned * * cpdef bint is_splittable(BasisFunction self): # <<<<<<<<<<<<<< @@ -3177,8 +3192,8 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_22is_pruned(struct __pyx_obj_6 * */ -static PyObject *__pyx_pw_6_basis_13BasisFunction_25is_splittable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static int __pyx_f_6_basis_13BasisFunction_is_splittable(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_25is_splittable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static int __pyx_f_7sklearn_5earth_6_basis_13BasisFunction_is_splittable(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3194,7 +3209,7 @@ static int __pyx_f_6_basis_13BasisFunction_is_splittable(struct __pyx_obj_6_basi else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__is_splittable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_13BasisFunction_25is_splittable)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_25is_splittable)) { __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -3206,7 +3221,7 @@ static int __pyx_f_6_basis_13BasisFunction_is_splittable(struct __pyx_obj_6_basi __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_basis.pyx":80 + /* "sklearn/earth/_basis.pyx":80 * * cpdef bint is_splittable(BasisFunction self): * return self.splittable # <<<<<<<<<<<<<< @@ -3221,7 +3236,7 @@ static int __pyx_f_6_basis_13BasisFunction_is_splittable(struct __pyx_obj_6_basi __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_WriteUnraisable("_basis.BasisFunction.is_splittable", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("sklearn.earth._basis.BasisFunction.is_splittable", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -3229,17 +3244,17 @@ static int __pyx_f_6_basis_13BasisFunction_is_splittable(struct __pyx_obj_6_basi } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_13BasisFunction_25is_splittable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_6_basis_13BasisFunction_25is_splittable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_25is_splittable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_25is_splittable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("is_splittable (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_13BasisFunction_24is_splittable(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_24is_splittable(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":79 +/* "sklearn/earth/_basis.pyx":79 * return self.pruned * * cpdef bint is_splittable(BasisFunction self): # <<<<<<<<<<<<<< @@ -3247,7 +3262,7 @@ static PyObject *__pyx_pw_6_basis_13BasisFunction_25is_splittable(PyObject *__py * */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_24is_splittable(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_24is_splittable(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3256,7 +3271,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_24is_splittable(struct __pyx_o int __pyx_clineno = 0; __Pyx_RefNannySetupContext("is_splittable", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->is_splittable(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->is_splittable(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3266,7 +3281,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_24is_splittable(struct __pyx_o goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_basis.BasisFunction.is_splittable", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.BasisFunction.is_splittable", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3274,7 +3289,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_24is_splittable(struct __pyx_o return __pyx_r; } -/* "_basis.pyx":82 +/* "sklearn/earth/_basis.pyx":82 * return self.splittable * * cpdef bint make_splittable(BasisFunction self): # <<<<<<<<<<<<<< @@ -3282,8 +3297,8 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_24is_splittable(struct __pyx_o * */ -static PyObject *__pyx_pw_6_basis_13BasisFunction_27make_splittable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static int __pyx_f_6_basis_13BasisFunction_make_splittable(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_27make_splittable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static int __pyx_f_7sklearn_5earth_6_basis_13BasisFunction_make_splittable(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3299,7 +3314,7 @@ static int __pyx_f_6_basis_13BasisFunction_make_splittable(struct __pyx_obj_6_ba else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__make_splittable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_13BasisFunction_27make_splittable)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_27make_splittable)) { __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -3311,7 +3326,7 @@ static int __pyx_f_6_basis_13BasisFunction_make_splittable(struct __pyx_obj_6_ba __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_basis.pyx":83 + /* "sklearn/earth/_basis.pyx":83 * * cpdef bint make_splittable(BasisFunction self): * self.splittable = True # <<<<<<<<<<<<<< @@ -3325,7 +3340,7 @@ static int __pyx_f_6_basis_13BasisFunction_make_splittable(struct __pyx_obj_6_ba __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_WriteUnraisable("_basis.BasisFunction.make_splittable", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("sklearn.earth._basis.BasisFunction.make_splittable", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -3333,17 +3348,17 @@ static int __pyx_f_6_basis_13BasisFunction_make_splittable(struct __pyx_obj_6_ba } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_13BasisFunction_27make_splittable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_6_basis_13BasisFunction_27make_splittable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_27make_splittable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_27make_splittable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("make_splittable (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_13BasisFunction_26make_splittable(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_26make_splittable(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":82 +/* "sklearn/earth/_basis.pyx":82 * return self.splittable * * cpdef bint make_splittable(BasisFunction self): # <<<<<<<<<<<<<< @@ -3351,7 +3366,7 @@ static PyObject *__pyx_pw_6_basis_13BasisFunction_27make_splittable(PyObject *__ * */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_26make_splittable(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_26make_splittable(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3360,7 +3375,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_26make_splittable(struct __pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("make_splittable", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->make_splittable(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->make_splittable(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3370,7 +3385,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_26make_splittable(struct __pyx goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_basis.BasisFunction.make_splittable", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.BasisFunction.make_splittable", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3378,7 +3393,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_26make_splittable(struct __pyx return __pyx_r; } -/* "_basis.pyx":85 +/* "sklearn/earth/_basis.pyx":85 * self.splittable = True * * cpdef bint make_unsplittable(BasisFunction self): # <<<<<<<<<<<<<< @@ -3386,8 +3401,8 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_26make_splittable(struct __pyx * */ -static PyObject *__pyx_pw_6_basis_13BasisFunction_29make_unsplittable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static int __pyx_f_6_basis_13BasisFunction_make_unsplittable(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_29make_unsplittable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static int __pyx_f_7sklearn_5earth_6_basis_13BasisFunction_make_unsplittable(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3403,7 +3418,7 @@ static int __pyx_f_6_basis_13BasisFunction_make_unsplittable(struct __pyx_obj_6_ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__make_unsplittable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_13BasisFunction_29make_unsplittable)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_29make_unsplittable)) { __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -3415,7 +3430,7 @@ static int __pyx_f_6_basis_13BasisFunction_make_unsplittable(struct __pyx_obj_6_ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_basis.pyx":86 + /* "sklearn/earth/_basis.pyx":86 * * cpdef bint make_unsplittable(BasisFunction self): * self.splittable = False # <<<<<<<<<<<<<< @@ -3429,7 +3444,7 @@ static int __pyx_f_6_basis_13BasisFunction_make_unsplittable(struct __pyx_obj_6_ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_WriteUnraisable("_basis.BasisFunction.make_unsplittable", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("sklearn.earth._basis.BasisFunction.make_unsplittable", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -3437,17 +3452,17 @@ static int __pyx_f_6_basis_13BasisFunction_make_unsplittable(struct __pyx_obj_6_ } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_13BasisFunction_29make_unsplittable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_6_basis_13BasisFunction_29make_unsplittable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_29make_unsplittable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_29make_unsplittable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("make_unsplittable (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_13BasisFunction_28make_unsplittable(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_28make_unsplittable(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":85 +/* "sklearn/earth/_basis.pyx":85 * self.splittable = True * * cpdef bint make_unsplittable(BasisFunction self): # <<<<<<<<<<<<<< @@ -3455,7 +3470,7 @@ static PyObject *__pyx_pw_6_basis_13BasisFunction_29make_unsplittable(PyObject * * */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_28make_unsplittable(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_28make_unsplittable(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3464,7 +3479,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_28make_unsplittable(struct __p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("make_unsplittable", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->make_unsplittable(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->make_unsplittable(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3474,7 +3489,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_28make_unsplittable(struct __p goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_basis.BasisFunction.make_unsplittable", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.BasisFunction.make_unsplittable", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3482,7 +3497,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_28make_unsplittable(struct __p return __pyx_r; } -/* "_basis.pyx":88 +/* "sklearn/earth/_basis.pyx":88 * self.splittable = False * * cdef list get_children(BasisFunction self): # <<<<<<<<<<<<<< @@ -3490,12 +3505,12 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_28make_unsplittable(struct __p * */ -static PyObject *__pyx_f_6_basis_13BasisFunction_get_children(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self) { +static PyObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_get_children(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_children", 0); - /* "_basis.pyx":89 + /* "sklearn/earth/_basis.pyx":89 * * cdef list get_children(BasisFunction self): * return self.children # <<<<<<<<<<<<<< @@ -3514,7 +3529,7 @@ static PyObject *__pyx_f_6_basis_13BasisFunction_get_children(struct __pyx_obj_6 return __pyx_r; } -/* "_basis.pyx":91 +/* "sklearn/earth/_basis.pyx":91 * return self.children * * cpdef _set_parent(self,BasisFunction parent): # <<<<<<<<<<<<<< @@ -3522,8 +3537,8 @@ static PyObject *__pyx_f_6_basis_13BasisFunction_get_children(struct __pyx_obj_6 * self.parent = parent */ -static PyObject *__pyx_pw_6_basis_13BasisFunction_31_set_parent(PyObject *__pyx_v_self, PyObject *__pyx_v_parent); /*proto*/ -static PyObject *__pyx_f_6_basis_13BasisFunction__set_parent(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, struct __pyx_obj_6_basis_BasisFunction *__pyx_v_parent, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_31_set_parent(PyObject *__pyx_v_self, PyObject *__pyx_v_parent); /*proto*/ +static PyObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction__set_parent(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self, struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_parent, int __pyx_skip_dispatch) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3539,7 +3554,7 @@ static PyObject *__pyx_f_6_basis_13BasisFunction__set_parent(struct __pyx_obj_6_ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___set_parent); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_13BasisFunction_31_set_parent)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_31_set_parent)) { __Pyx_XDECREF(__pyx_r); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -3557,7 +3572,7 @@ static PyObject *__pyx_f_6_basis_13BasisFunction__set_parent(struct __pyx_obj_6_ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_basis.pyx":93 + /* "sklearn/earth/_basis.pyx":93 * cpdef _set_parent(self,BasisFunction parent): * '''Calls _add_child.''' * self.parent = parent # <<<<<<<<<<<<<< @@ -3570,14 +3585,14 @@ static PyObject *__pyx_f_6_basis_13BasisFunction__set_parent(struct __pyx_obj_6_ __Pyx_DECREF(((PyObject *)__pyx_v_self->parent)); __pyx_v_self->parent = __pyx_v_parent; - /* "_basis.pyx":94 + /* "sklearn/earth/_basis.pyx":94 * '''Calls _add_child.''' * self.parent = parent * self.parent._add_child(self) # <<<<<<<<<<<<<< * * cpdef _add_child(self,BasisFunction child): */ - __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_self->parent->__pyx_vtab)->_add_child(__pyx_v_self->parent, __pyx_v_self, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self->parent->__pyx_vtab)->_add_child(__pyx_v_self->parent, __pyx_v_self, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -3587,7 +3602,7 @@ static PyObject *__pyx_f_6_basis_13BasisFunction__set_parent(struct __pyx_obj_6_ __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_basis.BasisFunction._set_parent", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.BasisFunction._set_parent", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3596,17 +3611,17 @@ static PyObject *__pyx_f_6_basis_13BasisFunction__set_parent(struct __pyx_obj_6_ } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_13BasisFunction_31_set_parent(PyObject *__pyx_v_self, PyObject *__pyx_v_parent); /*proto*/ -static char __pyx_doc_6_basis_13BasisFunction_30_set_parent[] = "Calls _add_child."; -static PyObject *__pyx_pw_6_basis_13BasisFunction_31_set_parent(PyObject *__pyx_v_self, PyObject *__pyx_v_parent) { - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_31_set_parent(PyObject *__pyx_v_self, PyObject *__pyx_v_parent); /*proto*/ +static char __pyx_doc_7sklearn_5earth_6_basis_13BasisFunction_30_set_parent[] = "Calls _add_child."; +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_31_set_parent(PyObject *__pyx_v_self, PyObject *__pyx_v_parent) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_set_parent (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parent), __pyx_ptype_6_basis_BasisFunction, 1, "parent", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_6_basis_13BasisFunction_30_set_parent(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self), ((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_parent)); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parent), __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction, 1, "parent", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_30_set_parent(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self), ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_parent)); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -3615,7 +3630,7 @@ static PyObject *__pyx_pw_6_basis_13BasisFunction_31_set_parent(PyObject *__pyx_ return __pyx_r; } -/* "_basis.pyx":91 +/* "sklearn/earth/_basis.pyx":91 * return self.children * * cpdef _set_parent(self,BasisFunction parent): # <<<<<<<<<<<<<< @@ -3623,7 +3638,7 @@ static PyObject *__pyx_pw_6_basis_13BasisFunction_31_set_parent(PyObject *__pyx_ * self.parent = parent */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_30_set_parent(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, struct __pyx_obj_6_basis_BasisFunction *__pyx_v_parent) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_30_set_parent(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self, struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_parent) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3632,7 +3647,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_30_set_parent(struct __pyx_obj int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_set_parent", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->_set_parent(__pyx_v_self, __pyx_v_parent, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->_set_parent(__pyx_v_self, __pyx_v_parent, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3642,7 +3657,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_30_set_parent(struct __pyx_obj goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_basis.BasisFunction._set_parent", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.BasisFunction._set_parent", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3650,7 +3665,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_30_set_parent(struct __pyx_obj return __pyx_r; } -/* "_basis.pyx":96 +/* "sklearn/earth/_basis.pyx":96 * self.parent._add_child(self) * * cpdef _add_child(self,BasisFunction child): # <<<<<<<<<<<<<< @@ -3658,9 +3673,9 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_30_set_parent(struct __pyx_obj * cdef INDEX_t n = len(self.children) */ -static PyObject *__pyx_pw_6_basis_13BasisFunction_33_add_child(PyObject *__pyx_v_self, PyObject *__pyx_v_child); /*proto*/ -static PyObject *__pyx_f_6_basis_13BasisFunction__add_child(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, struct __pyx_obj_6_basis_BasisFunction *__pyx_v_child, int __pyx_skip_dispatch) { - __pyx_t_6_basis_INDEX_t __pyx_v_n; +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_33_add_child(PyObject *__pyx_v_self, PyObject *__pyx_v_child); /*proto*/ +static PyObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction__add_child(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self, struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_child, int __pyx_skip_dispatch) { + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_n; int __pyx_v_var; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -3671,6 +3686,7 @@ static PyObject *__pyx_f_6_basis_13BasisFunction__add_child(struct __pyx_obj_6_b int __pyx_t_5; int __pyx_t_6; int __pyx_t_7; + int __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -3681,7 +3697,7 @@ static PyObject *__pyx_f_6_basis_13BasisFunction__add_child(struct __pyx_obj_6_b else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___add_child); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_13BasisFunction_33_add_child)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_33_add_child)) { __Pyx_XDECREF(__pyx_r); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -3699,7 +3715,7 @@ static PyObject *__pyx_f_6_basis_13BasisFunction__add_child(struct __pyx_obj_6_b __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_basis.pyx":98 + /* "sklearn/earth/_basis.pyx":98 * cpdef _add_child(self,BasisFunction child): * '''Called by _set_parent.''' * cdef INDEX_t n = len(self.children) # <<<<<<<<<<<<<< @@ -3716,7 +3732,7 @@ static PyObject *__pyx_f_6_basis_13BasisFunction__add_child(struct __pyx_obj_6_b __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_n = __pyx_t_4; - /* "_basis.pyx":99 + /* "sklearn/earth/_basis.pyx":99 * '''Called by _set_parent.''' * cdef INDEX_t n = len(self.children) * self.children.append(child) # <<<<<<<<<<<<<< @@ -3729,7 +3745,7 @@ static PyObject *__pyx_f_6_basis_13BasisFunction__add_child(struct __pyx_obj_6_b } __pyx_t_5 = __Pyx_PyList_Append(__pyx_v_self->children, ((PyObject *)__pyx_v_child)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "_basis.pyx":100 + /* "sklearn/earth/_basis.pyx":100 * cdef INDEX_t n = len(self.children) * self.children.append(child) * cdef int var = child.get_variable() # <<<<<<<<<<<<<< @@ -3745,7 +3761,7 @@ static PyObject *__pyx_f_6_basis_13BasisFunction__add_child(struct __pyx_obj_6_b __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_var = __pyx_t_6; - /* "_basis.pyx":101 + /* "sklearn/earth/_basis.pyx":101 * self.children.append(child) * cdef int var = child.get_variable() * if var in self.child_map: # <<<<<<<<<<<<<< @@ -3760,9 +3776,10 @@ static PyObject *__pyx_f_6_basis_13BasisFunction__add_child(struct __pyx_obj_6_b } __pyx_t_7 = (__Pyx_PyDict_Contains(__pyx_t_3, ((PyObject *)__pyx_v_self->child_map), Py_EQ)); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_7) { + __pyx_t_8 = (__pyx_t_7 != 0); + if (__pyx_t_8) { - /* "_basis.pyx":102 + /* "sklearn/earth/_basis.pyx":102 * cdef int var = child.get_variable() * if var in self.child_map: * self.child_map[var].append(n) # <<<<<<<<<<<<<< @@ -3786,7 +3803,7 @@ static PyObject *__pyx_f_6_basis_13BasisFunction__add_child(struct __pyx_obj_6_b } /*else*/ { - /* "_basis.pyx":104 + /* "sklearn/earth/_basis.pyx":104 * self.child_map[var].append(n) * else: * self.child_map[var] = [n] # <<<<<<<<<<<<<< @@ -3815,7 +3832,7 @@ static PyObject *__pyx_f_6_basis_13BasisFunction__add_child(struct __pyx_obj_6_b __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_basis.BasisFunction._add_child", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.BasisFunction._add_child", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3824,17 +3841,17 @@ static PyObject *__pyx_f_6_basis_13BasisFunction__add_child(struct __pyx_obj_6_b } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_13BasisFunction_33_add_child(PyObject *__pyx_v_self, PyObject *__pyx_v_child); /*proto*/ -static char __pyx_doc_6_basis_13BasisFunction_32_add_child[] = "Called by _set_parent."; -static PyObject *__pyx_pw_6_basis_13BasisFunction_33_add_child(PyObject *__pyx_v_self, PyObject *__pyx_v_child) { - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_33_add_child(PyObject *__pyx_v_self, PyObject *__pyx_v_child); /*proto*/ +static char __pyx_doc_7sklearn_5earth_6_basis_13BasisFunction_32_add_child[] = "Called by _set_parent."; +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_33_add_child(PyObject *__pyx_v_self, PyObject *__pyx_v_child) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_add_child (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_child), __pyx_ptype_6_basis_BasisFunction, 1, "child", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_6_basis_13BasisFunction_32_add_child(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self), ((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_child)); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_child), __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction, 1, "child", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_32_add_child(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self), ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_child)); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -3843,7 +3860,7 @@ static PyObject *__pyx_pw_6_basis_13BasisFunction_33_add_child(PyObject *__pyx_v return __pyx_r; } -/* "_basis.pyx":96 +/* "sklearn/earth/_basis.pyx":96 * self.parent._add_child(self) * * cpdef _add_child(self,BasisFunction child): # <<<<<<<<<<<<<< @@ -3851,7 +3868,7 @@ static PyObject *__pyx_pw_6_basis_13BasisFunction_33_add_child(PyObject *__pyx_v * cdef INDEX_t n = len(self.children) */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_32_add_child(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, struct __pyx_obj_6_basis_BasisFunction *__pyx_v_child) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_32_add_child(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self, struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_child) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3860,7 +3877,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_32_add_child(struct __pyx_obj_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_add_child", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->_add_child(__pyx_v_self, __pyx_v_child, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->_add_child(__pyx_v_self, __pyx_v_child, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3870,7 +3887,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_32_add_child(struct __pyx_obj_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_basis.BasisFunction._add_child", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.BasisFunction._add_child", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3878,7 +3895,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_32_add_child(struct __pyx_obj_ return __pyx_r; } -/* "_basis.pyx":106 +/* "sklearn/earth/_basis.pyx":106 * self.child_map[var] = [n] * * cpdef BasisFunction get_parent(self): # <<<<<<<<<<<<<< @@ -3886,9 +3903,9 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_32_add_child(struct __pyx_obj_ * */ -static PyObject *__pyx_pw_6_basis_13BasisFunction_35get_parent(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static struct __pyx_obj_6_basis_BasisFunction *__pyx_f_6_basis_13BasisFunction_get_parent(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { - struct __pyx_obj_6_basis_BasisFunction *__pyx_r = NULL; +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_35get_parent(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_get_parent(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; @@ -3902,12 +3919,12 @@ static struct __pyx_obj_6_basis_BasisFunction *__pyx_f_6_basis_13BasisFunction_g else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_parent); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_13BasisFunction_35get_parent)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_35get_parent)) { __Pyx_XDECREF(((PyObject *)__pyx_r)); __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = ((struct __pyx_obj_6_basis_BasisFunction *)__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; @@ -3915,7 +3932,7 @@ static struct __pyx_obj_6_basis_BasisFunction *__pyx_f_6_basis_13BasisFunction_g __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_basis.pyx":107 + /* "sklearn/earth/_basis.pyx":107 * * cpdef BasisFunction get_parent(self): * return self.parent # <<<<<<<<<<<<<< @@ -3927,12 +3944,12 @@ static struct __pyx_obj_6_basis_BasisFunction *__pyx_f_6_basis_13BasisFunction_g __pyx_r = __pyx_v_self->parent; goto __pyx_L0; - __pyx_r = ((struct __pyx_obj_6_basis_BasisFunction *)Py_None); __Pyx_INCREF(Py_None); + __pyx_r = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)Py_None); __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_basis.BasisFunction.get_parent", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.BasisFunction.get_parent", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF((PyObject *)__pyx_r); @@ -3941,17 +3958,17 @@ static struct __pyx_obj_6_basis_BasisFunction *__pyx_f_6_basis_13BasisFunction_g } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_13BasisFunction_35get_parent(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_6_basis_13BasisFunction_35get_parent(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_35get_parent(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_35get_parent(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_parent (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_13BasisFunction_34get_parent(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_34get_parent(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":106 +/* "sklearn/earth/_basis.pyx":106 * self.child_map[var] = [n] * * cpdef BasisFunction get_parent(self): # <<<<<<<<<<<<<< @@ -3959,7 +3976,7 @@ static PyObject *__pyx_pw_6_basis_13BasisFunction_35get_parent(PyObject *__pyx_v * */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_34get_parent(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_34get_parent(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3968,7 +3985,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_34get_parent(struct __pyx_obj_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_parent", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->get_parent(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->get_parent(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3978,7 +3995,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_34get_parent(struct __pyx_obj_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_basis.BasisFunction.get_parent", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.BasisFunction.get_parent", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3986,7 +4003,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_34get_parent(struct __pyx_obj_ return __pyx_r; } -/* "_basis.pyx":109 +/* "sklearn/earth/_basis.pyx":109 * return self.parent * * cpdef prune(self): # <<<<<<<<<<<<<< @@ -3994,8 +4011,8 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_34get_parent(struct __pyx_obj_ * */ -static PyObject *__pyx_pw_6_basis_13BasisFunction_37prune(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_f_6_basis_13BasisFunction_prune(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_37prune(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_prune(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -4010,7 +4027,7 @@ static PyObject *__pyx_f_6_basis_13BasisFunction_prune(struct __pyx_obj_6_basis_ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__prune); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_13BasisFunction_37prune)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_37prune)) { __Pyx_XDECREF(__pyx_r); __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -4022,7 +4039,7 @@ static PyObject *__pyx_f_6_basis_13BasisFunction_prune(struct __pyx_obj_6_basis_ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_basis.pyx":110 + /* "sklearn/earth/_basis.pyx":110 * * cpdef prune(self): * self.pruned = True # <<<<<<<<<<<<<< @@ -4036,7 +4053,7 @@ static PyObject *__pyx_f_6_basis_13BasisFunction_prune(struct __pyx_obj_6_basis_ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_basis.BasisFunction.prune", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.BasisFunction.prune", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -4045,17 +4062,17 @@ static PyObject *__pyx_f_6_basis_13BasisFunction_prune(struct __pyx_obj_6_basis_ } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_13BasisFunction_37prune(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_6_basis_13BasisFunction_37prune(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_37prune(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_37prune(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("prune (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_13BasisFunction_36prune(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_36prune(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":109 +/* "sklearn/earth/_basis.pyx":109 * return self.parent * * cpdef prune(self): # <<<<<<<<<<<<<< @@ -4063,7 +4080,7 @@ static PyObject *__pyx_pw_6_basis_13BasisFunction_37prune(PyObject *__pyx_v_self * */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_36prune(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_36prune(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -4072,7 +4089,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_36prune(struct __pyx_obj_6_bas int __pyx_clineno = 0; __Pyx_RefNannySetupContext("prune", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->prune(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->prune(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4082,7 +4099,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_36prune(struct __pyx_obj_6_bas goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_basis.BasisFunction.prune", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.BasisFunction.prune", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -4090,7 +4107,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_36prune(struct __pyx_obj_6_bas return __pyx_r; } -/* "_basis.pyx":112 +/* "sklearn/earth/_basis.pyx":112 * self.pruned = True * * cpdef unprune(self): # <<<<<<<<<<<<<< @@ -4098,8 +4115,8 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_36prune(struct __pyx_obj_6_bas * */ -static PyObject *__pyx_pw_6_basis_13BasisFunction_39unprune(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_f_6_basis_13BasisFunction_unprune(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_39unprune(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_unprune(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -4114,7 +4131,7 @@ static PyObject *__pyx_f_6_basis_13BasisFunction_unprune(struct __pyx_obj_6_basi else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__unprune); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_13BasisFunction_39unprune)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_39unprune)) { __Pyx_XDECREF(__pyx_r); __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -4126,7 +4143,7 @@ static PyObject *__pyx_f_6_basis_13BasisFunction_unprune(struct __pyx_obj_6_basi __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_basis.pyx":113 + /* "sklearn/earth/_basis.pyx":113 * * cpdef unprune(self): * self.pruned = False # <<<<<<<<<<<<<< @@ -4140,7 +4157,7 @@ static PyObject *__pyx_f_6_basis_13BasisFunction_unprune(struct __pyx_obj_6_basi __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_basis.BasisFunction.unprune", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.BasisFunction.unprune", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -4149,17 +4166,17 @@ static PyObject *__pyx_f_6_basis_13BasisFunction_unprune(struct __pyx_obj_6_basi } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_13BasisFunction_39unprune(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_6_basis_13BasisFunction_39unprune(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_39unprune(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_39unprune(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("unprune (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_13BasisFunction_38unprune(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_38unprune(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":112 +/* "sklearn/earth/_basis.pyx":112 * self.pruned = True * * cpdef unprune(self): # <<<<<<<<<<<<<< @@ -4167,7 +4184,7 @@ static PyObject *__pyx_pw_6_basis_13BasisFunction_39unprune(PyObject *__pyx_v_se * */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_38unprune(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_38unprune(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -4176,7 +4193,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_38unprune(struct __pyx_obj_6_b int __pyx_clineno = 0; __Pyx_RefNannySetupContext("unprune", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->unprune(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->unprune(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4186,7 +4203,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_38unprune(struct __pyx_obj_6_b goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_basis.BasisFunction.unprune", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.BasisFunction.unprune", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -4194,7 +4211,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_38unprune(struct __pyx_obj_6_b return __pyx_r; } -/* "_basis.pyx":115 +/* "sklearn/earth/_basis.pyx":115 * self.pruned = False * * cpdef knots(BasisFunction self, INDEX_t variable): # <<<<<<<<<<<<<< @@ -4202,12 +4219,12 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_38unprune(struct __pyx_obj_6_b * cdef list children */ -static PyObject *__pyx_pw_6_basis_13BasisFunction_41knots(PyObject *__pyx_v_self, PyObject *__pyx_arg_variable); /*proto*/ -static PyObject *__pyx_f_6_basis_13BasisFunction_knots(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, __pyx_t_6_basis_INDEX_t __pyx_v_variable, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_41knots(PyObject *__pyx_v_self, PyObject *__pyx_arg_variable); /*proto*/ +static PyObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_knots(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self, __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_variable, int __pyx_skip_dispatch) { PyObject *__pyx_v_children = 0; - struct __pyx_obj_6_basis_BasisFunction *__pyx_v_child = 0; - __pyx_t_6_basis_INDEX_t __pyx_v_n; - __pyx_t_6_basis_INDEX_t __pyx_v_i; + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_child = 0; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_n; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_i; PyObject *__pyx_v_result = 0; int __pyx_v_idx; PyObject *__pyx_r = NULL; @@ -4216,11 +4233,12 @@ static PyObject *__pyx_f_6_basis_13BasisFunction_knots(struct __pyx_obj_6_basis_ PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_t_4; - Py_ssize_t __pyx_t_5; - __pyx_t_6_basis_INDEX_t __pyx_t_6; - __pyx_t_6_basis_INDEX_t __pyx_t_7; - int __pyx_t_8; + int __pyx_t_5; + Py_ssize_t __pyx_t_6; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_7; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_8; int __pyx_t_9; + int __pyx_t_10; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -4231,7 +4249,7 @@ static PyObject *__pyx_f_6_basis_13BasisFunction_knots(struct __pyx_obj_6_basis_ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__knots); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_13BasisFunction_41knots)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_41knots)) { __Pyx_XDECREF(__pyx_r); __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -4251,7 +4269,7 @@ static PyObject *__pyx_f_6_basis_13BasisFunction_knots(struct __pyx_obj_6_basis_ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_basis.pyx":119 + /* "sklearn/earth/_basis.pyx":119 * cdef list children * cdef BasisFunction child * if variable in self.child_map: # <<<<<<<<<<<<<< @@ -4266,9 +4284,10 @@ static PyObject *__pyx_f_6_basis_13BasisFunction_knots(struct __pyx_obj_6_basis_ } __pyx_t_4 = (__Pyx_PyDict_Contains(__pyx_t_1, ((PyObject *)__pyx_v_self->child_map), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_4) { + __pyx_t_5 = (__pyx_t_4 != 0); + if (__pyx_t_5) { - /* "_basis.pyx":120 + /* "sklearn/earth/_basis.pyx":120 * cdef BasisFunction child * if variable in self.child_map: * children = self.child_map[variable] # <<<<<<<<<<<<<< @@ -4279,7 +4298,7 @@ static PyObject *__pyx_f_6_basis_13BasisFunction_knots(struct __pyx_obj_6_basis_ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->child_map), __pyx_v_variable, sizeof(__pyx_t_6_basis_INDEX_t)+1, __Pyx_PyInt_to_py_npy_ulonglong, 0, 0, 0); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->child_map), __pyx_v_variable, sizeof(__pyx_t_7sklearn_5earth_6_basis_INDEX_t)+1, __Pyx_PyInt_to_py_npy_ulonglong, 0, 0, 0); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_children = ((PyObject*)__pyx_t_1); @@ -4288,7 +4307,7 @@ static PyObject *__pyx_f_6_basis_13BasisFunction_knots(struct __pyx_obj_6_basis_ } /*else*/ { - /* "_basis.pyx":122 + /* "sklearn/earth/_basis.pyx":122 * children = self.child_map[variable] * else: * return [] # <<<<<<<<<<<<<< @@ -4304,7 +4323,7 @@ static PyObject *__pyx_f_6_basis_13BasisFunction_knots(struct __pyx_obj_6_basis_ } __pyx_L3:; - /* "_basis.pyx":123 + /* "sklearn/earth/_basis.pyx":123 * else: * return [] * cdef INDEX_t n = len(children) # <<<<<<<<<<<<<< @@ -4315,10 +4334,10 @@ static PyObject *__pyx_f_6_basis_13BasisFunction_knots(struct __pyx_obj_6_basis_ PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_5 = PyList_GET_SIZE(((PyObject *)__pyx_v_children)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_n = __pyx_t_5; + __pyx_t_6 = PyList_GET_SIZE(((PyObject *)__pyx_v_children)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_n = __pyx_t_6; - /* "_basis.pyx":125 + /* "sklearn/earth/_basis.pyx":125 * cdef INDEX_t n = len(children) * cdef INDEX_t i * cdef list result = [] # <<<<<<<<<<<<<< @@ -4330,18 +4349,18 @@ static PyObject *__pyx_f_6_basis_13BasisFunction_knots(struct __pyx_obj_6_basis_ __pyx_v_result = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "_basis.pyx":127 + /* "sklearn/earth/_basis.pyx":127 * cdef list result = [] * cdef int idx * for i in range(n): # <<<<<<<<<<<<<< * idx = children[i] * child = self.get_children()[idx] */ - __pyx_t_6 = __pyx_v_n; - for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { - __pyx_v_i = __pyx_t_7; + __pyx_t_7 = __pyx_v_n; + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { + __pyx_v_i = __pyx_t_8; - /* "_basis.pyx":128 + /* "sklearn/earth/_basis.pyx":128 * cdef int idx * for i in range(n): * idx = children[i] # <<<<<<<<<<<<<< @@ -4352,41 +4371,41 @@ static PyObject *__pyx_f_6_basis_13BasisFunction_knots(struct __pyx_obj_6_basis_ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_8 = __Pyx_PyInt_AsInt(PyList_GET_ITEM(__pyx_v_children, __pyx_v_i)); if (unlikely((__pyx_t_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_idx = __pyx_t_8; + __pyx_t_9 = __Pyx_PyInt_AsInt(PyList_GET_ITEM(__pyx_v_children, __pyx_v_i)); if (unlikely((__pyx_t_9 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_idx = __pyx_t_9; - /* "_basis.pyx":129 + /* "sklearn/earth/_basis.pyx":129 * for i in range(n): * idx = children[i] * child = self.get_children()[idx] # <<<<<<<<<<<<<< * if child.has_knot(): * result.append(child.get_knot_idx()) */ - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->get_children(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->get_children(__pyx_v_self)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (unlikely(__pyx_t_1 == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - if (!(likely(((PyList_GET_ITEM(__pyx_t_1, __pyx_v_idx)) == Py_None) || likely(__Pyx_TypeTest(PyList_GET_ITEM(__pyx_t_1, __pyx_v_idx), __pyx_ptype_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((PyList_GET_ITEM(__pyx_t_1, __pyx_v_idx)) == Py_None) || likely(__Pyx_TypeTest(PyList_GET_ITEM(__pyx_t_1, __pyx_v_idx), __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_v_idx); __Pyx_INCREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_XDECREF(((PyObject *)__pyx_v_child)); - __pyx_v_child = ((struct __pyx_obj_6_basis_BasisFunction *)__pyx_t_2); + __pyx_v_child = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_2); __pyx_t_2 = 0; - /* "_basis.pyx":130 + /* "sklearn/earth/_basis.pyx":130 * idx = children[i] * child = self.get_children()[idx] * if child.has_knot(): # <<<<<<<<<<<<<< * result.append(child.get_knot_idx()) * return result */ - __pyx_t_4 = ((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_child->__pyx_vtab)->has_knot(__pyx_v_child, 0); - if (__pyx_t_4) { + __pyx_t_5 = (((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_child->__pyx_vtab)->has_knot(__pyx_v_child, 0) != 0); + if (__pyx_t_5) { - /* "_basis.pyx":131 + /* "sklearn/earth/_basis.pyx":131 * child = self.get_children()[idx] * if child.has_knot(): * result.append(child.get_knot_idx()) # <<<<<<<<<<<<<< @@ -4398,14 +4417,14 @@ static PyObject *__pyx_f_6_basis_13BasisFunction_knots(struct __pyx_obj_6_basis_ __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_9 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_1); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_result, __pyx_t_1); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L6; } __pyx_L6:; } - /* "_basis.pyx":132 + /* "sklearn/earth/_basis.pyx":132 * if child.has_knot(): * result.append(child.get_knot_idx()) * return result # <<<<<<<<<<<<<< @@ -4423,7 +4442,7 @@ static PyObject *__pyx_f_6_basis_13BasisFunction_knots(struct __pyx_obj_6_basis_ __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_basis.BasisFunction.knots", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.BasisFunction.knots", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_children); @@ -4435,9 +4454,9 @@ static PyObject *__pyx_f_6_basis_13BasisFunction_knots(struct __pyx_obj_6_basis_ } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_13BasisFunction_41knots(PyObject *__pyx_v_self, PyObject *__pyx_arg_variable); /*proto*/ -static PyObject *__pyx_pw_6_basis_13BasisFunction_41knots(PyObject *__pyx_v_self, PyObject *__pyx_arg_variable) { - __pyx_t_6_basis_INDEX_t __pyx_v_variable; +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_41knots(PyObject *__pyx_v_self, PyObject *__pyx_arg_variable); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_41knots(PyObject *__pyx_v_self, PyObject *__pyx_arg_variable) { + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_variable; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -4449,16 +4468,16 @@ static PyObject *__pyx_pw_6_basis_13BasisFunction_41knots(PyObject *__pyx_v_self } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_basis.BasisFunction.knots", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.BasisFunction.knots", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_6_basis_13BasisFunction_40knots(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self), ((__pyx_t_6_basis_INDEX_t)__pyx_v_variable)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_40knots(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self), ((__pyx_t_7sklearn_5earth_6_basis_INDEX_t)__pyx_v_variable)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":115 +/* "sklearn/earth/_basis.pyx":115 * self.pruned = False * * cpdef knots(BasisFunction self, INDEX_t variable): # <<<<<<<<<<<<<< @@ -4466,7 +4485,7 @@ static PyObject *__pyx_pw_6_basis_13BasisFunction_41knots(PyObject *__pyx_v_self * cdef list children */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_40knots(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, __pyx_t_6_basis_INDEX_t __pyx_v_variable) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_40knots(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self, __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_variable) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -4475,7 +4494,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_40knots(struct __pyx_obj_6_bas int __pyx_clineno = 0; __Pyx_RefNannySetupContext("knots", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->knots(__pyx_v_self, __pyx_v_variable, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->knots(__pyx_v_self, __pyx_v_variable, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4485,7 +4504,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_40knots(struct __pyx_obj_6_bas goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_basis.BasisFunction.knots", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.BasisFunction.knots", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -4493,7 +4512,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_40knots(struct __pyx_obj_6_bas return __pyx_r; } -/* "_basis.pyx":134 +/* "sklearn/earth/_basis.pyx":134 * return result * * cpdef INDEX_t degree(BasisFunction self): # <<<<<<<<<<<<<< @@ -4501,13 +4520,13 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_40knots(struct __pyx_obj_6_bas * */ -static PyObject *__pyx_pw_6_basis_13BasisFunction_43degree(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static __pyx_t_6_basis_INDEX_t __pyx_f_6_basis_13BasisFunction_degree(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { - __pyx_t_6_basis_INDEX_t __pyx_r; +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_43degree(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_f_7sklearn_5earth_6_basis_13BasisFunction_degree(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - __pyx_t_6_basis_INDEX_t __pyx_t_3; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -4518,7 +4537,7 @@ static __pyx_t_6_basis_INDEX_t __pyx_f_6_basis_13BasisFunction_degree(struct __p else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__degree); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_13BasisFunction_43degree)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_43degree)) { __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -4530,14 +4549,14 @@ static __pyx_t_6_basis_INDEX_t __pyx_f_6_basis_13BasisFunction_degree(struct __p __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_basis.pyx":135 + /* "sklearn/earth/_basis.pyx":135 * * cpdef INDEX_t degree(BasisFunction self): * return self.parent.degree() + 1 # <<<<<<<<<<<<<< * * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = True): */ - __pyx_r = (((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_self->parent->__pyx_vtab)->degree(__pyx_v_self->parent, 0) + 1); + __pyx_r = (((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self->parent->__pyx_vtab)->degree(__pyx_v_self->parent, 0) + 1); goto __pyx_L0; __pyx_r = 0; @@ -4545,7 +4564,7 @@ static __pyx_t_6_basis_INDEX_t __pyx_f_6_basis_13BasisFunction_degree(struct __p __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_WriteUnraisable("_basis.BasisFunction.degree", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("sklearn.earth._basis.BasisFunction.degree", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -4553,17 +4572,17 @@ static __pyx_t_6_basis_INDEX_t __pyx_f_6_basis_13BasisFunction_degree(struct __p } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_13BasisFunction_43degree(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_6_basis_13BasisFunction_43degree(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_43degree(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_43degree(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("degree (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_13BasisFunction_42degree(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_42degree(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":134 +/* "sklearn/earth/_basis.pyx":134 * return result * * cpdef INDEX_t degree(BasisFunction self): # <<<<<<<<<<<<<< @@ -4571,7 +4590,7 @@ static PyObject *__pyx_pw_6_basis_13BasisFunction_43degree(PyObject *__pyx_v_sel * */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_42degree(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_42degree(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -4580,7 +4599,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_42degree(struct __pyx_obj_6_ba int __pyx_clineno = 0; __Pyx_RefNannySetupContext("degree", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->degree(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->degree(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4590,7 +4609,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_42degree(struct __pyx_obj_6_ba goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_basis.BasisFunction.degree", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.BasisFunction.degree", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -4598,7 +4617,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_42degree(struct __pyx_obj_6_ba return __pyx_r; } -/* "_basis.pyx":137 +/* "sklearn/earth/_basis.pyx":137 * return self.parent.degree() + 1 * * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = True): # <<<<<<<<<<<<<< @@ -4606,8 +4625,8 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_42degree(struct __pyx_obj_6_ba * X - Data matrix */ -static PyObject *__pyx_pw_6_basis_13BasisFunction_45apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_6_basis_13BasisFunction_apply(CYTHON_UNUSED struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, CYTHON_UNUSED PyArrayObject *__pyx_v_X, CYTHON_UNUSED PyArrayObject *__pyx_v_b, int __pyx_skip_dispatch, struct __pyx_opt_args_6_basis_13BasisFunction_apply *__pyx_optional_args) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_45apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_apply(CYTHON_UNUSED struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self, CYTHON_UNUSED PyArrayObject *__pyx_v_X, CYTHON_UNUSED PyArrayObject *__pyx_v_b, int __pyx_skip_dispatch, struct __pyx_opt_args_7sklearn_5earth_6_basis_13BasisFunction_apply *__pyx_optional_args) { int __pyx_v_recurse = ((int)1); __Pyx_LocalBuf_ND __pyx_pybuffernd_X; __Pyx_Buffer __pyx_pybuffer_X; @@ -4637,12 +4656,12 @@ static PyObject *__pyx_f_6_basis_13BasisFunction_apply(CYTHON_UNUSED struct __py __pyx_pybuffernd_b.rcbuffer = &__pyx_pybuffer_b; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)__pyx_v_b, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)__pyx_v_b, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_b.diminfo[0].strides = __pyx_pybuffernd_b.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_b.diminfo[0].shape = __pyx_pybuffernd_b.rcbuffer->pybuffer.shape[0]; /* Check if called by wrapper */ @@ -4651,7 +4670,7 @@ static PyObject *__pyx_f_6_basis_13BasisFunction_apply(CYTHON_UNUSED struct __py else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__apply); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_13BasisFunction_45apply)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_45apply)) { __Pyx_XDECREF(__pyx_r); __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_recurse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -4677,7 +4696,7 @@ static PyObject *__pyx_f_6_basis_13BasisFunction_apply(CYTHON_UNUSED struct __py __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_basis.pyx":145 + /* "sklearn/earth/_basis.pyx":145 * ''' * * cpdef cnp.ndarray[INT_t, ndim=1] valid_knots(BasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] values, cnp.ndarray[FLOAT_t,ndim=1] variable, int variable_idx, INDEX_t check_every, int endspan, int minspan, FLOAT_t minspan_alpha, INDEX_t n, cnp.ndarray[INT_t,ndim=1] workspace): # <<<<<<<<<<<<<< @@ -4696,7 +4715,7 @@ static PyObject *__pyx_f_6_basis_13BasisFunction_apply(CYTHON_UNUSED struct __py __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_b.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("_basis.BasisFunction.apply", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.BasisFunction.apply", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; goto __pyx_L2; __pyx_L0:; @@ -4709,9 +4728,9 @@ static PyObject *__pyx_f_6_basis_13BasisFunction_apply(CYTHON_UNUSED struct __py } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_13BasisFunction_45apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_6_basis_13BasisFunction_44apply[] = "\n X - Data matrix\n b - parent vector\n recurse - If False, assume b already contains the result of the parent function. Otherwise, recurse to compute\n parent function.\n "; -static PyObject *__pyx_pw_6_basis_13BasisFunction_45apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_45apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7sklearn_5earth_6_basis_13BasisFunction_44apply[] = "\n X - Data matrix\n b - parent vector\n recurse - If False, assume b already contains the result of the parent function. Otherwise, recurse to compute\n parent function.\n "; +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_45apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_X = 0; PyArrayObject *__pyx_v_b = 0; int __pyx_v_recurse; @@ -4768,7 +4787,7 @@ static PyObject *__pyx_pw_6_basis_13BasisFunction_45apply(PyObject *__pyx_v_self __pyx_v_recurse = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_recurse == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - /* "_basis.pyx":137 + /* "sklearn/earth/_basis.pyx":137 * return self.parent.degree() + 1 * * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = True): # <<<<<<<<<<<<<< @@ -4782,13 +4801,13 @@ static PyObject *__pyx_pw_6_basis_13BasisFunction_45apply(PyObject *__pyx_v_self __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("apply", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_basis.BasisFunction.apply", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.BasisFunction.apply", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_5numpy_ndarray, 1, "b", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_6_basis_13BasisFunction_44apply(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self), __pyx_v_X, __pyx_v_b, __pyx_v_recurse); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_44apply(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self), __pyx_v_X, __pyx_v_b, __pyx_v_recurse); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -4797,7 +4816,7 @@ static PyObject *__pyx_pw_6_basis_13BasisFunction_45apply(PyObject *__pyx_v_self return __pyx_r; } -static PyObject *__pyx_pf_6_basis_13BasisFunction_44apply(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_b, int __pyx_v_recurse) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_44apply(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_b, int __pyx_v_recurse) { __Pyx_LocalBuf_ND __pyx_pybuffernd_X; __Pyx_Buffer __pyx_pybuffer_X; __Pyx_LocalBuf_ND __pyx_pybuffernd_b; @@ -4805,7 +4824,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_44apply(struct __pyx_obj_6_bas PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - struct __pyx_opt_args_6_basis_13BasisFunction_apply __pyx_t_2; + struct __pyx_opt_args_7sklearn_5earth_6_basis_13BasisFunction_apply __pyx_t_2; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -4820,18 +4839,18 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_44apply(struct __pyx_obj_6_bas __pyx_pybuffernd_b.rcbuffer = &__pyx_pybuffer_b; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)__pyx_v_b, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)__pyx_v_b, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_b.diminfo[0].strides = __pyx_pybuffernd_b.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_b.diminfo[0].shape = __pyx_pybuffernd_b.rcbuffer->pybuffer.shape[0]; __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 1; __pyx_t_2.recurse = __pyx_v_recurse; - __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->apply(__pyx_v_self, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_b), 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->apply(__pyx_v_self, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_b), 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4846,7 +4865,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_44apply(struct __pyx_obj_6_bas __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_b.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("_basis.BasisFunction.apply", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.BasisFunction.apply", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; @@ -4858,7 +4877,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_44apply(struct __pyx_obj_6_bas return __pyx_r; } -/* "_basis.pyx":145 +/* "sklearn/earth/_basis.pyx":145 * ''' * * cpdef cnp.ndarray[INT_t, ndim=1] valid_knots(BasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] values, cnp.ndarray[FLOAT_t,ndim=1] variable, int variable_idx, INDEX_t check_every, int endspan, int minspan, FLOAT_t minspan_alpha, INDEX_t n, cnp.ndarray[INT_t,ndim=1] workspace): # <<<<<<<<<<<<<< @@ -4866,22 +4885,22 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_44apply(struct __pyx_obj_6_bas * values - The unsorted values of self in the data set */ -static PyObject *__pyx_pw_6_basis_13BasisFunction_47valid_knots(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_variable, int __pyx_v_variable_idx, __pyx_t_6_basis_INDEX_t __pyx_v_check_every, int __pyx_v_endspan, int __pyx_v_minspan, __pyx_t_6_basis_FLOAT_t __pyx_v_minspan_alpha, __pyx_t_6_basis_INDEX_t __pyx_v_n, PyArrayObject *__pyx_v_workspace, int __pyx_skip_dispatch) { - __pyx_t_6_basis_INDEX_t __pyx_v_i; - __pyx_t_6_basis_INDEX_t __pyx_v_j; - __pyx_t_6_basis_INDEX_t __pyx_v_k; - __pyx_t_6_basis_INDEX_t __pyx_v_m; - __pyx_t_6_basis_INT_t __pyx_v_int_tmp; - __pyx_t_6_basis_INDEX_t __pyx_v_count; +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_47valid_knots(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyArrayObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_valid_knots(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_variable, int __pyx_v_variable_idx, __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_check_every, int __pyx_v_endspan, int __pyx_v_minspan, __pyx_t_7sklearn_5earth_6_basis_FLOAT_t __pyx_v_minspan_alpha, __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_n, PyArrayObject *__pyx_v_workspace, int __pyx_skip_dispatch) { + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_i; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_j; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_k; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_m; + __pyx_t_7sklearn_5earth_6_basis_INT_t __pyx_v_int_tmp; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_count; int __pyx_v_minspan_; PyArrayObject *__pyx_v_result = 0; - __pyx_t_6_basis_INDEX_t __pyx_v_num_used; - __pyx_t_6_basis_INDEX_t __pyx_v_prev; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_num_used; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_prev; int __pyx_v_idx; int __pyx_v_last_idx; - __pyx_t_6_basis_FLOAT_t __pyx_v_first_var_value; - __pyx_t_6_basis_FLOAT_t __pyx_v_last_var_value; + __pyx_t_7sklearn_5earth_6_basis_FLOAT_t __pyx_v_first_var_value; + __pyx_t_7sklearn_5earth_6_basis_FLOAT_t __pyx_v_last_var_value; PyObject *__pyx_v_used_knots = 0; __Pyx_LocalBuf_ND __pyx_pybuffernd_result; __Pyx_Buffer __pyx_pybuffer_result; @@ -4901,46 +4920,45 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; PyObject *__pyx_t_8 = NULL; - __pyx_t_6_basis_INDEX_t __pyx_t_9; - __pyx_t_6_basis_INDEX_t __pyx_t_10; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_9; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_10; int __pyx_t_11; - __pyx_t_6_basis_INDEX_t __pyx_t_12; - __pyx_t_6_basis_INDEX_t __pyx_t_13; - __pyx_t_6_basis_INDEX_t __pyx_t_14; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_12; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_13; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_14; int __pyx_t_15; - __pyx_t_6_basis_INDEX_t __pyx_t_16; - __pyx_t_6_basis_INDEX_t __pyx_t_17; - __pyx_t_6_basis_INDEX_t __pyx_t_18; - __pyx_t_6_basis_INDEX_t __pyx_t_19; - __pyx_t_6_basis_INDEX_t __pyx_t_20; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_16; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_17; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_18; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_19; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_20; Py_ssize_t __pyx_t_21; int __pyx_t_22; int __pyx_t_23; int __pyx_t_24; - __pyx_t_6_basis_INDEX_t __pyx_t_25; - __pyx_t_6_basis_INT_t __pyx_t_26; - __pyx_t_6_basis_INDEX_t __pyx_t_27; - __pyx_t_6_basis_INDEX_t __pyx_t_28; - __pyx_t_6_basis_INDEX_t __pyx_t_29; - __pyx_t_6_basis_INDEX_t __pyx_t_30; - __pyx_t_6_basis_INDEX_t __pyx_t_31; - __pyx_t_6_basis_INDEX_t __pyx_t_32; - __pyx_t_6_basis_INDEX_t __pyx_t_33; - __pyx_t_6_basis_INDEX_t __pyx_t_34; - __pyx_t_6_basis_INDEX_t __pyx_t_35; - __pyx_t_6_basis_INDEX_t __pyx_t_36; - __pyx_t_6_basis_INDEX_t __pyx_t_37; - __pyx_t_6_basis_INDEX_t __pyx_t_38; - __pyx_t_6_basis_INDEX_t __pyx_t_39; - __pyx_t_6_basis_INDEX_t __pyx_t_40; - __pyx_t_6_basis_INDEX_t __pyx_t_41; - PyArrayObject *__pyx_t_42 = NULL; - int __pyx_t_43; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_25; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_26; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_27; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_28; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_29; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_30; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_31; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_32; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_33; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_34; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_35; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_36; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_37; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_38; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_39; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_40; + PyArrayObject *__pyx_t_41 = NULL; + int __pyx_t_42; + PyObject *__pyx_t_43 = NULL; PyObject *__pyx_t_44 = NULL; PyObject *__pyx_t_45 = NULL; - PyObject *__pyx_t_46 = NULL; - __pyx_t_6_basis_INDEX_t __pyx_t_47; - __pyx_t_6_basis_INDEX_t __pyx_t_48; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_46; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_47; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -4963,17 +4981,17 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o __pyx_pybuffernd_workspace.rcbuffer = &__pyx_pybuffer_workspace; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_variable.rcbuffer->pybuffer, (PyObject*)__pyx_v_variable, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_variable.rcbuffer->pybuffer, (PyObject*)__pyx_v_variable, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_variable.diminfo[0].strides = __pyx_pybuffernd_variable.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_variable.diminfo[0].shape = __pyx_pybuffernd_variable.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_workspace.rcbuffer->pybuffer, (PyObject*)__pyx_v_workspace, &__Pyx_TypeInfo_nn___pyx_t_6_basis_INT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_workspace.rcbuffer->pybuffer, (PyObject*)__pyx_v_workspace, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_INT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_workspace.diminfo[0].strides = __pyx_pybuffernd_workspace.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_workspace.diminfo[0].shape = __pyx_pybuffernd_workspace.rcbuffer->pybuffer.shape[0]; /* Check if called by wrapper */ @@ -4982,7 +5000,7 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__valid_knots); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_13BasisFunction_47valid_knots)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_47valid_knots)) { __Pyx_XDECREF(((PyObject *)__pyx_r)); __pyx_t_2 = PyInt_FromLong(__pyx_v_variable_idx); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -5037,7 +5055,7 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_basis.pyx":155 + /* "sklearn/earth/_basis.pyx":155 * cdef INDEX_t j * cdef INDEX_t k * cdef INDEX_t m = values.shape[0] # <<<<<<<<<<<<<< @@ -5046,7 +5064,7 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o */ __pyx_v_m = (__pyx_v_values->dimensions[0]); - /* "_basis.pyx":166 + /* "sklearn/earth/_basis.pyx":166 * cdef int idx * cdef int last_idx * cdef FLOAT_t first_var_value = variable[m-1] # <<<<<<<<<<<<<< @@ -5054,9 +5072,9 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o * */ __pyx_t_9 = (__pyx_v_m - 1); - __pyx_v_first_var_value = (*__Pyx_BufPtrStrided1d(__pyx_t_6_basis_FLOAT_t *, __pyx_pybuffernd_variable.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_variable.diminfo[0].strides)); + __pyx_v_first_var_value = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_FLOAT_t *, __pyx_pybuffernd_variable.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_variable.diminfo[0].strides)); - /* "_basis.pyx":167 + /* "sklearn/earth/_basis.pyx":167 * cdef int last_idx * cdef FLOAT_t first_var_value = variable[m-1] * cdef FLOAT_t last_var_value = variable[m-1] # <<<<<<<<<<<<<< @@ -5064,22 +5082,22 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o * #Calculate the used knots */ __pyx_t_10 = (__pyx_v_m - 1); - __pyx_v_last_var_value = (*__Pyx_BufPtrStrided1d(__pyx_t_6_basis_FLOAT_t *, __pyx_pybuffernd_variable.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_variable.diminfo[0].strides)); + __pyx_v_last_var_value = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_FLOAT_t *, __pyx_pybuffernd_variable.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_variable.diminfo[0].strides)); - /* "_basis.pyx":170 + /* "sklearn/earth/_basis.pyx":170 * * #Calculate the used knots * cdef list used_knots = self.knots(variable_idx) # <<<<<<<<<<<<<< * used_knots.sort() * */ - __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->knots(__pyx_v_self, __pyx_v_variable_idx, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->knots(__pyx_v_self, __pyx_v_variable_idx, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_used_knots = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "_basis.pyx":171 + /* "sklearn/earth/_basis.pyx":171 * #Calculate the used knots * cdef list used_knots = self.knots(variable_idx) * used_knots.sort() # <<<<<<<<<<<<<< @@ -5092,7 +5110,7 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o } __pyx_t_11 = PyList_Sort(((PyObject *)__pyx_v_used_knots)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "_basis.pyx":177 + /* "sklearn/earth/_basis.pyx":177 * #where value is nonzero and last_var_value to the * #minimum variable where value is nonzero * count = 0 # <<<<<<<<<<<<<< @@ -5101,7 +5119,7 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o */ __pyx_v_count = 0; - /* "_basis.pyx":178 + /* "sklearn/earth/_basis.pyx":178 * #minimum variable where value is nonzero * count = 0 * for i in range(m): # <<<<<<<<<<<<<< @@ -5112,7 +5130,7 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { __pyx_v_i = __pyx_t_13; - /* "_basis.pyx":179 + /* "sklearn/earth/_basis.pyx":179 * count = 0 * for i in range(m): * if abs(values[i]) > ZERO_TOL: # <<<<<<<<<<<<<< @@ -5120,10 +5138,10 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o * count += 1 */ __pyx_t_14 = __pyx_v_i; - __pyx_t_15 = (fabs((*__Pyx_BufPtrStrided1d(__pyx_t_6_basis_FLOAT_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_values.diminfo[0].strides))) > __pyx_v_6_basis_ZERO_TOL); + __pyx_t_15 = ((fabs((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_FLOAT_t *, __pyx_pybuffernd_values.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_values.diminfo[0].strides))) > __pyx_v_7sklearn_5earth_6_basis_ZERO_TOL) != 0); if (__pyx_t_15) { - /* "_basis.pyx":180 + /* "sklearn/earth/_basis.pyx":180 * for i in range(m): * if abs(values[i]) > ZERO_TOL: * workspace[i] = 1 # <<<<<<<<<<<<<< @@ -5131,9 +5149,9 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o * if variable[i] >= first_var_value: */ __pyx_t_16 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_workspace.diminfo[0].strides) = 1; + *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_workspace.diminfo[0].strides) = 1; - /* "_basis.pyx":181 + /* "sklearn/earth/_basis.pyx":181 * if abs(values[i]) > ZERO_TOL: * workspace[i] = 1 * count += 1 # <<<<<<<<<<<<<< @@ -5142,7 +5160,7 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o */ __pyx_v_count = (__pyx_v_count + 1); - /* "_basis.pyx":182 + /* "sklearn/earth/_basis.pyx":182 * workspace[i] = 1 * count += 1 * if variable[i] >= first_var_value: # <<<<<<<<<<<<<< @@ -5150,10 +5168,10 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o * last_var_value = variable[i] */ __pyx_t_17 = __pyx_v_i; - __pyx_t_15 = ((*__Pyx_BufPtrStrided1d(__pyx_t_6_basis_FLOAT_t *, __pyx_pybuffernd_variable.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_variable.diminfo[0].strides)) >= __pyx_v_first_var_value); + __pyx_t_15 = (((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_FLOAT_t *, __pyx_pybuffernd_variable.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_variable.diminfo[0].strides)) >= __pyx_v_first_var_value) != 0); if (__pyx_t_15) { - /* "_basis.pyx":183 + /* "sklearn/earth/_basis.pyx":183 * count += 1 * if variable[i] >= first_var_value: * first_var_value = variable[i] # <<<<<<<<<<<<<< @@ -5161,12 +5179,12 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o * else: */ __pyx_t_18 = __pyx_v_i; - __pyx_v_first_var_value = (*__Pyx_BufPtrStrided1d(__pyx_t_6_basis_FLOAT_t *, __pyx_pybuffernd_variable.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_variable.diminfo[0].strides)); + __pyx_v_first_var_value = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_FLOAT_t *, __pyx_pybuffernd_variable.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_variable.diminfo[0].strides)); goto __pyx_L6; } __pyx_L6:; - /* "_basis.pyx":184 + /* "sklearn/earth/_basis.pyx":184 * if variable[i] >= first_var_value: * first_var_value = variable[i] * last_var_value = variable[i] # <<<<<<<<<<<<<< @@ -5174,12 +5192,12 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o * workspace[i] = 0 */ __pyx_t_19 = __pyx_v_i; - __pyx_v_last_var_value = (*__Pyx_BufPtrStrided1d(__pyx_t_6_basis_FLOAT_t *, __pyx_pybuffernd_variable.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_variable.diminfo[0].strides)); + __pyx_v_last_var_value = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_FLOAT_t *, __pyx_pybuffernd_variable.rcbuffer->pybuffer.buf, __pyx_t_19, __pyx_pybuffernd_variable.diminfo[0].strides)); goto __pyx_L5; } /*else*/ { - /* "_basis.pyx":186 + /* "sklearn/earth/_basis.pyx":186 * last_var_value = variable[i] * else: * workspace[i] = 0 # <<<<<<<<<<<<<< @@ -5187,34 +5205,34 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o * #Calculate minspan */ __pyx_t_20 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_workspace.diminfo[0].strides) = 0; + *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_workspace.diminfo[0].strides) = 0; } __pyx_L5:; } - /* "_basis.pyx":189 + /* "sklearn/earth/_basis.pyx":189 * * #Calculate minspan * if minspan < 0: # <<<<<<<<<<<<<< * minspan_ = (-log2(-(1.0/(n*count))*log(1.0-minspan_alpha)) / 2.5) * else: */ - __pyx_t_15 = (__pyx_v_minspan < 0); + __pyx_t_15 = ((__pyx_v_minspan < 0) != 0); if (__pyx_t_15) { - /* "_basis.pyx":190 + /* "sklearn/earth/_basis.pyx":190 * #Calculate minspan * if minspan < 0: * minspan_ = (-log2(-(1.0/(n*count))*log(1.0-minspan_alpha)) / 2.5) # <<<<<<<<<<<<<< * else: * minspan_ = minspan */ - __pyx_v_minspan_ = ((int)((-__pyx_f_5_util_log2(((-(1.0 / (__pyx_v_n * __pyx_v_count))) * log((1.0 - __pyx_v_minspan_alpha))))) / 2.5)); + __pyx_v_minspan_ = ((int)((-__pyx_f_7sklearn_5earth_5_util_log2(((-(1.0 / (__pyx_v_n * __pyx_v_count))) * log((1.0 - __pyx_v_minspan_alpha))))) / 2.5)); goto __pyx_L7; } /*else*/ { - /* "_basis.pyx":192 + /* "sklearn/earth/_basis.pyx":192 * minspan_ = (-log2(-(1.0/(n*count))*log(1.0-minspan_alpha)) / 2.5) * else: * minspan_ = minspan # <<<<<<<<<<<<<< @@ -5225,7 +5243,7 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o } __pyx_L7:; - /* "_basis.pyx":195 + /* "sklearn/earth/_basis.pyx":195 * * #Take out the used points and apply minspan * num_used = len(used_knots) # <<<<<<<<<<<<<< @@ -5239,7 +5257,7 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o __pyx_t_21 = PyList_GET_SIZE(((PyObject *)__pyx_v_used_knots)); if (unlikely(__pyx_t_21 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_num_used = __pyx_t_21; - /* "_basis.pyx":196 + /* "sklearn/earth/_basis.pyx":196 * #Take out the used points and apply minspan * num_used = len(used_knots) * prev = 0 # <<<<<<<<<<<<<< @@ -5248,7 +5266,7 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o */ __pyx_v_prev = 0; - /* "_basis.pyx":197 + /* "sklearn/earth/_basis.pyx":197 * num_used = len(used_knots) * prev = 0 * last_idx = -1 # <<<<<<<<<<<<<< @@ -5257,7 +5275,7 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o */ __pyx_v_last_idx = -1; - /* "_basis.pyx":198 + /* "sklearn/earth/_basis.pyx":198 * prev = 0 * last_idx = -1 * for i in range(num_used): # <<<<<<<<<<<<<< @@ -5268,7 +5286,7 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o for (__pyx_t_13 = 0; __pyx_t_13 < __pyx_t_12; __pyx_t_13+=1) { __pyx_v_i = __pyx_t_13; - /* "_basis.pyx":199 + /* "sklearn/earth/_basis.pyx":199 * last_idx = -1 * for i in range(num_used): * idx = used_knots[i] # <<<<<<<<<<<<<< @@ -5282,17 +5300,17 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o __pyx_t_22 = __Pyx_PyInt_AsInt(PyList_GET_ITEM(__pyx_v_used_knots, __pyx_v_i)); if (unlikely((__pyx_t_22 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_idx = __pyx_t_22; - /* "_basis.pyx":200 + /* "sklearn/earth/_basis.pyx":200 * for i in range(num_used): * idx = used_knots[i] * if last_idx == idx: # <<<<<<<<<<<<<< * continue * workspace[idx] = 0 */ - __pyx_t_15 = (__pyx_v_last_idx == __pyx_v_idx); + __pyx_t_15 = ((__pyx_v_last_idx == __pyx_v_idx) != 0); if (__pyx_t_15) { - /* "_basis.pyx":201 + /* "sklearn/earth/_basis.pyx":201 * idx = used_knots[i] * if last_idx == idx: * continue # <<<<<<<<<<<<<< @@ -5304,7 +5322,7 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o } __pyx_L10:; - /* "_basis.pyx":202 + /* "sklearn/earth/_basis.pyx":202 * if last_idx == idx: * continue * workspace[idx] = 0 # <<<<<<<<<<<<<< @@ -5312,9 +5330,9 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o * k = 0 */ __pyx_t_22 = __pyx_v_idx; - *__Pyx_BufPtrStrided1d(__pyx_t_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_workspace.diminfo[0].strides) = 0; + *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_workspace.diminfo[0].strides) = 0; - /* "_basis.pyx":203 + /* "sklearn/earth/_basis.pyx":203 * continue * workspace[idx] = 0 * j = idx # <<<<<<<<<<<<<< @@ -5323,7 +5341,7 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o */ __pyx_v_j = __pyx_v_idx; - /* "_basis.pyx":204 + /* "sklearn/earth/_basis.pyx":204 * workspace[idx] = 0 * j = idx * k = 0 # <<<<<<<<<<<<<< @@ -5332,7 +5350,7 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o */ __pyx_v_k = 0; - /* "_basis.pyx":205 + /* "sklearn/earth/_basis.pyx":205 * j = idx * k = 0 * while j > prev + 1 and k < minspan_: # <<<<<<<<<<<<<< @@ -5340,16 +5358,16 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o * workspace[j-1] = False */ while (1) { - __pyx_t_15 = (__pyx_v_j > (__pyx_v_prev + 1)); + __pyx_t_15 = ((__pyx_v_j > (__pyx_v_prev + 1)) != 0); if (__pyx_t_15) { - __pyx_t_23 = (__pyx_v_k < __pyx_v_minspan_); + __pyx_t_23 = ((__pyx_v_k < __pyx_v_minspan_) != 0); __pyx_t_24 = __pyx_t_23; } else { __pyx_t_24 = __pyx_t_15; } if (!__pyx_t_24) break; - /* "_basis.pyx":206 + /* "sklearn/earth/_basis.pyx":206 * k = 0 * while j > prev + 1 and k < minspan_: * if workspace[j-1]: # <<<<<<<<<<<<<< @@ -5357,20 +5375,20 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o * k += 1 */ __pyx_t_25 = (__pyx_v_j - 1); - __pyx_t_26 = (*__Pyx_BufPtrStrided1d(__pyx_t_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_workspace.diminfo[0].strides)); - if (__pyx_t_26) { + __pyx_t_24 = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_workspace.diminfo[0].strides)) != 0); + if (__pyx_t_24) { - /* "_basis.pyx":207 + /* "sklearn/earth/_basis.pyx":207 * while j > prev + 1 and k < minspan_: * if workspace[j-1]: * workspace[j-1] = False # <<<<<<<<<<<<<< * k += 1 * j -= 1 */ - __pyx_t_27 = (__pyx_v_j - 1); - *__Pyx_BufPtrStrided1d(__pyx_t_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_workspace.diminfo[0].strides) = 0; + __pyx_t_26 = (__pyx_v_j - 1); + *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_workspace.diminfo[0].strides) = 0; - /* "_basis.pyx":208 + /* "sklearn/earth/_basis.pyx":208 * if workspace[j-1]: * workspace[j-1] = False * k += 1 # <<<<<<<<<<<<<< @@ -5382,7 +5400,7 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o } __pyx_L13:; - /* "_basis.pyx":209 + /* "sklearn/earth/_basis.pyx":209 * workspace[j-1] = False * k += 1 * j -= 1 # <<<<<<<<<<<<<< @@ -5392,7 +5410,7 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o __pyx_v_j = (__pyx_v_j - 1); } - /* "_basis.pyx":210 + /* "sklearn/earth/_basis.pyx":210 * k += 1 * j -= 1 * j = idx + 1 # <<<<<<<<<<<<<< @@ -5401,7 +5419,7 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o */ __pyx_v_j = (__pyx_v_idx + 1); - /* "_basis.pyx":211 + /* "sklearn/earth/_basis.pyx":211 * j -= 1 * j = idx + 1 * k = 0 # <<<<<<<<<<<<<< @@ -5410,7 +5428,7 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o */ __pyx_v_k = 0; - /* "_basis.pyx":212 + /* "sklearn/earth/_basis.pyx":212 * j = idx + 1 * k = 0 * while j < m and k < minspan_: # <<<<<<<<<<<<<< @@ -5418,37 +5436,37 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o * workspace[j] = False */ while (1) { - __pyx_t_24 = (__pyx_v_j < __pyx_v_m); + __pyx_t_24 = ((__pyx_v_j < __pyx_v_m) != 0); if (__pyx_t_24) { - __pyx_t_15 = (__pyx_v_k < __pyx_v_minspan_); + __pyx_t_15 = ((__pyx_v_k < __pyx_v_minspan_) != 0); __pyx_t_23 = __pyx_t_15; } else { __pyx_t_23 = __pyx_t_24; } if (!__pyx_t_23) break; - /* "_basis.pyx":213 + /* "sklearn/earth/_basis.pyx":213 * k = 0 * while j < m and k < minspan_: * if workspace[j]: # <<<<<<<<<<<<<< * workspace[j] = False * k += 1 */ - __pyx_t_28 = __pyx_v_j; - __pyx_t_26 = (*__Pyx_BufPtrStrided1d(__pyx_t_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_workspace.diminfo[0].strides)); - if (__pyx_t_26) { + __pyx_t_27 = __pyx_v_j; + __pyx_t_23 = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_workspace.diminfo[0].strides)) != 0); + if (__pyx_t_23) { - /* "_basis.pyx":214 + /* "sklearn/earth/_basis.pyx":214 * while j < m and k < minspan_: * if workspace[j]: * workspace[j] = False # <<<<<<<<<<<<<< * k += 1 * j += 1 */ - __pyx_t_29 = __pyx_v_j; - *__Pyx_BufPtrStrided1d(__pyx_t_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_workspace.diminfo[0].strides) = 0; + __pyx_t_28 = __pyx_v_j; + *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_workspace.diminfo[0].strides) = 0; - /* "_basis.pyx":215 + /* "sklearn/earth/_basis.pyx":215 * if workspace[j]: * workspace[j] = False * k += 1 # <<<<<<<<<<<<<< @@ -5460,7 +5478,7 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o } __pyx_L16:; - /* "_basis.pyx":216 + /* "sklearn/earth/_basis.pyx":216 * workspace[j] = False * k += 1 * j += 1 # <<<<<<<<<<<<<< @@ -5470,7 +5488,7 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o __pyx_v_j = (__pyx_v_j + 1); } - /* "_basis.pyx":217 + /* "sklearn/earth/_basis.pyx":217 * k += 1 * j += 1 * prev = idx # <<<<<<<<<<<<<< @@ -5479,7 +5497,7 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o */ __pyx_v_prev = __pyx_v_idx; - /* "_basis.pyx":218 + /* "sklearn/earth/_basis.pyx":218 * j += 1 * prev = idx * last_idx = idx # <<<<<<<<<<<<<< @@ -5490,7 +5508,7 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o __pyx_L8_continue:; } - /* "_basis.pyx":221 + /* "sklearn/earth/_basis.pyx":221 * * #Apply endspan * i = 0 # <<<<<<<<<<<<<< @@ -5499,7 +5517,7 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o */ __pyx_v_i = 0; - /* "_basis.pyx":222 + /* "sklearn/earth/_basis.pyx":222 * #Apply endspan * i = 0 * j = 0 # <<<<<<<<<<<<<< @@ -5508,7 +5526,7 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o */ __pyx_v_j = 0; - /* "_basis.pyx":223 + /* "sklearn/earth/_basis.pyx":223 * i = 0 * j = 0 * while i < endspan: # <<<<<<<<<<<<<< @@ -5516,10 +5534,10 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o * workspace[j] = 0 */ while (1) { - __pyx_t_23 = (__pyx_v_i < __pyx_v_endspan); + __pyx_t_23 = ((__pyx_v_i < __pyx_v_endspan) != 0); if (!__pyx_t_23) break; - /* "_basis.pyx":224 + /* "sklearn/earth/_basis.pyx":224 * j = 0 * while i < endspan: * if workspace[j]: # <<<<<<<<<<<<<< @@ -5527,10 +5545,10 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o * i += 1 */ __pyx_t_12 = __pyx_v_j; - __pyx_t_26 = (*__Pyx_BufPtrStrided1d(__pyx_t_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_workspace.diminfo[0].strides)); - if (__pyx_t_26) { + __pyx_t_23 = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_workspace.diminfo[0].strides)) != 0); + if (__pyx_t_23) { - /* "_basis.pyx":225 + /* "sklearn/earth/_basis.pyx":225 * while i < endspan: * if workspace[j]: * workspace[j] = 0 # <<<<<<<<<<<<<< @@ -5538,9 +5556,9 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o * j += 1 */ __pyx_t_13 = __pyx_v_j; - *__Pyx_BufPtrStrided1d(__pyx_t_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_workspace.diminfo[0].strides) = 0; + *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_workspace.diminfo[0].strides) = 0; - /* "_basis.pyx":226 + /* "sklearn/earth/_basis.pyx":226 * if workspace[j]: * workspace[j] = 0 * i += 1 # <<<<<<<<<<<<<< @@ -5552,7 +5570,7 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o } __pyx_L19:; - /* "_basis.pyx":227 + /* "sklearn/earth/_basis.pyx":227 * workspace[j] = 0 * i += 1 * j += 1 # <<<<<<<<<<<<<< @@ -5561,17 +5579,17 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o */ __pyx_v_j = (__pyx_v_j + 1); - /* "_basis.pyx":228 + /* "sklearn/earth/_basis.pyx":228 * i += 1 * j += 1 * if j == m: # <<<<<<<<<<<<<< * break * i = 0 */ - __pyx_t_23 = (__pyx_v_j == __pyx_v_m); + __pyx_t_23 = ((__pyx_v_j == __pyx_v_m) != 0); if (__pyx_t_23) { - /* "_basis.pyx":229 + /* "sklearn/earth/_basis.pyx":229 * j += 1 * if j == m: * break # <<<<<<<<<<<<<< @@ -5585,7 +5603,7 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o } __pyx_L18_break:; - /* "_basis.pyx":230 + /* "sklearn/earth/_basis.pyx":230 * if j == m: * break * i = 0 # <<<<<<<<<<<<<< @@ -5594,7 +5612,7 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o */ __pyx_v_i = 0; - /* "_basis.pyx":231 + /* "sklearn/earth/_basis.pyx":231 * break * i = 0 * j = m - 1 # <<<<<<<<<<<<<< @@ -5603,7 +5621,7 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o */ __pyx_v_j = (__pyx_v_m - 1); - /* "_basis.pyx":232 + /* "sklearn/earth/_basis.pyx":232 * i = 0 * j = m - 1 * while i < endspan: # <<<<<<<<<<<<<< @@ -5611,31 +5629,31 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o * workspace[j] = 0 */ while (1) { - __pyx_t_23 = (__pyx_v_i < __pyx_v_endspan); + __pyx_t_23 = ((__pyx_v_i < __pyx_v_endspan) != 0); if (!__pyx_t_23) break; - /* "_basis.pyx":233 + /* "sklearn/earth/_basis.pyx":233 * j = m - 1 * while i < endspan: * if workspace[j]: # <<<<<<<<<<<<<< * workspace[j] = 0 * i += 1 */ - __pyx_t_30 = __pyx_v_j; - __pyx_t_26 = (*__Pyx_BufPtrStrided1d(__pyx_t_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_workspace.diminfo[0].strides)); - if (__pyx_t_26) { + __pyx_t_29 = __pyx_v_j; + __pyx_t_23 = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_workspace.diminfo[0].strides)) != 0); + if (__pyx_t_23) { - /* "_basis.pyx":234 + /* "sklearn/earth/_basis.pyx":234 * while i < endspan: * if workspace[j]: * workspace[j] = 0 # <<<<<<<<<<<<<< * i += 1 * if j == 0: */ - __pyx_t_31 = __pyx_v_j; - *__Pyx_BufPtrStrided1d(__pyx_t_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_workspace.diminfo[0].strides) = 0; + __pyx_t_30 = __pyx_v_j; + *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_workspace.diminfo[0].strides) = 0; - /* "_basis.pyx":235 + /* "sklearn/earth/_basis.pyx":235 * if workspace[j]: * workspace[j] = 0 * i += 1 # <<<<<<<<<<<<<< @@ -5647,17 +5665,17 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o } __pyx_L23:; - /* "_basis.pyx":236 + /* "sklearn/earth/_basis.pyx":236 * workspace[j] = 0 * i += 1 * if j == 0: # <<<<<<<<<<<<<< * break * j -= 1 */ - __pyx_t_23 = (__pyx_v_j == 0); + __pyx_t_23 = ((__pyx_v_j == 0) != 0); if (__pyx_t_23) { - /* "_basis.pyx":237 + /* "sklearn/earth/_basis.pyx":237 * i += 1 * if j == 0: * break # <<<<<<<<<<<<<< @@ -5669,7 +5687,7 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o } __pyx_L24:; - /* "_basis.pyx":238 + /* "sklearn/earth/_basis.pyx":238 * if j == 0: * break * j -= 1 # <<<<<<<<<<<<<< @@ -5680,7 +5698,7 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o } __pyx_L22_break:; - /* "_basis.pyx":241 + /* "sklearn/earth/_basis.pyx":241 * * #Implement check_every * int_tmp = 0 # <<<<<<<<<<<<<< @@ -5689,7 +5707,7 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o */ __pyx_v_int_tmp = 0; - /* "_basis.pyx":242 + /* "sklearn/earth/_basis.pyx":242 * #Implement check_every * int_tmp = 0 * count = 0 # <<<<<<<<<<<<<< @@ -5698,52 +5716,52 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o */ __pyx_v_count = 0; - /* "_basis.pyx":243 + /* "sklearn/earth/_basis.pyx":243 * int_tmp = 0 * count = 0 * for i in range(m): # <<<<<<<<<<<<<< * if workspace[i]: * if (int_tmp % check_every) != 0: */ - __pyx_t_32 = __pyx_v_m; - for (__pyx_t_33 = 0; __pyx_t_33 < __pyx_t_32; __pyx_t_33+=1) { - __pyx_v_i = __pyx_t_33; + __pyx_t_31 = __pyx_v_m; + for (__pyx_t_32 = 0; __pyx_t_32 < __pyx_t_31; __pyx_t_32+=1) { + __pyx_v_i = __pyx_t_32; - /* "_basis.pyx":244 + /* "sklearn/earth/_basis.pyx":244 * count = 0 * for i in range(m): * if workspace[i]: # <<<<<<<<<<<<<< * if (int_tmp % check_every) != 0: * workspace[i] = 0 */ - __pyx_t_34 = __pyx_v_i; - __pyx_t_26 = (*__Pyx_BufPtrStrided1d(__pyx_t_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_workspace.diminfo[0].strides)); - if (__pyx_t_26) { + __pyx_t_33 = __pyx_v_i; + __pyx_t_23 = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_workspace.diminfo[0].strides)) != 0); + if (__pyx_t_23) { - /* "_basis.pyx":245 + /* "sklearn/earth/_basis.pyx":245 * for i in range(m): * if workspace[i]: * if (int_tmp % check_every) != 0: # <<<<<<<<<<<<<< * workspace[i] = 0 * else: */ - __pyx_t_23 = ((__pyx_v_int_tmp % __pyx_v_check_every) != 0); + __pyx_t_23 = (((__pyx_v_int_tmp % __pyx_v_check_every) != 0) != 0); if (__pyx_t_23) { - /* "_basis.pyx":246 + /* "sklearn/earth/_basis.pyx":246 * if workspace[i]: * if (int_tmp % check_every) != 0: * workspace[i] = 0 # <<<<<<<<<<<<<< * else: * count += 1 */ - __pyx_t_35 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_workspace.diminfo[0].strides) = 0; + __pyx_t_34 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_workspace.diminfo[0].strides) = 0; goto __pyx_L28; } /*else*/ { - /* "_basis.pyx":248 + /* "sklearn/earth/_basis.pyx":248 * workspace[i] = 0 * else: * count += 1 # <<<<<<<<<<<<<< @@ -5754,7 +5772,7 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o } __pyx_L28:; - /* "_basis.pyx":249 + /* "sklearn/earth/_basis.pyx":249 * else: * count += 1 * int_tmp += 1 # <<<<<<<<<<<<<< @@ -5766,7 +5784,7 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o } /*else*/ { - /* "_basis.pyx":251 + /* "sklearn/earth/_basis.pyx":251 * int_tmp += 1 * else: * int_tmp = 0 # <<<<<<<<<<<<<< @@ -5778,50 +5796,50 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o __pyx_L27:; } - /* "_basis.pyx":254 + /* "sklearn/earth/_basis.pyx":254 * * #Make sure the greatest value is not a candidate (this can happen if the first endspan+1 values are the same) * for i in range(m): # <<<<<<<<<<<<<< * if workspace[i]: * if variable[i] == first_var_value: */ - __pyx_t_32 = __pyx_v_m; - for (__pyx_t_33 = 0; __pyx_t_33 < __pyx_t_32; __pyx_t_33+=1) { - __pyx_v_i = __pyx_t_33; + __pyx_t_31 = __pyx_v_m; + for (__pyx_t_32 = 0; __pyx_t_32 < __pyx_t_31; __pyx_t_32+=1) { + __pyx_v_i = __pyx_t_32; - /* "_basis.pyx":255 + /* "sklearn/earth/_basis.pyx":255 * #Make sure the greatest value is not a candidate (this can happen if the first endspan+1 values are the same) * for i in range(m): * if workspace[i]: # <<<<<<<<<<<<<< * if variable[i] == first_var_value: * workspace[i] = 0 */ - __pyx_t_36 = __pyx_v_i; - __pyx_t_26 = (*__Pyx_BufPtrStrided1d(__pyx_t_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_workspace.diminfo[0].strides)); - if (__pyx_t_26) { + __pyx_t_35 = __pyx_v_i; + __pyx_t_23 = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_workspace.diminfo[0].strides)) != 0); + if (__pyx_t_23) { - /* "_basis.pyx":256 + /* "sklearn/earth/_basis.pyx":256 * for i in range(m): * if workspace[i]: * if variable[i] == first_var_value: # <<<<<<<<<<<<<< * workspace[i] = 0 * count -= 1 */ - __pyx_t_37 = __pyx_v_i; - __pyx_t_23 = ((*__Pyx_BufPtrStrided1d(__pyx_t_6_basis_FLOAT_t *, __pyx_pybuffernd_variable.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_variable.diminfo[0].strides)) == __pyx_v_first_var_value); + __pyx_t_36 = __pyx_v_i; + __pyx_t_23 = (((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_FLOAT_t *, __pyx_pybuffernd_variable.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_variable.diminfo[0].strides)) == __pyx_v_first_var_value) != 0); if (__pyx_t_23) { - /* "_basis.pyx":257 + /* "sklearn/earth/_basis.pyx":257 * if workspace[i]: * if variable[i] == first_var_value: * workspace[i] = 0 # <<<<<<<<<<<<<< * count -= 1 * else: */ - __pyx_t_38 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_workspace.diminfo[0].strides) = 0; + __pyx_t_37 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_workspace.diminfo[0].strides) = 0; - /* "_basis.pyx":258 + /* "sklearn/earth/_basis.pyx":258 * if variable[i] == first_var_value: * workspace[i] = 0 * count -= 1 # <<<<<<<<<<<<<< @@ -5833,7 +5851,7 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o } /*else*/ { - /* "_basis.pyx":260 + /* "sklearn/earth/_basis.pyx":260 * count -= 1 * else: * break # <<<<<<<<<<<<<< @@ -5849,50 +5867,50 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o } __pyx_L30_break:; - /* "_basis.pyx":263 + /* "sklearn/earth/_basis.pyx":263 * * #Also make sure the least value is not a candidate * for i in range(m): # <<<<<<<<<<<<<< * if workspace[m-i-1]: * if variable[m-i-1] == last_var_value: */ - __pyx_t_32 = __pyx_v_m; - for (__pyx_t_33 = 0; __pyx_t_33 < __pyx_t_32; __pyx_t_33+=1) { - __pyx_v_i = __pyx_t_33; + __pyx_t_31 = __pyx_v_m; + for (__pyx_t_32 = 0; __pyx_t_32 < __pyx_t_31; __pyx_t_32+=1) { + __pyx_v_i = __pyx_t_32; - /* "_basis.pyx":264 + /* "sklearn/earth/_basis.pyx":264 * #Also make sure the least value is not a candidate * for i in range(m): * if workspace[m-i-1]: # <<<<<<<<<<<<<< * if variable[m-i-1] == last_var_value: * workspace[m-i-1] = 0 */ - __pyx_t_39 = ((__pyx_v_m - __pyx_v_i) - 1); - __pyx_t_26 = (*__Pyx_BufPtrStrided1d(__pyx_t_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_workspace.diminfo[0].strides)); - if (__pyx_t_26) { + __pyx_t_38 = ((__pyx_v_m - __pyx_v_i) - 1); + __pyx_t_23 = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_workspace.diminfo[0].strides)) != 0); + if (__pyx_t_23) { - /* "_basis.pyx":265 + /* "sklearn/earth/_basis.pyx":265 * for i in range(m): * if workspace[m-i-1]: * if variable[m-i-1] == last_var_value: # <<<<<<<<<<<<<< * workspace[m-i-1] = 0 * count -= 1 */ - __pyx_t_40 = ((__pyx_v_m - __pyx_v_i) - 1); - __pyx_t_23 = ((*__Pyx_BufPtrStrided1d(__pyx_t_6_basis_FLOAT_t *, __pyx_pybuffernd_variable.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_variable.diminfo[0].strides)) == __pyx_v_last_var_value); + __pyx_t_39 = ((__pyx_v_m - __pyx_v_i) - 1); + __pyx_t_23 = (((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_FLOAT_t *, __pyx_pybuffernd_variable.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_variable.diminfo[0].strides)) == __pyx_v_last_var_value) != 0); if (__pyx_t_23) { - /* "_basis.pyx":266 + /* "sklearn/earth/_basis.pyx":266 * if workspace[m-i-1]: * if variable[m-i-1] == last_var_value: * workspace[m-i-1] = 0 # <<<<<<<<<<<<<< * count -= 1 * else: */ - __pyx_t_41 = ((__pyx_v_m - __pyx_v_i) - 1); - *__Pyx_BufPtrStrided1d(__pyx_t_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_workspace.diminfo[0].strides) = 0; + __pyx_t_40 = ((__pyx_v_m - __pyx_v_i) - 1); + *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_workspace.diminfo[0].strides) = 0; - /* "_basis.pyx":267 + /* "sklearn/earth/_basis.pyx":267 * if variable[m-i-1] == last_var_value: * workspace[m-i-1] = 0 * count -= 1 # <<<<<<<<<<<<<< @@ -5904,7 +5922,7 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o } /*else*/ { - /* "_basis.pyx":269 + /* "sklearn/earth/_basis.pyx":269 * count -= 1 * else: * break # <<<<<<<<<<<<<< @@ -5920,7 +5938,7 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o } __pyx_L34_break:; - /* "_basis.pyx":272 + /* "sklearn/earth/_basis.pyx":272 * * #Create result array and return * result = np.empty(shape=count,dtype=int) # <<<<<<<<<<<<<< @@ -5944,28 +5962,28 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_42 = ((PyArrayObject *)__pyx_t_8); + __pyx_t_41 = ((PyArrayObject *)__pyx_t_8); { __Pyx_BufFmt_StackElem __pyx_stack[1]; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_result.rcbuffer->pybuffer); - __pyx_t_43 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_42, &__Pyx_TypeInfo_nn___pyx_t_6_basis_INT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_43 < 0)) { - PyErr_Fetch(&__pyx_t_44, &__pyx_t_45, &__pyx_t_46); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn___pyx_t_6_basis_INT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_44); Py_XDECREF(__pyx_t_45); Py_XDECREF(__pyx_t_46); + __pyx_t_42 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_t_41, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_INT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack); + if (unlikely(__pyx_t_42 < 0)) { + PyErr_Fetch(&__pyx_t_43, &__pyx_t_44, &__pyx_t_45); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_result.rcbuffer->pybuffer, (PyObject*)__pyx_v_result, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_INT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_43); Py_XDECREF(__pyx_t_44); Py_XDECREF(__pyx_t_45); __Pyx_RaiseBufferFallbackError(); } else { - PyErr_Restore(__pyx_t_44, __pyx_t_45, __pyx_t_46); + PyErr_Restore(__pyx_t_43, __pyx_t_44, __pyx_t_45); } } __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_43 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_42 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_42 = 0; + __pyx_t_41 = 0; __pyx_v_result = ((PyArrayObject *)__pyx_t_8); __pyx_t_8 = 0; - /* "_basis.pyx":273 + /* "sklearn/earth/_basis.pyx":273 * #Create result array and return * result = np.empty(shape=count,dtype=int) * j = 0 # <<<<<<<<<<<<<< @@ -5974,39 +5992,39 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o */ __pyx_v_j = 0; - /* "_basis.pyx":274 + /* "sklearn/earth/_basis.pyx":274 * result = np.empty(shape=count,dtype=int) * j = 0 * for i in range(m): # <<<<<<<<<<<<<< * if workspace[i]: * result[j] = i */ - __pyx_t_32 = __pyx_v_m; - for (__pyx_t_33 = 0; __pyx_t_33 < __pyx_t_32; __pyx_t_33+=1) { - __pyx_v_i = __pyx_t_33; + __pyx_t_31 = __pyx_v_m; + for (__pyx_t_32 = 0; __pyx_t_32 < __pyx_t_31; __pyx_t_32+=1) { + __pyx_v_i = __pyx_t_32; - /* "_basis.pyx":275 + /* "sklearn/earth/_basis.pyx":275 * j = 0 * for i in range(m): * if workspace[i]: # <<<<<<<<<<<<<< * result[j] = i * j += 1 */ - __pyx_t_47 = __pyx_v_i; - __pyx_t_26 = (*__Pyx_BufPtrStrided1d(__pyx_t_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_workspace.diminfo[0].strides)); - if (__pyx_t_26) { + __pyx_t_46 = __pyx_v_i; + __pyx_t_23 = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_workspace.diminfo[0].strides)) != 0); + if (__pyx_t_23) { - /* "_basis.pyx":276 + /* "sklearn/earth/_basis.pyx":276 * for i in range(m): * if workspace[i]: * result[j] = i # <<<<<<<<<<<<<< * j += 1 * */ - __pyx_t_48 = __pyx_v_j; - *__Pyx_BufPtrStrided1d(__pyx_t_6_basis_INT_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_result.diminfo[0].strides) = __pyx_v_i; + __pyx_t_47 = __pyx_v_j; + *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_INT_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_result.diminfo[0].strides) = __pyx_v_i; - /* "_basis.pyx":277 + /* "sklearn/earth/_basis.pyx":277 * if workspace[i]: * result[j] = i * j += 1 # <<<<<<<<<<<<<< @@ -6019,7 +6037,7 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o __pyx_L39:; } - /* "_basis.pyx":279 + /* "sklearn/earth/_basis.pyx":279 * j += 1 * * return result # <<<<<<<<<<<<<< @@ -6049,7 +6067,7 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_variable.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_workspace.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("_basis.BasisFunction.valid_knots", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.BasisFunction.valid_knots", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; goto __pyx_L2; __pyx_L0:; @@ -6066,17 +6084,17 @@ static PyArrayObject *__pyx_f_6_basis_13BasisFunction_valid_knots(struct __pyx_o } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_13BasisFunction_47valid_knots(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_6_basis_13BasisFunction_46valid_knots[] = "\n values - The unsorted values of self in the data set\n variable - The sorted values of variable in the data set\n variable_idx - The index of the variable in the data set\n workspace - An m-vector (where m is the number of samples) used internally\n "; -static PyObject *__pyx_pw_6_basis_13BasisFunction_47valid_knots(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_47valid_knots(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7sklearn_5earth_6_basis_13BasisFunction_46valid_knots[] = "\n values - The unsorted values of self in the data set\n variable - The sorted values of variable in the data set\n variable_idx - The index of the variable in the data set\n workspace - An m-vector (where m is the number of samples) used internally\n "; +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_47valid_knots(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_values = 0; PyArrayObject *__pyx_v_variable = 0; int __pyx_v_variable_idx; - __pyx_t_6_basis_INDEX_t __pyx_v_check_every; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_check_every; int __pyx_v_endspan; int __pyx_v_minspan; - __pyx_t_6_basis_FLOAT_t __pyx_v_minspan_alpha; - __pyx_t_6_basis_INDEX_t __pyx_v_n; + __pyx_t_7sklearn_5earth_6_basis_FLOAT_t __pyx_v_minspan_alpha; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_n; PyArrayObject *__pyx_v_workspace = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -6179,14 +6197,14 @@ static PyObject *__pyx_pw_6_basis_13BasisFunction_47valid_knots(PyObject *__pyx_ __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("valid_knots", 1, 9, 9, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_basis.BasisFunction.valid_knots", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.BasisFunction.valid_knots", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_values), __pyx_ptype_5numpy_ndarray, 1, "values", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_variable), __pyx_ptype_5numpy_ndarray, 1, "variable", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_workspace), __pyx_ptype_5numpy_ndarray, 1, "workspace", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_6_basis_13BasisFunction_46valid_knots(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self), __pyx_v_values, __pyx_v_variable, __pyx_v_variable_idx, __pyx_v_check_every, __pyx_v_endspan, __pyx_v_minspan, __pyx_v_minspan_alpha, __pyx_v_n, __pyx_v_workspace); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_46valid_knots(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self), __pyx_v_values, __pyx_v_variable, __pyx_v_variable_idx, __pyx_v_check_every, __pyx_v_endspan, __pyx_v_minspan, __pyx_v_minspan_alpha, __pyx_v_n, __pyx_v_workspace); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -6195,7 +6213,7 @@ static PyObject *__pyx_pw_6_basis_13BasisFunction_47valid_knots(PyObject *__pyx_ return __pyx_r; } -/* "_basis.pyx":145 +/* "sklearn/earth/_basis.pyx":145 * ''' * * cpdef cnp.ndarray[INT_t, ndim=1] valid_knots(BasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] values, cnp.ndarray[FLOAT_t,ndim=1] variable, int variable_idx, INDEX_t check_every, int endspan, int minspan, FLOAT_t minspan_alpha, INDEX_t n, cnp.ndarray[INT_t,ndim=1] workspace): # <<<<<<<<<<<<<< @@ -6203,7 +6221,7 @@ static PyObject *__pyx_pw_6_basis_13BasisFunction_47valid_knots(PyObject *__pyx_ * values - The unsorted values of self in the data set */ -static PyObject *__pyx_pf_6_basis_13BasisFunction_46valid_knots(struct __pyx_obj_6_basis_BasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_variable, int __pyx_v_variable_idx, __pyx_t_6_basis_INDEX_t __pyx_v_check_every, int __pyx_v_endspan, int __pyx_v_minspan, __pyx_t_6_basis_FLOAT_t __pyx_v_minspan_alpha, __pyx_t_6_basis_INDEX_t __pyx_v_n, PyArrayObject *__pyx_v_workspace) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_46valid_knots(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_values, PyArrayObject *__pyx_v_variable, int __pyx_v_variable_idx, __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_check_every, int __pyx_v_endspan, int __pyx_v_minspan, __pyx_t_7sklearn_5earth_6_basis_FLOAT_t __pyx_v_minspan_alpha, __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_n, PyArrayObject *__pyx_v_workspace) { __Pyx_LocalBuf_ND __pyx_pybuffernd_values; __Pyx_Buffer __pyx_pybuffer_values; __Pyx_LocalBuf_ND __pyx_pybuffernd_variable; @@ -6231,21 +6249,21 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_46valid_knots(struct __pyx_obj __pyx_pybuffernd_workspace.rcbuffer = &__pyx_pybuffer_workspace; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_values.rcbuffer->pybuffer, (PyObject*)__pyx_v_values, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_values.diminfo[0].strides = __pyx_pybuffernd_values.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_values.diminfo[0].shape = __pyx_pybuffernd_values.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_variable.rcbuffer->pybuffer, (PyObject*)__pyx_v_variable, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_variable.rcbuffer->pybuffer, (PyObject*)__pyx_v_variable, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_variable.diminfo[0].strides = __pyx_pybuffernd_variable.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_variable.diminfo[0].shape = __pyx_pybuffernd_variable.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_workspace.rcbuffer->pybuffer, (PyObject*)__pyx_v_workspace, &__Pyx_TypeInfo_nn___pyx_t_6_basis_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_workspace.rcbuffer->pybuffer, (PyObject*)__pyx_v_workspace, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_workspace.diminfo[0].strides = __pyx_pybuffernd_workspace.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_workspace.diminfo[0].shape = __pyx_pybuffernd_workspace.rcbuffer->pybuffer.shape[0]; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->valid_knots(__pyx_v_self, ((PyArrayObject *)__pyx_v_values), ((PyArrayObject *)__pyx_v_variable), __pyx_v_variable_idx, __pyx_v_check_every, __pyx_v_endspan, __pyx_v_minspan, __pyx_v_minspan_alpha, __pyx_v_n, ((PyArrayObject *)__pyx_v_workspace), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self->__pyx_vtab)->valid_knots(__pyx_v_self, ((PyArrayObject *)__pyx_v_values), ((PyArrayObject *)__pyx_v_variable), __pyx_v_variable_idx, __pyx_v_check_every, __pyx_v_endspan, __pyx_v_minspan, __pyx_v_minspan_alpha, __pyx_v_n, ((PyArrayObject *)__pyx_v_workspace), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -6261,7 +6279,7 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_46valid_knots(struct __pyx_obj __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_variable.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_workspace.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("_basis.BasisFunction.valid_knots", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.BasisFunction.valid_knots", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; @@ -6275,20 +6293,20 @@ static PyObject *__pyx_pf_6_basis_13BasisFunction_46valid_knots(struct __pyx_obj } /* Python wrapper */ -static int __pyx_pw_6_basis_21ConstantBasisFunction_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_6_basis_21ConstantBasisFunction_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; - __pyx_r = __pyx_pf_6_basis_21ConstantBasisFunction___init__(((struct __pyx_obj_6_basis_ConstantBasisFunction *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction___init__(((struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":287 +/* "sklearn/earth/_basis.pyx":287 * * cdef class ConstantBasisFunction(BasisFunction): * def __init__(self): #@DuplicatedSignature # <<<<<<<<<<<<<< @@ -6296,12 +6314,12 @@ static int __pyx_pw_6_basis_21ConstantBasisFunction_1__init__(PyObject *__pyx_v_ * */ -static int __pyx_pf_6_basis_21ConstantBasisFunction___init__(struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self) { +static int __pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction___init__(struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); - /* "_basis.pyx":288 + /* "sklearn/earth/_basis.pyx":288 * cdef class ConstantBasisFunction(BasisFunction): * def __init__(self): #@DuplicatedSignature * self.prunable = False # <<<<<<<<<<<<<< @@ -6316,17 +6334,17 @@ static int __pyx_pf_6_basis_21ConstantBasisFunction___init__(struct __pyx_obj_6_ } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_3_get_root(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_3_get_root(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_3_get_root(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_3_get_root(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_get_root (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_21ConstantBasisFunction_2_get_root(((struct __pyx_obj_6_basis_ConstantBasisFunction *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_2_get_root(((struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":290 +/* "sklearn/earth/_basis.pyx":290 * self.prunable = False * * def _get_root(self): # <<<<<<<<<<<<<< @@ -6334,12 +6352,12 @@ static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_3_get_root(PyObject *_ * */ -static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_2_get_root(struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_2_get_root(struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_get_root", 0); - /* "_basis.pyx":291 + /* "sklearn/earth/_basis.pyx":291 * * def _get_root(self): * return self # <<<<<<<<<<<<<< @@ -6359,17 +6377,17 @@ static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_2_get_root(struct __py } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_5_get_parent_state(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_5_get_parent_state(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_5_get_parent_state(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_5_get_parent_state(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_get_parent_state (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_21ConstantBasisFunction_4_get_parent_state(((struct __pyx_obj_6_basis_ConstantBasisFunction *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_4_get_parent_state(((struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":293 +/* "sklearn/earth/_basis.pyx":293 * return self * * def _get_parent_state(self): # <<<<<<<<<<<<<< @@ -6377,7 +6395,7 @@ static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_5_get_parent_state(PyO * */ -static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_4_get_parent_state(CYTHON_UNUSED struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_4_get_parent_state(CYTHON_UNUSED struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -6386,7 +6404,7 @@ static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_4_get_parent_state(CYT int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_get_parent_state", 0); - /* "_basis.pyx":294 + /* "sklearn/earth/_basis.pyx":294 * * def _get_parent_state(self): * return {} # <<<<<<<<<<<<<< @@ -6404,7 +6422,7 @@ static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_4_get_parent_state(CYT goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_basis.ConstantBasisFunction._get_parent_state", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.ConstantBasisFunction._get_parent_state", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -6413,17 +6431,17 @@ static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_4_get_parent_state(CYT } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_7_set_parent_state(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ -static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_7_set_parent_state(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_7_set_parent_state(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_7_set_parent_state(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_set_parent_state (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_21ConstantBasisFunction_6_set_parent_state(((struct __pyx_obj_6_basis_ConstantBasisFunction *)__pyx_v_self), ((PyObject *)__pyx_v_state)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_6_set_parent_state(((struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *)__pyx_v_self), ((PyObject *)__pyx_v_state)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":296 +/* "sklearn/earth/_basis.pyx":296 * return {} * * def _set_parent_state(self, state): # <<<<<<<<<<<<<< @@ -6431,7 +6449,7 @@ static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_7_set_parent_state(PyO * */ -static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_6_set_parent_state(CYTHON_UNUSED struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_state) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_6_set_parent_state(CYTHON_UNUSED struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *__pyx_v_self, CYTHON_UNUSED PyObject *__pyx_v_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_set_parent_state", 0); @@ -6442,7 +6460,7 @@ static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_6_set_parent_state(CYT return __pyx_r; } -/* "_basis.pyx":299 +/* "sklearn/earth/_basis.pyx":299 * pass * * cpdef INDEX_t degree(ConstantBasisFunction self): # <<<<<<<<<<<<<< @@ -6450,13 +6468,13 @@ static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_6_set_parent_state(CYT * */ -static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_9degree(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static __pyx_t_6_basis_INDEX_t __pyx_f_6_basis_21ConstantBasisFunction_degree(CYTHON_UNUSED struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { - __pyx_t_6_basis_INDEX_t __pyx_r; +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_9degree(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_f_7sklearn_5earth_6_basis_21ConstantBasisFunction_degree(CYTHON_UNUSED struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - __pyx_t_6_basis_INDEX_t __pyx_t_3; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -6467,7 +6485,7 @@ static __pyx_t_6_basis_INDEX_t __pyx_f_6_basis_21ConstantBasisFunction_degree(CY else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__degree); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_21ConstantBasisFunction_9degree)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_9degree)) { __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -6479,7 +6497,7 @@ static __pyx_t_6_basis_INDEX_t __pyx_f_6_basis_21ConstantBasisFunction_degree(CY __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_basis.pyx":300 + /* "sklearn/earth/_basis.pyx":300 * * cpdef INDEX_t degree(ConstantBasisFunction self): * return 0 # <<<<<<<<<<<<<< @@ -6494,7 +6512,7 @@ static __pyx_t_6_basis_INDEX_t __pyx_f_6_basis_21ConstantBasisFunction_degree(CY __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_WriteUnraisable("_basis.ConstantBasisFunction.degree", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("sklearn.earth._basis.ConstantBasisFunction.degree", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -6502,17 +6520,17 @@ static __pyx_t_6_basis_INDEX_t __pyx_f_6_basis_21ConstantBasisFunction_degree(CY } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_9degree(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_9degree(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_9degree(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_9degree(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("degree (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_21ConstantBasisFunction_8degree(((struct __pyx_obj_6_basis_ConstantBasisFunction *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_8degree(((struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":299 +/* "sklearn/earth/_basis.pyx":299 * pass * * cpdef INDEX_t degree(ConstantBasisFunction self): # <<<<<<<<<<<<<< @@ -6520,7 +6538,7 @@ static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_9degree(PyObject *__py * */ -static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_8degree(struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_8degree(struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -6529,7 +6547,7 @@ static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_8degree(struct __pyx_o int __pyx_clineno = 0; __Pyx_RefNannySetupContext("degree", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_6_basis_ConstantBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.degree(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_ConstantBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.degree(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -6539,7 +6557,7 @@ static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_8degree(struct __pyx_o goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_basis.ConstantBasisFunction.degree", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.ConstantBasisFunction.degree", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -6547,7 +6565,7 @@ static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_8degree(struct __pyx_o return __pyx_r; } -/* "_basis.pyx":302 +/* "sklearn/earth/_basis.pyx":302 * return 0 * * cpdef translate(ConstantBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse): # <<<<<<<<<<<<<< @@ -6555,8 +6573,8 @@ static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_8degree(struct __pyx_o * */ -static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_11translate(PyObject *__pyx_v_ConstantBasisFunctionself, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_6_basis_21ConstantBasisFunction_translate(CYTHON_UNUSED struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_ConstantBasisFunctionself, CYTHON_UNUSED PyArrayObject *__pyx_v_slopes, CYTHON_UNUSED PyArrayObject *__pyx_v_intercepts, CYTHON_UNUSED int __pyx_v_recurse, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_11translate(PyObject *__pyx_v_ConstantBasisFunctionself, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_7sklearn_5earth_6_basis_21ConstantBasisFunction_translate(CYTHON_UNUSED struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *__pyx_v_ConstantBasisFunctionself, CYTHON_UNUSED PyArrayObject *__pyx_v_slopes, CYTHON_UNUSED PyArrayObject *__pyx_v_intercepts, CYTHON_UNUSED int __pyx_v_recurse, int __pyx_skip_dispatch) { __Pyx_LocalBuf_ND __pyx_pybuffernd_intercepts; __Pyx_Buffer __pyx_pybuffer_intercepts; __Pyx_LocalBuf_ND __pyx_pybuffernd_slopes; @@ -6580,12 +6598,12 @@ static PyObject *__pyx_f_6_basis_21ConstantBasisFunction_translate(CYTHON_UNUSED __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; /* Check if called by wrapper */ @@ -6594,7 +6612,7 @@ static PyObject *__pyx_f_6_basis_21ConstantBasisFunction_translate(CYTHON_UNUSED else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_ConstantBasisFunctionself))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_ConstantBasisFunctionself), __pyx_n_s__translate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_21ConstantBasisFunction_11translate)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_11translate)) { __Pyx_XDECREF(__pyx_r); __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_recurse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -6620,7 +6638,7 @@ static PyObject *__pyx_f_6_basis_21ConstantBasisFunction_translate(CYTHON_UNUSED __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_basis.pyx":303 + /* "sklearn/earth/_basis.pyx":303 * * cpdef translate(ConstantBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse): * pass # <<<<<<<<<<<<<< @@ -6639,7 +6657,7 @@ static PyObject *__pyx_f_6_basis_21ConstantBasisFunction_translate(CYTHON_UNUSED __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("_basis.ConstantBasisFunction.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.ConstantBasisFunction.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; goto __pyx_L2; __pyx_L0:; @@ -6652,8 +6670,8 @@ static PyObject *__pyx_f_6_basis_21ConstantBasisFunction_translate(CYTHON_UNUSED } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_11translate(PyObject *__pyx_v_ConstantBasisFunctionself, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_11translate(PyObject *__pyx_v_ConstantBasisFunctionself, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_11translate(PyObject *__pyx_v_ConstantBasisFunctionself, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_11translate(PyObject *__pyx_v_ConstantBasisFunctionself, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_slopes = 0; PyArrayObject *__pyx_v_intercepts = 0; int __pyx_v_recurse; @@ -6710,13 +6728,13 @@ static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_11translate(PyObject * __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("translate", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_basis.ConstantBasisFunction.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.ConstantBasisFunction.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_slopes), __pyx_ptype_5numpy_ndarray, 1, "slopes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercepts), __pyx_ptype_5numpy_ndarray, 1, "intercepts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_6_basis_21ConstantBasisFunction_10translate(((struct __pyx_obj_6_basis_ConstantBasisFunction *)__pyx_v_ConstantBasisFunctionself), __pyx_v_slopes, __pyx_v_intercepts, __pyx_v_recurse); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_10translate(((struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *)__pyx_v_ConstantBasisFunctionself), __pyx_v_slopes, __pyx_v_intercepts, __pyx_v_recurse); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -6725,7 +6743,7 @@ static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_11translate(PyObject * return __pyx_r; } -/* "_basis.pyx":302 +/* "sklearn/earth/_basis.pyx":302 * return 0 * * cpdef translate(ConstantBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse): # <<<<<<<<<<<<<< @@ -6733,7 +6751,7 @@ static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_11translate(PyObject * * */ -static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_10translate(struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_ConstantBasisFunctionself, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts, int __pyx_v_recurse) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_10translate(struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *__pyx_v_ConstantBasisFunctionself, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts, int __pyx_v_recurse) { __Pyx_LocalBuf_ND __pyx_pybuffernd_intercepts; __Pyx_Buffer __pyx_pybuffer_intercepts; __Pyx_LocalBuf_ND __pyx_pybuffernd_slopes; @@ -6755,16 +6773,16 @@ static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_10translate(struct __p __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_ConstantBasisFunction *)__pyx_v_ConstantBasisFunctionself->__pyx_base.__pyx_vtab)->translate(__pyx_v_ConstantBasisFunctionself, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), __pyx_v_recurse, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_ConstantBasisFunction *)__pyx_v_ConstantBasisFunctionself->__pyx_base.__pyx_vtab)->translate(__pyx_v_ConstantBasisFunctionself, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), __pyx_v_recurse, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -6779,7 +6797,7 @@ static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_10translate(struct __p __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("_basis.ConstantBasisFunction.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.ConstantBasisFunction.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; @@ -6791,7 +6809,7 @@ static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_10translate(struct __p return __pyx_r; } -/* "_basis.pyx":305 +/* "sklearn/earth/_basis.pyx":305 * pass * * cpdef FLOAT_t scale(ConstantBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): # <<<<<<<<<<<<<< @@ -6799,18 +6817,18 @@ static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_10translate(struct __p * */ -static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_13scale(PyObject *__pyx_v_ConstantBasisFunctionself, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static __pyx_t_6_basis_FLOAT_t __pyx_f_6_basis_21ConstantBasisFunction_scale(CYTHON_UNUSED struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_ConstantBasisFunctionself, CYTHON_UNUSED PyArrayObject *__pyx_v_slopes, CYTHON_UNUSED PyArrayObject *__pyx_v_intercepts, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_13scale(PyObject *__pyx_v_ConstantBasisFunctionself, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static __pyx_t_7sklearn_5earth_6_basis_FLOAT_t __pyx_f_7sklearn_5earth_6_basis_21ConstantBasisFunction_scale(CYTHON_UNUSED struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *__pyx_v_ConstantBasisFunctionself, CYTHON_UNUSED PyArrayObject *__pyx_v_slopes, CYTHON_UNUSED PyArrayObject *__pyx_v_intercepts, int __pyx_skip_dispatch) { __Pyx_LocalBuf_ND __pyx_pybuffernd_intercepts; __Pyx_Buffer __pyx_pybuffer_intercepts; __Pyx_LocalBuf_ND __pyx_pybuffernd_slopes; __Pyx_Buffer __pyx_pybuffer_slopes; - __pyx_t_6_basis_FLOAT_t __pyx_r; + __pyx_t_7sklearn_5earth_6_basis_FLOAT_t __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - __pyx_t_6_basis_FLOAT_t __pyx_t_4; + __pyx_t_7sklearn_5earth_6_basis_FLOAT_t __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -6825,12 +6843,12 @@ static __pyx_t_6_basis_FLOAT_t __pyx_f_6_basis_21ConstantBasisFunction_scale(CYT __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; /* Check if called by wrapper */ @@ -6839,7 +6857,7 @@ static __pyx_t_6_basis_FLOAT_t __pyx_f_6_basis_21ConstantBasisFunction_scale(CYT else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_ConstantBasisFunctionself))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_ConstantBasisFunctionself), __pyx_n_s__scale); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_21ConstantBasisFunction_13scale)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_13scale)) { __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_slopes)); @@ -6860,14 +6878,14 @@ static __pyx_t_6_basis_FLOAT_t __pyx_f_6_basis_21ConstantBasisFunction_scale(CYT __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_basis.pyx":306 + /* "sklearn/earth/_basis.pyx":306 * * cpdef FLOAT_t scale(ConstantBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): * return 1.0 # <<<<<<<<<<<<<< * * cpdef _set_parent(self,BasisFunction parent): */ - __pyx_r = ((__pyx_t_6_basis_FLOAT_t)1.0); + __pyx_r = ((__pyx_t_7sklearn_5earth_6_basis_FLOAT_t)1.0); goto __pyx_L0; __pyx_r = 0; @@ -6881,7 +6899,7 @@ static __pyx_t_6_basis_FLOAT_t __pyx_f_6_basis_21ConstantBasisFunction_scale(CYT __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_WriteUnraisable("_basis.ConstantBasisFunction.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("sklearn.earth._basis.ConstantBasisFunction.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; goto __pyx_L2; __pyx_L0:; @@ -6893,8 +6911,8 @@ static __pyx_t_6_basis_FLOAT_t __pyx_f_6_basis_21ConstantBasisFunction_scale(CYT } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_13scale(PyObject *__pyx_v_ConstantBasisFunctionself, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_13scale(PyObject *__pyx_v_ConstantBasisFunctionself, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_13scale(PyObject *__pyx_v_ConstantBasisFunctionself, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_13scale(PyObject *__pyx_v_ConstantBasisFunctionself, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_slopes = 0; PyArrayObject *__pyx_v_intercepts = 0; int __pyx_lineno = 0; @@ -6942,13 +6960,13 @@ static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_13scale(PyObject *__py __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("scale", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_basis.ConstantBasisFunction.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.ConstantBasisFunction.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_slopes), __pyx_ptype_5numpy_ndarray, 1, "slopes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercepts), __pyx_ptype_5numpy_ndarray, 1, "intercepts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_6_basis_21ConstantBasisFunction_12scale(((struct __pyx_obj_6_basis_ConstantBasisFunction *)__pyx_v_ConstantBasisFunctionself), __pyx_v_slopes, __pyx_v_intercepts); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_12scale(((struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *)__pyx_v_ConstantBasisFunctionself), __pyx_v_slopes, __pyx_v_intercepts); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -6957,7 +6975,7 @@ static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_13scale(PyObject *__py return __pyx_r; } -/* "_basis.pyx":305 +/* "sklearn/earth/_basis.pyx":305 * pass * * cpdef FLOAT_t scale(ConstantBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): # <<<<<<<<<<<<<< @@ -6965,7 +6983,7 @@ static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_13scale(PyObject *__py * */ -static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_12scale(struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_ConstantBasisFunctionself, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_12scale(struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *__pyx_v_ConstantBasisFunctionself, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts) { __Pyx_LocalBuf_ND __pyx_pybuffernd_intercepts; __Pyx_Buffer __pyx_pybuffer_intercepts; __Pyx_LocalBuf_ND __pyx_pybuffernd_slopes; @@ -6987,16 +7005,16 @@ static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_12scale(struct __pyx_o __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_6_basis_ConstantBasisFunction *)__pyx_v_ConstantBasisFunctionself->__pyx_base.__pyx_vtab)->scale(__pyx_v_ConstantBasisFunctionself, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_ConstantBasisFunction *)__pyx_v_ConstantBasisFunctionself->__pyx_base.__pyx_vtab)->scale(__pyx_v_ConstantBasisFunctionself, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -7011,7 +7029,7 @@ static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_12scale(struct __pyx_o __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("_basis.ConstantBasisFunction.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.ConstantBasisFunction.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; @@ -7023,7 +7041,7 @@ static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_12scale(struct __pyx_o return __pyx_r; } -/* "_basis.pyx":308 +/* "sklearn/earth/_basis.pyx":308 * return 1.0 * * cpdef _set_parent(self,BasisFunction parent): # <<<<<<<<<<<<<< @@ -7031,8 +7049,8 @@ static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_12scale(struct __pyx_o * */ -static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_15_set_parent(PyObject *__pyx_v_self, PyObject *__pyx_v_parent); /*proto*/ -static PyObject *__pyx_f_6_basis_21ConstantBasisFunction__set_parent(CYTHON_UNUSED struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self, CYTHON_UNUSED struct __pyx_obj_6_basis_BasisFunction *__pyx_v_parent, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_15_set_parent(PyObject *__pyx_v_self, PyObject *__pyx_v_parent); /*proto*/ +static PyObject *__pyx_f_7sklearn_5earth_6_basis_21ConstantBasisFunction__set_parent(CYTHON_UNUSED struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *__pyx_v_self, CYTHON_UNUSED struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_parent, int __pyx_skip_dispatch) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -7048,7 +7066,7 @@ static PyObject *__pyx_f_6_basis_21ConstantBasisFunction__set_parent(CYTHON_UNUS else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___set_parent); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_21ConstantBasisFunction_15_set_parent)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_15_set_parent)) { __Pyx_XDECREF(__pyx_r); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -7066,7 +7084,7 @@ static PyObject *__pyx_f_6_basis_21ConstantBasisFunction__set_parent(CYTHON_UNUS __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_basis.pyx":309 + /* "sklearn/earth/_basis.pyx":309 * * cpdef _set_parent(self,BasisFunction parent): * raise NotImplementedError # <<<<<<<<<<<<<< @@ -7082,7 +7100,7 @@ static PyObject *__pyx_f_6_basis_21ConstantBasisFunction__set_parent(CYTHON_UNUS __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_basis.ConstantBasisFunction._set_parent", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.ConstantBasisFunction._set_parent", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -7091,16 +7109,16 @@ static PyObject *__pyx_f_6_basis_21ConstantBasisFunction__set_parent(CYTHON_UNUS } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_15_set_parent(PyObject *__pyx_v_self, PyObject *__pyx_v_parent); /*proto*/ -static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_15_set_parent(PyObject *__pyx_v_self, PyObject *__pyx_v_parent) { - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_15_set_parent(PyObject *__pyx_v_self, PyObject *__pyx_v_parent); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_15_set_parent(PyObject *__pyx_v_self, PyObject *__pyx_v_parent) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_set_parent (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parent), __pyx_ptype_6_basis_BasisFunction, 1, "parent", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_6_basis_21ConstantBasisFunction_14_set_parent(((struct __pyx_obj_6_basis_ConstantBasisFunction *)__pyx_v_self), ((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_parent)); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parent), __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction, 1, "parent", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_14_set_parent(((struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *)__pyx_v_self), ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_parent)); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -7109,7 +7127,7 @@ static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_15_set_parent(PyObject return __pyx_r; } -/* "_basis.pyx":308 +/* "sklearn/earth/_basis.pyx":308 * return 1.0 * * cpdef _set_parent(self,BasisFunction parent): # <<<<<<<<<<<<<< @@ -7117,7 +7135,7 @@ static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_15_set_parent(PyObject * */ -static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_14_set_parent(struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self, struct __pyx_obj_6_basis_BasisFunction *__pyx_v_parent) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_14_set_parent(struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *__pyx_v_self, struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_parent) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -7126,7 +7144,7 @@ static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_14_set_parent(struct _ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_set_parent", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_ConstantBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._set_parent(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self), __pyx_v_parent, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_ConstantBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._set_parent(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self), __pyx_v_parent, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -7136,7 +7154,7 @@ static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_14_set_parent(struct _ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_basis.ConstantBasisFunction._set_parent", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.ConstantBasisFunction._set_parent", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -7144,7 +7162,7 @@ static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_14_set_parent(struct _ return __pyx_r; } -/* "_basis.pyx":311 +/* "sklearn/earth/_basis.pyx":311 * raise NotImplementedError * * cpdef BasisFunction get_parent(self): # <<<<<<<<<<<<<< @@ -7152,9 +7170,9 @@ static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_14_set_parent(struct _ * */ -static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_17get_parent(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static struct __pyx_obj_6_basis_BasisFunction *__pyx_f_6_basis_21ConstantBasisFunction_get_parent(CYTHON_UNUSED struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { - struct __pyx_obj_6_basis_BasisFunction *__pyx_r = NULL; +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_17get_parent(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_f_7sklearn_5earth_6_basis_21ConstantBasisFunction_get_parent(CYTHON_UNUSED struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; @@ -7168,12 +7186,12 @@ static struct __pyx_obj_6_basis_BasisFunction *__pyx_f_6_basis_21ConstantBasisFu else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_parent); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_21ConstantBasisFunction_17get_parent)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_17get_parent)) { __Pyx_XDECREF(((PyObject *)__pyx_r)); __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = ((struct __pyx_obj_6_basis_BasisFunction *)__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; @@ -7181,7 +7199,7 @@ static struct __pyx_obj_6_basis_BasisFunction *__pyx_f_6_basis_21ConstantBasisFu __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_basis.pyx":312 + /* "sklearn/earth/_basis.pyx":312 * * cpdef BasisFunction get_parent(self): * raise NotImplementedError # <<<<<<<<<<<<<< @@ -7191,12 +7209,12 @@ static struct __pyx_obj_6_basis_BasisFunction *__pyx_f_6_basis_21ConstantBasisFu __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = ((struct __pyx_obj_6_basis_BasisFunction *)Py_None); __Pyx_INCREF(Py_None); + __pyx_r = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)Py_None); __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_basis.ConstantBasisFunction.get_parent", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.ConstantBasisFunction.get_parent", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF((PyObject *)__pyx_r); @@ -7205,17 +7223,17 @@ static struct __pyx_obj_6_basis_BasisFunction *__pyx_f_6_basis_21ConstantBasisFu } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_17get_parent(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_17get_parent(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_17get_parent(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_17get_parent(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_parent (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_21ConstantBasisFunction_16get_parent(((struct __pyx_obj_6_basis_ConstantBasisFunction *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_16get_parent(((struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":311 +/* "sklearn/earth/_basis.pyx":311 * raise NotImplementedError * * cpdef BasisFunction get_parent(self): # <<<<<<<<<<<<<< @@ -7223,7 +7241,7 @@ static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_17get_parent(PyObject * */ -static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_16get_parent(struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_16get_parent(struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -7232,7 +7250,7 @@ static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_16get_parent(struct __ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_parent", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_6_basis_ConstantBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_parent(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_ConstantBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_parent(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -7242,7 +7260,7 @@ static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_16get_parent(struct __ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_basis.ConstantBasisFunction.get_parent", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.ConstantBasisFunction.get_parent", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -7250,7 +7268,7 @@ static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_16get_parent(struct __ return __pyx_r; } -/* "_basis.pyx":314 +/* "sklearn/earth/_basis.pyx":314 * raise NotImplementedError * * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = False): # <<<<<<<<<<<<<< @@ -7258,11 +7276,11 @@ static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_16get_parent(struct __ * X - Data matrix */ -static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_19apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_6_basis_21ConstantBasisFunction_apply(CYTHON_UNUSED struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self, CYTHON_UNUSED PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_b, int __pyx_skip_dispatch, struct __pyx_opt_args_6_basis_21ConstantBasisFunction_apply *__pyx_optional_args) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_19apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_7sklearn_5earth_6_basis_21ConstantBasisFunction_apply(CYTHON_UNUSED struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *__pyx_v_self, CYTHON_UNUSED PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_b, int __pyx_skip_dispatch, struct __pyx_opt_args_7sklearn_5earth_6_basis_21ConstantBasisFunction_apply *__pyx_optional_args) { int __pyx_v_recurse = ((int)0); - __pyx_t_6_basis_INDEX_t __pyx_v_i; - __pyx_t_6_basis_INDEX_t __pyx_v_m; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_i; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_m; __Pyx_LocalBuf_ND __pyx_pybuffernd_X; __Pyx_Buffer __pyx_pybuffer_X; __Pyx_LocalBuf_ND __pyx_pybuffernd_b; @@ -7273,9 +7291,9 @@ static PyObject *__pyx_f_6_basis_21ConstantBasisFunction_apply(CYTHON_UNUSED str PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; Py_ssize_t __pyx_t_4; - __pyx_t_6_basis_INDEX_t __pyx_t_5; - __pyx_t_6_basis_INDEX_t __pyx_t_6; - __pyx_t_6_basis_INDEX_t __pyx_t_7; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_5; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_6; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -7295,12 +7313,12 @@ static PyObject *__pyx_f_6_basis_21ConstantBasisFunction_apply(CYTHON_UNUSED str __pyx_pybuffernd_b.rcbuffer = &__pyx_pybuffer_b; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)__pyx_v_b, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)__pyx_v_b, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_b.diminfo[0].strides = __pyx_pybuffernd_b.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_b.diminfo[0].shape = __pyx_pybuffernd_b.rcbuffer->pybuffer.shape[0]; /* Check if called by wrapper */ @@ -7309,7 +7327,7 @@ static PyObject *__pyx_f_6_basis_21ConstantBasisFunction_apply(CYTHON_UNUSED str else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__apply); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_21ConstantBasisFunction_19apply)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_19apply)) { __Pyx_XDECREF(__pyx_r); __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_recurse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -7335,7 +7353,7 @@ static PyObject *__pyx_f_6_basis_21ConstantBasisFunction_apply(CYTHON_UNUSED str __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_basis.pyx":323 + /* "sklearn/earth/_basis.pyx":323 * ''' * cdef INDEX_t i #@DuplicatedSignature * cdef INDEX_t m = len(b) # <<<<<<<<<<<<<< @@ -7345,7 +7363,7 @@ static PyObject *__pyx_f_6_basis_21ConstantBasisFunction_apply(CYTHON_UNUSED str __pyx_t_4 = PyObject_Length(((PyObject *)__pyx_v_b)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_m = __pyx_t_4; - /* "_basis.pyx":324 + /* "sklearn/earth/_basis.pyx":324 * cdef INDEX_t i #@DuplicatedSignature * cdef INDEX_t m = len(b) * for i in range(m): # <<<<<<<<<<<<<< @@ -7356,7 +7374,7 @@ static PyObject *__pyx_f_6_basis_21ConstantBasisFunction_apply(CYTHON_UNUSED str for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "_basis.pyx":325 + /* "sklearn/earth/_basis.pyx":325 * cdef INDEX_t m = len(b) * for i in range(m): * b[i] = 1.0 # <<<<<<<<<<<<<< @@ -7364,7 +7382,7 @@ static PyObject *__pyx_f_6_basis_21ConstantBasisFunction_apply(CYTHON_UNUSED str * def __str__(self): */ __pyx_t_7 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_6_basis_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_b.diminfo[0].strides) = ((__pyx_t_6_basis_FLOAT_t)1.0); + *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_7, __pyx_pybuffernd_b.diminfo[0].strides) = ((__pyx_t_7sklearn_5earth_6_basis_FLOAT_t)1.0); } __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -7378,7 +7396,7 @@ static PyObject *__pyx_f_6_basis_21ConstantBasisFunction_apply(CYTHON_UNUSED str __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_b.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("_basis.ConstantBasisFunction.apply", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.ConstantBasisFunction.apply", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; goto __pyx_L2; __pyx_L0:; @@ -7391,9 +7409,9 @@ static PyObject *__pyx_f_6_basis_21ConstantBasisFunction_apply(CYTHON_UNUSED str } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_19apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_6_basis_21ConstantBasisFunction_18apply[] = "\n X - Data matrix\n b - parent vector\n recurse - The ConstantBasisFunction is the parent of all BasisFunctions and never has a parent. \n Therefore the recurse argument is ignored. This spares child BasisFunctions from \n having to know whether their parents have parents.\n "; -static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_19apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_19apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7sklearn_5earth_6_basis_21ConstantBasisFunction_18apply[] = "\n X - Data matrix\n b - parent vector\n recurse - The ConstantBasisFunction is the parent of all BasisFunctions and never has a parent. \n Therefore the recurse argument is ignored. This spares child BasisFunctions from \n having to know whether their parents have parents.\n "; +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_19apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_X = 0; PyArrayObject *__pyx_v_b = 0; int __pyx_v_recurse; @@ -7450,7 +7468,7 @@ static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_19apply(PyObject *__py __pyx_v_recurse = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_recurse == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - /* "_basis.pyx":314 + /* "sklearn/earth/_basis.pyx":314 * raise NotImplementedError * * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = False): # <<<<<<<<<<<<<< @@ -7464,13 +7482,13 @@ static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_19apply(PyObject *__py __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("apply", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_basis.ConstantBasisFunction.apply", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.ConstantBasisFunction.apply", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_5numpy_ndarray, 1, "b", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_6_basis_21ConstantBasisFunction_18apply(((struct __pyx_obj_6_basis_ConstantBasisFunction *)__pyx_v_self), __pyx_v_X, __pyx_v_b, __pyx_v_recurse); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_18apply(((struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *)__pyx_v_self), __pyx_v_X, __pyx_v_b, __pyx_v_recurse); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -7479,7 +7497,7 @@ static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_19apply(PyObject *__py return __pyx_r; } -static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_18apply(struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_b, int __pyx_v_recurse) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_18apply(struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_b, int __pyx_v_recurse) { __Pyx_LocalBuf_ND __pyx_pybuffernd_X; __Pyx_Buffer __pyx_pybuffer_X; __Pyx_LocalBuf_ND __pyx_pybuffernd_b; @@ -7487,7 +7505,7 @@ static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_18apply(struct __pyx_o PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - struct __pyx_opt_args_6_basis_13BasisFunction_apply __pyx_t_2; + struct __pyx_opt_args_7sklearn_5earth_6_basis_13BasisFunction_apply __pyx_t_2; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -7502,18 +7520,18 @@ static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_18apply(struct __pyx_o __pyx_pybuffernd_b.rcbuffer = &__pyx_pybuffer_b; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)__pyx_v_b, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)__pyx_v_b, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_b.diminfo[0].strides = __pyx_pybuffernd_b.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_b.diminfo[0].shape = __pyx_pybuffernd_b.rcbuffer->pybuffer.shape[0]; __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 1; __pyx_t_2.recurse = __pyx_v_recurse; - __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_ConstantBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.apply(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self), ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_b), 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_ConstantBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.apply(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self), ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_b), 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -7528,7 +7546,7 @@ static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_18apply(struct __pyx_o __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_b.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("_basis.ConstantBasisFunction.apply", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.ConstantBasisFunction.apply", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; @@ -7541,17 +7559,17 @@ static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_18apply(struct __pyx_o } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_21__str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_21__str__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_21__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_21__str__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_21ConstantBasisFunction_20__str__(((struct __pyx_obj_6_basis_ConstantBasisFunction *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_20__str__(((struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":327 +/* "sklearn/earth/_basis.pyx":327 * b[i] = 1.0 * * def __str__(self): # <<<<<<<<<<<<<< @@ -7559,12 +7577,12 @@ static PyObject *__pyx_pw_6_basis_21ConstantBasisFunction_21__str__(PyObject *__ * */ -static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_20__str__(CYTHON_UNUSED struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_20__str__(CYTHON_UNUSED struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__", 0); - /* "_basis.pyx":328 + /* "sklearn/earth/_basis.pyx":328 * * def __str__(self): * return '(Intercept)' # <<<<<<<<<<<<<< @@ -7584,12 +7602,12 @@ static PyObject *__pyx_pf_6_basis_21ConstantBasisFunction_20__str__(CYTHON_UNUSE } /* Python wrapper */ -static int __pyx_pw_6_basis_18HingeBasisFunction_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_6_basis_18HingeBasisFunction_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_6_basis_BasisFunction *__pyx_v_parent = 0; - __pyx_t_6_basis_FLOAT_t __pyx_v_knot; - __pyx_t_6_basis_INDEX_t __pyx_v_knot_idx; - __pyx_t_6_basis_INDEX_t __pyx_v_variable; +static int __pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_parent = 0; + __pyx_t_7sklearn_5earth_6_basis_FLOAT_t __pyx_v_knot; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_knot_idx; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_variable; int __pyx_v_reverse; PyObject *__pyx_v_label = 0; int __pyx_lineno = 0; @@ -7602,7 +7620,7 @@ static int __pyx_pw_6_basis_18HingeBasisFunction_1__init__(PyObject *__pyx_v_sel static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__parent,&__pyx_n_s__knot,&__pyx_n_s__knot_idx,&__pyx_n_s__variable,&__pyx_n_s__reverse,&__pyx_n_s__label,0}; PyObject* values[6] = {0,0,0,0,0,0}; - /* "_basis.pyx":332 + /* "sklearn/earth/_basis.pyx":332 * cdef class HingeBasisFunction(BasisFunction): * * def __init__(self, BasisFunction parent, FLOAT_t knot, INDEX_t knot_idx, INDEX_t variable, bint reverse, label=None): #@DuplicatedSignature # <<<<<<<<<<<<<< @@ -7669,7 +7687,7 @@ static int __pyx_pw_6_basis_18HingeBasisFunction_1__init__(PyObject *__pyx_v_sel default: goto __pyx_L5_argtuple_error; } } - __pyx_v_parent = ((struct __pyx_obj_6_basis_BasisFunction *)values[0]); + __pyx_v_parent = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)values[0]); __pyx_v_knot = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_knot == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_knot_idx = __Pyx_PyInt_from_py_npy_ulonglong(values[2]); if (unlikely((__pyx_v_knot_idx == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_variable = __Pyx_PyInt_from_py_npy_ulonglong(values[3]); if (unlikely((__pyx_v_variable == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L3_error;} @@ -7680,12 +7698,12 @@ static int __pyx_pw_6_basis_18HingeBasisFunction_1__init__(PyObject *__pyx_v_sel __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_basis.HingeBasisFunction.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.HingeBasisFunction.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parent), __pyx_ptype_6_basis_BasisFunction, 1, "parent", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_6_basis_18HingeBasisFunction___init__(((struct __pyx_obj_6_basis_HingeBasisFunction *)__pyx_v_self), __pyx_v_parent, __pyx_v_knot, __pyx_v_knot_idx, __pyx_v_variable, __pyx_v_reverse, __pyx_v_label); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parent), __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction, 1, "parent", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction___init__(((struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self), __pyx_v_parent, __pyx_v_knot, __pyx_v_knot_idx, __pyx_v_variable, __pyx_v_reverse, __pyx_v_label); goto __pyx_L0; __pyx_L1_error:; __pyx_r = -1; @@ -7694,7 +7712,7 @@ static int __pyx_pw_6_basis_18HingeBasisFunction_1__init__(PyObject *__pyx_v_sel return __pyx_r; } -static int __pyx_pf_6_basis_18HingeBasisFunction___init__(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self, struct __pyx_obj_6_basis_BasisFunction *__pyx_v_parent, __pyx_t_6_basis_FLOAT_t __pyx_v_knot, __pyx_t_6_basis_INDEX_t __pyx_v_knot_idx, __pyx_t_6_basis_INDEX_t __pyx_v_variable, int __pyx_v_reverse, PyObject *__pyx_v_label) { +static int __pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction___init__(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *__pyx_v_self, struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_parent, __pyx_t_7sklearn_5earth_6_basis_FLOAT_t __pyx_v_knot, __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_knot_idx, __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_variable, int __pyx_v_reverse, PyObject *__pyx_v_label) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -7706,7 +7724,7 @@ static int __pyx_pf_6_basis_18HingeBasisFunction___init__(struct __pyx_obj_6_bas int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "_basis.pyx":333 + /* "sklearn/earth/_basis.pyx":333 * * def __init__(self, BasisFunction parent, FLOAT_t knot, INDEX_t knot_idx, INDEX_t variable, bint reverse, label=None): #@DuplicatedSignature * self.knot = knot # <<<<<<<<<<<<<< @@ -7715,7 +7733,7 @@ static int __pyx_pf_6_basis_18HingeBasisFunction___init__(struct __pyx_obj_6_bas */ __pyx_v_self->knot = __pyx_v_knot; - /* "_basis.pyx":334 + /* "sklearn/earth/_basis.pyx":334 * def __init__(self, BasisFunction parent, FLOAT_t knot, INDEX_t knot_idx, INDEX_t variable, bint reverse, label=None): #@DuplicatedSignature * self.knot = knot * self.knot_idx = knot_idx # <<<<<<<<<<<<<< @@ -7724,7 +7742,7 @@ static int __pyx_pf_6_basis_18HingeBasisFunction___init__(struct __pyx_obj_6_bas */ __pyx_v_self->knot_idx = __pyx_v_knot_idx; - /* "_basis.pyx":335 + /* "sklearn/earth/_basis.pyx":335 * self.knot = knot * self.knot_idx = knot_idx * self.variable = variable # <<<<<<<<<<<<<< @@ -7733,7 +7751,7 @@ static int __pyx_pf_6_basis_18HingeBasisFunction___init__(struct __pyx_obj_6_bas */ __pyx_v_self->variable = __pyx_v_variable; - /* "_basis.pyx":336 + /* "sklearn/earth/_basis.pyx":336 * self.knot_idx = knot_idx * self.variable = variable * self.reverse = reverse # <<<<<<<<<<<<<< @@ -7742,7 +7760,7 @@ static int __pyx_pf_6_basis_18HingeBasisFunction___init__(struct __pyx_obj_6_bas */ __pyx_v_self->reverse = __pyx_v_reverse; - /* "_basis.pyx":337 + /* "sklearn/earth/_basis.pyx":337 * self.variable = variable * self.reverse = reverse * self.label = label if label is not None else 'x'+str(variable) # <<<<<<<<<<<<<< @@ -7750,7 +7768,7 @@ static int __pyx_pf_6_basis_18HingeBasisFunction___init__(struct __pyx_obj_6_bas * */ __pyx_t_2 = (__pyx_v_label != Py_None); - if (__pyx_t_2) { + if ((__pyx_t_2 != 0)) { __Pyx_INCREF(__pyx_v_label); __pyx_t_1 = __pyx_v_label; } else { @@ -7777,14 +7795,14 @@ static int __pyx_pf_6_basis_18HingeBasisFunction___init__(struct __pyx_obj_6_bas __pyx_v_self->label = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "_basis.pyx":338 + /* "sklearn/earth/_basis.pyx":338 * self.reverse = reverse * self.label = label if label is not None else 'x'+str(variable) * self._set_parent(parent) # <<<<<<<<<<<<<< * * def __reduce__(self): */ - __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._set_parent(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self), __pyx_v_parent, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._set_parent(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self), __pyx_v_parent, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -7794,7 +7812,7 @@ static int __pyx_pf_6_basis_18HingeBasisFunction___init__(struct __pyx_obj_6_bas __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_basis.HingeBasisFunction.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.HingeBasisFunction.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -7802,17 +7820,17 @@ static int __pyx_pf_6_basis_18HingeBasisFunction___init__(struct __pyx_obj_6_bas } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_18HingeBasisFunction_2__reduce__(((struct __pyx_obj_6_basis_HingeBasisFunction *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_2__reduce__(((struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":340 +/* "sklearn/earth/_basis.pyx":340 * self._set_parent(parent) * * def __reduce__(self): # <<<<<<<<<<<<<< @@ -7820,7 +7838,7 @@ static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_3__reduce__(PyObject *__p * */ -static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_2__reduce__(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_2__reduce__(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -7833,7 +7851,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_2__reduce__(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce__", 0); - /* "_basis.pyx":341 + /* "sklearn/earth/_basis.pyx":341 * * def __reduce__(self): * return (self.__class__, (pickle_place_holder, 1.0, 1, 1, True, ''), self._getstate()) # <<<<<<<<<<<<<< @@ -7897,7 +7915,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_2__reduce__(struct __pyx_ __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("_basis.HingeBasisFunction.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.HingeBasisFunction.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -7906,17 +7924,17 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_2__reduce__(struct __pyx_ } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_getstate (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_18HingeBasisFunction_4_getstate(((struct __pyx_obj_6_basis_HingeBasisFunction *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_4_getstate(((struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":343 +/* "sklearn/earth/_basis.pyx":343 * return (self.__class__, (pickle_place_holder, 1.0, 1, 1, True, ''), self._getstate()) * * def _getstate(self): # <<<<<<<<<<<<<< @@ -7924,7 +7942,7 @@ static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_5_getstate(PyObject *__py * result.update({'knot': self.knot, */ -static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_4_getstate(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_4_getstate(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *__pyx_v_self) { PyObject *__pyx_v_result = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -7936,7 +7954,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_4_getstate(struct __pyx_o int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_getstate", 0); - /* "_basis.pyx":344 + /* "sklearn/earth/_basis.pyx":344 * * def _getstate(self): * result = super(HingeBasisFunction, self)._getstate() # <<<<<<<<<<<<<< @@ -7945,9 +7963,9 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_4_getstate(struct __pyx_o */ __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_6_basis_HingeBasisFunction))); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_6_basis_HingeBasisFunction))); - __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_6_basis_HingeBasisFunction))); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_HingeBasisFunction))); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_HingeBasisFunction))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_HingeBasisFunction))); __Pyx_INCREF(((PyObject *)__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); @@ -7963,7 +7981,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_4_getstate(struct __pyx_o __pyx_v_result = __pyx_t_2; __pyx_t_2 = 0; - /* "_basis.pyx":345 + /* "sklearn/earth/_basis.pyx":345 * def _getstate(self): * result = super(HingeBasisFunction, self)._getstate() * result.update({'knot': self.knot, # <<<<<<<<<<<<<< @@ -7979,7 +7997,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_4_getstate(struct __pyx_o if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__knot), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "_basis.pyx":346 + /* "sklearn/earth/_basis.pyx":346 * result = super(HingeBasisFunction, self)._getstate() * result.update({'knot': self.knot, * 'knot_idx': self.knot_idx, # <<<<<<<<<<<<<< @@ -7991,7 +8009,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_4_getstate(struct __pyx_o if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__knot_idx), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "_basis.pyx":347 + /* "sklearn/earth/_basis.pyx":347 * result.update({'knot': self.knot, * 'knot_idx': self.knot_idx, * 'variable': self.variable, # <<<<<<<<<<<<<< @@ -8003,7 +8021,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_4_getstate(struct __pyx_o if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__variable), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "_basis.pyx":348 + /* "sklearn/earth/_basis.pyx":348 * 'knot_idx': self.knot_idx, * 'variable': self.variable, * 'reverse': self.reverse, # <<<<<<<<<<<<<< @@ -8015,7 +8033,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_4_getstate(struct __pyx_o if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__reverse), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "_basis.pyx":349 + /* "sklearn/earth/_basis.pyx":349 * 'variable': self.variable, * 'reverse': self.reverse, * 'label': self.label}) # <<<<<<<<<<<<<< @@ -8034,7 +8052,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_4_getstate(struct __pyx_o __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "_basis.pyx":350 + /* "sklearn/earth/_basis.pyx":350 * 'reverse': self.reverse, * 'label': self.label}) * return result # <<<<<<<<<<<<<< @@ -8052,7 +8070,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_4_getstate(struct __pyx_o __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_basis.HingeBasisFunction._getstate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.HingeBasisFunction._getstate", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_result); @@ -8062,17 +8080,17 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_4_getstate(struct __pyx_o } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ -static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_18HingeBasisFunction_6__setstate__(((struct __pyx_obj_6_basis_HingeBasisFunction *)__pyx_v_self), ((PyObject *)__pyx_v_state)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_6__setstate__(((struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self), ((PyObject *)__pyx_v_state)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":352 +/* "sklearn/earth/_basis.pyx":352 * return result * * def __setstate__(self, state): # <<<<<<<<<<<<<< @@ -8080,12 +8098,12 @@ static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_7__setstate__(PyObject *_ * self.knot_idx = state['knot_idx'] */ -static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_6__setstate__(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self, PyObject *__pyx_v_state) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_6__setstate__(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *__pyx_v_self, PyObject *__pyx_v_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __pyx_t_6_basis_FLOAT_t __pyx_t_2; - __pyx_t_6_basis_INDEX_t __pyx_t_3; + __pyx_t_7sklearn_5earth_6_basis_FLOAT_t __pyx_t_2; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_3; int __pyx_t_4; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; @@ -8094,7 +8112,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_6__setstate__(struct __py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate__", 0); - /* "_basis.pyx":353 + /* "sklearn/earth/_basis.pyx":353 * * def __setstate__(self, state): * self.knot = state['knot'] # <<<<<<<<<<<<<< @@ -8107,7 +8125,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_6__setstate__(struct __py __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->knot = __pyx_t_2; - /* "_basis.pyx":354 + /* "sklearn/earth/_basis.pyx":354 * def __setstate__(self, state): * self.knot = state['knot'] * self.knot_idx = state['knot_idx'] # <<<<<<<<<<<<<< @@ -8120,7 +8138,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_6__setstate__(struct __py __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->knot_idx = __pyx_t_3; - /* "_basis.pyx":355 + /* "sklearn/earth/_basis.pyx":355 * self.knot = state['knot'] * self.knot_idx = state['knot_idx'] * self.variable = state['variable'] # <<<<<<<<<<<<<< @@ -8133,7 +8151,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_6__setstate__(struct __py __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->variable = __pyx_t_3; - /* "_basis.pyx":356 + /* "sklearn/earth/_basis.pyx":356 * self.knot_idx = state['knot_idx'] * self.variable = state['variable'] * self.reverse = state['reverse'] # <<<<<<<<<<<<<< @@ -8146,7 +8164,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_6__setstate__(struct __py __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->reverse = __pyx_t_4; - /* "_basis.pyx":357 + /* "sklearn/earth/_basis.pyx":357 * self.variable = state['variable'] * self.reverse = state['reverse'] * self.label = state['label'] # <<<<<<<<<<<<<< @@ -8162,7 +8180,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_6__setstate__(struct __py __pyx_v_self->label = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "_basis.pyx":358 + /* "sklearn/earth/_basis.pyx":358 * self.reverse = state['reverse'] * self.label = state['label'] * super(HingeBasisFunction, self).__setstate__(state) # <<<<<<<<<<<<<< @@ -8171,9 +8189,9 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_6__setstate__(struct __py */ __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_6_basis_HingeBasisFunction))); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_6_basis_HingeBasisFunction))); - __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_6_basis_HingeBasisFunction))); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_HingeBasisFunction))); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_HingeBasisFunction))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_HingeBasisFunction))); __Pyx_INCREF(((PyObject *)__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); @@ -8200,7 +8218,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_6__setstate__(struct __py __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("_basis.HingeBasisFunction.__setstate__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.HingeBasisFunction.__setstate__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -8208,7 +8226,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_6__setstate__(struct __py return __pyx_r; } -/* "_basis.pyx":360 +/* "sklearn/earth/_basis.pyx":360 * super(HingeBasisFunction, self).__setstate__(state) * * cpdef bint has_knot(HingeBasisFunction self): # <<<<<<<<<<<<<< @@ -8216,8 +8234,8 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_6__setstate__(struct __py * */ -static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_9has_knot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static int __pyx_f_6_basis_18HingeBasisFunction_has_knot(CYTHON_UNUSED struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_9has_knot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static int __pyx_f_7sklearn_5earth_6_basis_18HingeBasisFunction_has_knot(CYTHON_UNUSED struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -8233,7 +8251,7 @@ static int __pyx_f_6_basis_18HingeBasisFunction_has_knot(CYTHON_UNUSED struct __ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__has_knot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_18HingeBasisFunction_9has_knot)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_9has_knot)) { __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -8245,7 +8263,7 @@ static int __pyx_f_6_basis_18HingeBasisFunction_has_knot(CYTHON_UNUSED struct __ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_basis.pyx":361 + /* "sklearn/earth/_basis.pyx":361 * * cpdef bint has_knot(HingeBasisFunction self): * return True # <<<<<<<<<<<<<< @@ -8260,7 +8278,7 @@ static int __pyx_f_6_basis_18HingeBasisFunction_has_knot(CYTHON_UNUSED struct __ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_WriteUnraisable("_basis.HingeBasisFunction.has_knot", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("sklearn.earth._basis.HingeBasisFunction.has_knot", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -8268,17 +8286,17 @@ static int __pyx_f_6_basis_18HingeBasisFunction_has_knot(CYTHON_UNUSED struct __ } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_9has_knot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_9has_knot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_9has_knot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_9has_knot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("has_knot (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_18HingeBasisFunction_8has_knot(((struct __pyx_obj_6_basis_HingeBasisFunction *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_8has_knot(((struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":360 +/* "sklearn/earth/_basis.pyx":360 * super(HingeBasisFunction, self).__setstate__(state) * * cpdef bint has_knot(HingeBasisFunction self): # <<<<<<<<<<<<<< @@ -8286,7 +8304,7 @@ static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_9has_knot(PyObject *__pyx * */ -static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_8has_knot(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_8has_knot(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -8295,7 +8313,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_8has_knot(struct __pyx_ob int __pyx_clineno = 0; __Pyx_RefNannySetupContext("has_knot", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_vtabstruct_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.has_knot(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.has_knot(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -8305,7 +8323,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_8has_knot(struct __pyx_ob goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_basis.HingeBasisFunction.has_knot", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.HingeBasisFunction.has_knot", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -8313,7 +8331,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_8has_knot(struct __pyx_ob return __pyx_r; } -/* "_basis.pyx":363 +/* "sklearn/earth/_basis.pyx":363 * return True * * cpdef translate(HingeBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse): # <<<<<<<<<<<<<< @@ -8321,8 +8339,8 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_8has_knot(struct __pyx_ob * if slopes[self.variable] < 0: */ -static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_11translate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_6_basis_18HingeBasisFunction_translate(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts, int __pyx_v_recurse, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_11translate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_7sklearn_5earth_6_basis_18HingeBasisFunction_translate(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts, int __pyx_v_recurse, int __pyx_skip_dispatch) { __Pyx_LocalBuf_ND __pyx_pybuffernd_intercepts; __Pyx_Buffer __pyx_pybuffer_intercepts; __Pyx_LocalBuf_ND __pyx_pybuffernd_slopes; @@ -8332,9 +8350,9 @@ static PyObject *__pyx_f_6_basis_18HingeBasisFunction_translate(struct __pyx_obj PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - __pyx_t_6_basis_INDEX_t __pyx_t_4; - __pyx_t_6_basis_INDEX_t __pyx_t_5; - __pyx_t_6_basis_INDEX_t __pyx_t_6; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_4; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_5; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_6; int __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -8350,12 +8368,12 @@ static PyObject *__pyx_f_6_basis_18HingeBasisFunction_translate(struct __pyx_obj __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; /* Check if called by wrapper */ @@ -8364,7 +8382,7 @@ static PyObject *__pyx_f_6_basis_18HingeBasisFunction_translate(struct __pyx_obj else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__translate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_18HingeBasisFunction_11translate)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_11translate)) { __Pyx_XDECREF(__pyx_r); __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_recurse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -8390,7 +8408,7 @@ static PyObject *__pyx_f_6_basis_18HingeBasisFunction_translate(struct __pyx_obj __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_basis.pyx":364 + /* "sklearn/earth/_basis.pyx":364 * * cpdef translate(HingeBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse): * self.knot = slopes[self.variable]*self.knot + intercepts[self.variable] # <<<<<<<<<<<<<< @@ -8399,9 +8417,9 @@ static PyObject *__pyx_f_6_basis_18HingeBasisFunction_translate(struct __pyx_obj */ __pyx_t_4 = __pyx_v_self->variable; __pyx_t_5 = __pyx_v_self->variable; - __pyx_v_self->knot = (((*__Pyx_BufPtrStrided1d(__pyx_t_6_basis_FLOAT_t *, __pyx_pybuffernd_slopes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_slopes.diminfo[0].strides)) * __pyx_v_self->knot) + (*__Pyx_BufPtrStrided1d(__pyx_t_6_basis_FLOAT_t *, __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_intercepts.diminfo[0].strides))); + __pyx_v_self->knot = (((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_FLOAT_t *, __pyx_pybuffernd_slopes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_slopes.diminfo[0].strides)) * __pyx_v_self->knot) + (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_FLOAT_t *, __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_intercepts.diminfo[0].strides))); - /* "_basis.pyx":365 + /* "sklearn/earth/_basis.pyx":365 * cpdef translate(HingeBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse): * self.knot = slopes[self.variable]*self.knot + intercepts[self.variable] * if slopes[self.variable] < 0: # <<<<<<<<<<<<<< @@ -8409,31 +8427,32 @@ static PyObject *__pyx_f_6_basis_18HingeBasisFunction_translate(struct __pyx_obj * if recurse: */ __pyx_t_6 = __pyx_v_self->variable; - __pyx_t_7 = ((*__Pyx_BufPtrStrided1d(__pyx_t_6_basis_FLOAT_t *, __pyx_pybuffernd_slopes.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_slopes.diminfo[0].strides)) < 0.0); + __pyx_t_7 = (((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_FLOAT_t *, __pyx_pybuffernd_slopes.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_slopes.diminfo[0].strides)) < 0.0) != 0); if (__pyx_t_7) { - /* "_basis.pyx":366 + /* "sklearn/earth/_basis.pyx":366 * self.knot = slopes[self.variable]*self.knot + intercepts[self.variable] * if slopes[self.variable] < 0: * self.reverse = not self.reverse # <<<<<<<<<<<<<< * if recurse: * self.parent.translate(slopes,intercepts) */ - __pyx_v_self->reverse = (!__pyx_v_self->reverse); + __pyx_v_self->reverse = (!(__pyx_v_self->reverse != 0)); goto __pyx_L3; } __pyx_L3:; - /* "_basis.pyx":367 + /* "sklearn/earth/_basis.pyx":367 * if slopes[self.variable] < 0: * self.reverse = not self.reverse * if recurse: # <<<<<<<<<<<<<< * self.parent.translate(slopes,intercepts) * */ - if (__pyx_v_recurse) { + __pyx_t_7 = (__pyx_v_recurse != 0); + if (__pyx_t_7) { - /* "_basis.pyx":368 + /* "sklearn/earth/_basis.pyx":368 * self.reverse = not self.reverse * if recurse: * self.parent.translate(slopes,intercepts) # <<<<<<<<<<<<<< @@ -8470,7 +8489,7 @@ static PyObject *__pyx_f_6_basis_18HingeBasisFunction_translate(struct __pyx_obj __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("_basis.HingeBasisFunction.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.HingeBasisFunction.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; goto __pyx_L2; __pyx_L0:; @@ -8483,8 +8502,8 @@ static PyObject *__pyx_f_6_basis_18HingeBasisFunction_translate(struct __pyx_obj } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_11translate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_11translate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_11translate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_11translate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_slopes = 0; PyArrayObject *__pyx_v_intercepts = 0; int __pyx_v_recurse; @@ -8541,13 +8560,13 @@ static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_11translate(PyObject *__p __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("translate", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_basis.HingeBasisFunction.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.HingeBasisFunction.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_slopes), __pyx_ptype_5numpy_ndarray, 1, "slopes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercepts), __pyx_ptype_5numpy_ndarray, 1, "intercepts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_6_basis_18HingeBasisFunction_10translate(((struct __pyx_obj_6_basis_HingeBasisFunction *)__pyx_v_self), __pyx_v_slopes, __pyx_v_intercepts, __pyx_v_recurse); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_10translate(((struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self), __pyx_v_slopes, __pyx_v_intercepts, __pyx_v_recurse); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -8556,7 +8575,7 @@ static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_11translate(PyObject *__p return __pyx_r; } -/* "_basis.pyx":363 +/* "sklearn/earth/_basis.pyx":363 * return True * * cpdef translate(HingeBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse): # <<<<<<<<<<<<<< @@ -8564,7 +8583,7 @@ static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_11translate(PyObject *__p * if slopes[self.variable] < 0: */ -static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_10translate(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts, int __pyx_v_recurse) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_10translate(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts, int __pyx_v_recurse) { __Pyx_LocalBuf_ND __pyx_pybuffernd_intercepts; __Pyx_Buffer __pyx_pybuffer_intercepts; __Pyx_LocalBuf_ND __pyx_pybuffernd_slopes; @@ -8586,16 +8605,16 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_10translate(struct __pyx_ __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->translate(__pyx_v_self, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), __pyx_v_recurse, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->translate(__pyx_v_self, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), __pyx_v_recurse, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -8610,7 +8629,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_10translate(struct __pyx_ __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("_basis.HingeBasisFunction.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.HingeBasisFunction.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; @@ -8622,7 +8641,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_10translate(struct __pyx_ return __pyx_r; } -/* "_basis.pyx":370 +/* "sklearn/earth/_basis.pyx":370 * self.parent.translate(slopes,intercepts) * * cpdef FLOAT_t scale(HingeBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): # <<<<<<<<<<<<<< @@ -8630,20 +8649,20 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_10translate(struct __pyx_ * result /= slopes[self.variable] */ -static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_13scale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static __pyx_t_6_basis_FLOAT_t __pyx_f_6_basis_18HingeBasisFunction_scale(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_13scale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static __pyx_t_7sklearn_5earth_6_basis_FLOAT_t __pyx_f_7sklearn_5earth_6_basis_18HingeBasisFunction_scale(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts, int __pyx_skip_dispatch) { PyObject *__pyx_v_result = NULL; __Pyx_LocalBuf_ND __pyx_pybuffernd_intercepts; __Pyx_Buffer __pyx_pybuffer_intercepts; __Pyx_LocalBuf_ND __pyx_pybuffernd_slopes; __Pyx_Buffer __pyx_pybuffer_slopes; - __pyx_t_6_basis_FLOAT_t __pyx_r; + __pyx_t_7sklearn_5earth_6_basis_FLOAT_t __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - __pyx_t_6_basis_FLOAT_t __pyx_t_4; - __pyx_t_6_basis_INDEX_t __pyx_t_5; + __pyx_t_7sklearn_5earth_6_basis_FLOAT_t __pyx_t_4; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -8658,12 +8677,12 @@ static __pyx_t_6_basis_FLOAT_t __pyx_f_6_basis_18HingeBasisFunction_scale(struct __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; /* Check if called by wrapper */ @@ -8672,7 +8691,7 @@ static __pyx_t_6_basis_FLOAT_t __pyx_f_6_basis_18HingeBasisFunction_scale(struct else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__scale); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_18HingeBasisFunction_13scale)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_13scale)) { __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_slopes)); @@ -8693,7 +8712,7 @@ static __pyx_t_6_basis_FLOAT_t __pyx_f_6_basis_18HingeBasisFunction_scale(struct __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_basis.pyx":371 + /* "sklearn/earth/_basis.pyx":371 * * cpdef FLOAT_t scale(HingeBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): * result = self.parent.scale(slopes,intercepts) # <<<<<<<<<<<<<< @@ -8717,7 +8736,7 @@ static __pyx_t_6_basis_FLOAT_t __pyx_f_6_basis_18HingeBasisFunction_scale(struct __pyx_v_result = __pyx_t_2; __pyx_t_2 = 0; - /* "_basis.pyx":372 + /* "sklearn/earth/_basis.pyx":372 * cpdef FLOAT_t scale(HingeBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): * result = self.parent.scale(slopes,intercepts) * result /= slopes[self.variable] # <<<<<<<<<<<<<< @@ -8725,7 +8744,7 @@ static __pyx_t_6_basis_FLOAT_t __pyx_f_6_basis_18HingeBasisFunction_scale(struct * */ __pyx_t_5 = __pyx_v_self->variable; - __pyx_t_2 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_6_basis_FLOAT_t *, __pyx_pybuffernd_slopes.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_slopes.diminfo[0].strides))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_FLOAT_t *, __pyx_pybuffernd_slopes.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_slopes.diminfo[0].strides))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyNumber_InPlaceDivide(__pyx_v_result, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); @@ -8734,7 +8753,7 @@ static __pyx_t_6_basis_FLOAT_t __pyx_f_6_basis_18HingeBasisFunction_scale(struct __pyx_v_result = __pyx_t_3; __pyx_t_3 = 0; - /* "_basis.pyx":373 + /* "sklearn/earth/_basis.pyx":373 * result = self.parent.scale(slopes,intercepts) * result /= slopes[self.variable] * return result # <<<<<<<<<<<<<< @@ -8756,7 +8775,7 @@ static __pyx_t_6_basis_FLOAT_t __pyx_f_6_basis_18HingeBasisFunction_scale(struct __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_WriteUnraisable("_basis.HingeBasisFunction.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("sklearn.earth._basis.HingeBasisFunction.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; goto __pyx_L2; __pyx_L0:; @@ -8769,8 +8788,8 @@ static __pyx_t_6_basis_FLOAT_t __pyx_f_6_basis_18HingeBasisFunction_scale(struct } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_13scale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_13scale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_13scale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_13scale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_slopes = 0; PyArrayObject *__pyx_v_intercepts = 0; int __pyx_lineno = 0; @@ -8818,13 +8837,13 @@ static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_13scale(PyObject *__pyx_v __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("scale", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_basis.HingeBasisFunction.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.HingeBasisFunction.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_slopes), __pyx_ptype_5numpy_ndarray, 1, "slopes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercepts), __pyx_ptype_5numpy_ndarray, 1, "intercepts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_6_basis_18HingeBasisFunction_12scale(((struct __pyx_obj_6_basis_HingeBasisFunction *)__pyx_v_self), __pyx_v_slopes, __pyx_v_intercepts); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_12scale(((struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self), __pyx_v_slopes, __pyx_v_intercepts); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -8833,7 +8852,7 @@ static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_13scale(PyObject *__pyx_v return __pyx_r; } -/* "_basis.pyx":370 +/* "sklearn/earth/_basis.pyx":370 * self.parent.translate(slopes,intercepts) * * cpdef FLOAT_t scale(HingeBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): # <<<<<<<<<<<<<< @@ -8841,7 +8860,7 @@ static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_13scale(PyObject *__pyx_v * result /= slopes[self.variable] */ -static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_12scale(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_12scale(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts) { __Pyx_LocalBuf_ND __pyx_pybuffernd_intercepts; __Pyx_Buffer __pyx_pybuffer_intercepts; __Pyx_LocalBuf_ND __pyx_pybuffernd_slopes; @@ -8863,16 +8882,16 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_12scale(struct __pyx_obj_ __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->scale(__pyx_v_self, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->scale(__pyx_v_self, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -8887,7 +8906,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_12scale(struct __pyx_obj_ __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("_basis.HingeBasisFunction.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.HingeBasisFunction.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; @@ -8900,17 +8919,17 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_12scale(struct __pyx_obj_ } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_15__str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_15__str__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_15__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_15__str__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_18HingeBasisFunction_14__str__(((struct __pyx_obj_6_basis_HingeBasisFunction *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_14__str__(((struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":375 +/* "sklearn/earth/_basis.pyx":375 * return result * * def __str__(self): # <<<<<<<<<<<<<< @@ -8918,21 +8937,22 @@ static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_15__str__(PyObject *__pyx * if self.variable is not None: */ -static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_14__str__(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_14__str__(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *__pyx_v_self) { PyObject *__pyx_v_result = NULL; PyObject *__pyx_v_parent = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; - PyObject *__pyx_t_3 = NULL; + int __pyx_t_3; PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - /* "_basis.pyx":376 + /* "sklearn/earth/_basis.pyx":376 * * def __str__(self): * result = '' # <<<<<<<<<<<<<< @@ -8942,7 +8962,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_14__str__(struct __pyx_ob __Pyx_INCREF(((PyObject *)__pyx_kp_s_2)); __pyx_v_result = ((PyObject *)__pyx_kp_s_2); - /* "_basis.pyx":377 + /* "sklearn/earth/_basis.pyx":377 * def __str__(self): * result = '' * if self.variable is not None: # <<<<<<<<<<<<<< @@ -8953,29 +8973,30 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_14__str__(struct __pyx_ob __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = (__pyx_t_1 != Py_None); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { + __pyx_t_3 = (__pyx_t_2 != 0); + if (__pyx_t_3) { - /* "_basis.pyx":378 + /* "sklearn/earth/_basis.pyx":378 * result = '' * if self.variable is not None: * if not self.reverse: # <<<<<<<<<<<<<< * if self.knot >= 0: * result = 'h(%s-%G)' % (self.label,self.knot) */ - __pyx_t_2 = (!__pyx_v_self->reverse); - if (__pyx_t_2) { + __pyx_t_3 = ((!(__pyx_v_self->reverse != 0)) != 0); + if (__pyx_t_3) { - /* "_basis.pyx":379 + /* "sklearn/earth/_basis.pyx":379 * if self.variable is not None: * if not self.reverse: * if self.knot >= 0: # <<<<<<<<<<<<<< * result = 'h(%s-%G)' % (self.label,self.knot) * else: */ - __pyx_t_2 = (__pyx_v_self->knot >= 0.0); - if (__pyx_t_2) { + __pyx_t_3 = ((__pyx_v_self->knot >= 0.0) != 0); + if (__pyx_t_3) { - /* "_basis.pyx":380 + /* "sklearn/earth/_basis.pyx":380 * if not self.reverse: * if self.knot >= 0: * result = 'h(%s-%G)' % (self.label,self.knot) # <<<<<<<<<<<<<< @@ -8984,17 +9005,17 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_14__str__(struct __pyx_ob */ __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->knot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(((PyObject *)__pyx_v_self->label)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self->label)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_self->label)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self->label)); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_3), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_3), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_v_result); __pyx_v_result = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; @@ -9002,7 +9023,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_14__str__(struct __pyx_ob } /*else*/ { - /* "_basis.pyx":382 + /* "sklearn/earth/_basis.pyx":382 * result = 'h(%s-%G)' % (self.label,self.knot) * else: * result = 'h(%s+%G)' % (self.label,-self.knot) # <<<<<<<<<<<<<< @@ -9011,17 +9032,17 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_14__str__(struct __pyx_ob */ __pyx_t_1 = PyFloat_FromDouble((-__pyx_v_self->knot)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(((PyObject *)__pyx_v_self->label)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self->label)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_self->label)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self->label)); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_4), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_4), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_v_result); __pyx_v_result = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; @@ -9031,7 +9052,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_14__str__(struct __pyx_ob } /*else*/ { - /* "_basis.pyx":384 + /* "sklearn/earth/_basis.pyx":384 * result = 'h(%s+%G)' % (self.label,-self.knot) * else: * result = 'h(%G-%s)' % (self.knot,self.label) # <<<<<<<<<<<<<< @@ -9040,17 +9061,17 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_14__str__(struct __pyx_ob */ __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->knot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_self->label)); - PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_self->label)); + PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_self->label)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self->label)); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_v_result); __pyx_v_result = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; @@ -9060,28 +9081,28 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_14__str__(struct __pyx_ob } __pyx_L3:; - /* "_basis.pyx":385 + /* "sklearn/earth/_basis.pyx":385 * else: * result = 'h(%G-%s)' % (self.knot,self.label) * parent = str(self.parent) if not self.parent.__class__ is ConstantBasisFunction else '' # <<<<<<<<<<<<<< * if parent != '': * result += '*%s' % (str(self.parent),) */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx_base.parent), __pyx_n_s____class__); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = (__pyx_t_3 == ((PyObject *)((PyObject*)__pyx_ptype_6_basis_ConstantBasisFunction))); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if ((!__pyx_t_2)) { - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx_base.parent), __pyx_n_s____class__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = (__pyx_t_4 == ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_ConstantBasisFunction))); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (((!(__pyx_t_3 != 0)) != 0)) { + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.parent)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self->__pyx_base.parent)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_self->__pyx_base.parent)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.parent)); - __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_1 = __pyx_t_4; - __pyx_t_4 = 0; + __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __pyx_t_1 = __pyx_t_5; + __pyx_t_5 = 0; } else { __Pyx_INCREF(((PyObject *)__pyx_kp_s_2)); __pyx_t_1 = ((PyObject *)__pyx_kp_s_2); @@ -9089,7 +9110,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_14__str__(struct __pyx_ob __pyx_v_parent = __pyx_t_1; __pyx_t_1 = 0; - /* "_basis.pyx":386 + /* "sklearn/earth/_basis.pyx":386 * result = 'h(%G-%s)' % (self.knot,self.label) * parent = str(self.parent) if not self.parent.__class__ is ConstantBasisFunction else '' * if parent != '': # <<<<<<<<<<<<<< @@ -9097,11 +9118,11 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_14__str__(struct __pyx_ob * return result */ __pyx_t_1 = PyObject_RichCompare(__pyx_v_parent, ((PyObject *)__pyx_kp_s_2), Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_2) { + if (__pyx_t_3) { - /* "_basis.pyx":387 + /* "sklearn/earth/_basis.pyx":387 * parent = str(self.parent) if not self.parent.__class__ is ConstantBasisFunction else '' * if parent != '': * result += '*%s' % (str(self.parent),) # <<<<<<<<<<<<<< @@ -9113,20 +9134,20 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_14__str__(struct __pyx_ob __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.parent)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self->__pyx_base.parent)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.parent)); - __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_6), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_6), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_v_result); __pyx_v_result = __pyx_t_1; __pyx_t_1 = 0; @@ -9134,7 +9155,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_14__str__(struct __pyx_ob } __pyx_L6:; - /* "_basis.pyx":388 + /* "sklearn/earth/_basis.pyx":388 * if parent != '': * result += '*%s' % (str(self.parent),) * return result # <<<<<<<<<<<<<< @@ -9150,9 +9171,9 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_14__str__(struct __pyx_ob goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_basis.HingeBasisFunction.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("sklearn.earth._basis.HingeBasisFunction.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_result); @@ -9162,7 +9183,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_14__str__(struct __pyx_ob return __pyx_r; } -/* "_basis.pyx":390 +/* "sklearn/earth/_basis.pyx":390 * return result * * cpdef INDEX_t get_variable(self): # <<<<<<<<<<<<<< @@ -9170,13 +9191,13 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_14__str__(struct __pyx_ob * */ -static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_17get_variable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static __pyx_t_6_basis_INDEX_t __pyx_f_6_basis_18HingeBasisFunction_get_variable(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { - __pyx_t_6_basis_INDEX_t __pyx_r; +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_17get_variable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_f_7sklearn_5earth_6_basis_18HingeBasisFunction_get_variable(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - __pyx_t_6_basis_INDEX_t __pyx_t_3; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -9187,7 +9208,7 @@ static __pyx_t_6_basis_INDEX_t __pyx_f_6_basis_18HingeBasisFunction_get_variable else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_variable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_18HingeBasisFunction_17get_variable)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_17get_variable)) { __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -9199,7 +9220,7 @@ static __pyx_t_6_basis_INDEX_t __pyx_f_6_basis_18HingeBasisFunction_get_variable __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_basis.pyx":391 + /* "sklearn/earth/_basis.pyx":391 * * cpdef INDEX_t get_variable(self): * return self.variable # <<<<<<<<<<<<<< @@ -9214,7 +9235,7 @@ static __pyx_t_6_basis_INDEX_t __pyx_f_6_basis_18HingeBasisFunction_get_variable __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_WriteUnraisable("_basis.HingeBasisFunction.get_variable", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("sklearn.earth._basis.HingeBasisFunction.get_variable", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -9222,17 +9243,17 @@ static __pyx_t_6_basis_INDEX_t __pyx_f_6_basis_18HingeBasisFunction_get_variable } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_17get_variable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_17get_variable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_17get_variable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_17get_variable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_variable (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_18HingeBasisFunction_16get_variable(((struct __pyx_obj_6_basis_HingeBasisFunction *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_16get_variable(((struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":390 +/* "sklearn/earth/_basis.pyx":390 * return result * * cpdef INDEX_t get_variable(self): # <<<<<<<<<<<<<< @@ -9240,7 +9261,7 @@ static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_17get_variable(PyObject * * */ -static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_16get_variable(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_16get_variable(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -9249,7 +9270,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_16get_variable(struct __p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_variable", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_variable(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_variable(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -9259,7 +9280,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_16get_variable(struct __p goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_basis.HingeBasisFunction.get_variable", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.HingeBasisFunction.get_variable", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -9267,7 +9288,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_16get_variable(struct __p return __pyx_r; } -/* "_basis.pyx":393 +/* "sklearn/earth/_basis.pyx":393 * return self.variable * * cpdef FLOAT_t get_knot(self): # <<<<<<<<<<<<<< @@ -9275,13 +9296,13 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_16get_variable(struct __p * */ -static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_19get_knot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static __pyx_t_6_basis_FLOAT_t __pyx_f_6_basis_18HingeBasisFunction_get_knot(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { - __pyx_t_6_basis_FLOAT_t __pyx_r; +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_19get_knot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static __pyx_t_7sklearn_5earth_6_basis_FLOAT_t __pyx_f_7sklearn_5earth_6_basis_18HingeBasisFunction_get_knot(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { + __pyx_t_7sklearn_5earth_6_basis_FLOAT_t __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - __pyx_t_6_basis_FLOAT_t __pyx_t_3; + __pyx_t_7sklearn_5earth_6_basis_FLOAT_t __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -9292,7 +9313,7 @@ static __pyx_t_6_basis_FLOAT_t __pyx_f_6_basis_18HingeBasisFunction_get_knot(str else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_knot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_18HingeBasisFunction_19get_knot)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_19get_knot)) { __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -9304,7 +9325,7 @@ static __pyx_t_6_basis_FLOAT_t __pyx_f_6_basis_18HingeBasisFunction_get_knot(str __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_basis.pyx":394 + /* "sklearn/earth/_basis.pyx":394 * * cpdef FLOAT_t get_knot(self): * return self.knot # <<<<<<<<<<<<<< @@ -9319,7 +9340,7 @@ static __pyx_t_6_basis_FLOAT_t __pyx_f_6_basis_18HingeBasisFunction_get_knot(str __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_WriteUnraisable("_basis.HingeBasisFunction.get_knot", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("sklearn.earth._basis.HingeBasisFunction.get_knot", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -9327,17 +9348,17 @@ static __pyx_t_6_basis_FLOAT_t __pyx_f_6_basis_18HingeBasisFunction_get_knot(str } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_19get_knot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_19get_knot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_19get_knot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_19get_knot(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_knot (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_18HingeBasisFunction_18get_knot(((struct __pyx_obj_6_basis_HingeBasisFunction *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_18get_knot(((struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":393 +/* "sklearn/earth/_basis.pyx":393 * return self.variable * * cpdef FLOAT_t get_knot(self): # <<<<<<<<<<<<<< @@ -9345,7 +9366,7 @@ static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_19get_knot(PyObject *__py * */ -static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_18get_knot(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_18get_knot(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -9354,7 +9375,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_18get_knot(struct __pyx_o int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_knot", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_knot(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_knot(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -9364,7 +9385,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_18get_knot(struct __pyx_o goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_basis.HingeBasisFunction.get_knot", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.HingeBasisFunction.get_knot", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -9372,7 +9393,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_18get_knot(struct __pyx_o return __pyx_r; } -/* "_basis.pyx":396 +/* "sklearn/earth/_basis.pyx":396 * return self.knot * * cpdef bint get_reverse(self): # <<<<<<<<<<<<<< @@ -9380,8 +9401,8 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_18get_knot(struct __pyx_o * */ -static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_21get_reverse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static int __pyx_f_6_basis_18HingeBasisFunction_get_reverse(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_21get_reverse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static int __pyx_f_7sklearn_5earth_6_basis_18HingeBasisFunction_get_reverse(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -9397,7 +9418,7 @@ static int __pyx_f_6_basis_18HingeBasisFunction_get_reverse(struct __pyx_obj_6_b else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_reverse); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_18HingeBasisFunction_21get_reverse)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_21get_reverse)) { __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -9409,7 +9430,7 @@ static int __pyx_f_6_basis_18HingeBasisFunction_get_reverse(struct __pyx_obj_6_b __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_basis.pyx":397 + /* "sklearn/earth/_basis.pyx":397 * * cpdef bint get_reverse(self): * return self.reverse # <<<<<<<<<<<<<< @@ -9424,7 +9445,7 @@ static int __pyx_f_6_basis_18HingeBasisFunction_get_reverse(struct __pyx_obj_6_b __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_WriteUnraisable("_basis.HingeBasisFunction.get_reverse", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("sklearn.earth._basis.HingeBasisFunction.get_reverse", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -9432,17 +9453,17 @@ static int __pyx_f_6_basis_18HingeBasisFunction_get_reverse(struct __pyx_obj_6_b } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_21get_reverse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_21get_reverse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_21get_reverse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_21get_reverse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_reverse (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_18HingeBasisFunction_20get_reverse(((struct __pyx_obj_6_basis_HingeBasisFunction *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_20get_reverse(((struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":396 +/* "sklearn/earth/_basis.pyx":396 * return self.knot * * cpdef bint get_reverse(self): # <<<<<<<<<<<<<< @@ -9450,7 +9471,7 @@ static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_21get_reverse(PyObject *_ * */ -static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_20get_reverse(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_20get_reverse(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -9459,7 +9480,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_20get_reverse(struct __py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_reverse", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_vtabstruct_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_reverse(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_reverse(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -9469,7 +9490,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_20get_reverse(struct __py goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_basis.HingeBasisFunction.get_reverse", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.HingeBasisFunction.get_reverse", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -9477,7 +9498,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_20get_reverse(struct __py return __pyx_r; } -/* "_basis.pyx":399 +/* "sklearn/earth/_basis.pyx":399 * return self.reverse * * cpdef INDEX_t get_knot_idx(self): # <<<<<<<<<<<<<< @@ -9485,13 +9506,13 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_20get_reverse(struct __py * */ -static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_23get_knot_idx(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static __pyx_t_6_basis_INDEX_t __pyx_f_6_basis_18HingeBasisFunction_get_knot_idx(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { - __pyx_t_6_basis_INDEX_t __pyx_r; +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_23get_knot_idx(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_f_7sklearn_5earth_6_basis_18HingeBasisFunction_get_knot_idx(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - __pyx_t_6_basis_INDEX_t __pyx_t_3; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -9502,7 +9523,7 @@ static __pyx_t_6_basis_INDEX_t __pyx_f_6_basis_18HingeBasisFunction_get_knot_idx else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_knot_idx); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_18HingeBasisFunction_23get_knot_idx)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_23get_knot_idx)) { __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -9514,7 +9535,7 @@ static __pyx_t_6_basis_INDEX_t __pyx_f_6_basis_18HingeBasisFunction_get_knot_idx __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_basis.pyx":400 + /* "sklearn/earth/_basis.pyx":400 * * cpdef INDEX_t get_knot_idx(self): * return self.knot_idx # <<<<<<<<<<<<<< @@ -9529,7 +9550,7 @@ static __pyx_t_6_basis_INDEX_t __pyx_f_6_basis_18HingeBasisFunction_get_knot_idx __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_WriteUnraisable("_basis.HingeBasisFunction.get_knot_idx", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("sklearn.earth._basis.HingeBasisFunction.get_knot_idx", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -9537,17 +9558,17 @@ static __pyx_t_6_basis_INDEX_t __pyx_f_6_basis_18HingeBasisFunction_get_knot_idx } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_23get_knot_idx(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_23get_knot_idx(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_23get_knot_idx(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_23get_knot_idx(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_knot_idx (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_18HingeBasisFunction_22get_knot_idx(((struct __pyx_obj_6_basis_HingeBasisFunction *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_22get_knot_idx(((struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":399 +/* "sklearn/earth/_basis.pyx":399 * return self.reverse * * cpdef INDEX_t get_knot_idx(self): # <<<<<<<<<<<<<< @@ -9555,7 +9576,7 @@ static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_23get_knot_idx(PyObject * * */ -static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_22get_knot_idx(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_22get_knot_idx(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -9564,7 +9585,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_22get_knot_idx(struct __p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_knot_idx", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_knot_idx(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_knot_idx(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -9574,7 +9595,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_22get_knot_idx(struct __p goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_basis.HingeBasisFunction.get_knot_idx", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.HingeBasisFunction.get_knot_idx", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -9582,7 +9603,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_22get_knot_idx(struct __p return __pyx_r; } -/* "_basis.pyx":402 +/* "sklearn/earth/_basis.pyx":402 * return self.knot_idx * * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = True): # <<<<<<<<<<<<<< @@ -9590,12 +9611,12 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_22get_knot_idx(struct __p * X - Data matrix */ -static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_25apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_6_basis_18HingeBasisFunction_apply(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_b, int __pyx_skip_dispatch, struct __pyx_opt_args_6_basis_18HingeBasisFunction_apply *__pyx_optional_args) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_25apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_7sklearn_5earth_6_basis_18HingeBasisFunction_apply(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_b, int __pyx_skip_dispatch, struct __pyx_opt_args_7sklearn_5earth_6_basis_18HingeBasisFunction_apply *__pyx_optional_args) { int __pyx_v_recurse = ((int)1); - __pyx_t_6_basis_INDEX_t __pyx_v_i; - __pyx_t_6_basis_INDEX_t __pyx_v_m; - __pyx_t_6_basis_FLOAT_t __pyx_v_tmp; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_i; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_m; + __pyx_t_7sklearn_5earth_6_basis_FLOAT_t __pyx_v_tmp; __Pyx_LocalBuf_ND __pyx_pybuffernd_X; __Pyx_Buffer __pyx_pybuffer_X; __Pyx_LocalBuf_ND __pyx_pybuffernd_b; @@ -9605,17 +9626,17 @@ static PyObject *__pyx_f_6_basis_18HingeBasisFunction_apply(struct __pyx_obj_6_b PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - struct __pyx_opt_args_6_basis_13BasisFunction_apply __pyx_t_4; - Py_ssize_t __pyx_t_5; - __pyx_t_6_basis_INDEX_t __pyx_t_6; - __pyx_t_6_basis_INDEX_t __pyx_t_7; - __pyx_t_6_basis_INDEX_t __pyx_t_8; - __pyx_t_6_basis_INDEX_t __pyx_t_9; - int __pyx_t_10; - __pyx_t_6_basis_INDEX_t __pyx_t_11; - __pyx_t_6_basis_INDEX_t __pyx_t_12; - __pyx_t_6_basis_INDEX_t __pyx_t_13; - __pyx_t_6_basis_INDEX_t __pyx_t_14; + int __pyx_t_4; + struct __pyx_opt_args_7sklearn_5earth_6_basis_13BasisFunction_apply __pyx_t_5; + Py_ssize_t __pyx_t_6; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_7; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_8; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_9; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_10; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_11; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_12; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_13; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_14; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -9635,12 +9656,12 @@ static PyObject *__pyx_f_6_basis_18HingeBasisFunction_apply(struct __pyx_obj_6_b __pyx_pybuffernd_b.rcbuffer = &__pyx_pybuffer_b; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)__pyx_v_b, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)__pyx_v_b, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_b.diminfo[0].strides = __pyx_pybuffernd_b.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_b.diminfo[0].shape = __pyx_pybuffernd_b.rcbuffer->pybuffer.shape[0]; /* Check if called by wrapper */ @@ -9649,7 +9670,7 @@ static PyObject *__pyx_f_6_basis_18HingeBasisFunction_apply(struct __pyx_obj_6_b else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__apply); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_18HingeBasisFunction_25apply)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_25apply)) { __Pyx_XDECREF(__pyx_r); __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_recurse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -9675,95 +9696,97 @@ static PyObject *__pyx_f_6_basis_18HingeBasisFunction_apply(struct __pyx_obj_6_b __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_basis.pyx":409 + /* "sklearn/earth/_basis.pyx":409 * parent function. * ''' * if recurse: # <<<<<<<<<<<<<< * self.parent.apply(X,b,recurse=True) * cdef INDEX_t i #@DuplicatedSignature */ - if (__pyx_v_recurse) { + __pyx_t_4 = (__pyx_v_recurse != 0); + if (__pyx_t_4) { - /* "_basis.pyx":410 + /* "sklearn/earth/_basis.pyx":410 * ''' * if recurse: * self.parent.apply(X,b,recurse=True) # <<<<<<<<<<<<<< * cdef INDEX_t i #@DuplicatedSignature * cdef INDEX_t m = len(b) #@DuplicatedSignature */ - __pyx_t_4.__pyx_n = 1; - __pyx_t_4.recurse = 1; - __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_self->__pyx_base.parent->__pyx_vtab)->apply(__pyx_v_self->__pyx_base.parent, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_b), 0, &__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5.__pyx_n = 1; + __pyx_t_5.recurse = 1; + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self->__pyx_base.parent->__pyx_vtab)->apply(__pyx_v_self->__pyx_base.parent, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_b), 0, &__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L3; } __pyx_L3:; - /* "_basis.pyx":412 + /* "sklearn/earth/_basis.pyx":412 * self.parent.apply(X,b,recurse=True) * cdef INDEX_t i #@DuplicatedSignature * cdef INDEX_t m = len(b) #@DuplicatedSignature # <<<<<<<<<<<<<< * cdef FLOAT_t tmp * if self.reverse: */ - __pyx_t_5 = PyObject_Length(((PyObject *)__pyx_v_b)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_m = __pyx_t_5; + __pyx_t_6 = PyObject_Length(((PyObject *)__pyx_v_b)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_m = __pyx_t_6; - /* "_basis.pyx":414 + /* "sklearn/earth/_basis.pyx":414 * cdef INDEX_t m = len(b) #@DuplicatedSignature * cdef FLOAT_t tmp * if self.reverse: # <<<<<<<<<<<<<< * for i in range(m): * tmp = self.knot - X[i,self.variable] */ - if (__pyx_v_self->reverse) { + __pyx_t_4 = (__pyx_v_self->reverse != 0); + if (__pyx_t_4) { - /* "_basis.pyx":415 + /* "sklearn/earth/_basis.pyx":415 * cdef FLOAT_t tmp * if self.reverse: * for i in range(m): # <<<<<<<<<<<<<< * tmp = self.knot - X[i,self.variable] * if tmp < 0: */ - __pyx_t_6 = __pyx_v_m; - for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { - __pyx_v_i = __pyx_t_7; + __pyx_t_7 = __pyx_v_m; + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { + __pyx_v_i = __pyx_t_8; - /* "_basis.pyx":416 + /* "sklearn/earth/_basis.pyx":416 * if self.reverse: * for i in range(m): * tmp = self.knot - X[i,self.variable] # <<<<<<<<<<<<<< * if tmp < 0: * tmp = 0.0 */ - __pyx_t_8 = __pyx_v_i; - __pyx_t_9 = __pyx_v_self->variable; - __pyx_v_tmp = (__pyx_v_self->knot - (*__Pyx_BufPtrStrided2d(__pyx_t_6_basis_FLOAT_t *, __pyx_pybuffernd_X.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_X.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_X.diminfo[1].strides))); + __pyx_t_9 = __pyx_v_i; + __pyx_t_10 = __pyx_v_self->variable; + __pyx_v_tmp = (__pyx_v_self->knot - (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_6_basis_FLOAT_t *, __pyx_pybuffernd_X.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_X.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_X.diminfo[1].strides))); - /* "_basis.pyx":417 + /* "sklearn/earth/_basis.pyx":417 * for i in range(m): * tmp = self.knot - X[i,self.variable] * if tmp < 0: # <<<<<<<<<<<<<< * tmp = 0.0 * b[i] *= tmp */ - __pyx_t_10 = (__pyx_v_tmp < 0.0); - if (__pyx_t_10) { + __pyx_t_4 = ((__pyx_v_tmp < 0.0) != 0); + if (__pyx_t_4) { - /* "_basis.pyx":418 + /* "sklearn/earth/_basis.pyx":418 * tmp = self.knot - X[i,self.variable] * if tmp < 0: * tmp = 0.0 # <<<<<<<<<<<<<< * b[i] *= tmp * else: */ - __pyx_v_tmp = ((__pyx_t_6_basis_FLOAT_t)0.0); + __pyx_v_tmp = ((__pyx_t_7sklearn_5earth_6_basis_FLOAT_t)0.0); goto __pyx_L7; } __pyx_L7:; - /* "_basis.pyx":419 + /* "sklearn/earth/_basis.pyx":419 * if tmp < 0: * tmp = 0.0 * b[i] *= tmp # <<<<<<<<<<<<<< @@ -9771,24 +9794,24 @@ static PyObject *__pyx_f_6_basis_18HingeBasisFunction_apply(struct __pyx_obj_6_b * for i in range(m): */ __pyx_t_11 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_6_basis_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_b.diminfo[0].strides) *= __pyx_v_tmp; + *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_b.diminfo[0].strides) *= __pyx_v_tmp; } goto __pyx_L4; } /*else*/ { - /* "_basis.pyx":421 + /* "sklearn/earth/_basis.pyx":421 * b[i] *= tmp * else: * for i in range(m): # <<<<<<<<<<<<<< * tmp = X[i,self.variable] - self.knot * if tmp < 0: */ - __pyx_t_6 = __pyx_v_m; - for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { - __pyx_v_i = __pyx_t_7; + __pyx_t_7 = __pyx_v_m; + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { + __pyx_v_i = __pyx_t_8; - /* "_basis.pyx":422 + /* "sklearn/earth/_basis.pyx":422 * else: * for i in range(m): * tmp = X[i,self.variable] - self.knot # <<<<<<<<<<<<<< @@ -9797,31 +9820,31 @@ static PyObject *__pyx_f_6_basis_18HingeBasisFunction_apply(struct __pyx_obj_6_b */ __pyx_t_12 = __pyx_v_i; __pyx_t_13 = __pyx_v_self->variable; - __pyx_v_tmp = ((*__Pyx_BufPtrStrided2d(__pyx_t_6_basis_FLOAT_t *, __pyx_pybuffernd_X.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_X.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_X.diminfo[1].strides)) - __pyx_v_self->knot); + __pyx_v_tmp = ((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_6_basis_FLOAT_t *, __pyx_pybuffernd_X.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_X.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_X.diminfo[1].strides)) - __pyx_v_self->knot); - /* "_basis.pyx":423 + /* "sklearn/earth/_basis.pyx":423 * for i in range(m): * tmp = X[i,self.variable] - self.knot * if tmp < 0: # <<<<<<<<<<<<<< * tmp = 0.0 * b[i] *= tmp */ - __pyx_t_10 = (__pyx_v_tmp < 0.0); - if (__pyx_t_10) { + __pyx_t_4 = ((__pyx_v_tmp < 0.0) != 0); + if (__pyx_t_4) { - /* "_basis.pyx":424 + /* "sklearn/earth/_basis.pyx":424 * tmp = X[i,self.variable] - self.knot * if tmp < 0: * tmp = 0.0 # <<<<<<<<<<<<<< * b[i] *= tmp * */ - __pyx_v_tmp = ((__pyx_t_6_basis_FLOAT_t)0.0); + __pyx_v_tmp = ((__pyx_t_7sklearn_5earth_6_basis_FLOAT_t)0.0); goto __pyx_L10; } __pyx_L10:; - /* "_basis.pyx":425 + /* "sklearn/earth/_basis.pyx":425 * if tmp < 0: * tmp = 0.0 * b[i] *= tmp # <<<<<<<<<<<<<< @@ -9829,7 +9852,7 @@ static PyObject *__pyx_f_6_basis_18HingeBasisFunction_apply(struct __pyx_obj_6_b * cdef class LinearBasisFunction(BasisFunction): */ __pyx_t_14 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_6_basis_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_b.diminfo[0].strides) *= __pyx_v_tmp; + *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_b.diminfo[0].strides) *= __pyx_v_tmp; } } __pyx_L4:; @@ -9845,7 +9868,7 @@ static PyObject *__pyx_f_6_basis_18HingeBasisFunction_apply(struct __pyx_obj_6_b __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_b.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("_basis.HingeBasisFunction.apply", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.HingeBasisFunction.apply", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; goto __pyx_L2; __pyx_L0:; @@ -9858,9 +9881,9 @@ static PyObject *__pyx_f_6_basis_18HingeBasisFunction_apply(struct __pyx_obj_6_b } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_25apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_6_basis_18HingeBasisFunction_24apply[] = "\n X - Data matrix\n b - parent vector\n recurse - If False, assume b already contains the result of the parent function. Otherwise, recurse to compute\n parent function.\n "; -static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_25apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_25apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7sklearn_5earth_6_basis_18HingeBasisFunction_24apply[] = "\n X - Data matrix\n b - parent vector\n recurse - If False, assume b already contains the result of the parent function. Otherwise, recurse to compute\n parent function.\n "; +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_25apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_X = 0; PyArrayObject *__pyx_v_b = 0; int __pyx_v_recurse; @@ -9917,7 +9940,7 @@ static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_25apply(PyObject *__pyx_v __pyx_v_recurse = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_recurse == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - /* "_basis.pyx":402 + /* "sklearn/earth/_basis.pyx":402 * return self.knot_idx * * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = True): # <<<<<<<<<<<<<< @@ -9931,13 +9954,13 @@ static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_25apply(PyObject *__pyx_v __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("apply", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_basis.HingeBasisFunction.apply", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.HingeBasisFunction.apply", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_5numpy_ndarray, 1, "b", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_6_basis_18HingeBasisFunction_24apply(((struct __pyx_obj_6_basis_HingeBasisFunction *)__pyx_v_self), __pyx_v_X, __pyx_v_b, __pyx_v_recurse); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_24apply(((struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self), __pyx_v_X, __pyx_v_b, __pyx_v_recurse); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -9946,7 +9969,7 @@ static PyObject *__pyx_pw_6_basis_18HingeBasisFunction_25apply(PyObject *__pyx_v return __pyx_r; } -static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_24apply(struct __pyx_obj_6_basis_HingeBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_b, int __pyx_v_recurse) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_24apply(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_b, int __pyx_v_recurse) { __Pyx_LocalBuf_ND __pyx_pybuffernd_X; __Pyx_Buffer __pyx_pybuffer_X; __Pyx_LocalBuf_ND __pyx_pybuffernd_b; @@ -9954,7 +9977,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_24apply(struct __pyx_obj_ PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - struct __pyx_opt_args_6_basis_13BasisFunction_apply __pyx_t_2; + struct __pyx_opt_args_7sklearn_5earth_6_basis_13BasisFunction_apply __pyx_t_2; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -9969,18 +9992,18 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_24apply(struct __pyx_obj_ __pyx_pybuffernd_b.rcbuffer = &__pyx_pybuffer_b; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)__pyx_v_b, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)__pyx_v_b, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_b.diminfo[0].strides = __pyx_pybuffernd_b.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_b.diminfo[0].shape = __pyx_pybuffernd_b.rcbuffer->pybuffer.shape[0]; __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 1; __pyx_t_2.recurse = __pyx_v_recurse; - __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.apply(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self), ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_b), 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.apply(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self), ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_b), 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -9995,7 +10018,7 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_24apply(struct __pyx_obj_ __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_b.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("_basis.HingeBasisFunction.apply", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.HingeBasisFunction.apply", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; @@ -10008,10 +10031,10 @@ static PyObject *__pyx_pf_6_basis_18HingeBasisFunction_24apply(struct __pyx_obj_ } /* Python wrapper */ -static int __pyx_pw_6_basis_19LinearBasisFunction_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_6_basis_19LinearBasisFunction_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_6_basis_BasisFunction *__pyx_v_parent = 0; - __pyx_t_6_basis_INDEX_t __pyx_v_variable; +static int __pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_parent = 0; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_variable; PyObject *__pyx_v_label = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -10023,7 +10046,7 @@ static int __pyx_pw_6_basis_19LinearBasisFunction_1__init__(PyObject *__pyx_v_se static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__parent,&__pyx_n_s__variable,&__pyx_n_s__label,0}; PyObject* values[3] = {0,0,0}; - /* "_basis.pyx":428 + /* "sklearn/earth/_basis.pyx":428 * * cdef class LinearBasisFunction(BasisFunction): * def __init__(self, BasisFunction parent, INDEX_t variable, label=None): #@DuplicatedSignature # <<<<<<<<<<<<<< @@ -10069,7 +10092,7 @@ static int __pyx_pw_6_basis_19LinearBasisFunction_1__init__(PyObject *__pyx_v_se default: goto __pyx_L5_argtuple_error; } } - __pyx_v_parent = ((struct __pyx_obj_6_basis_BasisFunction *)values[0]); + __pyx_v_parent = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)values[0]); __pyx_v_variable = __Pyx_PyInt_from_py_npy_ulonglong(values[1]); if (unlikely((__pyx_v_variable == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_label = values[2]; } @@ -10077,12 +10100,12 @@ static int __pyx_pw_6_basis_19LinearBasisFunction_1__init__(PyObject *__pyx_v_se __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_basis.LinearBasisFunction.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.LinearBasisFunction.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parent), __pyx_ptype_6_basis_BasisFunction, 1, "parent", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_6_basis_19LinearBasisFunction___init__(((struct __pyx_obj_6_basis_LinearBasisFunction *)__pyx_v_self), __pyx_v_parent, __pyx_v_variable, __pyx_v_label); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parent), __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction, 1, "parent", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction___init__(((struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *)__pyx_v_self), __pyx_v_parent, __pyx_v_variable, __pyx_v_label); goto __pyx_L0; __pyx_L1_error:; __pyx_r = -1; @@ -10091,7 +10114,7 @@ static int __pyx_pw_6_basis_19LinearBasisFunction_1__init__(PyObject *__pyx_v_se return __pyx_r; } -static int __pyx_pf_6_basis_19LinearBasisFunction___init__(struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_self, struct __pyx_obj_6_basis_BasisFunction *__pyx_v_parent, __pyx_t_6_basis_INDEX_t __pyx_v_variable, PyObject *__pyx_v_label) { +static int __pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction___init__(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *__pyx_v_self, struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_parent, __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_variable, PyObject *__pyx_v_label) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -10103,7 +10126,7 @@ static int __pyx_pf_6_basis_19LinearBasisFunction___init__(struct __pyx_obj_6_ba int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "_basis.pyx":429 + /* "sklearn/earth/_basis.pyx":429 * cdef class LinearBasisFunction(BasisFunction): * def __init__(self, BasisFunction parent, INDEX_t variable, label=None): #@DuplicatedSignature * self.variable = variable # <<<<<<<<<<<<<< @@ -10112,7 +10135,7 @@ static int __pyx_pf_6_basis_19LinearBasisFunction___init__(struct __pyx_obj_6_ba */ __pyx_v_self->variable = __pyx_v_variable; - /* "_basis.pyx":430 + /* "sklearn/earth/_basis.pyx":430 * def __init__(self, BasisFunction parent, INDEX_t variable, label=None): #@DuplicatedSignature * self.variable = variable * self.label = label if label is not None else 'x'+str(variable) # <<<<<<<<<<<<<< @@ -10120,7 +10143,7 @@ static int __pyx_pf_6_basis_19LinearBasisFunction___init__(struct __pyx_obj_6_ba * */ __pyx_t_2 = (__pyx_v_label != Py_None); - if (__pyx_t_2) { + if ((__pyx_t_2 != 0)) { __Pyx_INCREF(__pyx_v_label); __pyx_t_1 = __pyx_v_label; } else { @@ -10147,14 +10170,14 @@ static int __pyx_pf_6_basis_19LinearBasisFunction___init__(struct __pyx_obj_6_ba __pyx_v_self->label = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "_basis.pyx":431 + /* "sklearn/earth/_basis.pyx":431 * self.variable = variable * self.label = label if label is not None else 'x'+str(variable) * self._set_parent(parent) # <<<<<<<<<<<<<< * * def __reduce__(self): */ - __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_LinearBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._set_parent(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self), __pyx_v_parent, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_LinearBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._set_parent(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self), __pyx_v_parent, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -10164,7 +10187,7 @@ static int __pyx_pf_6_basis_19LinearBasisFunction___init__(struct __pyx_obj_6_ba __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_basis.LinearBasisFunction.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.LinearBasisFunction.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -10172,17 +10195,17 @@ static int __pyx_pf_6_basis_19LinearBasisFunction___init__(struct __pyx_obj_6_ba } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_19LinearBasisFunction_2__reduce__(((struct __pyx_obj_6_basis_LinearBasisFunction *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_2__reduce__(((struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":433 +/* "sklearn/earth/_basis.pyx":433 * self._set_parent(parent) * * def __reduce__(self): # <<<<<<<<<<<<<< @@ -10190,7 +10213,7 @@ static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_3__reduce__(PyObject *__ * */ -static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_2__reduce__(struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_2__reduce__(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -10202,7 +10225,7 @@ static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_2__reduce__(struct __pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce__", 0); - /* "_basis.pyx":434 + /* "sklearn/earth/_basis.pyx":434 * * def __reduce__(self): * return (self.__class__, (pickle_place_holder, 1, ''), self._getstate()) # <<<<<<<<<<<<<< @@ -10252,7 +10275,7 @@ static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_2__reduce__(struct __pyx __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_basis.LinearBasisFunction.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.LinearBasisFunction.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -10261,17 +10284,17 @@ static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_2__reduce__(struct __pyx } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_getstate (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_19LinearBasisFunction_4_getstate(((struct __pyx_obj_6_basis_LinearBasisFunction *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_4_getstate(((struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":436 +/* "sklearn/earth/_basis.pyx":436 * return (self.__class__, (pickle_place_holder, 1, ''), self._getstate()) * * def _getstate(self): # <<<<<<<<<<<<<< @@ -10279,7 +10302,7 @@ static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_5_getstate(PyObject *__p * result.update({'variable': self.variable, */ -static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_4_getstate(struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_4_getstate(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *__pyx_v_self) { PyObject *__pyx_v_result = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -10291,7 +10314,7 @@ static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_4_getstate(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_getstate", 0); - /* "_basis.pyx":437 + /* "sklearn/earth/_basis.pyx":437 * * def _getstate(self): * result = super(LinearBasisFunction, self)._getstate() # <<<<<<<<<<<<<< @@ -10300,9 +10323,9 @@ static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_4_getstate(struct __pyx_ */ __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_6_basis_LinearBasisFunction))); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_6_basis_LinearBasisFunction))); - __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_6_basis_LinearBasisFunction))); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_LinearBasisFunction))); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_LinearBasisFunction))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_LinearBasisFunction))); __Pyx_INCREF(((PyObject *)__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); @@ -10318,7 +10341,7 @@ static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_4_getstate(struct __pyx_ __pyx_v_result = __pyx_t_2; __pyx_t_2 = 0; - /* "_basis.pyx":438 + /* "sklearn/earth/_basis.pyx":438 * def _getstate(self): * result = super(LinearBasisFunction, self)._getstate() * result.update({'variable': self.variable, # <<<<<<<<<<<<<< @@ -10334,7 +10357,7 @@ static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_4_getstate(struct __pyx_ if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__variable), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "_basis.pyx":439 + /* "sklearn/earth/_basis.pyx":439 * result = super(LinearBasisFunction, self)._getstate() * result.update({'variable': self.variable, * 'label': self.label}) # <<<<<<<<<<<<<< @@ -10353,7 +10376,7 @@ static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_4_getstate(struct __pyx_ __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "_basis.pyx":440 + /* "sklearn/earth/_basis.pyx":440 * result.update({'variable': self.variable, * 'label': self.label}) * return result # <<<<<<<<<<<<<< @@ -10371,7 +10394,7 @@ static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_4_getstate(struct __pyx_ __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_basis.LinearBasisFunction._getstate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.LinearBasisFunction._getstate", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_result); @@ -10381,17 +10404,17 @@ static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_4_getstate(struct __pyx_ } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ -static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_19LinearBasisFunction_6__setstate__(((struct __pyx_obj_6_basis_LinearBasisFunction *)__pyx_v_self), ((PyObject *)__pyx_v_state)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_6__setstate__(((struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *)__pyx_v_self), ((PyObject *)__pyx_v_state)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":442 +/* "sklearn/earth/_basis.pyx":442 * return result * * def __setstate__(self, state): # <<<<<<<<<<<<<< @@ -10399,11 +10422,11 @@ static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_7__setstate__(PyObject * * self.label = state['label'] */ -static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_6__setstate__(struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_self, PyObject *__pyx_v_state) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_6__setstate__(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *__pyx_v_self, PyObject *__pyx_v_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __pyx_t_6_basis_INDEX_t __pyx_t_2; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_2; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; @@ -10411,7 +10434,7 @@ static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_6__setstate__(struct __p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate__", 0); - /* "_basis.pyx":443 + /* "sklearn/earth/_basis.pyx":443 * * def __setstate__(self, state): * self.variable = state['variable'] # <<<<<<<<<<<<<< @@ -10424,7 +10447,7 @@ static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_6__setstate__(struct __p __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->variable = __pyx_t_2; - /* "_basis.pyx":444 + /* "sklearn/earth/_basis.pyx":444 * def __setstate__(self, state): * self.variable = state['variable'] * self.label = state['label'] # <<<<<<<<<<<<<< @@ -10440,7 +10463,7 @@ static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_6__setstate__(struct __p __pyx_v_self->label = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "_basis.pyx":445 + /* "sklearn/earth/_basis.pyx":445 * self.variable = state['variable'] * self.label = state['label'] * super(LinearBasisFunction, self).__setstate__(state) # <<<<<<<<<<<<<< @@ -10449,9 +10472,9 @@ static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_6__setstate__(struct __p */ __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_6_basis_LinearBasisFunction))); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_6_basis_LinearBasisFunction))); - __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_6_basis_LinearBasisFunction))); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_LinearBasisFunction))); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_LinearBasisFunction))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_LinearBasisFunction))); __Pyx_INCREF(((PyObject *)__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); @@ -10478,7 +10501,7 @@ static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_6__setstate__(struct __p __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_basis.LinearBasisFunction.__setstate__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.LinearBasisFunction.__setstate__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -10486,7 +10509,7 @@ static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_6__setstate__(struct __p return __pyx_r; } -/* "_basis.pyx":447 +/* "sklearn/earth/_basis.pyx":447 * super(LinearBasisFunction, self).__setstate__(state) * * cpdef translate(LinearBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse): # <<<<<<<<<<<<<< @@ -10494,8 +10517,8 @@ static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_6__setstate__(struct __p * */ -static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_9translate(PyObject *__pyx_v_LinearBasisFunctionself, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_6_basis_19LinearBasisFunction_translate(CYTHON_UNUSED struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_LinearBasisFunctionself, CYTHON_UNUSED PyArrayObject *__pyx_v_slopes, CYTHON_UNUSED PyArrayObject *__pyx_v_intercepts, CYTHON_UNUSED int __pyx_v_recurse, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_9translate(PyObject *__pyx_v_LinearBasisFunctionself, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_7sklearn_5earth_6_basis_19LinearBasisFunction_translate(CYTHON_UNUSED struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *__pyx_v_LinearBasisFunctionself, CYTHON_UNUSED PyArrayObject *__pyx_v_slopes, CYTHON_UNUSED PyArrayObject *__pyx_v_intercepts, CYTHON_UNUSED int __pyx_v_recurse, int __pyx_skip_dispatch) { __Pyx_LocalBuf_ND __pyx_pybuffernd_intercepts; __Pyx_Buffer __pyx_pybuffer_intercepts; __Pyx_LocalBuf_ND __pyx_pybuffernd_slopes; @@ -10519,12 +10542,12 @@ static PyObject *__pyx_f_6_basis_19LinearBasisFunction_translate(CYTHON_UNUSED s __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; /* Check if called by wrapper */ @@ -10533,7 +10556,7 @@ static PyObject *__pyx_f_6_basis_19LinearBasisFunction_translate(CYTHON_UNUSED s else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_LinearBasisFunctionself))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_LinearBasisFunctionself), __pyx_n_s__translate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_19LinearBasisFunction_9translate)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_9translate)) { __Pyx_XDECREF(__pyx_r); __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_recurse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -10559,7 +10582,7 @@ static PyObject *__pyx_f_6_basis_19LinearBasisFunction_translate(CYTHON_UNUSED s __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_basis.pyx":448 + /* "sklearn/earth/_basis.pyx":448 * * cpdef translate(LinearBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse): * pass # <<<<<<<<<<<<<< @@ -10578,7 +10601,7 @@ static PyObject *__pyx_f_6_basis_19LinearBasisFunction_translate(CYTHON_UNUSED s __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("_basis.LinearBasisFunction.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.LinearBasisFunction.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; goto __pyx_L2; __pyx_L0:; @@ -10591,8 +10614,8 @@ static PyObject *__pyx_f_6_basis_19LinearBasisFunction_translate(CYTHON_UNUSED s } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_9translate(PyObject *__pyx_v_LinearBasisFunctionself, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_9translate(PyObject *__pyx_v_LinearBasisFunctionself, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_9translate(PyObject *__pyx_v_LinearBasisFunctionself, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_9translate(PyObject *__pyx_v_LinearBasisFunctionself, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_slopes = 0; PyArrayObject *__pyx_v_intercepts = 0; int __pyx_v_recurse; @@ -10649,13 +10672,13 @@ static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_9translate(PyObject *__p __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("translate", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_basis.LinearBasisFunction.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.LinearBasisFunction.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_slopes), __pyx_ptype_5numpy_ndarray, 1, "slopes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercepts), __pyx_ptype_5numpy_ndarray, 1, "intercepts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_6_basis_19LinearBasisFunction_8translate(((struct __pyx_obj_6_basis_LinearBasisFunction *)__pyx_v_LinearBasisFunctionself), __pyx_v_slopes, __pyx_v_intercepts, __pyx_v_recurse); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_8translate(((struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *)__pyx_v_LinearBasisFunctionself), __pyx_v_slopes, __pyx_v_intercepts, __pyx_v_recurse); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -10664,7 +10687,7 @@ static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_9translate(PyObject *__p return __pyx_r; } -/* "_basis.pyx":447 +/* "sklearn/earth/_basis.pyx":447 * super(LinearBasisFunction, self).__setstate__(state) * * cpdef translate(LinearBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse): # <<<<<<<<<<<<<< @@ -10672,7 +10695,7 @@ static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_9translate(PyObject *__p * */ -static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_8translate(struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_LinearBasisFunctionself, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts, int __pyx_v_recurse) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_8translate(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *__pyx_v_LinearBasisFunctionself, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts, int __pyx_v_recurse) { __Pyx_LocalBuf_ND __pyx_pybuffernd_intercepts; __Pyx_Buffer __pyx_pybuffer_intercepts; __Pyx_LocalBuf_ND __pyx_pybuffernd_slopes; @@ -10694,16 +10717,16 @@ static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_8translate(struct __pyx_ __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_LinearBasisFunction *)__pyx_v_LinearBasisFunctionself->__pyx_base.__pyx_vtab)->translate(__pyx_v_LinearBasisFunctionself, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), __pyx_v_recurse, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_LinearBasisFunction *)__pyx_v_LinearBasisFunctionself->__pyx_base.__pyx_vtab)->translate(__pyx_v_LinearBasisFunctionself, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), __pyx_v_recurse, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -10718,7 +10741,7 @@ static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_8translate(struct __pyx_ __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("_basis.LinearBasisFunction.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.LinearBasisFunction.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; @@ -10730,7 +10753,7 @@ static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_8translate(struct __pyx_ return __pyx_r; } -/* "_basis.pyx":450 +/* "sklearn/earth/_basis.pyx":450 * pass * * cpdef FLOAT_t scale(LinearBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): # <<<<<<<<<<<<<< @@ -10738,20 +10761,20 @@ static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_8translate(struct __pyx_ * result /= slopes[self.variable] */ -static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_11scale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static __pyx_t_6_basis_FLOAT_t __pyx_f_6_basis_19LinearBasisFunction_scale(struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_11scale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static __pyx_t_7sklearn_5earth_6_basis_FLOAT_t __pyx_f_7sklearn_5earth_6_basis_19LinearBasisFunction_scale(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts, int __pyx_skip_dispatch) { PyObject *__pyx_v_result = NULL; __Pyx_LocalBuf_ND __pyx_pybuffernd_intercepts; __Pyx_Buffer __pyx_pybuffer_intercepts; __Pyx_LocalBuf_ND __pyx_pybuffernd_slopes; __Pyx_Buffer __pyx_pybuffer_slopes; - __pyx_t_6_basis_FLOAT_t __pyx_r; + __pyx_t_7sklearn_5earth_6_basis_FLOAT_t __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - __pyx_t_6_basis_FLOAT_t __pyx_t_4; - __pyx_t_6_basis_INDEX_t __pyx_t_5; + __pyx_t_7sklearn_5earth_6_basis_FLOAT_t __pyx_t_4; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -10766,12 +10789,12 @@ static __pyx_t_6_basis_FLOAT_t __pyx_f_6_basis_19LinearBasisFunction_scale(struc __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; /* Check if called by wrapper */ @@ -10780,7 +10803,7 @@ static __pyx_t_6_basis_FLOAT_t __pyx_f_6_basis_19LinearBasisFunction_scale(struc else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__scale); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_19LinearBasisFunction_11scale)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_11scale)) { __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_slopes)); @@ -10801,7 +10824,7 @@ static __pyx_t_6_basis_FLOAT_t __pyx_f_6_basis_19LinearBasisFunction_scale(struc __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_basis.pyx":451 + /* "sklearn/earth/_basis.pyx":451 * * cpdef FLOAT_t scale(LinearBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): * result = self.parent.scale(slopes,intercepts) # <<<<<<<<<<<<<< @@ -10825,7 +10848,7 @@ static __pyx_t_6_basis_FLOAT_t __pyx_f_6_basis_19LinearBasisFunction_scale(struc __pyx_v_result = __pyx_t_2; __pyx_t_2 = 0; - /* "_basis.pyx":452 + /* "sklearn/earth/_basis.pyx":452 * cpdef FLOAT_t scale(LinearBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): * result = self.parent.scale(slopes,intercepts) * result /= slopes[self.variable] # <<<<<<<<<<<<<< @@ -10833,7 +10856,7 @@ static __pyx_t_6_basis_FLOAT_t __pyx_f_6_basis_19LinearBasisFunction_scale(struc * */ __pyx_t_5 = __pyx_v_self->variable; - __pyx_t_2 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_6_basis_FLOAT_t *, __pyx_pybuffernd_slopes.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_slopes.diminfo[0].strides))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_FLOAT_t *, __pyx_pybuffernd_slopes.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_slopes.diminfo[0].strides))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyNumber_InPlaceDivide(__pyx_v_result, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); @@ -10842,7 +10865,7 @@ static __pyx_t_6_basis_FLOAT_t __pyx_f_6_basis_19LinearBasisFunction_scale(struc __pyx_v_result = __pyx_t_3; __pyx_t_3 = 0; - /* "_basis.pyx":453 + /* "sklearn/earth/_basis.pyx":453 * result = self.parent.scale(slopes,intercepts) * result /= slopes[self.variable] * return result # <<<<<<<<<<<<<< @@ -10864,7 +10887,7 @@ static __pyx_t_6_basis_FLOAT_t __pyx_f_6_basis_19LinearBasisFunction_scale(struc __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_WriteUnraisable("_basis.LinearBasisFunction.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("sklearn.earth._basis.LinearBasisFunction.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; goto __pyx_L2; __pyx_L0:; @@ -10877,8 +10900,8 @@ static __pyx_t_6_basis_FLOAT_t __pyx_f_6_basis_19LinearBasisFunction_scale(struc } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_11scale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_11scale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_11scale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_11scale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_slopes = 0; PyArrayObject *__pyx_v_intercepts = 0; int __pyx_lineno = 0; @@ -10926,13 +10949,13 @@ static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_11scale(PyObject *__pyx_ __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("scale", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_basis.LinearBasisFunction.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.LinearBasisFunction.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_slopes), __pyx_ptype_5numpy_ndarray, 1, "slopes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercepts), __pyx_ptype_5numpy_ndarray, 1, "intercepts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_6_basis_19LinearBasisFunction_10scale(((struct __pyx_obj_6_basis_LinearBasisFunction *)__pyx_v_self), __pyx_v_slopes, __pyx_v_intercepts); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_10scale(((struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *)__pyx_v_self), __pyx_v_slopes, __pyx_v_intercepts); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -10941,7 +10964,7 @@ static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_11scale(PyObject *__pyx_ return __pyx_r; } -/* "_basis.pyx":450 +/* "sklearn/earth/_basis.pyx":450 * pass * * cpdef FLOAT_t scale(LinearBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): # <<<<<<<<<<<<<< @@ -10949,7 +10972,7 @@ static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_11scale(PyObject *__pyx_ * result /= slopes[self.variable] */ -static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_10scale(struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_10scale(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts) { __Pyx_LocalBuf_ND __pyx_pybuffernd_intercepts; __Pyx_Buffer __pyx_pybuffer_intercepts; __Pyx_LocalBuf_ND __pyx_pybuffernd_slopes; @@ -10971,16 +10994,16 @@ static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_10scale(struct __pyx_obj __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_6_basis_LinearBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->scale(__pyx_v_self, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_LinearBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->scale(__pyx_v_self, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -10995,7 +11018,7 @@ static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_10scale(struct __pyx_obj __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("_basis.LinearBasisFunction.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.LinearBasisFunction.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; @@ -11008,17 +11031,17 @@ static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_10scale(struct __pyx_obj } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_13__str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_13__str__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_13__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_13__str__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_19LinearBasisFunction_12__str__(((struct __pyx_obj_6_basis_LinearBasisFunction *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_12__str__(((struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":455 +/* "sklearn/earth/_basis.pyx":455 * return result * * def __str__(LinearBasisFunction self): # <<<<<<<<<<<<<< @@ -11026,7 +11049,7 @@ static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_13__str__(PyObject *__py * if not self.parent.__class__ is ConstantBasisFunction: */ -static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_12__str__(struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_12__str__(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *__pyx_v_self) { PyObject *__pyx_v_result = NULL; PyObject *__pyx_v_parent = NULL; PyObject *__pyx_r = NULL; @@ -11040,7 +11063,7 @@ static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_12__str__(struct __pyx_o int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - /* "_basis.pyx":456 + /* "sklearn/earth/_basis.pyx":456 * * def __str__(LinearBasisFunction self): * result = self.label # <<<<<<<<<<<<<< @@ -11052,7 +11075,7 @@ static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_12__str__(struct __pyx_o __pyx_v_result = __pyx_t_1; __pyx_t_1 = 0; - /* "_basis.pyx":457 + /* "sklearn/earth/_basis.pyx":457 * def __str__(LinearBasisFunction self): * result = self.label * if not self.parent.__class__ is ConstantBasisFunction: # <<<<<<<<<<<<<< @@ -11061,12 +11084,12 @@ static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_12__str__(struct __pyx_o */ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx_base.parent), __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = (__pyx_t_1 == ((PyObject *)((PyObject*)__pyx_ptype_6_basis_ConstantBasisFunction))); + __pyx_t_2 = (__pyx_t_1 == ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_ConstantBasisFunction))); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = (!__pyx_t_2); + __pyx_t_3 = ((!(__pyx_t_2 != 0)) != 0); if (__pyx_t_3) { - /* "_basis.pyx":458 + /* "sklearn/earth/_basis.pyx":458 * result = self.label * if not self.parent.__class__ is ConstantBasisFunction: * parent = str(self.parent) # <<<<<<<<<<<<<< @@ -11084,7 +11107,7 @@ static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_12__str__(struct __pyx_o __pyx_v_parent = __pyx_t_4; __pyx_t_4 = 0; - /* "_basis.pyx":459 + /* "sklearn/earth/_basis.pyx":459 * if not self.parent.__class__ is ConstantBasisFunction: * parent = str(self.parent) * result += '*'+parent # <<<<<<<<<<<<<< @@ -11103,7 +11126,7 @@ static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_12__str__(struct __pyx_o } __pyx_L3:; - /* "_basis.pyx":460 + /* "sklearn/earth/_basis.pyx":460 * parent = str(self.parent) * result += '*'+parent * return result # <<<<<<<<<<<<<< @@ -11120,7 +11143,7 @@ static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_12__str__(struct __pyx_o __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_basis.LinearBasisFunction.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.LinearBasisFunction.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_result); @@ -11130,7 +11153,7 @@ static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_12__str__(struct __pyx_o return __pyx_r; } -/* "_basis.pyx":462 +/* "sklearn/earth/_basis.pyx":462 * return result * * cpdef INDEX_t get_variable(self): # <<<<<<<<<<<<<< @@ -11138,13 +11161,13 @@ static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_12__str__(struct __pyx_o * */ -static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_15get_variable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static __pyx_t_6_basis_INDEX_t __pyx_f_6_basis_19LinearBasisFunction_get_variable(struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { - __pyx_t_6_basis_INDEX_t __pyx_r; +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_15get_variable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_f_7sklearn_5earth_6_basis_19LinearBasisFunction_get_variable(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *__pyx_v_self, int __pyx_skip_dispatch) { + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - __pyx_t_6_basis_INDEX_t __pyx_t_3; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -11155,7 +11178,7 @@ static __pyx_t_6_basis_INDEX_t __pyx_f_6_basis_19LinearBasisFunction_get_variabl else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_variable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_19LinearBasisFunction_15get_variable)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_15get_variable)) { __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -11167,7 +11190,7 @@ static __pyx_t_6_basis_INDEX_t __pyx_f_6_basis_19LinearBasisFunction_get_variabl __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_basis.pyx":463 + /* "sklearn/earth/_basis.pyx":463 * * cpdef INDEX_t get_variable(self): * return self.variable # <<<<<<<<<<<<<< @@ -11182,7 +11205,7 @@ static __pyx_t_6_basis_INDEX_t __pyx_f_6_basis_19LinearBasisFunction_get_variabl __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_WriteUnraisable("_basis.LinearBasisFunction.get_variable", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("sklearn.earth._basis.LinearBasisFunction.get_variable", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -11190,17 +11213,17 @@ static __pyx_t_6_basis_INDEX_t __pyx_f_6_basis_19LinearBasisFunction_get_variabl } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_15get_variable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_15get_variable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_15get_variable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_15get_variable(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_variable (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_19LinearBasisFunction_14get_variable(((struct __pyx_obj_6_basis_LinearBasisFunction *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_14get_variable(((struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":462 +/* "sklearn/earth/_basis.pyx":462 * return result * * cpdef INDEX_t get_variable(self): # <<<<<<<<<<<<<< @@ -11208,7 +11231,7 @@ static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_15get_variable(PyObject * */ -static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_14get_variable(struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_14get_variable(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -11217,7 +11240,7 @@ static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_14get_variable(struct __ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_variable", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_6_basis_LinearBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_variable(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_LinearBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_variable(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -11227,7 +11250,7 @@ static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_14get_variable(struct __ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_basis.LinearBasisFunction.get_variable", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.LinearBasisFunction.get_variable", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -11235,7 +11258,7 @@ static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_14get_variable(struct __ return __pyx_r; } -/* "_basis.pyx":465 +/* "sklearn/earth/_basis.pyx":465 * return self.variable * * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = True): # <<<<<<<<<<<<<< @@ -11243,11 +11266,11 @@ static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_14get_variable(struct __ * X - Data matrix */ -static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_17apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_6_basis_19LinearBasisFunction_apply(struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_b, int __pyx_skip_dispatch, struct __pyx_opt_args_6_basis_19LinearBasisFunction_apply *__pyx_optional_args) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_17apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_7sklearn_5earth_6_basis_19LinearBasisFunction_apply(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_b, int __pyx_skip_dispatch, struct __pyx_opt_args_7sklearn_5earth_6_basis_19LinearBasisFunction_apply *__pyx_optional_args) { int __pyx_v_recurse = ((int)1); - __pyx_t_6_basis_INDEX_t __pyx_v_i; - __pyx_t_6_basis_INDEX_t __pyx_v_m; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_i; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_m; __Pyx_LocalBuf_ND __pyx_pybuffernd_X; __Pyx_Buffer __pyx_pybuffer_X; __Pyx_LocalBuf_ND __pyx_pybuffernd_b; @@ -11257,13 +11280,14 @@ static PyObject *__pyx_f_6_basis_19LinearBasisFunction_apply(struct __pyx_obj_6_ PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - struct __pyx_opt_args_6_basis_13BasisFunction_apply __pyx_t_4; - Py_ssize_t __pyx_t_5; - __pyx_t_6_basis_INDEX_t __pyx_t_6; - __pyx_t_6_basis_INDEX_t __pyx_t_7; - __pyx_t_6_basis_INDEX_t __pyx_t_8; - __pyx_t_6_basis_INDEX_t __pyx_t_9; - __pyx_t_6_basis_INDEX_t __pyx_t_10; + int __pyx_t_4; + struct __pyx_opt_args_7sklearn_5earth_6_basis_13BasisFunction_apply __pyx_t_5; + Py_ssize_t __pyx_t_6; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_7; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_8; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_9; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_10; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_11; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -11283,12 +11307,12 @@ static PyObject *__pyx_f_6_basis_19LinearBasisFunction_apply(struct __pyx_obj_6_ __pyx_pybuffernd_b.rcbuffer = &__pyx_pybuffer_b; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)__pyx_v_b, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)__pyx_v_b, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_b.diminfo[0].strides = __pyx_pybuffernd_b.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_b.diminfo[0].shape = __pyx_pybuffernd_b.rcbuffer->pybuffer.shape[0]; /* Check if called by wrapper */ @@ -11297,7 +11321,7 @@ static PyObject *__pyx_f_6_basis_19LinearBasisFunction_apply(struct __pyx_obj_6_ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__apply); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_19LinearBasisFunction_17apply)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_17apply)) { __Pyx_XDECREF(__pyx_r); __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_recurse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -11323,63 +11347,64 @@ static PyObject *__pyx_f_6_basis_19LinearBasisFunction_apply(struct __pyx_obj_6_ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_basis.pyx":472 + /* "sklearn/earth/_basis.pyx":472 * parent function. * ''' * if recurse: # <<<<<<<<<<<<<< * self.parent.apply(X,b,recurse=True) * cdef INDEX_t i #@DuplicatedSignature */ - if (__pyx_v_recurse) { + __pyx_t_4 = (__pyx_v_recurse != 0); + if (__pyx_t_4) { - /* "_basis.pyx":473 + /* "sklearn/earth/_basis.pyx":473 * ''' * if recurse: * self.parent.apply(X,b,recurse=True) # <<<<<<<<<<<<<< * cdef INDEX_t i #@DuplicatedSignature * cdef INDEX_t m = len(b) #@DuplicatedSignature */ - __pyx_t_4.__pyx_n = 1; - __pyx_t_4.recurse = 1; - __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_self->__pyx_base.parent->__pyx_vtab)->apply(__pyx_v_self->__pyx_base.parent, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_b), 0, &__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5.__pyx_n = 1; + __pyx_t_5.recurse = 1; + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self->__pyx_base.parent->__pyx_vtab)->apply(__pyx_v_self->__pyx_base.parent, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_b), 0, &__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L3; } __pyx_L3:; - /* "_basis.pyx":475 + /* "sklearn/earth/_basis.pyx":475 * self.parent.apply(X,b,recurse=True) * cdef INDEX_t i #@DuplicatedSignature * cdef INDEX_t m = len(b) #@DuplicatedSignature # <<<<<<<<<<<<<< * for i in range(m): * b[i] *= X[i,self.variable] */ - __pyx_t_5 = PyObject_Length(((PyObject *)__pyx_v_b)); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_m = __pyx_t_5; + __pyx_t_6 = PyObject_Length(((PyObject *)__pyx_v_b)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_m = __pyx_t_6; - /* "_basis.pyx":476 + /* "sklearn/earth/_basis.pyx":476 * cdef INDEX_t i #@DuplicatedSignature * cdef INDEX_t m = len(b) #@DuplicatedSignature * for i in range(m): # <<<<<<<<<<<<<< * b[i] *= X[i,self.variable] * */ - __pyx_t_6 = __pyx_v_m; - for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { - __pyx_v_i = __pyx_t_7; + __pyx_t_7 = __pyx_v_m; + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { + __pyx_v_i = __pyx_t_8; - /* "_basis.pyx":477 + /* "sklearn/earth/_basis.pyx":477 * cdef INDEX_t m = len(b) #@DuplicatedSignature * for i in range(m): * b[i] *= X[i,self.variable] # <<<<<<<<<<<<<< * * cdef class Basis: */ - __pyx_t_8 = __pyx_v_i; - __pyx_t_9 = __pyx_v_self->variable; - __pyx_t_10 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_6_basis_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_b.diminfo[0].strides) *= (*__Pyx_BufPtrStrided2d(__pyx_t_6_basis_FLOAT_t *, __pyx_pybuffernd_X.rcbuffer->pybuffer.buf, __pyx_t_8, __pyx_pybuffernd_X.diminfo[0].strides, __pyx_t_9, __pyx_pybuffernd_X.diminfo[1].strides)); + __pyx_t_9 = __pyx_v_i; + __pyx_t_10 = __pyx_v_self->variable; + __pyx_t_11 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_b.diminfo[0].strides) *= (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_6_basis_FLOAT_t *, __pyx_pybuffernd_X.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_X.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_X.diminfo[1].strides)); } __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -11393,7 +11418,7 @@ static PyObject *__pyx_f_6_basis_19LinearBasisFunction_apply(struct __pyx_obj_6_ __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_b.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("_basis.LinearBasisFunction.apply", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.LinearBasisFunction.apply", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; goto __pyx_L2; __pyx_L0:; @@ -11406,9 +11431,9 @@ static PyObject *__pyx_f_6_basis_19LinearBasisFunction_apply(struct __pyx_obj_6_ } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_17apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_6_basis_19LinearBasisFunction_16apply[] = "\n X - Data matrix\n b - parent vector\n recurse - If False, assume b already contains the result of the parent function. Otherwise, recurse to compute\n parent function.\n "; -static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_17apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_17apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7sklearn_5earth_6_basis_19LinearBasisFunction_16apply[] = "\n X - Data matrix\n b - parent vector\n recurse - If False, assume b already contains the result of the parent function. Otherwise, recurse to compute\n parent function.\n "; +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_17apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_X = 0; PyArrayObject *__pyx_v_b = 0; int __pyx_v_recurse; @@ -11465,7 +11490,7 @@ static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_17apply(PyObject *__pyx_ __pyx_v_recurse = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_recurse == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - /* "_basis.pyx":465 + /* "sklearn/earth/_basis.pyx":465 * return self.variable * * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = True): # <<<<<<<<<<<<<< @@ -11479,13 +11504,13 @@ static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_17apply(PyObject *__pyx_ __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("apply", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_basis.LinearBasisFunction.apply", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.LinearBasisFunction.apply", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_5numpy_ndarray, 1, "b", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_6_basis_19LinearBasisFunction_16apply(((struct __pyx_obj_6_basis_LinearBasisFunction *)__pyx_v_self), __pyx_v_X, __pyx_v_b, __pyx_v_recurse); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_16apply(((struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *)__pyx_v_self), __pyx_v_X, __pyx_v_b, __pyx_v_recurse); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -11494,7 +11519,7 @@ static PyObject *__pyx_pw_6_basis_19LinearBasisFunction_17apply(PyObject *__pyx_ return __pyx_r; } -static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_16apply(struct __pyx_obj_6_basis_LinearBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_b, int __pyx_v_recurse) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_16apply(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_b, int __pyx_v_recurse) { __Pyx_LocalBuf_ND __pyx_pybuffernd_X; __Pyx_Buffer __pyx_pybuffer_X; __Pyx_LocalBuf_ND __pyx_pybuffernd_b; @@ -11502,7 +11527,7 @@ static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_16apply(struct __pyx_obj PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - struct __pyx_opt_args_6_basis_13BasisFunction_apply __pyx_t_2; + struct __pyx_opt_args_7sklearn_5earth_6_basis_13BasisFunction_apply __pyx_t_2; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -11517,18 +11542,18 @@ static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_16apply(struct __pyx_obj __pyx_pybuffernd_b.rcbuffer = &__pyx_pybuffer_b; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)__pyx_v_b, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)__pyx_v_b, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_b.diminfo[0].strides = __pyx_pybuffernd_b.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_b.diminfo[0].shape = __pyx_pybuffernd_b.rcbuffer->pybuffer.shape[0]; __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 1; __pyx_t_2.recurse = __pyx_v_recurse; - __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_LinearBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.apply(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_self), ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_b), 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_LinearBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.apply(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self), ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_b), 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -11543,7 +11568,7 @@ static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_16apply(struct __pyx_obj __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_b.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("_basis.LinearBasisFunction.apply", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.LinearBasisFunction.apply", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; @@ -11556,20 +11581,20 @@ static PyObject *__pyx_pf_6_basis_19LinearBasisFunction_16apply(struct __pyx_obj } /* Python wrapper */ -static int __pyx_pw_6_basis_5Basis_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_6_basis_5Basis_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_pw_7sklearn_5earth_6_basis_5Basis_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7sklearn_5earth_6_basis_5Basis_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; - __pyx_r = __pyx_pf_6_basis_5Basis___init__(((struct __pyx_obj_6_basis_Basis *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_5Basis___init__(((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":484 +/* "sklearn/earth/_basis.pyx":484 * added.''' * * def __init__(Basis self): #@DuplicatedSignature # <<<<<<<<<<<<<< @@ -11577,7 +11602,7 @@ static int __pyx_pw_6_basis_5Basis_1__init__(PyObject *__pyx_v_self, PyObject *_ * */ -static int __pyx_pf_6_basis_5Basis___init__(struct __pyx_obj_6_basis_Basis *__pyx_v_self) { +static int __pyx_pf_7sklearn_5earth_6_basis_5Basis___init__(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -11586,7 +11611,7 @@ static int __pyx_pf_6_basis_5Basis___init__(struct __pyx_obj_6_basis_Basis *__py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "_basis.pyx":485 + /* "sklearn/earth/_basis.pyx":485 * * def __init__(Basis self): #@DuplicatedSignature * self.order = [] # <<<<<<<<<<<<<< @@ -11605,7 +11630,7 @@ static int __pyx_pf_6_basis_5Basis___init__(struct __pyx_obj_6_basis_Basis *__py goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_basis.Basis.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.Basis.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -11613,17 +11638,17 @@ static int __pyx_pf_6_basis_5Basis___init__(struct __pyx_obj_6_basis_Basis *__py } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_5Basis_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_6_basis_5Basis_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_5Basis_2__reduce__(((struct __pyx_obj_6_basis_Basis *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_5Basis_2__reduce__(((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":487 +/* "sklearn/earth/_basis.pyx":487 * self.order = [] * * def __reduce__(self): # <<<<<<<<<<<<<< @@ -11631,7 +11656,7 @@ static PyObject *__pyx_pw_6_basis_5Basis_3__reduce__(PyObject *__pyx_v_self, CYT * */ -static PyObject *__pyx_pf_6_basis_5Basis_2__reduce__(struct __pyx_obj_6_basis_Basis *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_2__reduce__(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -11642,7 +11667,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_2__reduce__(struct __pyx_obj_6_basis_Ba int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce__", 0); - /* "_basis.pyx":488 + /* "sklearn/earth/_basis.pyx":488 * * def __reduce__(self): * return (self.__class__, (), self._getstate()) # <<<<<<<<<<<<<< @@ -11678,7 +11703,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_2__reduce__(struct __pyx_obj_6_basis_Ba __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_basis.Basis.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.Basis.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -11687,17 +11712,17 @@ static PyObject *__pyx_pf_6_basis_5Basis_2__reduce__(struct __pyx_obj_6_basis_Ba } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_5Basis_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_6_basis_5Basis_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_getstate (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_5Basis_4_getstate(((struct __pyx_obj_6_basis_Basis *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_5Basis_4_getstate(((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":490 +/* "sklearn/earth/_basis.pyx":490 * return (self.__class__, (), self._getstate()) * * def _getstate(self): # <<<<<<<<<<<<<< @@ -11705,7 +11730,7 @@ static PyObject *__pyx_pw_6_basis_5Basis_5_getstate(PyObject *__pyx_v_self, CYTH * */ -static PyObject *__pyx_pf_6_basis_5Basis_4_getstate(struct __pyx_obj_6_basis_Basis *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_4_getstate(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -11714,7 +11739,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_4_getstate(struct __pyx_obj_6_basis_Bas int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_getstate", 0); - /* "_basis.pyx":491 + /* "sklearn/earth/_basis.pyx":491 * * def _getstate(self): * return {'order': self.order} # <<<<<<<<<<<<<< @@ -11733,7 +11758,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_4_getstate(struct __pyx_obj_6_basis_Bas goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_basis.Basis._getstate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.Basis._getstate", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -11742,17 +11767,17 @@ static PyObject *__pyx_pf_6_basis_5Basis_4_getstate(struct __pyx_obj_6_basis_Bas } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_5Basis_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ -static PyObject *__pyx_pw_6_basis_5Basis_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_5Basis_6__setstate__(((struct __pyx_obj_6_basis_Basis *)__pyx_v_self), ((PyObject *)__pyx_v_state)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_5Basis_6__setstate__(((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)__pyx_v_self), ((PyObject *)__pyx_v_state)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":493 +/* "sklearn/earth/_basis.pyx":493 * return {'order': self.order} * * def __setstate__(self, state): # <<<<<<<<<<<<<< @@ -11760,7 +11785,7 @@ static PyObject *__pyx_pw_6_basis_5Basis_7__setstate__(PyObject *__pyx_v_self, P * */ -static PyObject *__pyx_pf_6_basis_5Basis_6__setstate__(struct __pyx_obj_6_basis_Basis *__pyx_v_self, PyObject *__pyx_v_state) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_6__setstate__(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self, PyObject *__pyx_v_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -11769,7 +11794,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_6__setstate__(struct __pyx_obj_6_basis_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate__", 0); - /* "_basis.pyx":494 + /* "sklearn/earth/_basis.pyx":494 * * def __setstate__(self, state): * self.order = state['order'] # <<<<<<<<<<<<<< @@ -11789,7 +11814,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_6__setstate__(struct __pyx_obj_6_basis_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_basis.Basis.__setstate__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.Basis.__setstate__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -11798,8 +11823,8 @@ static PyObject *__pyx_pf_6_basis_5Basis_6__setstate__(struct __pyx_obj_6_basis_ } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_5Basis_9__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_arg_method); /*proto*/ -static PyObject *__pyx_pw_6_basis_5Basis_9__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_arg_method) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_9__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_arg_method); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_9__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_arg_method) { PyObject *__pyx_v_method = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -11811,17 +11836,17 @@ static PyObject *__pyx_pw_6_basis_5Basis_9__richcmp__(PyObject *__pyx_v_self, Py __Pyx_GOTREF(__pyx_v_method); goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_basis.Basis.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.Basis.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_6_basis_5Basis_8__richcmp__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other), ((PyObject *)__pyx_v_method)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_5Basis_8__richcmp__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other), ((PyObject *)__pyx_v_method)); __Pyx_XDECREF(__pyx_v_method); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":496 +/* "sklearn/earth/_basis.pyx":496 * self.order = state['order'] * * def __richcmp__(self, other, method): # <<<<<<<<<<<<<< @@ -11829,7 +11854,7 @@ static PyObject *__pyx_pw_6_basis_5Basis_9__richcmp__(PyObject *__pyx_v_self, Py * return self._eq(other) */ -static PyObject *__pyx_pf_6_basis_5Basis_8__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_method) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_8__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_method) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -11841,7 +11866,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_8__richcmp__(PyObject *__pyx_v_self, Py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__richcmp__", 0); - /* "_basis.pyx":497 + /* "sklearn/earth/_basis.pyx":497 * * def __richcmp__(self, other, method): * if method == 2: # <<<<<<<<<<<<<< @@ -11853,7 +11878,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_8__richcmp__(PyObject *__pyx_v_self, Py __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "_basis.pyx":498 + /* "sklearn/earth/_basis.pyx":498 * def __richcmp__(self, other, method): * if method == 2: * return self._eq(other) # <<<<<<<<<<<<<< @@ -11878,7 +11903,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_8__richcmp__(PyObject *__pyx_v_self, Py goto __pyx_L3; } - /* "_basis.pyx":499 + /* "sklearn/earth/_basis.pyx":499 * if method == 2: * return self._eq(other) * elif method == 3: # <<<<<<<<<<<<<< @@ -11890,7 +11915,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_8__richcmp__(PyObject *__pyx_v_self, Py __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_2) { - /* "_basis.pyx":500 + /* "sklearn/earth/_basis.pyx":500 * return self._eq(other) * elif method == 3: * return not self._eq(other) # <<<<<<<<<<<<<< @@ -11920,7 +11945,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_8__richcmp__(PyObject *__pyx_v_self, Py } /*else*/ { - /* "_basis.pyx":502 + /* "sklearn/earth/_basis.pyx":502 * return not self._eq(other) * else: * return NotImplemented # <<<<<<<<<<<<<< @@ -11940,7 +11965,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_8__richcmp__(PyObject *__pyx_v_self, Py __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_basis.Basis.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.Basis.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -11949,17 +11974,17 @@ static PyObject *__pyx_pf_6_basis_5Basis_8__richcmp__(PyObject *__pyx_v_self, Py } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_5Basis_11_eq(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ -static PyObject *__pyx_pw_6_basis_5Basis_11_eq(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_11_eq(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_11_eq(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_eq (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_5Basis_10_eq(((struct __pyx_obj_6_basis_Basis *)__pyx_v_self), ((PyObject *)__pyx_v_other)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_5Basis_10_eq(((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)__pyx_v_self), ((PyObject *)__pyx_v_other)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":504 +/* "sklearn/earth/_basis.pyx":504 * return NotImplemented * * def _eq(self, other): # <<<<<<<<<<<<<< @@ -11967,7 +11992,7 @@ static PyObject *__pyx_pw_6_basis_5Basis_11_eq(PyObject *__pyx_v_self, PyObject * */ -static PyObject *__pyx_pf_6_basis_5Basis_10_eq(struct __pyx_obj_6_basis_Basis *__pyx_v_self, PyObject *__pyx_v_other) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_10_eq(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self, PyObject *__pyx_v_other) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -11980,7 +12005,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_10_eq(struct __pyx_obj_6_basis_Basis *_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_eq", 0); - /* "_basis.pyx":505 + /* "sklearn/earth/_basis.pyx":505 * * def _eq(self, other): * return self.__class__ is other.__class__ and self._getstate() == other._getstate() # <<<<<<<<<<<<<< @@ -12030,27 +12055,27 @@ static PyObject *__pyx_pf_6_basis_5Basis_10_eq(struct __pyx_obj_6_basis_Basis *_ __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("_basis.Basis._eq", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.Basis._eq", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -static PyObject *__pyx_gb_6_basis_5Basis_14generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ +static PyObject *__pyx_gb_7sklearn_5earth_6_basis_5Basis_14generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value); /* proto */ /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_5Basis_13piter(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_6_basis_5Basis_13piter(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_13piter(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_13piter(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("piter (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_5Basis_12piter(((struct __pyx_obj_6_basis_Basis *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_5Basis_12piter(((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":507 +/* "sklearn/earth/_basis.pyx":507 * return self.__class__ is other.__class__ and self._getstate() == other._getstate() * * def piter(Basis self): # <<<<<<<<<<<<<< @@ -12058,15 +12083,15 @@ static PyObject *__pyx_pw_6_basis_5Basis_13piter(PyObject *__pyx_v_self, CYTHON_ * if not bf.is_pruned(): */ -static PyObject *__pyx_pf_6_basis_5Basis_12piter(struct __pyx_obj_6_basis_Basis *__pyx_v_self) { - struct __pyx_obj_6_basis___pyx_scope_struct__piter *__pyx_cur_scope; +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_12piter(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self) { + struct __pyx_obj_7sklearn_5earth_6_basis___pyx_scope_struct__piter *__pyx_cur_scope; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("piter", 0); - __pyx_cur_scope = (struct __pyx_obj_6_basis___pyx_scope_struct__piter *)__pyx_tp_new_6_basis___pyx_scope_struct__piter(__pyx_ptype_6_basis___pyx_scope_struct__piter, __pyx_empty_tuple, NULL); + __pyx_cur_scope = (struct __pyx_obj_7sklearn_5earth_6_basis___pyx_scope_struct__piter *)__pyx_tp_new_7sklearn_5earth_6_basis___pyx_scope_struct__piter(__pyx_ptype_7sklearn_5earth_6_basis___pyx_scope_struct__piter, __pyx_empty_tuple, NULL); if (unlikely(!__pyx_cur_scope)) { __Pyx_RefNannyFinishContext(); return NULL; @@ -12076,7 +12101,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_12piter(struct __pyx_obj_6_basis_Basis __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); { - __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_6_basis_5Basis_14generator, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_7sklearn_5earth_6_basis_5Basis_14generator, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -12085,7 +12110,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_12piter(struct __pyx_obj_6_basis_Basis __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_basis.Basis.piter", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.Basis.piter", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(((PyObject *)__pyx_cur_scope)); @@ -12094,9 +12119,9 @@ static PyObject *__pyx_pf_6_basis_5Basis_12piter(struct __pyx_obj_6_basis_Basis return __pyx_r; } -static PyObject *__pyx_gb_6_basis_5Basis_14generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ +static PyObject *__pyx_gb_7sklearn_5earth_6_basis_5Basis_14generator(__pyx_GeneratorObject *__pyx_generator, PyObject *__pyx_sent_value) /* generator body */ { - struct __pyx_obj_6_basis___pyx_scope_struct__piter *__pyx_cur_scope = ((struct __pyx_obj_6_basis___pyx_scope_struct__piter *)__pyx_generator->closure); + struct __pyx_obj_7sklearn_5earth_6_basis___pyx_scope_struct__piter *__pyx_cur_scope = ((struct __pyx_obj_7sklearn_5earth_6_basis___pyx_scope_struct__piter *)__pyx_generator->closure); PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; Py_ssize_t __pyx_t_2; @@ -12119,7 +12144,7 @@ static PyObject *__pyx_gb_6_basis_5Basis_14generator(__pyx_GeneratorObject *__py __pyx_L3_first_run:; if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "_basis.pyx":508 + /* "sklearn/earth/_basis.pyx":508 * * def piter(Basis self): * for bf in self.order: # <<<<<<<<<<<<<< @@ -12144,7 +12169,7 @@ static PyObject *__pyx_gb_6_basis_5Basis_14generator(__pyx_GeneratorObject *__py __pyx_cur_scope->__pyx_v_bf = __pyx_t_3; __pyx_t_3 = 0; - /* "_basis.pyx":509 + /* "sklearn/earth/_basis.pyx":509 * def piter(Basis self): * for bf in self.order: * if not bf.is_pruned(): # <<<<<<<<<<<<<< @@ -12158,10 +12183,10 @@ static PyObject *__pyx_gb_6_basis_5Basis_14generator(__pyx_GeneratorObject *__py __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_6 = (!__pyx_t_5); + __pyx_t_6 = ((!__pyx_t_5) != 0); if (__pyx_t_6) { - /* "_basis.pyx":510 + /* "sklearn/earth/_basis.pyx":510 * for bf in self.order: * if not bf.is_pruned(): * yield bf # <<<<<<<<<<<<<< @@ -12205,17 +12230,17 @@ static PyObject *__pyx_gb_6_basis_5Basis_14generator(__pyx_GeneratorObject *__py } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_5Basis_16__str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_6_basis_5Basis_16__str__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_16__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_16__str__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_5Basis_15__str__(((struct __pyx_obj_6_basis_Basis *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_5Basis_15__str__(((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":512 +/* "sklearn/earth/_basis.pyx":512 * yield bf * * def __str__(Basis self): # <<<<<<<<<<<<<< @@ -12223,15 +12248,15 @@ static PyObject *__pyx_pw_6_basis_5Basis_16__str__(PyObject *__pyx_v_self) { * cdef INDEX_t n = len(self) */ -static PyObject *__pyx_pf_6_basis_5Basis_15__str__(struct __pyx_obj_6_basis_Basis *__pyx_v_self) { - __pyx_t_6_basis_INDEX_t __pyx_v_i; - __pyx_t_6_basis_INDEX_t __pyx_v_n; +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_15__str__(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self) { + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_i; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_n; PyObject *__pyx_v_result = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations Py_ssize_t __pyx_t_1; - __pyx_t_6_basis_INDEX_t __pyx_t_2; - __pyx_t_6_basis_INDEX_t __pyx_t_3; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_2; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_3; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; int __pyx_lineno = 0; @@ -12239,7 +12264,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_15__str__(struct __pyx_obj_6_basis_Basi int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - /* "_basis.pyx":514 + /* "sklearn/earth/_basis.pyx":514 * def __str__(Basis self): * cdef INDEX_t i * cdef INDEX_t n = len(self) # <<<<<<<<<<<<<< @@ -12249,7 +12274,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_15__str__(struct __pyx_obj_6_basis_Basi __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_n = __pyx_t_1; - /* "_basis.pyx":515 + /* "sklearn/earth/_basis.pyx":515 * cdef INDEX_t i * cdef INDEX_t n = len(self) * result = '' # <<<<<<<<<<<<<< @@ -12259,7 +12284,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_15__str__(struct __pyx_obj_6_basis_Basi __Pyx_INCREF(((PyObject *)__pyx_kp_s_2)); __pyx_v_result = ((PyObject *)__pyx_kp_s_2); - /* "_basis.pyx":516 + /* "sklearn/earth/_basis.pyx":516 * cdef INDEX_t n = len(self) * result = '' * for i in range(n): # <<<<<<<<<<<<<< @@ -12270,14 +12295,14 @@ static PyObject *__pyx_pf_6_basis_5Basis_15__str__(struct __pyx_obj_6_basis_Basi for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "_basis.pyx":517 + /* "sklearn/earth/_basis.pyx":517 * result = '' * for i in range(n): * result += str(self[i]) # <<<<<<<<<<<<<< * result += '\n' * return result */ - __pyx_t_4 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self), __pyx_v_i, sizeof(__pyx_t_6_basis_INDEX_t)+1, __Pyx_PyInt_to_py_npy_ulonglong, 0, 0, 0); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self), __pyx_v_i, sizeof(__pyx_t_7sklearn_5earth_6_basis_INDEX_t)+1, __Pyx_PyInt_to_py_npy_ulonglong, 0, 0, 0); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); @@ -12294,7 +12319,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_15__str__(struct __pyx_obj_6_basis_Basi __pyx_v_result = __pyx_t_5; __pyx_t_5 = 0; - /* "_basis.pyx":518 + /* "sklearn/earth/_basis.pyx":518 * for i in range(n): * result += str(self[i]) * result += '\n' # <<<<<<<<<<<<<< @@ -12308,7 +12333,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_15__str__(struct __pyx_obj_6_basis_Basi __pyx_t_5 = 0; } - /* "_basis.pyx":519 + /* "sklearn/earth/_basis.pyx":519 * result += str(self[i]) * result += '\n' * return result # <<<<<<<<<<<<<< @@ -12325,7 +12350,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_15__str__(struct __pyx_obj_6_basis_Basi __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("_basis.Basis.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.Basis.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_result); @@ -12334,7 +12359,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_15__str__(struct __pyx_obj_6_basis_Basi return __pyx_r; } -/* "_basis.pyx":521 +/* "sklearn/earth/_basis.pyx":521 * return result * * cpdef translate(Basis self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): # <<<<<<<<<<<<<< @@ -12342,10 +12367,10 @@ static PyObject *__pyx_pf_6_basis_5Basis_15__str__(struct __pyx_obj_6_basis_Basi * cdef INDEX_t i #@DuplicatedSignature */ -static PyObject *__pyx_pw_6_basis_5Basis_18translate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_6_basis_5Basis_translate(struct __pyx_obj_6_basis_Basis *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts, int __pyx_skip_dispatch) { - __pyx_t_6_basis_INDEX_t __pyx_v_n; - __pyx_t_6_basis_INDEX_t __pyx_v_i; +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_18translate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_translate(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts, int __pyx_skip_dispatch) { + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_n; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_i; __Pyx_LocalBuf_ND __pyx_pybuffernd_intercepts; __Pyx_Buffer __pyx_pybuffer_intercepts; __Pyx_LocalBuf_ND __pyx_pybuffernd_slopes; @@ -12356,8 +12381,8 @@ static PyObject *__pyx_f_6_basis_5Basis_translate(struct __pyx_obj_6_basis_Basis PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; Py_ssize_t __pyx_t_4; - __pyx_t_6_basis_INDEX_t __pyx_t_5; - __pyx_t_6_basis_INDEX_t __pyx_t_6; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_5; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_6; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -12372,12 +12397,12 @@ static PyObject *__pyx_f_6_basis_5Basis_translate(struct __pyx_obj_6_basis_Basis __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; /* Check if called by wrapper */ @@ -12386,7 +12411,7 @@ static PyObject *__pyx_f_6_basis_5Basis_translate(struct __pyx_obj_6_basis_Basis else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__translate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_5Basis_18translate)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_5Basis_18translate)) { __Pyx_XDECREF(__pyx_r); __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -12407,7 +12432,7 @@ static PyObject *__pyx_f_6_basis_5Basis_translate(struct __pyx_obj_6_basis_Basis __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_basis.pyx":522 + /* "sklearn/earth/_basis.pyx":522 * * cpdef translate(Basis self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): * cdef INDEX_t n = len(self) # <<<<<<<<<<<<<< @@ -12417,7 +12442,7 @@ static PyObject *__pyx_f_6_basis_5Basis_translate(struct __pyx_obj_6_basis_Basis __pyx_t_4 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_n = __pyx_t_4; - /* "_basis.pyx":524 + /* "sklearn/earth/_basis.pyx":524 * cdef INDEX_t n = len(self) * cdef INDEX_t i #@DuplicatedSignature * for i in range(n): # <<<<<<<<<<<<<< @@ -12428,7 +12453,7 @@ static PyObject *__pyx_f_6_basis_5Basis_translate(struct __pyx_obj_6_basis_Basis for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "_basis.pyx":525 + /* "sklearn/earth/_basis.pyx":525 * cdef INDEX_t i #@DuplicatedSignature * for i in range(n): * self.order[i].translate(slopes,intercepts,False) # <<<<<<<<<<<<<< @@ -12472,7 +12497,7 @@ static PyObject *__pyx_f_6_basis_5Basis_translate(struct __pyx_obj_6_basis_Basis __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("_basis.Basis.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.Basis.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; goto __pyx_L2; __pyx_L0:; @@ -12485,8 +12510,8 @@ static PyObject *__pyx_f_6_basis_5Basis_translate(struct __pyx_obj_6_basis_Basis } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_5Basis_18translate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_6_basis_5Basis_18translate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_18translate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_18translate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_slopes = 0; PyArrayObject *__pyx_v_intercepts = 0; int __pyx_lineno = 0; @@ -12534,13 +12559,13 @@ static PyObject *__pyx_pw_6_basis_5Basis_18translate(PyObject *__pyx_v_self, PyO __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("translate", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_basis.Basis.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.Basis.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_slopes), __pyx_ptype_5numpy_ndarray, 1, "slopes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercepts), __pyx_ptype_5numpy_ndarray, 1, "intercepts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_6_basis_5Basis_17translate(((struct __pyx_obj_6_basis_Basis *)__pyx_v_self), __pyx_v_slopes, __pyx_v_intercepts); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_5Basis_17translate(((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)__pyx_v_self), __pyx_v_slopes, __pyx_v_intercepts); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -12549,7 +12574,7 @@ static PyObject *__pyx_pw_6_basis_5Basis_18translate(PyObject *__pyx_v_self, PyO return __pyx_r; } -/* "_basis.pyx":521 +/* "sklearn/earth/_basis.pyx":521 * return result * * cpdef translate(Basis self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): # <<<<<<<<<<<<<< @@ -12557,7 +12582,7 @@ static PyObject *__pyx_pw_6_basis_5Basis_18translate(PyObject *__pyx_v_self, PyO * cdef INDEX_t i #@DuplicatedSignature */ -static PyObject *__pyx_pf_6_basis_5Basis_17translate(struct __pyx_obj_6_basis_Basis *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_17translate(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts) { __Pyx_LocalBuf_ND __pyx_pybuffernd_intercepts; __Pyx_Buffer __pyx_pybuffer_intercepts; __Pyx_LocalBuf_ND __pyx_pybuffernd_slopes; @@ -12579,16 +12604,16 @@ static PyObject *__pyx_pf_6_basis_5Basis_17translate(struct __pyx_obj_6_basis_Ba __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->translate(__pyx_v_self, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->translate(__pyx_v_self, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -12603,7 +12628,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_17translate(struct __pyx_obj_6_basis_Ba __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("_basis.Basis.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.Basis.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; @@ -12615,7 +12640,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_17translate(struct __pyx_obj_6_basis_Ba return __pyx_r; } -/* "_basis.pyx":527 +/* "sklearn/earth/_basis.pyx":527 * self.order[i].translate(slopes,intercepts,False) * * cpdef scale(Basis self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, cnp.ndarray[FLOAT_t,ndim=1] beta): # <<<<<<<<<<<<<< @@ -12623,11 +12648,11 @@ static PyObject *__pyx_pf_6_basis_5Basis_17translate(struct __pyx_obj_6_basis_Ba * cdef INDEX_t i #@DuplicatedSignature */ -static PyObject *__pyx_pw_6_basis_5Basis_20scale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_6_basis_5Basis_scale(struct __pyx_obj_6_basis_Basis *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts, PyArrayObject *__pyx_v_beta, int __pyx_skip_dispatch) { - __pyx_t_6_basis_INDEX_t __pyx_v_n; - __pyx_t_6_basis_INDEX_t __pyx_v_i; - __pyx_t_6_basis_INDEX_t __pyx_v_j; +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_20scale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_scale(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts, PyArrayObject *__pyx_v_beta, int __pyx_skip_dispatch) { + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_n; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_i; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_j; __Pyx_LocalBuf_ND __pyx_pybuffernd_beta; __Pyx_Buffer __pyx_pybuffer_beta; __Pyx_LocalBuf_ND __pyx_pybuffernd_intercepts; @@ -12640,11 +12665,11 @@ static PyObject *__pyx_f_6_basis_5Basis_scale(struct __pyx_obj_6_basis_Basis *__ PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; Py_ssize_t __pyx_t_4; - __pyx_t_6_basis_INDEX_t __pyx_t_5; - __pyx_t_6_basis_INDEX_t __pyx_t_6; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_5; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_6; int __pyx_t_7; - __pyx_t_6_basis_FLOAT_t __pyx_t_8; - __pyx_t_6_basis_INDEX_t __pyx_t_9; + __pyx_t_7sklearn_5earth_6_basis_FLOAT_t __pyx_t_8; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_9; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -12663,17 +12688,17 @@ static PyObject *__pyx_f_6_basis_5Basis_scale(struct __pyx_obj_6_basis_Basis *__ __pyx_pybuffernd_beta.rcbuffer = &__pyx_pybuffer_beta; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_beta.rcbuffer->pybuffer, (PyObject*)__pyx_v_beta, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_beta.rcbuffer->pybuffer, (PyObject*)__pyx_v_beta, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_beta.diminfo[0].strides = __pyx_pybuffernd_beta.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_beta.diminfo[0].shape = __pyx_pybuffernd_beta.rcbuffer->pybuffer.shape[0]; /* Check if called by wrapper */ @@ -12682,7 +12707,7 @@ static PyObject *__pyx_f_6_basis_5Basis_scale(struct __pyx_obj_6_basis_Basis *__ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__scale); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_5Basis_20scale)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_5Basis_20scale)) { __Pyx_XDECREF(__pyx_r); __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -12706,7 +12731,7 @@ static PyObject *__pyx_f_6_basis_5Basis_scale(struct __pyx_obj_6_basis_Basis *__ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_basis.pyx":528 + /* "sklearn/earth/_basis.pyx":528 * * cpdef scale(Basis self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, cnp.ndarray[FLOAT_t,ndim=1] beta): * cdef INDEX_t n = len(self) #@DuplicatedSignature # <<<<<<<<<<<<<< @@ -12716,7 +12741,7 @@ static PyObject *__pyx_f_6_basis_5Basis_scale(struct __pyx_obj_6_basis_Basis *__ __pyx_t_4 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_n = __pyx_t_4; - /* "_basis.pyx":530 + /* "sklearn/earth/_basis.pyx":530 * cdef INDEX_t n = len(self) #@DuplicatedSignature * cdef INDEX_t i #@DuplicatedSignature * cdef INDEX_t j = 0 # <<<<<<<<<<<<<< @@ -12725,7 +12750,7 @@ static PyObject *__pyx_f_6_basis_5Basis_scale(struct __pyx_obj_6_basis_Basis *__ */ __pyx_v_j = 0; - /* "_basis.pyx":531 + /* "sklearn/earth/_basis.pyx":531 * cdef INDEX_t i #@DuplicatedSignature * cdef INDEX_t j = 0 * for i in range(n): # <<<<<<<<<<<<<< @@ -12736,7 +12761,7 @@ static PyObject *__pyx_f_6_basis_5Basis_scale(struct __pyx_obj_6_basis_Basis *__ for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "_basis.pyx":532 + /* "sklearn/earth/_basis.pyx":532 * cdef INDEX_t j = 0 * for i in range(n): * if self.order[i].is_pruned(): # <<<<<<<<<<<<<< @@ -12756,7 +12781,7 @@ static PyObject *__pyx_f_6_basis_5Basis_scale(struct __pyx_obj_6_basis_Basis *__ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { - /* "_basis.pyx":533 + /* "sklearn/earth/_basis.pyx":533 * for i in range(n): * if self.order[i].is_pruned(): * continue # <<<<<<<<<<<<<< @@ -12768,7 +12793,7 @@ static PyObject *__pyx_f_6_basis_5Basis_scale(struct __pyx_obj_6_basis_Basis *__ } __pyx_L5:; - /* "_basis.pyx":534 + /* "sklearn/earth/_basis.pyx":534 * if self.order[i].is_pruned(): * continue * beta[j] *= self.order[i].scale(slopes,intercepts) # <<<<<<<<<<<<<< @@ -12796,9 +12821,9 @@ static PyObject *__pyx_f_6_basis_5Basis_scale(struct __pyx_obj_6_basis_Basis *__ __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_8 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_9 = __pyx_v_j; - *__Pyx_BufPtrStrided1d(__pyx_t_6_basis_FLOAT_t *, __pyx_pybuffernd_beta.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_beta.diminfo[0].strides) *= __pyx_t_8; + *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_FLOAT_t *, __pyx_pybuffernd_beta.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_beta.diminfo[0].strides) *= __pyx_t_8; - /* "_basis.pyx":535 + /* "sklearn/earth/_basis.pyx":535 * continue * beta[j] *= self.order[i].scale(slopes,intercepts) * j += 1 # <<<<<<<<<<<<<< @@ -12821,7 +12846,7 @@ static PyObject *__pyx_f_6_basis_5Basis_scale(struct __pyx_obj_6_basis_Basis *__ __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("_basis.Basis.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.Basis.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; goto __pyx_L2; __pyx_L0:; @@ -12835,8 +12860,8 @@ static PyObject *__pyx_f_6_basis_5Basis_scale(struct __pyx_obj_6_basis_Basis *__ } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_5Basis_20scale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_6_basis_5Basis_20scale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_20scale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_20scale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_slopes = 0; PyArrayObject *__pyx_v_intercepts = 0; PyArrayObject *__pyx_v_beta = 0; @@ -12893,14 +12918,14 @@ static PyObject *__pyx_pw_6_basis_5Basis_20scale(PyObject *__pyx_v_self, PyObjec __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("scale", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_basis.Basis.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.Basis.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_slopes), __pyx_ptype_5numpy_ndarray, 1, "slopes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercepts), __pyx_ptype_5numpy_ndarray, 1, "intercepts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_beta), __pyx_ptype_5numpy_ndarray, 1, "beta", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_6_basis_5Basis_19scale(((struct __pyx_obj_6_basis_Basis *)__pyx_v_self), __pyx_v_slopes, __pyx_v_intercepts, __pyx_v_beta); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_5Basis_19scale(((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)__pyx_v_self), __pyx_v_slopes, __pyx_v_intercepts, __pyx_v_beta); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -12909,7 +12934,7 @@ static PyObject *__pyx_pw_6_basis_5Basis_20scale(PyObject *__pyx_v_self, PyObjec return __pyx_r; } -/* "_basis.pyx":527 +/* "sklearn/earth/_basis.pyx":527 * self.order[i].translate(slopes,intercepts,False) * * cpdef scale(Basis self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, cnp.ndarray[FLOAT_t,ndim=1] beta): # <<<<<<<<<<<<<< @@ -12917,7 +12942,7 @@ static PyObject *__pyx_pw_6_basis_5Basis_20scale(PyObject *__pyx_v_self, PyObjec * cdef INDEX_t i #@DuplicatedSignature */ -static PyObject *__pyx_pf_6_basis_5Basis_19scale(struct __pyx_obj_6_basis_Basis *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts, PyArrayObject *__pyx_v_beta) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_19scale(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts, PyArrayObject *__pyx_v_beta) { __Pyx_LocalBuf_ND __pyx_pybuffernd_beta; __Pyx_Buffer __pyx_pybuffer_beta; __Pyx_LocalBuf_ND __pyx_pybuffernd_intercepts; @@ -12945,21 +12970,21 @@ static PyObject *__pyx_pf_6_basis_5Basis_19scale(struct __pyx_obj_6_basis_Basis __pyx_pybuffernd_beta.rcbuffer = &__pyx_pybuffer_beta; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_beta.rcbuffer->pybuffer, (PyObject*)__pyx_v_beta, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_beta.rcbuffer->pybuffer, (PyObject*)__pyx_v_beta, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_beta.diminfo[0].strides = __pyx_pybuffernd_beta.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_beta.diminfo[0].shape = __pyx_pybuffernd_beta.rcbuffer->pybuffer.shape[0]; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->scale(__pyx_v_self, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), ((PyArrayObject *)__pyx_v_beta), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->scale(__pyx_v_self, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), ((PyArrayObject *)__pyx_v_beta), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -12975,7 +13000,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_19scale(struct __pyx_obj_6_basis_Basis __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("_basis.Basis.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.Basis.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; @@ -12988,7 +13013,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_19scale(struct __pyx_obj_6_basis_Basis return __pyx_r; } -/* "_basis.pyx":537 +/* "sklearn/earth/_basis.pyx":537 * j += 1 * * cpdef BasisFunction get_root(Basis self): # <<<<<<<<<<<<<< @@ -12996,9 +13021,9 @@ static PyObject *__pyx_pf_6_basis_5Basis_19scale(struct __pyx_obj_6_basis_Basis * */ -static PyObject *__pyx_pw_6_basis_5Basis_22get_root(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static struct __pyx_obj_6_basis_BasisFunction *__pyx_f_6_basis_5Basis_get_root(struct __pyx_obj_6_basis_Basis *__pyx_v_self, int __pyx_skip_dispatch) { - struct __pyx_obj_6_basis_BasisFunction *__pyx_r = NULL; +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_22get_root(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_f_7sklearn_5earth_6_basis_5Basis_get_root(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self, int __pyx_skip_dispatch) { + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; @@ -13012,12 +13037,12 @@ static struct __pyx_obj_6_basis_BasisFunction *__pyx_f_6_basis_5Basis_get_root(s else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_root); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_5Basis_22get_root)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_5Basis_22get_root)) { __Pyx_XDECREF(((PyObject *)__pyx_r)); __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = ((struct __pyx_obj_6_basis_BasisFunction *)__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; @@ -13025,7 +13050,7 @@ static struct __pyx_obj_6_basis_BasisFunction *__pyx_f_6_basis_5Basis_get_root(s __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_basis.pyx":538 + /* "sklearn/earth/_basis.pyx":538 * * cpdef BasisFunction get_root(Basis self): * return self.root # <<<<<<<<<<<<<< @@ -13035,17 +13060,17 @@ static struct __pyx_obj_6_basis_BasisFunction *__pyx_f_6_basis_5Basis_get_root(s __Pyx_XDECREF(((PyObject *)__pyx_r)); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__root); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = ((struct __pyx_obj_6_basis_BasisFunction *)__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = ((struct __pyx_obj_6_basis_BasisFunction *)Py_None); __Pyx_INCREF(Py_None); + __pyx_r = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)Py_None); __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_basis.Basis.get_root", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.Basis.get_root", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF((PyObject *)__pyx_r); @@ -13054,17 +13079,17 @@ static struct __pyx_obj_6_basis_BasisFunction *__pyx_f_6_basis_5Basis_get_root(s } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_5Basis_22get_root(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_6_basis_5Basis_22get_root(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_22get_root(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_22get_root(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_root (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_5Basis_21get_root(((struct __pyx_obj_6_basis_Basis *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_5Basis_21get_root(((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":537 +/* "sklearn/earth/_basis.pyx":537 * j += 1 * * cpdef BasisFunction get_root(Basis self): # <<<<<<<<<<<<<< @@ -13072,7 +13097,7 @@ static PyObject *__pyx_pw_6_basis_5Basis_22get_root(PyObject *__pyx_v_self, CYTH * */ -static PyObject *__pyx_pf_6_basis_5Basis_21get_root(struct __pyx_obj_6_basis_Basis *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_21get_root(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -13081,7 +13106,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_21get_root(struct __pyx_obj_6_basis_Bas int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_root", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->get_root(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->get_root(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -13091,7 +13116,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_21get_root(struct __pyx_obj_6_basis_Bas goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_basis.Basis.get_root", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.Basis.get_root", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -13099,7 +13124,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_21get_root(struct __pyx_obj_6_basis_Bas return __pyx_r; } -/* "_basis.pyx":540 +/* "sklearn/earth/_basis.pyx":540 * return self.root * * cpdef append(Basis self, BasisFunction basis_function): # <<<<<<<<<<<<<< @@ -13107,8 +13132,8 @@ static PyObject *__pyx_pf_6_basis_5Basis_21get_root(struct __pyx_obj_6_basis_Bas * */ -static PyObject *__pyx_pw_6_basis_5Basis_24append(PyObject *__pyx_v_self, PyObject *__pyx_v_basis_function); /*proto*/ -static PyObject *__pyx_f_6_basis_5Basis_append(struct __pyx_obj_6_basis_Basis *__pyx_v_self, struct __pyx_obj_6_basis_BasisFunction *__pyx_v_basis_function, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_24append(PyObject *__pyx_v_self, PyObject *__pyx_v_basis_function); /*proto*/ +static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_append(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self, struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_basis_function, int __pyx_skip_dispatch) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -13125,7 +13150,7 @@ static PyObject *__pyx_f_6_basis_5Basis_append(struct __pyx_obj_6_basis_Basis *_ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__append); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_5Basis_24append)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_5Basis_24append)) { __Pyx_XDECREF(__pyx_r); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -13143,7 +13168,7 @@ static PyObject *__pyx_f_6_basis_5Basis_append(struct __pyx_obj_6_basis_Basis *_ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_basis.pyx":541 + /* "sklearn/earth/_basis.pyx":541 * * cpdef append(Basis self, BasisFunction basis_function): * self.order.append(basis_function) # <<<<<<<<<<<<<< @@ -13162,7 +13187,7 @@ static PyObject *__pyx_f_6_basis_5Basis_append(struct __pyx_obj_6_basis_Basis *_ __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_basis.Basis.append", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.Basis.append", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -13171,16 +13196,16 @@ static PyObject *__pyx_f_6_basis_5Basis_append(struct __pyx_obj_6_basis_Basis *_ } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_5Basis_24append(PyObject *__pyx_v_self, PyObject *__pyx_v_basis_function); /*proto*/ -static PyObject *__pyx_pw_6_basis_5Basis_24append(PyObject *__pyx_v_self, PyObject *__pyx_v_basis_function) { - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_24append(PyObject *__pyx_v_self, PyObject *__pyx_v_basis_function); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_24append(PyObject *__pyx_v_self, PyObject *__pyx_v_basis_function) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("append (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_basis_function), __pyx_ptype_6_basis_BasisFunction, 1, "basis_function", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_6_basis_5Basis_23append(((struct __pyx_obj_6_basis_Basis *)__pyx_v_self), ((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_basis_function)); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_basis_function), __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction, 1, "basis_function", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_5Basis_23append(((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)__pyx_v_self), ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_basis_function)); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -13189,7 +13214,7 @@ static PyObject *__pyx_pw_6_basis_5Basis_24append(PyObject *__pyx_v_self, PyObje return __pyx_r; } -/* "_basis.pyx":540 +/* "sklearn/earth/_basis.pyx":540 * return self.root * * cpdef append(Basis self, BasisFunction basis_function): # <<<<<<<<<<<<<< @@ -13197,7 +13222,7 @@ static PyObject *__pyx_pw_6_basis_5Basis_24append(PyObject *__pyx_v_self, PyObje * */ -static PyObject *__pyx_pf_6_basis_5Basis_23append(struct __pyx_obj_6_basis_Basis *__pyx_v_self, struct __pyx_obj_6_basis_BasisFunction *__pyx_v_basis_function) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_23append(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self, struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_basis_function) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -13206,7 +13231,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_23append(struct __pyx_obj_6_basis_Basis int __pyx_clineno = 0; __Pyx_RefNannySetupContext("append", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->append(__pyx_v_self, __pyx_v_basis_function, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->append(__pyx_v_self, __pyx_v_basis_function, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -13216,7 +13241,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_23append(struct __pyx_obj_6_basis_Basis goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_basis.Basis.append", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.Basis.append", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -13225,17 +13250,17 @@ static PyObject *__pyx_pf_6_basis_5Basis_23append(struct __pyx_obj_6_basis_Basis } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_5Basis_26__iter__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_6_basis_5Basis_26__iter__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_26__iter__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_26__iter__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__iter__ (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_5Basis_25__iter__(((struct __pyx_obj_6_basis_Basis *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_5Basis_25__iter__(((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":543 +/* "sklearn/earth/_basis.pyx":543 * self.order.append(basis_function) * * def __iter__(Basis self): # <<<<<<<<<<<<<< @@ -13243,7 +13268,7 @@ static PyObject *__pyx_pw_6_basis_5Basis_26__iter__(PyObject *__pyx_v_self) { * */ -static PyObject *__pyx_pf_6_basis_5Basis_25__iter__(struct __pyx_obj_6_basis_Basis *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_25__iter__(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -13253,7 +13278,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_25__iter__(struct __pyx_obj_6_basis_Bas int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__iter__", 0); - /* "_basis.pyx":544 + /* "sklearn/earth/_basis.pyx":544 * * def __iter__(Basis self): * return self.order.__iter__() # <<<<<<<<<<<<<< @@ -13275,7 +13300,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_25__iter__(struct __pyx_obj_6_basis_Bas __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_basis.Basis.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.Basis.__iter__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -13284,17 +13309,17 @@ static PyObject *__pyx_pf_6_basis_5Basis_25__iter__(struct __pyx_obj_6_basis_Bas } /* Python wrapper */ -static Py_ssize_t __pyx_pw_6_basis_5Basis_28__len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_pw_6_basis_5Basis_28__len__(PyObject *__pyx_v_self) { +static Py_ssize_t __pyx_pw_7sklearn_5earth_6_basis_5Basis_28__len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_pw_7sklearn_5earth_6_basis_5Basis_28__len__(PyObject *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_5Basis_27__len__(((struct __pyx_obj_6_basis_Basis *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_5Basis_27__len__(((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":546 +/* "sklearn/earth/_basis.pyx":546 * return self.order.__iter__() * * def __len__(Basis self): # <<<<<<<<<<<<<< @@ -13302,7 +13327,7 @@ static Py_ssize_t __pyx_pw_6_basis_5Basis_28__len__(PyObject *__pyx_v_self) { * */ -static Py_ssize_t __pyx_pf_6_basis_5Basis_27__len__(struct __pyx_obj_6_basis_Basis *__pyx_v_self) { +static Py_ssize_t __pyx_pf_7sklearn_5earth_6_basis_5Basis_27__len__(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -13313,7 +13338,7 @@ static Py_ssize_t __pyx_pf_6_basis_5Basis_27__len__(struct __pyx_obj_6_basis_Bas int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__len__", 0); - /* "_basis.pyx":547 + /* "sklearn/earth/_basis.pyx":547 * * def __len__(Basis self): * return self.order.__len__() # <<<<<<<<<<<<<< @@ -13335,14 +13360,14 @@ static Py_ssize_t __pyx_pf_6_basis_5Basis_27__len__(struct __pyx_obj_6_basis_Bas __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_basis.Basis.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.Basis.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":549 +/* "sklearn/earth/_basis.pyx":549 * return self.order.__len__() * * cpdef BasisFunction get(Basis self, INDEX_t i): # <<<<<<<<<<<<<< @@ -13350,9 +13375,9 @@ static Py_ssize_t __pyx_pf_6_basis_5Basis_27__len__(struct __pyx_obj_6_basis_Bas * */ -static PyObject *__pyx_pw_6_basis_5Basis_30get(PyObject *__pyx_v_self, PyObject *__pyx_arg_i); /*proto*/ -static struct __pyx_obj_6_basis_BasisFunction *__pyx_f_6_basis_5Basis_get(struct __pyx_obj_6_basis_Basis *__pyx_v_self, __pyx_t_6_basis_INDEX_t __pyx_v_i, int __pyx_skip_dispatch) { - struct __pyx_obj_6_basis_BasisFunction *__pyx_r = NULL; +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_30get(PyObject *__pyx_v_self, PyObject *__pyx_arg_i); /*proto*/ +static struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_f_7sklearn_5earth_6_basis_5Basis_get(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self, __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_i, int __pyx_skip_dispatch) { + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; @@ -13367,7 +13392,7 @@ static struct __pyx_obj_6_basis_BasisFunction *__pyx_f_6_basis_5Basis_get(struct else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_5Basis_30get)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_5Basis_30get)) { __Pyx_XDECREF(((PyObject *)__pyx_r)); __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -13379,8 +13404,8 @@ static struct __pyx_obj_6_basis_BasisFunction *__pyx_f_6_basis_5Basis_get(struct __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = ((struct __pyx_obj_6_basis_BasisFunction *)__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; @@ -13388,7 +13413,7 @@ static struct __pyx_obj_6_basis_BasisFunction *__pyx_f_6_basis_5Basis_get(struct __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_basis.pyx":550 + /* "sklearn/earth/_basis.pyx":550 * * cpdef BasisFunction get(Basis self, INDEX_t i): * return self.order[i] # <<<<<<<<<<<<<< @@ -13400,18 +13425,18 @@ static struct __pyx_obj_6_basis_BasisFunction *__pyx_f_6_basis_5Basis_get(struct PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - if (!(likely(((PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i)) == Py_None) || likely(__Pyx_TypeTest(PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i), __pyx_ptype_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i)) == Py_None) || likely(__Pyx_TypeTest(PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i), __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_INCREF(PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i)); - __pyx_r = ((struct __pyx_obj_6_basis_BasisFunction *)PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i)); + __pyx_r = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i)); goto __pyx_L0; - __pyx_r = ((struct __pyx_obj_6_basis_BasisFunction *)Py_None); __Pyx_INCREF(Py_None); + __pyx_r = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)Py_None); __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_basis.Basis.get", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.Basis.get", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF((PyObject *)__pyx_r); @@ -13420,9 +13445,9 @@ static struct __pyx_obj_6_basis_BasisFunction *__pyx_f_6_basis_5Basis_get(struct } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_5Basis_30get(PyObject *__pyx_v_self, PyObject *__pyx_arg_i); /*proto*/ -static PyObject *__pyx_pw_6_basis_5Basis_30get(PyObject *__pyx_v_self, PyObject *__pyx_arg_i) { - __pyx_t_6_basis_INDEX_t __pyx_v_i; +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_30get(PyObject *__pyx_v_self, PyObject *__pyx_arg_i); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_30get(PyObject *__pyx_v_self, PyObject *__pyx_arg_i) { + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_i; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -13434,16 +13459,16 @@ static PyObject *__pyx_pw_6_basis_5Basis_30get(PyObject *__pyx_v_self, PyObject } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_basis.Basis.get", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.Basis.get", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_6_basis_5Basis_29get(((struct __pyx_obj_6_basis_Basis *)__pyx_v_self), ((__pyx_t_6_basis_INDEX_t)__pyx_v_i)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_5Basis_29get(((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)__pyx_v_self), ((__pyx_t_7sklearn_5earth_6_basis_INDEX_t)__pyx_v_i)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":549 +/* "sklearn/earth/_basis.pyx":549 * return self.order.__len__() * * cpdef BasisFunction get(Basis self, INDEX_t i): # <<<<<<<<<<<<<< @@ -13451,7 +13476,7 @@ static PyObject *__pyx_pw_6_basis_5Basis_30get(PyObject *__pyx_v_self, PyObject * */ -static PyObject *__pyx_pf_6_basis_5Basis_29get(struct __pyx_obj_6_basis_Basis *__pyx_v_self, __pyx_t_6_basis_INDEX_t __pyx_v_i) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_29get(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self, __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_i) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -13460,7 +13485,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_29get(struct __pyx_obj_6_basis_Basis *_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->get(__pyx_v_self, __pyx_v_i, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->get(__pyx_v_self, __pyx_v_i, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -13470,7 +13495,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_29get(struct __pyx_obj_6_basis_Basis *_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_basis.Basis.get", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.Basis.get", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -13479,9 +13504,9 @@ static PyObject *__pyx_pf_6_basis_5Basis_29get(struct __pyx_obj_6_basis_Basis *_ } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_5Basis_32__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_i); /*proto*/ -static PyObject *__pyx_pw_6_basis_5Basis_32__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_i) { - __pyx_t_6_basis_INDEX_t __pyx_v_i; +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_32__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_i); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_32__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_i) { + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_i; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -13493,16 +13518,16 @@ static PyObject *__pyx_pw_6_basis_5Basis_32__getitem__(PyObject *__pyx_v_self, P } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_basis.Basis.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.Basis.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_6_basis_5Basis_31__getitem__(((struct __pyx_obj_6_basis_Basis *)__pyx_v_self), ((__pyx_t_6_basis_INDEX_t)__pyx_v_i)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_5Basis_31__getitem__(((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)__pyx_v_self), ((__pyx_t_7sklearn_5earth_6_basis_INDEX_t)__pyx_v_i)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":552 +/* "sklearn/earth/_basis.pyx":552 * return self.order[i] * * def __getitem__(Basis self, INDEX_t i): # <<<<<<<<<<<<<< @@ -13510,7 +13535,7 @@ static PyObject *__pyx_pw_6_basis_5Basis_32__getitem__(PyObject *__pyx_v_self, P * */ -static PyObject *__pyx_pf_6_basis_5Basis_31__getitem__(struct __pyx_obj_6_basis_Basis *__pyx_v_self, __pyx_t_6_basis_INDEX_t __pyx_v_i) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_31__getitem__(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self, __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_i) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -13519,7 +13544,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_31__getitem__(struct __pyx_obj_6_basis_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getitem__", 0); - /* "_basis.pyx":553 + /* "sklearn/earth/_basis.pyx":553 * * def __getitem__(Basis self, INDEX_t i): * return self.get(i) # <<<<<<<<<<<<<< @@ -13527,7 +13552,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_31__getitem__(struct __pyx_obj_6_basis_ * cpdef INDEX_t plen(Basis self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->get(__pyx_v_self, __pyx_v_i, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->get(__pyx_v_self, __pyx_v_i, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -13537,7 +13562,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_31__getitem__(struct __pyx_obj_6_basis_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_basis.Basis.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.Basis.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -13545,7 +13570,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_31__getitem__(struct __pyx_obj_6_basis_ return __pyx_r; } -/* "_basis.pyx":555 +/* "sklearn/earth/_basis.pyx":555 * return self.get(i) * * cpdef INDEX_t plen(Basis self): # <<<<<<<<<<<<<< @@ -13553,18 +13578,18 @@ static PyObject *__pyx_pf_6_basis_5Basis_31__getitem__(struct __pyx_obj_6_basis_ * cdef INDEX_t i */ -static PyObject *__pyx_pw_6_basis_5Basis_34plen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static __pyx_t_6_basis_INDEX_t __pyx_f_6_basis_5Basis_plen(struct __pyx_obj_6_basis_Basis *__pyx_v_self, int __pyx_skip_dispatch) { - __pyx_t_6_basis_INDEX_t __pyx_v_length; - __pyx_t_6_basis_INDEX_t __pyx_v_i; - __pyx_t_6_basis_INDEX_t __pyx_v_n; - __pyx_t_6_basis_INDEX_t __pyx_r; +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_34plen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_f_7sklearn_5earth_6_basis_5Basis_plen(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self, int __pyx_skip_dispatch) { + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_length; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_i; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_n; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - __pyx_t_6_basis_INDEX_t __pyx_t_3; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_3; Py_ssize_t __pyx_t_4; - __pyx_t_6_basis_INDEX_t __pyx_t_5; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_5; int __pyx_t_6; int __pyx_t_7; int __pyx_lineno = 0; @@ -13577,7 +13602,7 @@ static __pyx_t_6_basis_INDEX_t __pyx_f_6_basis_5Basis_plen(struct __pyx_obj_6_ba else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__plen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_5Basis_34plen)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_5Basis_34plen)) { __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -13589,7 +13614,7 @@ static __pyx_t_6_basis_INDEX_t __pyx_f_6_basis_5Basis_plen(struct __pyx_obj_6_ba __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_basis.pyx":556 + /* "sklearn/earth/_basis.pyx":556 * * cpdef INDEX_t plen(Basis self): * cdef INDEX_t length = 0 # <<<<<<<<<<<<<< @@ -13598,7 +13623,7 @@ static __pyx_t_6_basis_INDEX_t __pyx_f_6_basis_5Basis_plen(struct __pyx_obj_6_ba */ __pyx_v_length = 0; - /* "_basis.pyx":558 + /* "sklearn/earth/_basis.pyx":558 * cdef INDEX_t length = 0 * cdef INDEX_t i * cdef INDEX_t n = len(self.order) # <<<<<<<<<<<<<< @@ -13615,7 +13640,7 @@ static __pyx_t_6_basis_INDEX_t __pyx_f_6_basis_5Basis_plen(struct __pyx_obj_6_ba __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_n = __pyx_t_4; - /* "_basis.pyx":559 + /* "sklearn/earth/_basis.pyx":559 * cdef INDEX_t i * cdef INDEX_t n = len(self.order) * for i in range(n): # <<<<<<<<<<<<<< @@ -13626,7 +13651,7 @@ static __pyx_t_6_basis_INDEX_t __pyx_f_6_basis_5Basis_plen(struct __pyx_obj_6_ba for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_3; __pyx_t_5+=1) { __pyx_v_i = __pyx_t_5; - /* "_basis.pyx":560 + /* "sklearn/earth/_basis.pyx":560 * cdef INDEX_t n = len(self.order) * for i in range(n): * if not self.order[i].is_pruned(): # <<<<<<<<<<<<<< @@ -13644,10 +13669,10 @@ static __pyx_t_6_basis_INDEX_t __pyx_f_6_basis_5Basis_plen(struct __pyx_obj_6_ba __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_7 = (!__pyx_t_6); + __pyx_t_7 = ((!__pyx_t_6) != 0); if (__pyx_t_7) { - /* "_basis.pyx":561 + /* "sklearn/earth/_basis.pyx":561 * for i in range(n): * if not self.order[i].is_pruned(): * length += 1 # <<<<<<<<<<<<<< @@ -13660,7 +13685,7 @@ static __pyx_t_6_basis_INDEX_t __pyx_f_6_basis_5Basis_plen(struct __pyx_obj_6_ba __pyx_L5:; } - /* "_basis.pyx":562 + /* "sklearn/earth/_basis.pyx":562 * if not self.order[i].is_pruned(): * length += 1 * return length # <<<<<<<<<<<<<< @@ -13675,7 +13700,7 @@ static __pyx_t_6_basis_INDEX_t __pyx_f_6_basis_5Basis_plen(struct __pyx_obj_6_ba __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_WriteUnraisable("_basis.Basis.plen", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("sklearn.earth._basis.Basis.plen", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -13683,17 +13708,17 @@ static __pyx_t_6_basis_INDEX_t __pyx_f_6_basis_5Basis_plen(struct __pyx_obj_6_ba } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_5Basis_34plen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_6_basis_5Basis_34plen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_34plen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_34plen(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("plen (wrapper)", 0); - __pyx_r = __pyx_pf_6_basis_5Basis_33plen(((struct __pyx_obj_6_basis_Basis *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_5Basis_33plen(((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_basis.pyx":555 +/* "sklearn/earth/_basis.pyx":555 * return self.get(i) * * cpdef INDEX_t plen(Basis self): # <<<<<<<<<<<<<< @@ -13701,7 +13726,7 @@ static PyObject *__pyx_pw_6_basis_5Basis_34plen(PyObject *__pyx_v_self, CYTHON_U * cdef INDEX_t i */ -static PyObject *__pyx_pf_6_basis_5Basis_33plen(struct __pyx_obj_6_basis_Basis *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_33plen(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -13710,7 +13735,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_33plen(struct __pyx_obj_6_basis_Basis * int __pyx_clineno = 0; __Pyx_RefNannySetupContext("plen", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->plen(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->plen(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -13720,7 +13745,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_33plen(struct __pyx_obj_6_basis_Basis * goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_basis.Basis.plen", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.Basis.plen", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -13728,7 +13753,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_33plen(struct __pyx_obj_6_basis_Basis * return __pyx_r; } -/* "_basis.pyx":564 +/* "sklearn/earth/_basis.pyx":564 * return length * * cpdef transform(Basis self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=2] B): # <<<<<<<<<<<<<< @@ -13736,12 +13761,12 @@ static PyObject *__pyx_pf_6_basis_5Basis_33plen(struct __pyx_obj_6_basis_Basis * * cdef INDEX_t n = self.__len__() */ -static PyObject *__pyx_pw_6_basis_5Basis_36transform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_6_basis_5Basis_transform(struct __pyx_obj_6_basis_Basis *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_B, int __pyx_skip_dispatch) { - __pyx_t_6_basis_INDEX_t __pyx_v_i; - __pyx_t_6_basis_INDEX_t __pyx_v_n; - struct __pyx_obj_6_basis_BasisFunction *__pyx_v_bf = 0; - __pyx_t_6_basis_INDEX_t __pyx_v_col; +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_36transform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_transform(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_B, int __pyx_skip_dispatch) { + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_i; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_n; + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_bf = 0; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_col; __Pyx_LocalBuf_ND __pyx_pybuffernd_B; __Pyx_Buffer __pyx_pybuffer_B; __Pyx_LocalBuf_ND __pyx_pybuffernd_X; @@ -13751,10 +13776,10 @@ static PyObject *__pyx_f_6_basis_5Basis_transform(struct __pyx_obj_6_basis_Basis PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - __pyx_t_6_basis_INDEX_t __pyx_t_4; - __pyx_t_6_basis_INDEX_t __pyx_t_5; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_4; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_5; int __pyx_t_6; - struct __pyx_opt_args_6_basis_13BasisFunction_apply __pyx_t_7; + struct __pyx_opt_args_7sklearn_5earth_6_basis_13BasisFunction_apply __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -13769,12 +13794,12 @@ static PyObject *__pyx_f_6_basis_5Basis_transform(struct __pyx_obj_6_basis_Basis __pyx_pybuffernd_B.rcbuffer = &__pyx_pybuffer_B; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_v_B, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_v_B, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_B.diminfo[0].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B.diminfo[0].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B.diminfo[1].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B.diminfo[1].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[1]; /* Check if called by wrapper */ @@ -13783,7 +13808,7 @@ static PyObject *__pyx_f_6_basis_5Basis_transform(struct __pyx_obj_6_basis_Basis else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__transform); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_5Basis_36transform)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_5Basis_36transform)) { __Pyx_XDECREF(__pyx_r); __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -13804,7 +13829,7 @@ static PyObject *__pyx_f_6_basis_5Basis_transform(struct __pyx_obj_6_basis_Basis __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_basis.pyx":566 + /* "sklearn/earth/_basis.pyx":566 * cpdef transform(Basis self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=2] B): * cdef INDEX_t i #@DuplicatedSignature * cdef INDEX_t n = self.__len__() # <<<<<<<<<<<<<< @@ -13820,7 +13845,7 @@ static PyObject *__pyx_f_6_basis_5Basis_transform(struct __pyx_obj_6_basis_Basis __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_n = __pyx_t_4; - /* "_basis.pyx":568 + /* "sklearn/earth/_basis.pyx":568 * cdef INDEX_t n = self.__len__() * cdef BasisFunction bf * cdef INDEX_t col = 0 # <<<<<<<<<<<<<< @@ -13829,7 +13854,7 @@ static PyObject *__pyx_f_6_basis_5Basis_transform(struct __pyx_obj_6_basis_Basis */ __pyx_v_col = 0; - /* "_basis.pyx":569 + /* "sklearn/earth/_basis.pyx":569 * cdef BasisFunction bf * cdef INDEX_t col = 0 * for i in range(n): # <<<<<<<<<<<<<< @@ -13840,7 +13865,7 @@ static PyObject *__pyx_f_6_basis_5Basis_transform(struct __pyx_obj_6_basis_Basis for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { __pyx_v_i = __pyx_t_5; - /* "_basis.pyx":570 + /* "sklearn/earth/_basis.pyx":570 * cdef INDEX_t col = 0 * for i in range(n): * bf = self.order[i] # <<<<<<<<<<<<<< @@ -13851,24 +13876,24 @@ static PyObject *__pyx_f_6_basis_5Basis_transform(struct __pyx_obj_6_basis_Basis PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - if (!(likely(((PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i)) == Py_None) || likely(__Pyx_TypeTest(PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i), __pyx_ptype_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i)) == Py_None) || likely(__Pyx_TypeTest(PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i), __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_3 = PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i); __Pyx_INCREF(__pyx_t_3); __Pyx_XDECREF(((PyObject *)__pyx_v_bf)); - __pyx_v_bf = ((struct __pyx_obj_6_basis_BasisFunction *)__pyx_t_3); + __pyx_v_bf = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_3); __pyx_t_3 = 0; - /* "_basis.pyx":571 + /* "sklearn/earth/_basis.pyx":571 * for i in range(n): * bf = self.order[i] * if bf.is_pruned(): # <<<<<<<<<<<<<< * continue * bf.apply(X,B[:,col],recurse=True) */ - __pyx_t_6 = ((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_bf->__pyx_vtab)->is_pruned(__pyx_v_bf, 0); + __pyx_t_6 = (((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_bf->__pyx_vtab)->is_pruned(__pyx_v_bf, 0) != 0); if (__pyx_t_6) { - /* "_basis.pyx":572 + /* "sklearn/earth/_basis.pyx":572 * bf = self.order[i] * if bf.is_pruned(): * continue # <<<<<<<<<<<<<< @@ -13880,7 +13905,7 @@ static PyObject *__pyx_f_6_basis_5Basis_transform(struct __pyx_obj_6_basis_Basis } __pyx_L5:; - /* "_basis.pyx":573 + /* "sklearn/earth/_basis.pyx":573 * if bf.is_pruned(): * continue * bf.apply(X,B[:,col],recurse=True) # <<<<<<<<<<<<<< @@ -13903,12 +13928,12 @@ static PyObject *__pyx_f_6_basis_5Basis_transform(struct __pyx_obj_6_basis_Basis if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_7.__pyx_n = 1; __pyx_t_7.recurse = 1; - __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_bf->__pyx_vtab)->apply(__pyx_v_bf, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_t_3), 0, &__pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_bf->__pyx_vtab)->apply(__pyx_v_bf, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_t_3), 0, &__pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "_basis.pyx":574 + /* "sklearn/earth/_basis.pyx":574 * continue * bf.apply(X,B[:,col],recurse=True) * col += 1 # <<<<<<<<<<<<<< @@ -13930,7 +13955,7 @@ static PyObject *__pyx_f_6_basis_5Basis_transform(struct __pyx_obj_6_basis_Basis __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_B.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("_basis.Basis.transform", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.Basis.transform", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; goto __pyx_L2; __pyx_L0:; @@ -13944,8 +13969,8 @@ static PyObject *__pyx_f_6_basis_5Basis_transform(struct __pyx_obj_6_basis_Basis } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_5Basis_36transform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_6_basis_5Basis_36transform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_36transform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_36transform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_X = 0; PyArrayObject *__pyx_v_B = 0; int __pyx_lineno = 0; @@ -13993,13 +14018,13 @@ static PyObject *__pyx_pw_6_basis_5Basis_36transform(PyObject *__pyx_v_self, PyO __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("transform", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_basis.Basis.transform", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.Basis.transform", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_B), __pyx_ptype_5numpy_ndarray, 1, "B", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_6_basis_5Basis_35transform(((struct __pyx_obj_6_basis_Basis *)__pyx_v_self), __pyx_v_X, __pyx_v_B); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_5Basis_35transform(((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)__pyx_v_self), __pyx_v_X, __pyx_v_B); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -14008,7 +14033,7 @@ static PyObject *__pyx_pw_6_basis_5Basis_36transform(PyObject *__pyx_v_self, PyO return __pyx_r; } -/* "_basis.pyx":564 +/* "sklearn/earth/_basis.pyx":564 * return length * * cpdef transform(Basis self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=2] B): # <<<<<<<<<<<<<< @@ -14016,7 +14041,7 @@ static PyObject *__pyx_pw_6_basis_5Basis_36transform(PyObject *__pyx_v_self, PyO * cdef INDEX_t n = self.__len__() */ -static PyObject *__pyx_pf_6_basis_5Basis_35transform(struct __pyx_obj_6_basis_Basis *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_B) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_35transform(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_B) { __Pyx_LocalBuf_ND __pyx_pybuffernd_B; __Pyx_Buffer __pyx_pybuffer_B; __Pyx_LocalBuf_ND __pyx_pybuffernd_X; @@ -14038,16 +14063,16 @@ static PyObject *__pyx_pf_6_basis_5Basis_35transform(struct __pyx_obj_6_basis_Ba __pyx_pybuffernd_B.rcbuffer = &__pyx_pybuffer_B; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_v_B, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_v_B, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_B.diminfo[0].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B.diminfo[0].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B.diminfo[1].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B.diminfo[1].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[1]; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->transform(__pyx_v_self, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_B), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->transform(__pyx_v_self, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_B), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -14062,7 +14087,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_35transform(struct __pyx_obj_6_basis_Ba __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_B.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("_basis.Basis.transform", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.Basis.transform", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; @@ -14074,7 +14099,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_35transform(struct __pyx_obj_6_basis_Ba return __pyx_r; } -/* "_basis.pyx":576 +/* "sklearn/earth/_basis.pyx":576 * col += 1 * * cpdef weighted_transform(Basis self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=2] B, cnp.ndarray[FLOAT_t,ndim=1] weights): # <<<<<<<<<<<<<< @@ -14082,9 +14107,9 @@ static PyObject *__pyx_pf_6_basis_5Basis_35transform(struct __pyx_obj_6_basis_Ba * cdef INDEX_t n = self.__len__() */ -static PyObject *__pyx_pw_6_basis_5Basis_38weighted_transform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_6_basis_5Basis_weighted_transform(struct __pyx_obj_6_basis_Basis *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_B, PyArrayObject *__pyx_v_weights, int __pyx_skip_dispatch) { - CYTHON_UNUSED __pyx_t_6_basis_INDEX_t __pyx_v_n; +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_38weighted_transform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_weighted_transform(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_B, PyArrayObject *__pyx_v_weights, int __pyx_skip_dispatch) { + CYTHON_UNUSED __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_v_n; __Pyx_LocalBuf_ND __pyx_pybuffernd_B; __Pyx_Buffer __pyx_pybuffer_B; __Pyx_LocalBuf_ND __pyx_pybuffernd_X; @@ -14096,7 +14121,7 @@ static PyObject *__pyx_f_6_basis_5Basis_weighted_transform(struct __pyx_obj_6_ba PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - __pyx_t_6_basis_INDEX_t __pyx_t_4; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -14115,17 +14140,17 @@ static PyObject *__pyx_f_6_basis_5Basis_weighted_transform(struct __pyx_obj_6_ba __pyx_pybuffernd_weights.rcbuffer = &__pyx_pybuffer_weights; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_v_B, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_v_B, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_B.diminfo[0].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B.diminfo[0].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B.diminfo[1].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B.diminfo[1].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_weights.diminfo[0].strides = __pyx_pybuffernd_weights.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weights.diminfo[0].shape = __pyx_pybuffernd_weights.rcbuffer->pybuffer.shape[0]; /* Check if called by wrapper */ @@ -14134,7 +14159,7 @@ static PyObject *__pyx_f_6_basis_5Basis_weighted_transform(struct __pyx_obj_6_ba else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__weighted_transform); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_6_basis_5Basis_38weighted_transform)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_5Basis_38weighted_transform)) { __Pyx_XDECREF(__pyx_r); __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -14158,7 +14183,7 @@ static PyObject *__pyx_f_6_basis_5Basis_weighted_transform(struct __pyx_obj_6_ba __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_basis.pyx":578 + /* "sklearn/earth/_basis.pyx":578 * cpdef weighted_transform(Basis self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=2] B, cnp.ndarray[FLOAT_t,ndim=1] weights): * cdef INDEX_t i #@DuplicatedSignature * cdef INDEX_t n = self.__len__() # <<<<<<<<<<<<<< @@ -14174,24 +14199,24 @@ static PyObject *__pyx_f_6_basis_5Basis_weighted_transform(struct __pyx_obj_6_ba __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_n = __pyx_t_4; - /* "_basis.pyx":580 + /* "sklearn/earth/_basis.pyx":580 * cdef INDEX_t n = self.__len__() * * self.transform(X,B) # <<<<<<<<<<<<<< * apply_weights_2d(B,weights) * */ - __pyx_t_3 = ((struct __pyx_vtabstruct_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->transform(__pyx_v_self, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_B), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->transform(__pyx_v_self, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_B), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "_basis.pyx":581 + /* "sklearn/earth/_basis.pyx":581 * * self.transform(X,B) * apply_weights_2d(B,weights) # <<<<<<<<<<<<<< * */ - __pyx_t_3 = __pyx_f_5_util_apply_weights_2d(((PyArrayObject *)__pyx_v_B), ((PyArrayObject *)__pyx_v_weights), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_f_7sklearn_5earth_5_util_apply_weights_2d(((PyArrayObject *)__pyx_v_B), ((PyArrayObject *)__pyx_v_weights), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -14207,7 +14232,7 @@ static PyObject *__pyx_f_6_basis_5Basis_weighted_transform(struct __pyx_obj_6_ba __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("_basis.Basis.weighted_transform", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.Basis.weighted_transform", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; goto __pyx_L2; __pyx_L0:; @@ -14221,8 +14246,8 @@ static PyObject *__pyx_f_6_basis_5Basis_weighted_transform(struct __pyx_obj_6_ba } /* Python wrapper */ -static PyObject *__pyx_pw_6_basis_5Basis_38weighted_transform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_6_basis_5Basis_38weighted_transform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_38weighted_transform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_38weighted_transform(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_X = 0; PyArrayObject *__pyx_v_B = 0; PyArrayObject *__pyx_v_weights = 0; @@ -14279,14 +14304,14 @@ static PyObject *__pyx_pw_6_basis_5Basis_38weighted_transform(PyObject *__pyx_v_ __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("weighted_transform", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_basis.Basis.weighted_transform", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.Basis.weighted_transform", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_B), __pyx_ptype_5numpy_ndarray, 1, "B", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weights), __pyx_ptype_5numpy_ndarray, 1, "weights", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_6_basis_5Basis_37weighted_transform(((struct __pyx_obj_6_basis_Basis *)__pyx_v_self), __pyx_v_X, __pyx_v_B, __pyx_v_weights); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_5Basis_37weighted_transform(((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)__pyx_v_self), __pyx_v_X, __pyx_v_B, __pyx_v_weights); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -14295,7 +14320,7 @@ static PyObject *__pyx_pw_6_basis_5Basis_38weighted_transform(PyObject *__pyx_v_ return __pyx_r; } -/* "_basis.pyx":576 +/* "sklearn/earth/_basis.pyx":576 * col += 1 * * cpdef weighted_transform(Basis self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=2] B, cnp.ndarray[FLOAT_t,ndim=1] weights): # <<<<<<<<<<<<<< @@ -14303,7 +14328,7 @@ static PyObject *__pyx_pw_6_basis_5Basis_38weighted_transform(PyObject *__pyx_v_ * cdef INDEX_t n = self.__len__() */ -static PyObject *__pyx_pf_6_basis_5Basis_37weighted_transform(struct __pyx_obj_6_basis_Basis *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_B, PyArrayObject *__pyx_v_weights) { +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_37weighted_transform(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_B, PyArrayObject *__pyx_v_weights) { __Pyx_LocalBuf_ND __pyx_pybuffernd_B; __Pyx_Buffer __pyx_pybuffer_B; __Pyx_LocalBuf_ND __pyx_pybuffernd_X; @@ -14331,21 +14356,21 @@ static PyObject *__pyx_pf_6_basis_5Basis_37weighted_transform(struct __pyx_obj_6 __pyx_pybuffernd_weights.rcbuffer = &__pyx_pybuffer_weights; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_v_B, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_v_B, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_B.diminfo[0].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B.diminfo[0].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B.diminfo[1].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B.diminfo[1].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_weights.diminfo[0].strides = __pyx_pybuffernd_weights.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weights.diminfo[0].shape = __pyx_pybuffernd_weights.rcbuffer->pybuffer.shape[0]; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->weighted_transform(__pyx_v_self, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_B), ((PyArrayObject *)__pyx_v_weights), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->weighted_transform(__pyx_v_self, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_B), ((PyArrayObject *)__pyx_v_weights), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -14361,7 +14386,7 @@ static PyObject *__pyx_pf_6_basis_5Basis_37weighted_transform(struct __pyx_obj_6 __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("_basis.Basis.weighted_transform", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._basis.Basis.weighted_transform", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; @@ -14431,7 +14456,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * * cdef int copy_shape, i, ndim */ - __pyx_t_1 = (__pyx_v_info == NULL); + __pyx_t_1 = ((__pyx_v_info == NULL) != 0); if (__pyx_t_1) { __pyx_r = 0; goto __pyx_L0; @@ -14473,7 +14498,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * copy_shape = 1 * else: */ - __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); if (__pyx_t_1) { /* "numpy.pxd":209 @@ -14506,7 +14531,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); + __pyx_t_1 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0); if (__pyx_t_1) { /* "numpy.pxd":214 @@ -14516,7 +14541,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * raise ValueError(u"ndarray is not C contiguous") * */ - __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS)); + __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; @@ -14546,7 +14571,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") */ - __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); + __pyx_t_3 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0); if (__pyx_t_3) { /* "numpy.pxd":218 @@ -14556,7 +14581,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * raise ValueError(u"ndarray is not Fortran contiguous") * */ - __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS)); + __pyx_t_1 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; @@ -14604,7 +14629,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. */ - if (__pyx_v_copy_shape) { + __pyx_t_2 = (__pyx_v_copy_shape != 0); + if (__pyx_t_2) { /* "numpy.pxd":226 * # Allocate new buffer for strides and shape info. @@ -14702,7 +14728,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * * cdef int t */ - __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self)); + __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0)); /* "numpy.pxd":239 * @@ -14741,9 +14767,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * # do not call releasebuffer * info.obj = None */ - __pyx_t_2 = (!__pyx_v_hasfields); + __pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0); if (__pyx_t_2) { - __pyx_t_3 = (!__pyx_v_copy_shape); + __pyx_t_3 = ((!(__pyx_v_copy_shape != 0)) != 0); __pyx_t_1 = __pyx_t_3; } else { __pyx_t_1 = __pyx_t_2; @@ -14788,7 +14814,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or */ - __pyx_t_1 = (!__pyx_v_hasfields); + __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0); if (__pyx_t_1) { /* "numpy.pxd":254 @@ -14808,9 +14834,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ - __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); + __pyx_t_1 = ((__pyx_v_descr->byteorder == '>') != 0); if (__pyx_t_1) { - __pyx_t_2 = __pyx_v_little_endian; + __pyx_t_2 = (__pyx_v_little_endian != 0); } else { __pyx_t_2 = __pyx_t_1; } @@ -14823,9 +14849,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" */ - __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); + __pyx_t_1 = ((__pyx_v_descr->byteorder == '<') != 0); if (__pyx_t_1) { - __pyx_t_3 = (!__pyx_v_little_endian); + __pyx_t_3 = ((!(__pyx_v_little_endian != 0)) != 0); __pyx_t_7 = __pyx_t_3; } else { __pyx_t_7 = __pyx_t_1; @@ -15197,7 +15223,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self); + __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0); if (__pyx_t_1) { /* "numpy.pxd":290 @@ -15219,7 +15245,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s * stdlib.free(info.strides) * # info.shape was stored after info.strides in the same block */ - __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); if (__pyx_t_1) { /* "numpy.pxd":292 @@ -15650,9 +15676,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ - __pyx_t_7 = (__pyx_v_child->byteorder == '>'); + __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0); if (__pyx_t_7) { - __pyx_t_8 = __pyx_v_little_endian; + __pyx_t_8 = (__pyx_v_little_endian != 0); } else { __pyx_t_8 = __pyx_t_7; } @@ -15665,9 +15691,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ - __pyx_t_7 = (__pyx_v_child->byteorder == '<'); + __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0); if (__pyx_t_7) { - __pyx_t_9 = (!__pyx_v_little_endian); + __pyx_t_9 = ((!(__pyx_v_little_endian != 0)) != 0); __pyx_t_10 = __pyx_t_9; } else { __pyx_t_10 = __pyx_t_7; @@ -15756,7 +15782,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * t = child.type_num * if end - f < 5: */ - __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child)); + __pyx_t_7 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0); if (__pyx_t_7) { /* "numpy.pxd":821 @@ -15779,7 +15805,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * raise RuntimeError(u"Format string allocated too short.") * */ - __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5); + __pyx_t_7 = (((__pyx_v_end - __pyx_v_f) < 5) != 0); if (__pyx_t_7) { /* "numpy.pxd":823 @@ -16201,6 +16227,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a PyObject *__pyx_v_baseptr; __Pyx_RefNannyDeclarations int __pyx_t_1; + int __pyx_t_2; __Pyx_RefNannySetupContext("set_array_base", 0); /* "numpy.pxd":967 @@ -16211,7 +16238,8 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a * else: */ __pyx_t_1 = (__pyx_v_base == Py_None); - if (__pyx_t_1) { + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { /* "numpy.pxd":968 * cdef PyObject* baseptr @@ -16287,7 +16315,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py * return None * else: */ - __pyx_t_1 = (__pyx_v_arr->base == NULL); + __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0); if (__pyx_t_1) { /* "numpy.pxd":977 @@ -16323,152 +16351,73 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __Pyx_RefNannyFinishContext(); return __pyx_r; } -static struct __pyx_vtabstruct_6_basis_BasisFunction __pyx_vtable_6_basis_BasisFunction; +static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis __pyx_vtable_7sklearn_5earth_6_basis_Basis; -static PyObject *__pyx_tp_new_6_basis_BasisFunction(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_6_basis_BasisFunction *p; +static PyObject *__pyx_tp_new_7sklearn_5earth_6_basis_Basis(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_7sklearn_5earth_6_basis_Basis *p; PyObject *o; o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_6_basis_BasisFunction *)o); - p->__pyx_vtab = __pyx_vtabptr_6_basis_BasisFunction; - p->parent = ((struct __pyx_obj_6_basis_BasisFunction *)Py_None); Py_INCREF(Py_None); - p->child_map = ((PyObject*)Py_None); Py_INCREF(Py_None); - p->children = ((PyObject*)Py_None); Py_INCREF(Py_None); - if (unlikely(__pyx_pw_6_basis_13BasisFunction_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) { - Py_DECREF(o); o = 0; - } + p = ((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)o); + p->__pyx_vtab = __pyx_vtabptr_7sklearn_5earth_6_basis_Basis; + p->order = ((PyObject*)Py_None); Py_INCREF(Py_None); return o; } -static void __pyx_tp_dealloc_6_basis_BasisFunction(PyObject *o) { - struct __pyx_obj_6_basis_BasisFunction *p = (struct __pyx_obj_6_basis_BasisFunction *)o; +static void __pyx_tp_dealloc_7sklearn_5earth_6_basis_Basis(PyObject *o) { + struct __pyx_obj_7sklearn_5earth_6_basis_Basis *p = (struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)o; PyObject_GC_UnTrack(o); - Py_CLEAR(p->parent); - Py_CLEAR(p->child_map); - Py_CLEAR(p->children); + Py_CLEAR(p->order); (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_6_basis_BasisFunction(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_7sklearn_5earth_6_basis_Basis(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_6_basis_BasisFunction *p = (struct __pyx_obj_6_basis_BasisFunction *)o; - if (p->parent) { - e = (*v)(((PyObject*)p->parent), a); if (e) return e; - } - if (p->child_map) { - e = (*v)(p->child_map, a); if (e) return e; - } - if (p->children) { - e = (*v)(p->children, a); if (e) return e; + struct __pyx_obj_7sklearn_5earth_6_basis_Basis *p = (struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)o; + if (p->order) { + e = (*v)(p->order, a); if (e) return e; } return 0; } -static int __pyx_tp_clear_6_basis_BasisFunction(PyObject *o) { - struct __pyx_obj_6_basis_BasisFunction *p = (struct __pyx_obj_6_basis_BasisFunction *)o; +static int __pyx_tp_clear_7sklearn_5earth_6_basis_Basis(PyObject *o) { + struct __pyx_obj_7sklearn_5earth_6_basis_Basis *p = (struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)o; PyObject* tmp; - tmp = ((PyObject*)p->parent); - p->parent = ((struct __pyx_obj_6_basis_BasisFunction *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->child_map); - p->child_map = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->children); - p->children = ((PyObject*)Py_None); Py_INCREF(Py_None); + tmp = ((PyObject*)p->order); + p->order = ((PyObject*)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } +static PyObject *__pyx_sq_item_7sklearn_5earth_6_basis_Basis(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + Py_DECREF(x); + return r; +} -static PyMethodDef __pyx_methods_6_basis_BasisFunction[] = { - {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_3__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("_get_root"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_5_get_root, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("_getstate"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_7_getstate, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("_get_parent_state"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_9_get_parent_state, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("_set_parent_state"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_11_set_parent_state, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("__setstate__"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_13__setstate__, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("_eq"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_15_eq, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("has_knot"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_19has_knot, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("is_prunable"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_21is_prunable, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("is_pruned"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_23is_pruned, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("is_splittable"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_25is_splittable, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("make_splittable"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_27make_splittable, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("make_unsplittable"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_29make_unsplittable, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("_set_parent"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_31_set_parent, METH_O, __Pyx_DOCSTR(__pyx_doc_6_basis_13BasisFunction_30_set_parent)}, - {__Pyx_NAMESTR("_add_child"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_33_add_child, METH_O, __Pyx_DOCSTR(__pyx_doc_6_basis_13BasisFunction_32_add_child)}, - {__Pyx_NAMESTR("get_parent"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_35get_parent, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("prune"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_37prune, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("unprune"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_39unprune, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("knots"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_41knots, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("degree"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_43degree, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("apply"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_45apply, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6_basis_13BasisFunction_44apply)}, - {__Pyx_NAMESTR("valid_knots"), (PyCFunction)__pyx_pw_6_basis_13BasisFunction_47valid_knots, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6_basis_13BasisFunction_46valid_knots)}, +static PyMethodDef __pyx_methods_7sklearn_5earth_6_basis_Basis[] = { + {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_5Basis_3__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_getstate"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_5Basis_5_getstate, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__setstate__"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_5Basis_7__setstate__, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_eq"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_5Basis_11_eq, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("piter"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_5Basis_13piter, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("translate"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_5Basis_18translate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("scale"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_5Basis_20scale, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_root"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_5Basis_22get_root, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("append"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_5Basis_24append, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_5Basis_30get, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("plen"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_5Basis_34plen, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("transform"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_5Basis_36transform, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("weighted_transform"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_5Basis_38weighted_transform, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; -static PyNumberMethods __pyx_tp_as_number_BasisFunction = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_long*/ - #else - 0, /*reserved*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if PY_VERSION_HEX >= 0x02050000 - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_BasisFunction = { - 0, /*sq_length*/ +static PySequenceMethods __pyx_tp_as_sequence_Basis = { + __pyx_pw_7sklearn_5earth_6_basis_5Basis_28__len__, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ - 0, /*sq_item*/ + __pyx_sq_item_7sklearn_5earth_6_basis_Basis, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ @@ -16477,39 +16426,18 @@ static PySequenceMethods __pyx_tp_as_sequence_BasisFunction = { 0, /*sq_inplace_repeat*/ }; -static PyMappingMethods __pyx_tp_as_mapping_BasisFunction = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ +static PyMappingMethods __pyx_tp_as_mapping_Basis = { + __pyx_pw_7sklearn_5earth_6_basis_5Basis_28__len__, /*mp_length*/ + __pyx_pw_7sklearn_5earth_6_basis_5Basis_32__getitem__, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; -static PyBufferProcs __pyx_tp_as_buffer_BasisFunction = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -static PyTypeObject __pyx_type_6_basis_BasisFunction = { +static PyTypeObject __pyx_type_7sklearn_5earth_6_basis_Basis = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_basis.BasisFunction"), /*tp_name*/ - sizeof(struct __pyx_obj_6_basis_BasisFunction), /*tp_basicsize*/ + __Pyx_NAMESTR("sklearn.earth._basis.Basis"), /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_5earth_6_basis_Basis), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6_basis_BasisFunction, /*tp_dealloc*/ + __pyx_tp_dealloc_7sklearn_5earth_6_basis_Basis, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -16519,24 +16447,24 @@ static PyTypeObject __pyx_type_6_basis_BasisFunction = { 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number_BasisFunction, /*tp_as_number*/ - &__pyx_tp_as_sequence_BasisFunction, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_BasisFunction, /*tp_as_mapping*/ + 0, /*tp_as_number*/ + &__pyx_tp_as_sequence_Basis, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_Basis, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ - 0, /*tp_str*/ + __pyx_pw_7sklearn_5earth_6_basis_5Basis_16__str__, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_BasisFunction, /*tp_as_buffer*/ + 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - __Pyx_DOCSTR("Abstract. Subclasses must implement the apply, translate, scale, and __init__ methods."), /*tp_doc*/ - __pyx_tp_traverse_6_basis_BasisFunction, /*tp_traverse*/ - __pyx_tp_clear_6_basis_BasisFunction, /*tp_clear*/ - __pyx_pw_6_basis_13BasisFunction_17__richcmp__, /*tp_richcompare*/ + __Pyx_DOCSTR("A container that provides functionality related to a set of BasisFunctions with a \n common ConstantBasisFunction ancestor. Retains the order in which BasisFunctions are \n added."), /*tp_doc*/ + __pyx_tp_traverse_7sklearn_5earth_6_basis_Basis, /*tp_traverse*/ + __pyx_tp_clear_7sklearn_5earth_6_basis_Basis, /*tp_clear*/ + __pyx_pw_7sklearn_5earth_6_basis_5Basis_9__richcmp__, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ + __pyx_pw_7sklearn_5earth_6_basis_5Basis_26__iter__, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_6_basis_BasisFunction, /*tp_methods*/ + __pyx_methods_7sklearn_5earth_6_basis_Basis, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -16544,9 +16472,9 @@ static PyTypeObject __pyx_type_6_basis_BasisFunction = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - 0, /*tp_init*/ + __pyx_pw_7sklearn_5earth_6_basis_5Basis_1__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_6_basis_BasisFunction, /*tp_new*/ + __pyx_tp_new_7sklearn_5earth_6_basis_Basis, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -16559,134 +16487,95 @@ static PyTypeObject __pyx_type_6_basis_BasisFunction = { 0, /*tp_version_tag*/ #endif }; -static struct __pyx_vtabstruct_6_basis_ConstantBasisFunction __pyx_vtable_6_basis_ConstantBasisFunction; +static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction __pyx_vtable_7sklearn_5earth_6_basis_BasisFunction; -static PyObject *__pyx_tp_new_6_basis_ConstantBasisFunction(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_6_basis_ConstantBasisFunction *p; - PyObject *o = __pyx_tp_new_6_basis_BasisFunction(t, a, k); +static PyObject *__pyx_tp_new_7sklearn_5earth_6_basis_BasisFunction(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_6_basis_ConstantBasisFunction *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6_basis_BasisFunction*)__pyx_vtabptr_6_basis_ConstantBasisFunction; + p = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)o); + p->__pyx_vtab = __pyx_vtabptr_7sklearn_5earth_6_basis_BasisFunction; + p->parent = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)Py_None); Py_INCREF(Py_None); + p->child_map = ((PyObject*)Py_None); Py_INCREF(Py_None); + p->children = ((PyObject*)Py_None); Py_INCREF(Py_None); + if (unlikely(__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_1__cinit__(o, __pyx_empty_tuple, NULL) < 0)) { + Py_DECREF(o); o = 0; + } return o; } -static PyMethodDef __pyx_methods_6_basis_ConstantBasisFunction[] = { - {__Pyx_NAMESTR("_get_root"), (PyCFunction)__pyx_pw_6_basis_21ConstantBasisFunction_3_get_root, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("_get_parent_state"), (PyCFunction)__pyx_pw_6_basis_21ConstantBasisFunction_5_get_parent_state, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("_set_parent_state"), (PyCFunction)__pyx_pw_6_basis_21ConstantBasisFunction_7_set_parent_state, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("degree"), (PyCFunction)__pyx_pw_6_basis_21ConstantBasisFunction_9degree, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("translate"), (PyCFunction)__pyx_pw_6_basis_21ConstantBasisFunction_11translate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("scale"), (PyCFunction)__pyx_pw_6_basis_21ConstantBasisFunction_13scale, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("_set_parent"), (PyCFunction)__pyx_pw_6_basis_21ConstantBasisFunction_15_set_parent, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_parent"), (PyCFunction)__pyx_pw_6_basis_21ConstantBasisFunction_17get_parent, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("apply"), (PyCFunction)__pyx_pw_6_basis_21ConstantBasisFunction_19apply, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6_basis_21ConstantBasisFunction_18apply)}, - {0, 0, 0, 0} -}; +static void __pyx_tp_dealloc_7sklearn_5earth_6_basis_BasisFunction(PyObject *o) { + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *p = (struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->parent); + Py_CLEAR(p->child_map); + Py_CLEAR(p->children); + (*Py_TYPE(o)->tp_free)(o); +} -static PyNumberMethods __pyx_tp_as_number_ConstantBasisFunction = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_long*/ - #else - 0, /*reserved*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if PY_VERSION_HEX >= 0x02050000 - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_ConstantBasisFunction = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; +static int __pyx_tp_traverse_7sklearn_5earth_6_basis_BasisFunction(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *p = (struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)o; + if (p->parent) { + e = (*v)(((PyObject*)p->parent), a); if (e) return e; + } + if (p->child_map) { + e = (*v)(p->child_map, a); if (e) return e; + } + if (p->children) { + e = (*v)(p->children, a); if (e) return e; + } + return 0; +} -static PyMappingMethods __pyx_tp_as_mapping_ConstantBasisFunction = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; +static int __pyx_tp_clear_7sklearn_5earth_6_basis_BasisFunction(PyObject *o) { + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *p = (struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)o; + PyObject* tmp; + tmp = ((PyObject*)p->parent); + p->parent = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->child_map); + p->child_map = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->children); + p->children = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} -static PyBufferProcs __pyx_tp_as_buffer_ConstantBasisFunction = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif +static PyMethodDef __pyx_methods_7sklearn_5earth_6_basis_BasisFunction[] = { + {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_3__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_get_root"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_5_get_root, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_getstate"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_7_getstate, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_get_parent_state"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_9_get_parent_state, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_set_parent_state"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_11_set_parent_state, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__setstate__"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_13__setstate__, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_eq"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_15_eq, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("has_knot"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_19has_knot, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("is_prunable"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_21is_prunable, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("is_pruned"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_23is_pruned, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("is_splittable"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_25is_splittable, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("make_splittable"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_27make_splittable, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("make_unsplittable"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_29make_unsplittable, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_set_parent"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_31_set_parent, METH_O, __Pyx_DOCSTR(__pyx_doc_7sklearn_5earth_6_basis_13BasisFunction_30_set_parent)}, + {__Pyx_NAMESTR("_add_child"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_33_add_child, METH_O, __Pyx_DOCSTR(__pyx_doc_7sklearn_5earth_6_basis_13BasisFunction_32_add_child)}, + {__Pyx_NAMESTR("get_parent"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_35get_parent, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("prune"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_37prune, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("unprune"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_39unprune, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("knots"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_41knots, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("degree"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_43degree, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("apply"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_45apply, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7sklearn_5earth_6_basis_13BasisFunction_44apply)}, + {__Pyx_NAMESTR("valid_knots"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_47valid_knots, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7sklearn_5earth_6_basis_13BasisFunction_46valid_knots)}, + {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_6_basis_ConstantBasisFunction = { +static PyTypeObject __pyx_type_7sklearn_5earth_6_basis_BasisFunction = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_basis.ConstantBasisFunction"), /*tp_name*/ - sizeof(struct __pyx_obj_6_basis_ConstantBasisFunction), /*tp_basicsize*/ + __Pyx_NAMESTR("sklearn.earth._basis.BasisFunction"), /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6_basis_BasisFunction, /*tp_dealloc*/ + __pyx_tp_dealloc_7sklearn_5earth_6_basis_BasisFunction, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -16696,24 +16585,24 @@ static PyTypeObject __pyx_type_6_basis_ConstantBasisFunction = { 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number_ConstantBasisFunction, /*tp_as_number*/ - &__pyx_tp_as_sequence_ConstantBasisFunction, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_ConstantBasisFunction, /*tp_as_mapping*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ - __pyx_pw_6_basis_21ConstantBasisFunction_21__str__, /*tp_str*/ + 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_ConstantBasisFunction, /*tp_as_buffer*/ + 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_6_basis_BasisFunction, /*tp_traverse*/ - __pyx_tp_clear_6_basis_BasisFunction, /*tp_clear*/ - 0, /*tp_richcompare*/ + __Pyx_DOCSTR("Abstract. Subclasses must implement the apply, translate, scale, and __init__ methods."), /*tp_doc*/ + __pyx_tp_traverse_7sklearn_5earth_6_basis_BasisFunction, /*tp_traverse*/ + __pyx_tp_clear_7sklearn_5earth_6_basis_BasisFunction, /*tp_clear*/ + __pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_17__richcmp__, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_6_basis_ConstantBasisFunction, /*tp_methods*/ + __pyx_methods_7sklearn_5earth_6_basis_BasisFunction, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -16721,9 +16610,9 @@ static PyTypeObject __pyx_type_6_basis_ConstantBasisFunction = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pw_6_basis_21ConstantBasisFunction_1__init__, /*tp_init*/ + 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_6_basis_ConstantBasisFunction, /*tp_new*/ + __pyx_tp_new_7sklearn_5earth_6_basis_BasisFunction, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -16736,165 +16625,27 @@ static PyTypeObject __pyx_type_6_basis_ConstantBasisFunction = { 0, /*tp_version_tag*/ #endif }; -static struct __pyx_vtabstruct_6_basis_HingeBasisFunction __pyx_vtable_6_basis_HingeBasisFunction; +static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction __pyx_vtable_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction; -static PyObject *__pyx_tp_new_6_basis_HingeBasisFunction(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_6_basis_HingeBasisFunction *p; - PyObject *o = __pyx_tp_new_6_basis_BasisFunction(t, a, k); +static PyObject *__pyx_tp_new_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction *p; + PyObject *o = __pyx_tp_new_7sklearn_5earth_6_basis_BasisFunction(t, a, k); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_6_basis_HingeBasisFunction *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6_basis_BasisFunction*)__pyx_vtabptr_6_basis_HingeBasisFunction; - p->label = ((PyObject*)Py_None); Py_INCREF(Py_None); + p = ((struct __pyx_obj_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction*)__pyx_vtabptr_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction; return o; } -static void __pyx_tp_dealloc_6_basis_HingeBasisFunction(PyObject *o) { - struct __pyx_obj_6_basis_HingeBasisFunction *p = (struct __pyx_obj_6_basis_HingeBasisFunction *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->label); - PyObject_GC_Track(o); - __pyx_tp_dealloc_6_basis_BasisFunction(o); -} - -static int __pyx_tp_traverse_6_basis_HingeBasisFunction(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_6_basis_HingeBasisFunction *p = (struct __pyx_obj_6_basis_HingeBasisFunction *)o; - e = __pyx_tp_traverse_6_basis_BasisFunction(o, v, a); if (e) return e; - if (p->label) { - e = (*v)(p->label, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_6_basis_HingeBasisFunction(PyObject *o) { - struct __pyx_obj_6_basis_HingeBasisFunction *p = (struct __pyx_obj_6_basis_HingeBasisFunction *)o; - PyObject* tmp; - __pyx_tp_clear_6_basis_BasisFunction(o); - tmp = ((PyObject*)p->label); - p->label = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyMethodDef __pyx_methods_6_basis_HingeBasisFunction[] = { - {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_6_basis_18HingeBasisFunction_3__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("_getstate"), (PyCFunction)__pyx_pw_6_basis_18HingeBasisFunction_5_getstate, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("__setstate__"), (PyCFunction)__pyx_pw_6_basis_18HingeBasisFunction_7__setstate__, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("has_knot"), (PyCFunction)__pyx_pw_6_basis_18HingeBasisFunction_9has_knot, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("translate"), (PyCFunction)__pyx_pw_6_basis_18HingeBasisFunction_11translate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("scale"), (PyCFunction)__pyx_pw_6_basis_18HingeBasisFunction_13scale, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_variable"), (PyCFunction)__pyx_pw_6_basis_18HingeBasisFunction_17get_variable, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_knot"), (PyCFunction)__pyx_pw_6_basis_18HingeBasisFunction_19get_knot, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_reverse"), (PyCFunction)__pyx_pw_6_basis_18HingeBasisFunction_21get_reverse, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_knot_idx"), (PyCFunction)__pyx_pw_6_basis_18HingeBasisFunction_23get_knot_idx, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("apply"), (PyCFunction)__pyx_pw_6_basis_18HingeBasisFunction_25apply, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6_basis_18HingeBasisFunction_24apply)}, +static PyMethodDef __pyx_methods_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction[] = { {0, 0, 0, 0} }; -static PyNumberMethods __pyx_tp_as_number_HingeBasisFunction = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_long*/ - #else - 0, /*reserved*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if PY_VERSION_HEX >= 0x02050000 - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_HingeBasisFunction = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_HingeBasisFunction = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_HingeBasisFunction = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -static PyTypeObject __pyx_type_6_basis_HingeBasisFunction = { +static PyTypeObject __pyx_type_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_basis.HingeBasisFunction"), /*tp_name*/ - sizeof(struct __pyx_obj_6_basis_HingeBasisFunction), /*tp_basicsize*/ + __Pyx_NAMESTR("sklearn.earth._basis.PicklePlaceHolderBasisFunction"), /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6_basis_HingeBasisFunction, /*tp_dealloc*/ + __pyx_tp_dealloc_7sklearn_5earth_6_basis_BasisFunction, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -16904,24 +16655,24 @@ static PyTypeObject __pyx_type_6_basis_HingeBasisFunction = { 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number_HingeBasisFunction, /*tp_as_number*/ - &__pyx_tp_as_sequence_HingeBasisFunction, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_HingeBasisFunction, /*tp_as_mapping*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ - __pyx_pw_6_basis_18HingeBasisFunction_15__str__, /*tp_str*/ + 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_HingeBasisFunction, /*tp_as_buffer*/ + 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_6_basis_HingeBasisFunction, /*tp_traverse*/ - __pyx_tp_clear_6_basis_HingeBasisFunction, /*tp_clear*/ + __Pyx_DOCSTR("This is a place holder for unpickling the basis function tree."), /*tp_doc*/ + __pyx_tp_traverse_7sklearn_5earth_6_basis_BasisFunction, /*tp_traverse*/ + __pyx_tp_clear_7sklearn_5earth_6_basis_BasisFunction, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_6_basis_HingeBasisFunction, /*tp_methods*/ + __pyx_methods_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -16929,9 +16680,9 @@ static PyTypeObject __pyx_type_6_basis_HingeBasisFunction = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pw_6_basis_18HingeBasisFunction_1__init__, /*tp_init*/ + 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_6_basis_HingeBasisFunction, /*tp_new*/ + __pyx_tp_new_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -16944,161 +16695,36 @@ static PyTypeObject __pyx_type_6_basis_HingeBasisFunction = { 0, /*tp_version_tag*/ #endif }; -static struct __pyx_vtabstruct_6_basis_LinearBasisFunction __pyx_vtable_6_basis_LinearBasisFunction; +static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_ConstantBasisFunction __pyx_vtable_7sklearn_5earth_6_basis_ConstantBasisFunction; -static PyObject *__pyx_tp_new_6_basis_LinearBasisFunction(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_6_basis_LinearBasisFunction *p; - PyObject *o = __pyx_tp_new_6_basis_BasisFunction(t, a, k); +static PyObject *__pyx_tp_new_7sklearn_5earth_6_basis_ConstantBasisFunction(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *p; + PyObject *o = __pyx_tp_new_7sklearn_5earth_6_basis_BasisFunction(t, a, k); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_6_basis_LinearBasisFunction *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6_basis_BasisFunction*)__pyx_vtabptr_6_basis_LinearBasisFunction; - p->label = ((PyObject*)Py_None); Py_INCREF(Py_None); + p = ((struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction*)__pyx_vtabptr_7sklearn_5earth_6_basis_ConstantBasisFunction; return o; } -static void __pyx_tp_dealloc_6_basis_LinearBasisFunction(PyObject *o) { - struct __pyx_obj_6_basis_LinearBasisFunction *p = (struct __pyx_obj_6_basis_LinearBasisFunction *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->label); - PyObject_GC_Track(o); - __pyx_tp_dealloc_6_basis_BasisFunction(o); -} - -static int __pyx_tp_traverse_6_basis_LinearBasisFunction(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_6_basis_LinearBasisFunction *p = (struct __pyx_obj_6_basis_LinearBasisFunction *)o; - e = __pyx_tp_traverse_6_basis_BasisFunction(o, v, a); if (e) return e; - if (p->label) { - e = (*v)(p->label, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_6_basis_LinearBasisFunction(PyObject *o) { - struct __pyx_obj_6_basis_LinearBasisFunction *p = (struct __pyx_obj_6_basis_LinearBasisFunction *)o; - PyObject* tmp; - __pyx_tp_clear_6_basis_BasisFunction(o); - tmp = ((PyObject*)p->label); - p->label = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} - -static PyMethodDef __pyx_methods_6_basis_LinearBasisFunction[] = { - {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_6_basis_19LinearBasisFunction_3__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("_getstate"), (PyCFunction)__pyx_pw_6_basis_19LinearBasisFunction_5_getstate, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("__setstate__"), (PyCFunction)__pyx_pw_6_basis_19LinearBasisFunction_7__setstate__, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("translate"), (PyCFunction)__pyx_pw_6_basis_19LinearBasisFunction_9translate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("scale"), (PyCFunction)__pyx_pw_6_basis_19LinearBasisFunction_11scale, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_variable"), (PyCFunction)__pyx_pw_6_basis_19LinearBasisFunction_15get_variable, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("apply"), (PyCFunction)__pyx_pw_6_basis_19LinearBasisFunction_17apply, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_6_basis_19LinearBasisFunction_16apply)}, +static PyMethodDef __pyx_methods_7sklearn_5earth_6_basis_ConstantBasisFunction[] = { + {__Pyx_NAMESTR("_get_root"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_3_get_root, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_get_parent_state"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_5_get_parent_state, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_set_parent_state"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_7_set_parent_state, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("degree"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_9degree, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("translate"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_11translate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("scale"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_13scale, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_set_parent"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_15_set_parent, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_parent"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_17get_parent, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("apply"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_19apply, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7sklearn_5earth_6_basis_21ConstantBasisFunction_18apply)}, {0, 0, 0, 0} }; -static PyNumberMethods __pyx_tp_as_number_LinearBasisFunction = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_long*/ - #else - 0, /*reserved*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if PY_VERSION_HEX >= 0x02050000 - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_LinearBasisFunction = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_LinearBasisFunction = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_LinearBasisFunction = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -static PyTypeObject __pyx_type_6_basis_LinearBasisFunction = { +static PyTypeObject __pyx_type_7sklearn_5earth_6_basis_ConstantBasisFunction = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_basis.LinearBasisFunction"), /*tp_name*/ - sizeof(struct __pyx_obj_6_basis_LinearBasisFunction), /*tp_basicsize*/ + __Pyx_NAMESTR("sklearn.earth._basis.ConstantBasisFunction"), /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6_basis_LinearBasisFunction, /*tp_dealloc*/ + __pyx_tp_dealloc_7sklearn_5earth_6_basis_BasisFunction, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -17108,24 +16734,24 @@ static PyTypeObject __pyx_type_6_basis_LinearBasisFunction = { 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number_LinearBasisFunction, /*tp_as_number*/ - &__pyx_tp_as_sequence_LinearBasisFunction, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_LinearBasisFunction, /*tp_as_mapping*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ - __pyx_pw_6_basis_19LinearBasisFunction_13__str__, /*tp_str*/ + __pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_21__str__, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_LinearBasisFunction, /*tp_as_buffer*/ + 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_6_basis_LinearBasisFunction, /*tp_traverse*/ - __pyx_tp_clear_6_basis_LinearBasisFunction, /*tp_clear*/ + __pyx_tp_traverse_7sklearn_5earth_6_basis_BasisFunction, /*tp_traverse*/ + __pyx_tp_clear_7sklearn_5earth_6_basis_BasisFunction, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_6_basis_LinearBasisFunction, /*tp_methods*/ + __pyx_methods_7sklearn_5earth_6_basis_ConstantBasisFunction, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -17133,9 +16759,9 @@ static PyTypeObject __pyx_type_6_basis_LinearBasisFunction = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pw_6_basis_19LinearBasisFunction_1__init__, /*tp_init*/ + __pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_1__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_6_basis_LinearBasisFunction, /*tp_new*/ + __pyx_tp_new_7sklearn_5earth_6_basis_ConstantBasisFunction, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -17148,172 +16774,82 @@ static PyTypeObject __pyx_type_6_basis_LinearBasisFunction = { 0, /*tp_version_tag*/ #endif }; -static struct __pyx_vtabstruct_6_basis_Basis __pyx_vtable_6_basis_Basis; -static PyObject *__pyx_tp_new_6_basis_Basis(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_6_basis_Basis *p; +static struct __pyx_obj_7sklearn_5earth_6_basis___pyx_scope_struct__piter *__pyx_freelist_7sklearn_5earth_6_basis___pyx_scope_struct__piter[8]; +static int __pyx_freecount_7sklearn_5earth_6_basis___pyx_scope_struct__piter = 0; + +static PyObject *__pyx_tp_new_7sklearn_5earth_6_basis___pyx_scope_struct__piter(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_7sklearn_5earth_6_basis___pyx_scope_struct__piter *p; PyObject *o; - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_6_basis_Basis *)o); - p->__pyx_vtab = __pyx_vtabptr_6_basis_Basis; - p->order = ((PyObject*)Py_None); Py_INCREF(Py_None); + if (likely((__pyx_freecount_7sklearn_5earth_6_basis___pyx_scope_struct__piter > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_7sklearn_5earth_6_basis___pyx_scope_struct__piter)))) { + o = (PyObject*)__pyx_freelist_7sklearn_5earth_6_basis___pyx_scope_struct__piter[--__pyx_freecount_7sklearn_5earth_6_basis___pyx_scope_struct__piter]; + memset(o, 0, sizeof(struct __pyx_obj_7sklearn_5earth_6_basis___pyx_scope_struct__piter)); + PyObject_INIT(o, t); + PyObject_GC_Track(o); + } else { + o = (*t->tp_alloc)(t, 0); + if (unlikely(!o)) return 0; + } + p = ((struct __pyx_obj_7sklearn_5earth_6_basis___pyx_scope_struct__piter *)o); + p->__pyx_v_bf = 0; + p->__pyx_v_self = 0; + p->__pyx_t_0 = 0; return o; } -static void __pyx_tp_dealloc_6_basis_Basis(PyObject *o) { - struct __pyx_obj_6_basis_Basis *p = (struct __pyx_obj_6_basis_Basis *)o; +static void __pyx_tp_dealloc_7sklearn_5earth_6_basis___pyx_scope_struct__piter(PyObject *o) { + struct __pyx_obj_7sklearn_5earth_6_basis___pyx_scope_struct__piter *p = (struct __pyx_obj_7sklearn_5earth_6_basis___pyx_scope_struct__piter *)o; PyObject_GC_UnTrack(o); - Py_CLEAR(p->order); - (*Py_TYPE(o)->tp_free)(o); + Py_CLEAR(p->__pyx_v_bf); + Py_CLEAR(p->__pyx_v_self); + Py_CLEAR(p->__pyx_t_0); + if ((__pyx_freecount_7sklearn_5earth_6_basis___pyx_scope_struct__piter < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_7sklearn_5earth_6_basis___pyx_scope_struct__piter))) { + __pyx_freelist_7sklearn_5earth_6_basis___pyx_scope_struct__piter[__pyx_freecount_7sklearn_5earth_6_basis___pyx_scope_struct__piter++] = ((struct __pyx_obj_7sklearn_5earth_6_basis___pyx_scope_struct__piter *)o); + } else { + (*Py_TYPE(o)->tp_free)(o); + } } -static int __pyx_tp_traverse_6_basis_Basis(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_7sklearn_5earth_6_basis___pyx_scope_struct__piter(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_6_basis_Basis *p = (struct __pyx_obj_6_basis_Basis *)o; - if (p->order) { - e = (*v)(p->order, a); if (e) return e; + struct __pyx_obj_7sklearn_5earth_6_basis___pyx_scope_struct__piter *p = (struct __pyx_obj_7sklearn_5earth_6_basis___pyx_scope_struct__piter *)o; + if (p->__pyx_v_bf) { + e = (*v)(p->__pyx_v_bf, a); if (e) return e; + } + if (p->__pyx_v_self) { + e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e; + } + if (p->__pyx_t_0) { + e = (*v)(p->__pyx_t_0, a); if (e) return e; } return 0; } -static int __pyx_tp_clear_6_basis_Basis(PyObject *o) { - struct __pyx_obj_6_basis_Basis *p = (struct __pyx_obj_6_basis_Basis *)o; +static int __pyx_tp_clear_7sklearn_5earth_6_basis___pyx_scope_struct__piter(PyObject *o) { + struct __pyx_obj_7sklearn_5earth_6_basis___pyx_scope_struct__piter *p = (struct __pyx_obj_7sklearn_5earth_6_basis___pyx_scope_struct__piter *)o; PyObject* tmp; - tmp = ((PyObject*)p->order); - p->order = ((PyObject*)Py_None); Py_INCREF(Py_None); + tmp = ((PyObject*)p->__pyx_v_bf); + p->__pyx_v_bf = Py_None; Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_v_self); + p->__pyx_v_self = ((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + tmp = ((PyObject*)p->__pyx_t_0); + p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyObject *__pyx_sq_item_6_basis_Basis(PyObject *o, Py_ssize_t i) { - PyObject *r; - PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; - r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); - Py_DECREF(x); - return r; -} -static PyMethodDef __pyx_methods_6_basis_Basis[] = { - {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_6_basis_5Basis_3__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("_getstate"), (PyCFunction)__pyx_pw_6_basis_5Basis_5_getstate, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("__setstate__"), (PyCFunction)__pyx_pw_6_basis_5Basis_7__setstate__, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("_eq"), (PyCFunction)__pyx_pw_6_basis_5Basis_11_eq, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("piter"), (PyCFunction)__pyx_pw_6_basis_5Basis_13piter, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("translate"), (PyCFunction)__pyx_pw_6_basis_5Basis_18translate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("scale"), (PyCFunction)__pyx_pw_6_basis_5Basis_20scale, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_root"), (PyCFunction)__pyx_pw_6_basis_5Basis_22get_root, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("append"), (PyCFunction)__pyx_pw_6_basis_5Basis_24append, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get"), (PyCFunction)__pyx_pw_6_basis_5Basis_30get, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("plen"), (PyCFunction)__pyx_pw_6_basis_5Basis_34plen, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("transform"), (PyCFunction)__pyx_pw_6_basis_5Basis_36transform, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("weighted_transform"), (PyCFunction)__pyx_pw_6_basis_5Basis_38weighted_transform, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, +static PyMethodDef __pyx_methods_7sklearn_5earth_6_basis___pyx_scope_struct__piter[] = { {0, 0, 0, 0} }; -static PyNumberMethods __pyx_tp_as_number_Basis = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_long*/ - #else - 0, /*reserved*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if PY_VERSION_HEX >= 0x02050000 - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_Basis = { - __pyx_pw_6_basis_5Basis_28__len__, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - __pyx_sq_item_6_basis_Basis, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_Basis = { - __pyx_pw_6_basis_5Basis_28__len__, /*mp_length*/ - __pyx_pw_6_basis_5Basis_32__getitem__, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_Basis = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -static PyTypeObject __pyx_type_6_basis_Basis = { +static PyTypeObject __pyx_type_7sklearn_5earth_6_basis___pyx_scope_struct__piter = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_basis.Basis"), /*tp_name*/ - sizeof(struct __pyx_obj_6_basis_Basis), /*tp_basicsize*/ + __Pyx_NAMESTR("sklearn.earth._basis.__pyx_scope_struct__piter"), /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_5earth_6_basis___pyx_scope_struct__piter), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6_basis_Basis, /*tp_dealloc*/ + __pyx_tp_dealloc_7sklearn_5earth_6_basis___pyx_scope_struct__piter, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -17323,24 +16859,24 @@ static PyTypeObject __pyx_type_6_basis_Basis = { 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number_Basis, /*tp_as_number*/ - &__pyx_tp_as_sequence_Basis, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_Basis, /*tp_as_mapping*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ - __pyx_pw_6_basis_5Basis_16__str__, /*tp_str*/ + 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_Basis, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - __Pyx_DOCSTR("A container that provides functionality related to a set of BasisFunctions with a \n common ConstantBasisFunction ancestor. Retains the order in which BasisFunctions are \n added."), /*tp_doc*/ - __pyx_tp_traverse_6_basis_Basis, /*tp_traverse*/ - __pyx_tp_clear_6_basis_Basis, /*tp_clear*/ - __pyx_pw_6_basis_5Basis_9__richcmp__, /*tp_richcompare*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_7sklearn_5earth_6_basis___pyx_scope_struct__piter, /*tp_traverse*/ + __pyx_tp_clear_7sklearn_5earth_6_basis___pyx_scope_struct__piter, /*tp_clear*/ + 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ - __pyx_pw_6_basis_5Basis_26__iter__, /*tp_iter*/ + 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_6_basis_Basis, /*tp_methods*/ + __pyx_methods_7sklearn_5earth_6_basis___pyx_scope_struct__piter, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -17348,140 +16884,82 @@ static PyTypeObject __pyx_type_6_basis_Basis = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pw_6_basis_5Basis_1__init__, /*tp_init*/ + 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_6_basis_Basis, /*tp_new*/ + __pyx_tp_new_7sklearn_5earth_6_basis___pyx_scope_struct__piter, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; -static struct __pyx_vtabstruct_6_basis_PicklePlaceHolderBasisFunction __pyx_vtable_6_basis_PicklePlaceHolderBasisFunction; - -static PyObject *__pyx_tp_new_6_basis_PicklePlaceHolderBasisFunction(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_6_basis_PicklePlaceHolderBasisFunction *p; - PyObject *o = __pyx_tp_new_6_basis_BasisFunction(t, a, k); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_6_basis_PicklePlaceHolderBasisFunction *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_6_basis_BasisFunction*)__pyx_vtabptr_6_basis_PicklePlaceHolderBasisFunction; - return o; -} - -static PyMethodDef __pyx_methods_6_basis_PicklePlaceHolderBasisFunction[] = { - {0, 0, 0, 0} -}; - -static PyNumberMethods __pyx_tp_as_number_PicklePlaceHolderBasisFunction = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_long*/ - #else - 0, /*reserved*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if PY_VERSION_HEX >= 0x02050000 - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_PicklePlaceHolderBasisFunction = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_PicklePlaceHolderBasisFunction = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_PicklePlaceHolderBasisFunction = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ + 0, /*tp_version_tag*/ #endif }; +static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction __pyx_vtable_7sklearn_5earth_6_basis_HingeBasisFunction; + +static PyObject *__pyx_tp_new_7sklearn_5earth_6_basis_HingeBasisFunction(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *p; + PyObject *o = __pyx_tp_new_7sklearn_5earth_6_basis_BasisFunction(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction*)__pyx_vtabptr_7sklearn_5earth_6_basis_HingeBasisFunction; + p->label = ((PyObject*)Py_None); Py_INCREF(Py_None); + return o; +} + +static void __pyx_tp_dealloc_7sklearn_5earth_6_basis_HingeBasisFunction(PyObject *o) { + struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *p = (struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->label); + PyObject_GC_Track(o); + __pyx_tp_dealloc_7sklearn_5earth_6_basis_BasisFunction(o); +} + +static int __pyx_tp_traverse_7sklearn_5earth_6_basis_HingeBasisFunction(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *p = (struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *)o; + e = __pyx_tp_traverse_7sklearn_5earth_6_basis_BasisFunction(o, v, a); if (e) return e; + if (p->label) { + e = (*v)(p->label, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_7sklearn_5earth_6_basis_HingeBasisFunction(PyObject *o) { + struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *p = (struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *)o; + PyObject* tmp; + __pyx_tp_clear_7sklearn_5earth_6_basis_BasisFunction(o); + tmp = ((PyObject*)p->label); + p->label = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} + +static PyMethodDef __pyx_methods_7sklearn_5earth_6_basis_HingeBasisFunction[] = { + {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_3__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_getstate"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_5_getstate, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__setstate__"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_7__setstate__, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("has_knot"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_9has_knot, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("translate"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_11translate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("scale"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_13scale, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_variable"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_17get_variable, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_knot"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_19get_knot, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_reverse"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_21get_reverse, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_knot_idx"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_23get_knot_idx, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("apply"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_25apply, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7sklearn_5earth_6_basis_18HingeBasisFunction_24apply)}, + {0, 0, 0, 0} +}; -static PyTypeObject __pyx_type_6_basis_PicklePlaceHolderBasisFunction = { +static PyTypeObject __pyx_type_7sklearn_5earth_6_basis_HingeBasisFunction = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_basis.PicklePlaceHolderBasisFunction"), /*tp_name*/ - sizeof(struct __pyx_obj_6_basis_PicklePlaceHolderBasisFunction), /*tp_basicsize*/ + __Pyx_NAMESTR("sklearn.earth._basis.HingeBasisFunction"), /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6_basis_BasisFunction, /*tp_dealloc*/ + __pyx_tp_dealloc_7sklearn_5earth_6_basis_HingeBasisFunction, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -17491,24 +16969,24 @@ static PyTypeObject __pyx_type_6_basis_PicklePlaceHolderBasisFunction = { 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number_PicklePlaceHolderBasisFunction, /*tp_as_number*/ - &__pyx_tp_as_sequence_PicklePlaceHolderBasisFunction, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_PicklePlaceHolderBasisFunction, /*tp_as_mapping*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ - 0, /*tp_str*/ + __pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_15__str__, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_PicklePlaceHolderBasisFunction, /*tp_as_buffer*/ + 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - __Pyx_DOCSTR("This is a place holder for unpickling the basis function tree."), /*tp_doc*/ - __pyx_tp_traverse_6_basis_BasisFunction, /*tp_traverse*/ - __pyx_tp_clear_6_basis_BasisFunction, /*tp_clear*/ + 0, /*tp_doc*/ + __pyx_tp_traverse_7sklearn_5earth_6_basis_HingeBasisFunction, /*tp_traverse*/ + __pyx_tp_clear_7sklearn_5earth_6_basis_HingeBasisFunction, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_6_basis_PicklePlaceHolderBasisFunction, /*tp_methods*/ + __pyx_methods_7sklearn_5earth_6_basis_HingeBasisFunction, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -17516,9 +16994,9 @@ static PyTypeObject __pyx_type_6_basis_PicklePlaceHolderBasisFunction = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - 0, /*tp_init*/ + __pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_1__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_6_basis_PicklePlaceHolderBasisFunction, /*tp_new*/ + __pyx_tp_new_7sklearn_5earth_6_basis_HingeBasisFunction, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -17531,180 +17009,63 @@ static PyTypeObject __pyx_type_6_basis_PicklePlaceHolderBasisFunction = { 0, /*tp_version_tag*/ #endif }; +static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_LinearBasisFunction __pyx_vtable_7sklearn_5earth_6_basis_LinearBasisFunction; -static struct __pyx_obj_6_basis___pyx_scope_struct__piter *__pyx_freelist_6_basis___pyx_scope_struct__piter[8]; -static int __pyx_freecount_6_basis___pyx_scope_struct__piter = 0; - -static PyObject *__pyx_tp_new_6_basis___pyx_scope_struct__piter(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_6_basis___pyx_scope_struct__piter *p; - PyObject *o; - if (likely((__pyx_freecount_6_basis___pyx_scope_struct__piter > 0) & (t->tp_basicsize == sizeof(struct __pyx_obj_6_basis___pyx_scope_struct__piter)))) { - o = (PyObject*)__pyx_freelist_6_basis___pyx_scope_struct__piter[--__pyx_freecount_6_basis___pyx_scope_struct__piter]; - memset(o, 0, sizeof(struct __pyx_obj_6_basis___pyx_scope_struct__piter)); - PyObject_INIT(o, t); - PyObject_GC_Track(o); - } else { - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - } - p = ((struct __pyx_obj_6_basis___pyx_scope_struct__piter *)o); - p->__pyx_v_bf = 0; - p->__pyx_v_self = 0; - p->__pyx_t_0 = 0; +static PyObject *__pyx_tp_new_7sklearn_5earth_6_basis_LinearBasisFunction(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *p; + PyObject *o = __pyx_tp_new_7sklearn_5earth_6_basis_BasisFunction(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction*)__pyx_vtabptr_7sklearn_5earth_6_basis_LinearBasisFunction; + p->label = ((PyObject*)Py_None); Py_INCREF(Py_None); return o; } -static void __pyx_tp_dealloc_6_basis___pyx_scope_struct__piter(PyObject *o) { - struct __pyx_obj_6_basis___pyx_scope_struct__piter *p = (struct __pyx_obj_6_basis___pyx_scope_struct__piter *)o; +static void __pyx_tp_dealloc_7sklearn_5earth_6_basis_LinearBasisFunction(PyObject *o) { + struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *p = (struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *)o; PyObject_GC_UnTrack(o); - Py_CLEAR(p->__pyx_v_bf); - Py_CLEAR(p->__pyx_v_self); - Py_CLEAR(p->__pyx_t_0); - if ((__pyx_freecount_6_basis___pyx_scope_struct__piter < 8) & (Py_TYPE(o)->tp_basicsize == sizeof(struct __pyx_obj_6_basis___pyx_scope_struct__piter))) { - __pyx_freelist_6_basis___pyx_scope_struct__piter[__pyx_freecount_6_basis___pyx_scope_struct__piter++] = ((struct __pyx_obj_6_basis___pyx_scope_struct__piter *)o); - } else { - (*Py_TYPE(o)->tp_free)(o); - } + Py_CLEAR(p->label); + PyObject_GC_Track(o); + __pyx_tp_dealloc_7sklearn_5earth_6_basis_BasisFunction(o); } -static int __pyx_tp_traverse_6_basis___pyx_scope_struct__piter(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_7sklearn_5earth_6_basis_LinearBasisFunction(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_6_basis___pyx_scope_struct__piter *p = (struct __pyx_obj_6_basis___pyx_scope_struct__piter *)o; - if (p->__pyx_v_bf) { - e = (*v)(p->__pyx_v_bf, a); if (e) return e; - } - if (p->__pyx_v_self) { - e = (*v)(((PyObject*)p->__pyx_v_self), a); if (e) return e; - } - if (p->__pyx_t_0) { - e = (*v)(p->__pyx_t_0, a); if (e) return e; + struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *p = (struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *)o; + e = __pyx_tp_traverse_7sklearn_5earth_6_basis_BasisFunction(o, v, a); if (e) return e; + if (p->label) { + e = (*v)(p->label, a); if (e) return e; } return 0; } -static int __pyx_tp_clear_6_basis___pyx_scope_struct__piter(PyObject *o) { - struct __pyx_obj_6_basis___pyx_scope_struct__piter *p = (struct __pyx_obj_6_basis___pyx_scope_struct__piter *)o; +static int __pyx_tp_clear_7sklearn_5earth_6_basis_LinearBasisFunction(PyObject *o) { + struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *p = (struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *)o; PyObject* tmp; - tmp = ((PyObject*)p->__pyx_v_bf); - p->__pyx_v_bf = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_v_self); - p->__pyx_v_self = ((struct __pyx_obj_6_basis_Basis *)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - tmp = ((PyObject*)p->__pyx_t_0); - p->__pyx_t_0 = Py_None; Py_INCREF(Py_None); + __pyx_tp_clear_7sklearn_5earth_6_basis_BasisFunction(o); + tmp = ((PyObject*)p->label); + p->label = ((PyObject*)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyMethodDef __pyx_methods_6_basis___pyx_scope_struct__piter[] = { +static PyMethodDef __pyx_methods_7sklearn_5earth_6_basis_LinearBasisFunction[] = { + {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_3__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_getstate"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_5_getstate, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__setstate__"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_7__setstate__, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("translate"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_9translate, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("scale"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_11scale, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_variable"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_15get_variable, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("apply"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_17apply, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7sklearn_5earth_6_basis_19LinearBasisFunction_16apply)}, {0, 0, 0, 0} }; -static PyNumberMethods __pyx_tp_as_number___pyx_scope_struct__piter = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_long*/ - #else - 0, /*reserved*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if PY_VERSION_HEX >= 0x02050000 - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence___pyx_scope_struct__piter = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping___pyx_scope_struct__piter = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer___pyx_scope_struct__piter = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -static PyTypeObject __pyx_type_6_basis___pyx_scope_struct__piter = { +static PyTypeObject __pyx_type_7sklearn_5earth_6_basis_LinearBasisFunction = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_basis.__pyx_scope_struct__piter"), /*tp_name*/ - sizeof(struct __pyx_obj_6_basis___pyx_scope_struct__piter), /*tp_basicsize*/ + __Pyx_NAMESTR("sklearn.earth._basis.LinearBasisFunction"), /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_6_basis___pyx_scope_struct__piter, /*tp_dealloc*/ + __pyx_tp_dealloc_7sklearn_5earth_6_basis_LinearBasisFunction, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -17714,24 +17075,24 @@ static PyTypeObject __pyx_type_6_basis___pyx_scope_struct__piter = { 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number___pyx_scope_struct__piter, /*tp_as_number*/ - &__pyx_tp_as_sequence___pyx_scope_struct__piter, /*tp_as_sequence*/ - &__pyx_tp_as_mapping___pyx_scope_struct__piter, /*tp_as_mapping*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ - 0, /*tp_str*/ + __pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_13__str__, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer___pyx_scope_struct__piter, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_6_basis___pyx_scope_struct__piter, /*tp_traverse*/ - __pyx_tp_clear_6_basis___pyx_scope_struct__piter, /*tp_clear*/ + __pyx_tp_traverse_7sklearn_5earth_6_basis_LinearBasisFunction, /*tp_traverse*/ + __pyx_tp_clear_7sklearn_5earth_6_basis_LinearBasisFunction, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_6_basis___pyx_scope_struct__piter, /*tp_methods*/ + __pyx_methods_7sklearn_5earth_6_basis_LinearBasisFunction, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -17739,9 +17100,9 @@ static PyTypeObject __pyx_type_6_basis___pyx_scope_struct__piter = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - 0, /*tp_init*/ + __pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_1__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_6_basis___pyx_scope_struct__piter, /*tp_new*/ + __pyx_tp_new_7sklearn_5earth_6_basis_LinearBasisFunction, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -17805,6 +17166,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, {&__pyx_n_s____pyx_getbuffer, __pyx_k____pyx_getbuffer, sizeof(__pyx_k____pyx_getbuffer), 0, 0, 1, 1}, {&__pyx_n_s____pyx_releasebuffer, __pyx_k____pyx_releasebuffer, sizeof(__pyx_k____pyx_releasebuffer), 0, 0, 1, 1}, + {&__pyx_n_s____pyx_vtable__, __pyx_k____pyx_vtable__, sizeof(__pyx_k____pyx_vtable__), 0, 0, 1, 1}, {&__pyx_n_s____setstate__, __pyx_k____setstate__, sizeof(__pyx_k____setstate__), 0, 0, 1, 1}, {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, {&__pyx_n_s___add_child, __pyx_k___add_child, sizeof(__pyx_k___add_child), 0, 0, 1, 1}, @@ -17898,7 +17260,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "_basis.pyx":573 + /* "sklearn/earth/_basis.pyx":573 * if bf.is_pruned(): * continue * bf.apply(X,B[:,col],recurse=True) # <<<<<<<<<<<<<< @@ -18047,8 +17409,8 @@ PyMODINIT_FUNC PyInit__basis(void) #if PY_MAJOR_VERSION >= 3 { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (!PyDict_GetItemString(modules, "_basis")) { - if (unlikely(PyDict_SetItemString(modules, "_basis", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyDict_GetItemString(modules, "sklearn.earth._basis")) { + if (unlikely(PyDict_SetItemString(modules, "sklearn.earth._basis", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif @@ -18062,7 +17424,7 @@ PyMODINIT_FUNC PyInit__basis(void) #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif - if (__pyx_module_is_main__basis) { + if (__pyx_module_is_main_sklearn__earth___basis) { if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; } /*--- Builtin init code ---*/ @@ -18073,88 +17435,88 @@ PyMODINIT_FUNC PyInit__basis(void) /*--- Variable export code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ - __pyx_vtabptr_6_basis_BasisFunction = &__pyx_vtable_6_basis_BasisFunction; - __pyx_vtable_6_basis_BasisFunction.has_knot = (int (*)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_13BasisFunction_has_knot; - __pyx_vtable_6_basis_BasisFunction.is_prunable = (int (*)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_13BasisFunction_is_prunable; - __pyx_vtable_6_basis_BasisFunction.is_pruned = (int (*)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_13BasisFunction_is_pruned; - __pyx_vtable_6_basis_BasisFunction.is_splittable = (int (*)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_13BasisFunction_is_splittable; - __pyx_vtable_6_basis_BasisFunction.make_splittable = (int (*)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_13BasisFunction_make_splittable; - __pyx_vtable_6_basis_BasisFunction.make_unsplittable = (int (*)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_13BasisFunction_make_unsplittable; - __pyx_vtable_6_basis_BasisFunction.get_children = (PyObject *(*)(struct __pyx_obj_6_basis_BasisFunction *))__pyx_f_6_basis_13BasisFunction_get_children; - __pyx_vtable_6_basis_BasisFunction._set_parent = (PyObject *(*)(struct __pyx_obj_6_basis_BasisFunction *, struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_13BasisFunction__set_parent; - __pyx_vtable_6_basis_BasisFunction._add_child = (PyObject *(*)(struct __pyx_obj_6_basis_BasisFunction *, struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_13BasisFunction__add_child; - __pyx_vtable_6_basis_BasisFunction.get_parent = (struct __pyx_obj_6_basis_BasisFunction *(*)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_13BasisFunction_get_parent; - __pyx_vtable_6_basis_BasisFunction.prune = (PyObject *(*)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_13BasisFunction_prune; - __pyx_vtable_6_basis_BasisFunction.unprune = (PyObject *(*)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_13BasisFunction_unprune; - __pyx_vtable_6_basis_BasisFunction.knots = (PyObject *(*)(struct __pyx_obj_6_basis_BasisFunction *, __pyx_t_6_basis_INDEX_t, int __pyx_skip_dispatch))__pyx_f_6_basis_13BasisFunction_knots; - __pyx_vtable_6_basis_BasisFunction.degree = (__pyx_t_6_basis_INDEX_t (*)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_13BasisFunction_degree; - __pyx_vtable_6_basis_BasisFunction.apply = (PyObject *(*)(struct __pyx_obj_6_basis_BasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_6_basis_13BasisFunction_apply *__pyx_optional_args))__pyx_f_6_basis_13BasisFunction_apply; - __pyx_vtable_6_basis_BasisFunction.valid_knots = (PyArrayObject *(*)(struct __pyx_obj_6_basis_BasisFunction *, PyArrayObject *, PyArrayObject *, int, __pyx_t_6_basis_INDEX_t, int, int, __pyx_t_6_basis_FLOAT_t, __pyx_t_6_basis_INDEX_t, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_6_basis_13BasisFunction_valid_knots; - if (PyType_Ready(&__pyx_type_6_basis_BasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_6_basis_BasisFunction.tp_dict, __pyx_vtabptr_6_basis_BasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "BasisFunction", (PyObject *)&__pyx_type_6_basis_BasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_6_basis_BasisFunction = &__pyx_type_6_basis_BasisFunction; - __pyx_vtabptr_6_basis_ConstantBasisFunction = &__pyx_vtable_6_basis_ConstantBasisFunction; - __pyx_vtable_6_basis_ConstantBasisFunction.__pyx_base = *__pyx_vtabptr_6_basis_BasisFunction; - __pyx_vtable_6_basis_ConstantBasisFunction.__pyx_base._set_parent = (PyObject *(*)(struct __pyx_obj_6_basis_BasisFunction *, struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_21ConstantBasisFunction__set_parent; - __pyx_vtable_6_basis_ConstantBasisFunction.__pyx_base.get_parent = (struct __pyx_obj_6_basis_BasisFunction *(*)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_21ConstantBasisFunction_get_parent; - __pyx_vtable_6_basis_ConstantBasisFunction.__pyx_base.degree = (__pyx_t_6_basis_INDEX_t (*)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_21ConstantBasisFunction_degree; - __pyx_vtable_6_basis_ConstantBasisFunction.__pyx_base.apply = (PyObject *(*)(struct __pyx_obj_6_basis_BasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_6_basis_13BasisFunction_apply *__pyx_optional_args))__pyx_f_6_basis_21ConstantBasisFunction_apply; - __pyx_vtable_6_basis_ConstantBasisFunction.translate = (PyObject *(*)(struct __pyx_obj_6_basis_ConstantBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch))__pyx_f_6_basis_21ConstantBasisFunction_translate; - __pyx_vtable_6_basis_ConstantBasisFunction.scale = (__pyx_t_6_basis_FLOAT_t (*)(struct __pyx_obj_6_basis_ConstantBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_6_basis_21ConstantBasisFunction_scale; - __pyx_type_6_basis_ConstantBasisFunction.tp_base = __pyx_ptype_6_basis_BasisFunction; - if (PyType_Ready(&__pyx_type_6_basis_ConstantBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_6_basis_ConstantBasisFunction.tp_dict, __pyx_vtabptr_6_basis_ConstantBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "ConstantBasisFunction", (PyObject *)&__pyx_type_6_basis_ConstantBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_6_basis_ConstantBasisFunction = &__pyx_type_6_basis_ConstantBasisFunction; - __pyx_vtabptr_6_basis_HingeBasisFunction = &__pyx_vtable_6_basis_HingeBasisFunction; - __pyx_vtable_6_basis_HingeBasisFunction.__pyx_base = *__pyx_vtabptr_6_basis_BasisFunction; - __pyx_vtable_6_basis_HingeBasisFunction.__pyx_base.has_knot = (int (*)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_18HingeBasisFunction_has_knot; - __pyx_vtable_6_basis_HingeBasisFunction.__pyx_base.apply = (PyObject *(*)(struct __pyx_obj_6_basis_BasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_6_basis_13BasisFunction_apply *__pyx_optional_args))__pyx_f_6_basis_18HingeBasisFunction_apply; - __pyx_vtable_6_basis_HingeBasisFunction.translate = (PyObject *(*)(struct __pyx_obj_6_basis_HingeBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch))__pyx_f_6_basis_18HingeBasisFunction_translate; - __pyx_vtable_6_basis_HingeBasisFunction.scale = (__pyx_t_6_basis_FLOAT_t (*)(struct __pyx_obj_6_basis_HingeBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_6_basis_18HingeBasisFunction_scale; - __pyx_vtable_6_basis_HingeBasisFunction.get_variable = (__pyx_t_6_basis_INDEX_t (*)(struct __pyx_obj_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_18HingeBasisFunction_get_variable; - __pyx_vtable_6_basis_HingeBasisFunction.get_knot = (__pyx_t_6_basis_FLOAT_t (*)(struct __pyx_obj_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_18HingeBasisFunction_get_knot; - __pyx_vtable_6_basis_HingeBasisFunction.get_reverse = (int (*)(struct __pyx_obj_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_18HingeBasisFunction_get_reverse; - __pyx_vtable_6_basis_HingeBasisFunction.get_knot_idx = (__pyx_t_6_basis_INDEX_t (*)(struct __pyx_obj_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_18HingeBasisFunction_get_knot_idx; - __pyx_type_6_basis_HingeBasisFunction.tp_base = __pyx_ptype_6_basis_BasisFunction; - if (PyType_Ready(&__pyx_type_6_basis_HingeBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_6_basis_HingeBasisFunction.tp_dict, __pyx_vtabptr_6_basis_HingeBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "HingeBasisFunction", (PyObject *)&__pyx_type_6_basis_HingeBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_6_basis_HingeBasisFunction = &__pyx_type_6_basis_HingeBasisFunction; - __pyx_vtabptr_6_basis_LinearBasisFunction = &__pyx_vtable_6_basis_LinearBasisFunction; - __pyx_vtable_6_basis_LinearBasisFunction.__pyx_base = *__pyx_vtabptr_6_basis_BasisFunction; - __pyx_vtable_6_basis_LinearBasisFunction.__pyx_base.apply = (PyObject *(*)(struct __pyx_obj_6_basis_BasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_6_basis_13BasisFunction_apply *__pyx_optional_args))__pyx_f_6_basis_19LinearBasisFunction_apply; - __pyx_vtable_6_basis_LinearBasisFunction.translate = (PyObject *(*)(struct __pyx_obj_6_basis_LinearBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch))__pyx_f_6_basis_19LinearBasisFunction_translate; - __pyx_vtable_6_basis_LinearBasisFunction.scale = (__pyx_t_6_basis_FLOAT_t (*)(struct __pyx_obj_6_basis_LinearBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_6_basis_19LinearBasisFunction_scale; - __pyx_vtable_6_basis_LinearBasisFunction.get_variable = (__pyx_t_6_basis_INDEX_t (*)(struct __pyx_obj_6_basis_LinearBasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_19LinearBasisFunction_get_variable; - __pyx_type_6_basis_LinearBasisFunction.tp_base = __pyx_ptype_6_basis_BasisFunction; - if (PyType_Ready(&__pyx_type_6_basis_LinearBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_6_basis_LinearBasisFunction.tp_dict, __pyx_vtabptr_6_basis_LinearBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "LinearBasisFunction", (PyObject *)&__pyx_type_6_basis_LinearBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_6_basis_LinearBasisFunction = &__pyx_type_6_basis_LinearBasisFunction; - __pyx_vtabptr_6_basis_Basis = &__pyx_vtable_6_basis_Basis; - __pyx_vtable_6_basis_Basis.translate = (PyObject *(*)(struct __pyx_obj_6_basis_Basis *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_6_basis_5Basis_translate; - __pyx_vtable_6_basis_Basis.scale = (PyObject *(*)(struct __pyx_obj_6_basis_Basis *, PyArrayObject *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_6_basis_5Basis_scale; - __pyx_vtable_6_basis_Basis.get_root = (struct __pyx_obj_6_basis_BasisFunction *(*)(struct __pyx_obj_6_basis_Basis *, int __pyx_skip_dispatch))__pyx_f_6_basis_5Basis_get_root; - __pyx_vtable_6_basis_Basis.append = (PyObject *(*)(struct __pyx_obj_6_basis_Basis *, struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_6_basis_5Basis_append; - __pyx_vtable_6_basis_Basis.plen = (__pyx_t_6_basis_INDEX_t (*)(struct __pyx_obj_6_basis_Basis *, int __pyx_skip_dispatch))__pyx_f_6_basis_5Basis_plen; - __pyx_vtable_6_basis_Basis.get = (struct __pyx_obj_6_basis_BasisFunction *(*)(struct __pyx_obj_6_basis_Basis *, __pyx_t_6_basis_INDEX_t, int __pyx_skip_dispatch))__pyx_f_6_basis_5Basis_get; - __pyx_vtable_6_basis_Basis.transform = (PyObject *(*)(struct __pyx_obj_6_basis_Basis *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_6_basis_5Basis_transform; - __pyx_vtable_6_basis_Basis.weighted_transform = (PyObject *(*)(struct __pyx_obj_6_basis_Basis *, PyArrayObject *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_6_basis_5Basis_weighted_transform; - if (PyType_Ready(&__pyx_type_6_basis_Basis) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_6_basis_Basis.tp_dict, __pyx_vtabptr_6_basis_Basis) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "Basis", (PyObject *)&__pyx_type_6_basis_Basis) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_6_basis_Basis = &__pyx_type_6_basis_Basis; - __pyx_vtabptr_6_basis_PicklePlaceHolderBasisFunction = &__pyx_vtable_6_basis_PicklePlaceHolderBasisFunction; - __pyx_vtable_6_basis_PicklePlaceHolderBasisFunction.__pyx_base = *__pyx_vtabptr_6_basis_BasisFunction; - __pyx_type_6_basis_PicklePlaceHolderBasisFunction.tp_base = __pyx_ptype_6_basis_BasisFunction; - if (PyType_Ready(&__pyx_type_6_basis_PicklePlaceHolderBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_6_basis_PicklePlaceHolderBasisFunction.tp_dict, __pyx_vtabptr_6_basis_PicklePlaceHolderBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "PicklePlaceHolderBasisFunction", (PyObject *)&__pyx_type_6_basis_PicklePlaceHolderBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_6_basis_PicklePlaceHolderBasisFunction = &__pyx_type_6_basis_PicklePlaceHolderBasisFunction; - if (PyType_Ready(&__pyx_type_6_basis___pyx_scope_struct__piter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_6_basis___pyx_scope_struct__piter = &__pyx_type_6_basis___pyx_scope_struct__piter; + __pyx_vtabptr_7sklearn_5earth_6_basis_Basis = &__pyx_vtable_7sklearn_5earth_6_basis_Basis; + __pyx_vtable_7sklearn_5earth_6_basis_Basis.translate = (PyObject *(*)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_5Basis_translate; + __pyx_vtable_7sklearn_5earth_6_basis_Basis.scale = (PyObject *(*)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, PyArrayObject *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_5Basis_scale; + __pyx_vtable_7sklearn_5earth_6_basis_Basis.get_root = (struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *(*)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_5Basis_get_root; + __pyx_vtable_7sklearn_5earth_6_basis_Basis.append = (PyObject *(*)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_5Basis_append; + __pyx_vtable_7sklearn_5earth_6_basis_Basis.plen = (__pyx_t_7sklearn_5earth_6_basis_INDEX_t (*)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_5Basis_plen; + __pyx_vtable_7sklearn_5earth_6_basis_Basis.get = (struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *(*)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, __pyx_t_7sklearn_5earth_6_basis_INDEX_t, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_5Basis_get; + __pyx_vtable_7sklearn_5earth_6_basis_Basis.transform = (PyObject *(*)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_5Basis_transform; + __pyx_vtable_7sklearn_5earth_6_basis_Basis.weighted_transform = (PyObject *(*)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, PyArrayObject *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_5Basis_weighted_transform; + if (PyType_Ready(&__pyx_type_7sklearn_5earth_6_basis_Basis) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_5earth_6_basis_Basis.tp_dict, __pyx_vtabptr_7sklearn_5earth_6_basis_Basis) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "Basis", (PyObject *)&__pyx_type_7sklearn_5earth_6_basis_Basis) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_6_basis_Basis = &__pyx_type_7sklearn_5earth_6_basis_Basis; + __pyx_vtabptr_7sklearn_5earth_6_basis_BasisFunction = &__pyx_vtable_7sklearn_5earth_6_basis_BasisFunction; + __pyx_vtable_7sklearn_5earth_6_basis_BasisFunction.has_knot = (int (*)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_has_knot; + __pyx_vtable_7sklearn_5earth_6_basis_BasisFunction.is_prunable = (int (*)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_is_prunable; + __pyx_vtable_7sklearn_5earth_6_basis_BasisFunction.is_pruned = (int (*)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_is_pruned; + __pyx_vtable_7sklearn_5earth_6_basis_BasisFunction.is_splittable = (int (*)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_is_splittable; + __pyx_vtable_7sklearn_5earth_6_basis_BasisFunction.make_splittable = (int (*)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_make_splittable; + __pyx_vtable_7sklearn_5earth_6_basis_BasisFunction.make_unsplittable = (int (*)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_make_unsplittable; + __pyx_vtable_7sklearn_5earth_6_basis_BasisFunction.get_children = (PyObject *(*)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *))__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_get_children; + __pyx_vtable_7sklearn_5earth_6_basis_BasisFunction._set_parent = (PyObject *(*)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_13BasisFunction__set_parent; + __pyx_vtable_7sklearn_5earth_6_basis_BasisFunction._add_child = (PyObject *(*)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_13BasisFunction__add_child; + __pyx_vtable_7sklearn_5earth_6_basis_BasisFunction.get_parent = (struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *(*)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_get_parent; + __pyx_vtable_7sklearn_5earth_6_basis_BasisFunction.prune = (PyObject *(*)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_prune; + __pyx_vtable_7sklearn_5earth_6_basis_BasisFunction.unprune = (PyObject *(*)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_unprune; + __pyx_vtable_7sklearn_5earth_6_basis_BasisFunction.knots = (PyObject *(*)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, __pyx_t_7sklearn_5earth_6_basis_INDEX_t, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_knots; + __pyx_vtable_7sklearn_5earth_6_basis_BasisFunction.degree = (__pyx_t_7sklearn_5earth_6_basis_INDEX_t (*)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_degree; + __pyx_vtable_7sklearn_5earth_6_basis_BasisFunction.apply = (PyObject *(*)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_7sklearn_5earth_6_basis_13BasisFunction_apply *__pyx_optional_args))__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_apply; + __pyx_vtable_7sklearn_5earth_6_basis_BasisFunction.valid_knots = (PyArrayObject *(*)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, PyArrayObject *, PyArrayObject *, int, __pyx_t_7sklearn_5earth_6_basis_INDEX_t, int, int, __pyx_t_7sklearn_5earth_6_basis_FLOAT_t, __pyx_t_7sklearn_5earth_6_basis_INDEX_t, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_valid_knots; + if (PyType_Ready(&__pyx_type_7sklearn_5earth_6_basis_BasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_5earth_6_basis_BasisFunction.tp_dict, __pyx_vtabptr_7sklearn_5earth_6_basis_BasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "BasisFunction", (PyObject *)&__pyx_type_7sklearn_5earth_6_basis_BasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction = &__pyx_type_7sklearn_5earth_6_basis_BasisFunction; + __pyx_vtabptr_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction = &__pyx_vtable_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction; + __pyx_vtable_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction.__pyx_base = *__pyx_vtabptr_7sklearn_5earth_6_basis_BasisFunction; + __pyx_type_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction.tp_base = __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction; + if (PyType_Ready(&__pyx_type_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction.tp_dict, __pyx_vtabptr_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "PicklePlaceHolderBasisFunction", (PyObject *)&__pyx_type_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction = &__pyx_type_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction; + __pyx_vtabptr_7sklearn_5earth_6_basis_ConstantBasisFunction = &__pyx_vtable_7sklearn_5earth_6_basis_ConstantBasisFunction; + __pyx_vtable_7sklearn_5earth_6_basis_ConstantBasisFunction.__pyx_base = *__pyx_vtabptr_7sklearn_5earth_6_basis_BasisFunction; + __pyx_vtable_7sklearn_5earth_6_basis_ConstantBasisFunction.__pyx_base._set_parent = (PyObject *(*)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_21ConstantBasisFunction__set_parent; + __pyx_vtable_7sklearn_5earth_6_basis_ConstantBasisFunction.__pyx_base.get_parent = (struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *(*)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_21ConstantBasisFunction_get_parent; + __pyx_vtable_7sklearn_5earth_6_basis_ConstantBasisFunction.__pyx_base.degree = (__pyx_t_7sklearn_5earth_6_basis_INDEX_t (*)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_21ConstantBasisFunction_degree; + __pyx_vtable_7sklearn_5earth_6_basis_ConstantBasisFunction.__pyx_base.apply = (PyObject *(*)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_7sklearn_5earth_6_basis_13BasisFunction_apply *__pyx_optional_args))__pyx_f_7sklearn_5earth_6_basis_21ConstantBasisFunction_apply; + __pyx_vtable_7sklearn_5earth_6_basis_ConstantBasisFunction.translate = (PyObject *(*)(struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_21ConstantBasisFunction_translate; + __pyx_vtable_7sklearn_5earth_6_basis_ConstantBasisFunction.scale = (__pyx_t_7sklearn_5earth_6_basis_FLOAT_t (*)(struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_21ConstantBasisFunction_scale; + __pyx_type_7sklearn_5earth_6_basis_ConstantBasisFunction.tp_base = __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction; + if (PyType_Ready(&__pyx_type_7sklearn_5earth_6_basis_ConstantBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_5earth_6_basis_ConstantBasisFunction.tp_dict, __pyx_vtabptr_7sklearn_5earth_6_basis_ConstantBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "ConstantBasisFunction", (PyObject *)&__pyx_type_7sklearn_5earth_6_basis_ConstantBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_6_basis_ConstantBasisFunction = &__pyx_type_7sklearn_5earth_6_basis_ConstantBasisFunction; + if (PyType_Ready(&__pyx_type_7sklearn_5earth_6_basis___pyx_scope_struct__piter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_6_basis___pyx_scope_struct__piter = &__pyx_type_7sklearn_5earth_6_basis___pyx_scope_struct__piter; + __pyx_vtabptr_7sklearn_5earth_6_basis_HingeBasisFunction = &__pyx_vtable_7sklearn_5earth_6_basis_HingeBasisFunction; + __pyx_vtable_7sklearn_5earth_6_basis_HingeBasisFunction.__pyx_base = *__pyx_vtabptr_7sklearn_5earth_6_basis_BasisFunction; + __pyx_vtable_7sklearn_5earth_6_basis_HingeBasisFunction.__pyx_base.has_knot = (int (*)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_18HingeBasisFunction_has_knot; + __pyx_vtable_7sklearn_5earth_6_basis_HingeBasisFunction.__pyx_base.apply = (PyObject *(*)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_7sklearn_5earth_6_basis_13BasisFunction_apply *__pyx_optional_args))__pyx_f_7sklearn_5earth_6_basis_18HingeBasisFunction_apply; + __pyx_vtable_7sklearn_5earth_6_basis_HingeBasisFunction.translate = (PyObject *(*)(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_18HingeBasisFunction_translate; + __pyx_vtable_7sklearn_5earth_6_basis_HingeBasisFunction.scale = (__pyx_t_7sklearn_5earth_6_basis_FLOAT_t (*)(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_18HingeBasisFunction_scale; + __pyx_vtable_7sklearn_5earth_6_basis_HingeBasisFunction.get_variable = (__pyx_t_7sklearn_5earth_6_basis_INDEX_t (*)(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_18HingeBasisFunction_get_variable; + __pyx_vtable_7sklearn_5earth_6_basis_HingeBasisFunction.get_knot = (__pyx_t_7sklearn_5earth_6_basis_FLOAT_t (*)(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_18HingeBasisFunction_get_knot; + __pyx_vtable_7sklearn_5earth_6_basis_HingeBasisFunction.get_reverse = (int (*)(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_18HingeBasisFunction_get_reverse; + __pyx_vtable_7sklearn_5earth_6_basis_HingeBasisFunction.get_knot_idx = (__pyx_t_7sklearn_5earth_6_basis_INDEX_t (*)(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_18HingeBasisFunction_get_knot_idx; + __pyx_type_7sklearn_5earth_6_basis_HingeBasisFunction.tp_base = __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction; + if (PyType_Ready(&__pyx_type_7sklearn_5earth_6_basis_HingeBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_5earth_6_basis_HingeBasisFunction.tp_dict, __pyx_vtabptr_7sklearn_5earth_6_basis_HingeBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "HingeBasisFunction", (PyObject *)&__pyx_type_7sklearn_5earth_6_basis_HingeBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_6_basis_HingeBasisFunction = &__pyx_type_7sklearn_5earth_6_basis_HingeBasisFunction; + __pyx_vtabptr_7sklearn_5earth_6_basis_LinearBasisFunction = &__pyx_vtable_7sklearn_5earth_6_basis_LinearBasisFunction; + __pyx_vtable_7sklearn_5earth_6_basis_LinearBasisFunction.__pyx_base = *__pyx_vtabptr_7sklearn_5earth_6_basis_BasisFunction; + __pyx_vtable_7sklearn_5earth_6_basis_LinearBasisFunction.__pyx_base.apply = (PyObject *(*)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_7sklearn_5earth_6_basis_13BasisFunction_apply *__pyx_optional_args))__pyx_f_7sklearn_5earth_6_basis_19LinearBasisFunction_apply; + __pyx_vtable_7sklearn_5earth_6_basis_LinearBasisFunction.translate = (PyObject *(*)(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_19LinearBasisFunction_translate; + __pyx_vtable_7sklearn_5earth_6_basis_LinearBasisFunction.scale = (__pyx_t_7sklearn_5earth_6_basis_FLOAT_t (*)(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_19LinearBasisFunction_scale; + __pyx_vtable_7sklearn_5earth_6_basis_LinearBasisFunction.get_variable = (__pyx_t_7sklearn_5earth_6_basis_INDEX_t (*)(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_19LinearBasisFunction_get_variable; + __pyx_type_7sklearn_5earth_6_basis_LinearBasisFunction.tp_base = __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction; + if (PyType_Ready(&__pyx_type_7sklearn_5earth_6_basis_LinearBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_5earth_6_basis_LinearBasisFunction.tp_dict, __pyx_vtabptr_7sklearn_5earth_6_basis_LinearBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "LinearBasisFunction", (PyObject *)&__pyx_type_7sklearn_5earth_6_basis_LinearBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_6_basis_LinearBasisFunction = &__pyx_type_7sklearn_5earth_6_basis_LinearBasisFunction; /*--- Type import code ---*/ __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", #if CYTHON_COMPILING_IN_PYPY @@ -18170,22 +17532,22 @@ PyMODINIT_FUNC PyInit__basis(void) __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Variable import code ---*/ /*--- Function import code ---*/ - __pyx_t_1 = __Pyx_ImportModule("_util"); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_ImportFunction(__pyx_t_1, "log2", (void (**)(void))&__pyx_f_5_util_log2, "__pyx_t_5_util_FLOAT_t (__pyx_t_5_util_FLOAT_t)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_ImportFunction(__pyx_t_1, "apply_weights_2d", (void (**)(void))&__pyx_f_5_util_apply_weights_2d, "PyObject *(PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_ImportModule("sklearn.earth._util"); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_t_1, "log2", (void (**)(void))&__pyx_f_7sklearn_5earth_5_util_log2, "__pyx_t_7sklearn_5earth_5_util_FLOAT_t (__pyx_t_7sklearn_5earth_5_util_FLOAT_t)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_t_1, "apply_weights_2d", (void (**)(void))&__pyx_f_7sklearn_5earth_5_util_apply_weights_2d, "PyObject *(PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_t_1); __pyx_t_1 = 0; /*--- Execution code ---*/ - /* "_basis.pyx":10 + /* "sklearn/earth/_basis.pyx":10 * from libc.math cimport log * from libc.math cimport abs * cdef FLOAT_t ZERO_TOL = 1e-16 # <<<<<<<<<<<<<< * import numpy as np * */ - __pyx_v_6_basis_ZERO_TOL = 1e-16; + __pyx_v_7sklearn_5earth_6_basis_ZERO_TOL = 1e-16; - /* "_basis.pyx":11 + /* "sklearn/earth/_basis.pyx":11 * from libc.math cimport abs * cdef FLOAT_t ZERO_TOL = 1e-16 * import numpy as np # <<<<<<<<<<<<<< @@ -18197,19 +17559,19 @@ PyMODINIT_FUNC PyInit__basis(void) if (PyDict_SetItem(__pyx_d, __pyx_n_s__np, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "_basis.pyx":284 + /* "sklearn/earth/_basis.pyx":284 * '''This is a place holder for unpickling the basis function tree.''' * * pickle_place_holder = PicklePlaceHolderBasisFunction() # <<<<<<<<<<<<<< * * cdef class ConstantBasisFunction(BasisFunction): */ - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6_basis_PicklePlaceHolderBasisFunction)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s__pickle_place_holder, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "_basis.pyx":1 + /* "sklearn/earth/_basis.pyx":1 * # distutils: language = c # <<<<<<<<<<<<<< * # cython: cdivision = True * # cython: boundscheck = False @@ -18231,10 +17593,10 @@ PyMODINIT_FUNC PyInit__basis(void) __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); if (__pyx_m) { - __Pyx_AddTraceback("init _basis", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("init sklearn.earth._basis", __pyx_clineno, __pyx_lineno, __pyx_filename); Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init _basis"); + PyErr_SetString(PyExc_ImportError, "init sklearn.earth._basis"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -18355,6 +17717,56 @@ static CYTHON_INLINE void __Pyx_RaiseUnboundLocalError(const char *varname) { PyErr_Format(PyExc_UnboundLocalError, "local variable '%s' referenced before assignment", varname); } +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_Restore(type, value, tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#else + PyErr_Fetch(type, value, tb); +#endif +} + +static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, + CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) { + PyObject *old_exc, *old_val, *old_tb; + PyObject *ctx; + __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); + #if PY_MAJOR_VERSION < 3 + ctx = PyString_FromString(name); + #else + ctx = PyUnicode_FromString(name); + #endif + __Pyx_ErrRestore(old_exc, old_val, old_tb); + if (!ctx) { + PyErr_WriteUnraisable(Py_None); + } else { + PyErr_WriteUnraisable(ctx); + Py_DECREF(ctx); + } +} + static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact) { @@ -19054,37 +18466,6 @@ static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { __Pyx_ReleaseBuffer(info); } -static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { -#if CYTHON_COMPILING_IN_CPYTHON - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyThreadState *tstate = PyThreadState_GET(); - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -#else - PyErr_Restore(type, value, tb); -#endif -} -static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { -#if CYTHON_COMPILING_IN_CPYTHON - PyThreadState *tstate = PyThreadState_GET(); - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -#else - PyErr_Fetch(type, value, tb); -#endif -} - static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) @@ -19433,6 +18814,23 @@ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { return 0; } +static int __Pyx_SetVtable(PyObject *dict, void *vtable) { +#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) + PyObject *ob = PyCapsule_New(vtable, 0, 0); +#else + PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); +#endif + if (!ob) + goto bad; + if (PyDict_SetItem(dict, __pyx_n_s____pyx_vtable__, ob) < 0) + goto bad; + Py_DECREF(ob); + return 0; +bad: + Py_XDECREF(ob); + return -1; +} + #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { #if PY_VERSION_HEX >= 0x02060000 @@ -20458,25 +19856,6 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* } } -static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, - CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) { - PyObject *old_exc, *old_val, *old_tb; - PyObject *ctx; - __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); - #if PY_MAJOR_VERSION < 3 - ctx = PyString_FromString(name); - #else - ctx = PyUnicode_FromString(name); - #endif - __Pyx_ErrRestore(old_exc, old_val, old_tb); - if (!ctx) { - PyErr_WriteUnraisable(Py_None); - } else { - PyErr_WriteUnraisable(ctx); - Py_DECREF(ctx); - } -} - static CYTHON_INLINE void __Pyx_ExceptionSwap(PyObject **type, PyObject **value, PyObject **tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; #if CYTHON_COMPILING_IN_CPYTHON @@ -21016,23 +20395,6 @@ static int __Pyx_check_binary_version(void) { return 0; } -static int __Pyx_SetVtable(PyObject *dict, void *vtable) { -#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) - PyObject *ob = PyCapsule_New(vtable, 0, 0); -#else - PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); -#endif - if (!ob) - goto bad; - if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0) - goto bad; - Py_DECREF(ob); - return 0; -bad: - Py_XDECREF(ob); - return -1; -} - #ifndef __PYX_HAVE_RT_ImportModule #define __PYX_HAVE_RT_ImportModule static PyObject *__Pyx_ImportModule(const char *name) { diff --git a/sklearn/earth/_forward.c b/sklearn/earth/_forward.c index 22f047ad96fec..7a4f81f55407b 100644 --- a/sklearn/earth/_forward.c +++ b/sklearn/earth/_forward.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19 on Sat Jul 20 23:46:45 2013 */ +/* Generated by Cython 0.19.1 on Thu Jul 25 22:12:25 2013 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS @@ -261,6 +261,17 @@ #define CYTHON_INLINE #endif #endif +#ifndef CYTHON_RESTRICT + #if defined(__GNUC__) + #define CYTHON_RESTRICT __restrict__ + #elif defined(_MSC_VER) + #define CYTHON_RESTRICT __restrict + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_RESTRICT restrict + #else + #define CYTHON_RESTRICT + #endif +#endif #ifdef NAN #define __PYX_NAN() ((float) NAN) #else @@ -295,8 +306,8 @@ static CYTHON_INLINE float __PYX_NAN() { #define _USE_MATH_DEFINES #endif #include -#define __PYX_HAVE___forward -#define __PYX_HAVE_API___forward +#define __PYX_HAVE__sklearn__earth___forward +#define __PYX_HAVE_API__sklearn__earth___forward #include "string.h" #include "stdio.h" #include "stdlib.h" @@ -733,7 +744,7 @@ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; * ctypedef cnp.intp_t INT_t * ctypedef cnp.ulong_t INDEX_t */ -typedef __pyx_t_5numpy_float64_t __pyx_t_6_basis_FLOAT_t; +typedef __pyx_t_5numpy_float64_t __pyx_t_7sklearn_5earth_6_basis_FLOAT_t; /* "_basis.pxd":3 * cimport numpy as cnp @@ -742,7 +753,7 @@ typedef __pyx_t_5numpy_float64_t __pyx_t_6_basis_FLOAT_t; * ctypedef cnp.ulong_t INDEX_t * ctypedef cnp.uint8_t BOOL_t */ -typedef __pyx_t_5numpy_intp_t __pyx_t_6_basis_INT_t; +typedef __pyx_t_5numpy_intp_t __pyx_t_7sklearn_5earth_6_basis_INT_t; /* "_basis.pxd":4 * ctypedef cnp.float64_t FLOAT_t @@ -751,7 +762,7 @@ typedef __pyx_t_5numpy_intp_t __pyx_t_6_basis_INT_t; * ctypedef cnp.uint8_t BOOL_t * */ -typedef __pyx_t_5numpy_ulong_t __pyx_t_6_basis_INDEX_t; +typedef __pyx_t_5numpy_ulong_t __pyx_t_7sklearn_5earth_6_basis_INDEX_t; /* "_basis.pxd":5 * ctypedef cnp.intp_t INT_t @@ -760,7 +771,7 @@ typedef __pyx_t_5numpy_ulong_t __pyx_t_6_basis_INDEX_t; * * cdef class BasisFunction: */ -typedef __pyx_t_5numpy_uint8_t __pyx_t_6_basis_BOOL_t; +typedef __pyx_t_5numpy_uint8_t __pyx_t_7sklearn_5earth_6_basis_BOOL_t; /* "_record.pxd":2 * cimport numpy as cnp @@ -768,7 +779,7 @@ typedef __pyx_t_5numpy_uint8_t __pyx_t_6_basis_BOOL_t; * ctypedef cnp.intp_t INT_t * ctypedef cnp.ulong_t INDEX_t */ -typedef __pyx_t_5numpy_float64_t __pyx_t_7_record_FLOAT_t; +typedef __pyx_t_5numpy_float64_t __pyx_t_7sklearn_5earth_7_record_FLOAT_t; /* "_record.pxd":3 * cimport numpy as cnp @@ -777,7 +788,7 @@ typedef __pyx_t_5numpy_float64_t __pyx_t_7_record_FLOAT_t; * ctypedef cnp.ulong_t INDEX_t * ctypedef cnp.uint8_t BOOL_t */ -typedef __pyx_t_5numpy_intp_t __pyx_t_7_record_INT_t; +typedef __pyx_t_5numpy_intp_t __pyx_t_7sklearn_5earth_7_record_INT_t; /* "_record.pxd":4 * ctypedef cnp.float64_t FLOAT_t @@ -786,7 +797,7 @@ typedef __pyx_t_5numpy_intp_t __pyx_t_7_record_INT_t; * ctypedef cnp.uint8_t BOOL_t * from _basis cimport Basis */ -typedef __pyx_t_5numpy_ulong_t __pyx_t_7_record_INDEX_t; +typedef __pyx_t_5numpy_ulong_t __pyx_t_7sklearn_5earth_7_record_INDEX_t; /* "_record.pxd":5 * ctypedef cnp.intp_t INT_t @@ -795,7 +806,7 @@ typedef __pyx_t_5numpy_ulong_t __pyx_t_7_record_INDEX_t; * from _basis cimport Basis * */ -typedef __pyx_t_5numpy_uint8_t __pyx_t_7_record_BOOL_t; +typedef __pyx_t_5numpy_uint8_t __pyx_t_7sklearn_5earth_7_record_BOOL_t; /* "_util.pxd":2 * cimport numpy as cnp @@ -803,7 +814,7 @@ typedef __pyx_t_5numpy_uint8_t __pyx_t_7_record_BOOL_t; * ctypedef cnp.intp_t INT_t * ctypedef cnp.ulong_t INDEX_t */ -typedef __pyx_t_5numpy_float64_t __pyx_t_5_util_FLOAT_t; +typedef __pyx_t_5numpy_float64_t __pyx_t_7sklearn_5earth_5_util_FLOAT_t; /* "_util.pxd":3 * cimport numpy as cnp @@ -812,7 +823,7 @@ typedef __pyx_t_5numpy_float64_t __pyx_t_5_util_FLOAT_t; * ctypedef cnp.ulong_t INDEX_t * ctypedef cnp.uint8_t BOOL_t */ -typedef __pyx_t_5numpy_intp_t __pyx_t_5_util_INT_t; +typedef __pyx_t_5numpy_intp_t __pyx_t_7sklearn_5earth_5_util_INT_t; /* "_util.pxd":4 * ctypedef cnp.float64_t FLOAT_t @@ -821,7 +832,7 @@ typedef __pyx_t_5numpy_intp_t __pyx_t_5_util_INT_t; * ctypedef cnp.uint8_t BOOL_t * */ -typedef __pyx_t_5numpy_ulong_t __pyx_t_5_util_INDEX_t; +typedef __pyx_t_5numpy_ulong_t __pyx_t_7sklearn_5earth_5_util_INDEX_t; /* "_util.pxd":5 * ctypedef cnp.intp_t INT_t @@ -830,43 +841,43 @@ typedef __pyx_t_5numpy_ulong_t __pyx_t_5_util_INDEX_t; * * cdef FLOAT_t log2(FLOAT_t x) */ -typedef __pyx_t_5numpy_uint8_t __pyx_t_5_util_BOOL_t; +typedef __pyx_t_5numpy_uint8_t __pyx_t_7sklearn_5earth_5_util_BOOL_t; -/* "_forward.pxd":3 +/* "sklearn/earth/_forward.pxd":3 * cimport numpy as cnp * import numpy as np * ctypedef cnp.float64_t FLOAT_t # <<<<<<<<<<<<<< * ctypedef cnp.intp_t INT_t * ctypedef cnp.ulong_t INDEX_t */ -typedef __pyx_t_5numpy_float64_t __pyx_t_8_forward_FLOAT_t; +typedef __pyx_t_5numpy_float64_t __pyx_t_7sklearn_5earth_8_forward_FLOAT_t; -/* "_forward.pxd":4 +/* "sklearn/earth/_forward.pxd":4 * import numpy as np * ctypedef cnp.float64_t FLOAT_t * ctypedef cnp.intp_t INT_t # <<<<<<<<<<<<<< * ctypedef cnp.ulong_t INDEX_t * ctypedef cnp.uint8_t BOOL_t */ -typedef __pyx_t_5numpy_intp_t __pyx_t_8_forward_INT_t; +typedef __pyx_t_5numpy_intp_t __pyx_t_7sklearn_5earth_8_forward_INT_t; -/* "_forward.pxd":5 +/* "sklearn/earth/_forward.pxd":5 * ctypedef cnp.float64_t FLOAT_t * ctypedef cnp.intp_t INT_t * ctypedef cnp.ulong_t INDEX_t # <<<<<<<<<<<<<< * ctypedef cnp.uint8_t BOOL_t * from _basis cimport Basis */ -typedef __pyx_t_5numpy_ulong_t __pyx_t_8_forward_INDEX_t; +typedef __pyx_t_5numpy_ulong_t __pyx_t_7sklearn_5earth_8_forward_INDEX_t; -/* "_forward.pxd":6 +/* "sklearn/earth/_forward.pxd":6 * ctypedef cnp.intp_t INT_t * ctypedef cnp.ulong_t INDEX_t * ctypedef cnp.uint8_t BOOL_t # <<<<<<<<<<<<<< * from _basis cimport Basis * from _record cimport ForwardPassRecord */ -typedef __pyx_t_5numpy_uint8_t __pyx_t_8_forward_BOOL_t; +typedef __pyx_t_5numpy_uint8_t __pyx_t_7sklearn_5earth_8_forward_BOOL_t; #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; @@ -889,20 +900,20 @@ typedef __pyx_t_5numpy_uint8_t __pyx_t_8_forward_BOOL_t; /*--- Type declarations ---*/ -struct __pyx_obj_7_record_Record; -struct __pyx_obj_7_record_PruningPassRecord; -struct __pyx_obj_7_record_Iteration; -struct __pyx_obj_7_record_ForwardPassIteration; -struct __pyx_obj_7_record_FirstForwardPassIteration; -struct __pyx_obj_6_basis_Basis; -struct __pyx_obj_8_forward_ForwardPasser; -struct __pyx_obj_6_basis_BasisFunction; -struct __pyx_obj_6_basis_LinearBasisFunction; -struct __pyx_obj_7_record_PruningPassIteration; -struct __pyx_obj_7_record_FirstPruningPassIteration; -struct __pyx_obj_6_basis_HingeBasisFunction; -struct __pyx_obj_7_record_ForwardPassRecord; -struct __pyx_obj_6_basis_ConstantBasisFunction; +struct __pyx_obj_7sklearn_5earth_6_basis_Basis; +struct __pyx_obj_7sklearn_5earth_7_record_Iteration; +struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration; +struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction; +struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction; +struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser; +struct __pyx_obj_7sklearn_5earth_7_record_Record; +struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord; +struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord; +struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction; +struct __pyx_obj_7sklearn_5earth_7_record_PruningPassIteration; +struct __pyx_obj_7sklearn_5earth_7_record_FirstPruningPassIteration; +struct __pyx_obj_7sklearn_5earth_7_record_FirstForwardPassIteration; +struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction; /* "numpy.pxd":762 * ctypedef npy_longdouble longdouble_t @@ -939,10 +950,10 @@ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; * cdef inline object PyArray_MultiIterNew1(a): */ typedef npy_cdouble __pyx_t_5numpy_complex_t; -struct __pyx_opt_args_6_basis_13BasisFunction_apply; -struct __pyx_opt_args_6_basis_21ConstantBasisFunction_apply; -struct __pyx_opt_args_6_basis_18HingeBasisFunction_apply; -struct __pyx_opt_args_6_basis_19LinearBasisFunction_apply; +struct __pyx_opt_args_7sklearn_5earth_6_basis_13BasisFunction_apply; +struct __pyx_opt_args_7sklearn_5earth_6_basis_21ConstantBasisFunction_apply; +struct __pyx_opt_args_7sklearn_5earth_6_basis_18HingeBasisFunction_apply; +struct __pyx_opt_args_7sklearn_5earth_6_basis_19LinearBasisFunction_apply; /* "_basis.pxd":45 * cpdef INDEX_t degree(BasisFunction self) @@ -951,7 +962,7 @@ struct __pyx_opt_args_6_basis_19LinearBasisFunction_apply; * * cpdef cnp.ndarray[INT_t, ndim=1] valid_knots(BasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] values, cnp.ndarray[FLOAT_t,ndim=1] variable, int variable_idx, INDEX_t check_every, int endspan, int minspan, FLOAT_t minspan_alpha, INDEX_t n, cnp.ndarray[INT_t,ndim=1] workspace) */ -struct __pyx_opt_args_6_basis_13BasisFunction_apply { +struct __pyx_opt_args_7sklearn_5earth_6_basis_13BasisFunction_apply { int __pyx_n; int recurse; }; @@ -963,7 +974,7 @@ struct __pyx_opt_args_6_basis_13BasisFunction_apply { * * */ -struct __pyx_opt_args_6_basis_21ConstantBasisFunction_apply { +struct __pyx_opt_args_7sklearn_5earth_6_basis_21ConstantBasisFunction_apply { int __pyx_n; int recurse; }; @@ -975,7 +986,7 @@ struct __pyx_opt_args_6_basis_21ConstantBasisFunction_apply { * * cdef class LinearBasisFunction(BasisFunction): */ -struct __pyx_opt_args_6_basis_18HingeBasisFunction_apply { +struct __pyx_opt_args_7sklearn_5earth_6_basis_18HingeBasisFunction_apply { int __pyx_n; int recurse; }; @@ -987,176 +998,191 @@ struct __pyx_opt_args_6_basis_18HingeBasisFunction_apply { * * */ -struct __pyx_opt_args_6_basis_19LinearBasisFunction_apply { +struct __pyx_opt_args_7sklearn_5earth_6_basis_19LinearBasisFunction_apply { int __pyx_n; int recurse; }; -/* "_forward.pxd":10 +/* "sklearn/earth/_forward.pxd":10 * from _record cimport ForwardPassRecord * * ctypedef enum StoppingCondition: # <<<<<<<<<<<<<< * MAXTERMS=0, * MAXRSQ=1, */ -enum __pyx_t_8_forward_StoppingCondition { - __pyx_e_8_forward_MAXTERMS = 0, - __pyx_e_8_forward_MAXRSQ = 1, - __pyx_e_8_forward_NOIMPRV = 2, - __pyx_e_8_forward_LOWGRSQ = 3, - __pyx_e_8_forward_NOCAND = 4 +enum __pyx_t_7sklearn_5earth_8_forward_StoppingCondition { + __pyx_e_7sklearn_5earth_8_forward_MAXTERMS = 0, + __pyx_e_7sklearn_5earth_8_forward_MAXRSQ = 1, + __pyx_e_7sklearn_5earth_8_forward_NOIMPRV = 2, + __pyx_e_7sklearn_5earth_8_forward_LOWGRSQ = 3, + __pyx_e_7sklearn_5earth_8_forward_NOCAND = 4 }; -typedef enum __pyx_t_8_forward_StoppingCondition __pyx_t_8_forward_StoppingCondition; +typedef enum __pyx_t_7sklearn_5earth_8_forward_StoppingCondition __pyx_t_7sklearn_5earth_8_forward_StoppingCondition; -/* "_record.pxd":8 - * from _basis cimport Basis - * - * cdef class Record: # <<<<<<<<<<<<<< - * cdef list iterations - * cdef int num_samples - */ -struct __pyx_obj_7_record_Record { - PyObject_HEAD - struct __pyx_vtabstruct_7_record_Record *__pyx_vtab; - PyObject *iterations; - int num_samples; - int num_variables; - __pyx_t_7_record_FLOAT_t penalty; - __pyx_t_7_record_FLOAT_t sst; -}; - - -/* "_record.pxd":25 - * cpdef FLOAT_t grsq(Record self, INDEX_t iteration) +/* "_basis.pxd":102 * - * cdef class PruningPassRecord(Record): # <<<<<<<<<<<<<< - * cdef INDEX_t selected * + * cdef class Basis: # <<<<<<<<<<<<<< + * '''A wrapper that provides functionality related to a set of BasisFunctions with a + * common ConstantBasisFunction ancestor. Retains the order in which BasisFunctions are */ -struct __pyx_obj_7_record_PruningPassRecord { - struct __pyx_obj_7_record_Record __pyx_base; - __pyx_t_7_record_INDEX_t selected; +struct __pyx_obj_7sklearn_5earth_6_basis_Basis { + PyObject_HEAD + struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *__pyx_vtab; + PyObject *order; }; -/* "_record.pxd":39 +/* "_record.pxd":41 * cpdef set_stopping_condition(ForwardPassRecord self, int stopping_condition) * * cdef class Iteration: # <<<<<<<<<<<<<< * cdef FLOAT_t mse * cdef INDEX_t size */ -struct __pyx_obj_7_record_Iteration { +struct __pyx_obj_7sklearn_5earth_7_record_Iteration { PyObject_HEAD - struct __pyx_vtabstruct_7_record_Iteration *__pyx_vtab; - __pyx_t_7_record_FLOAT_t mse; - __pyx_t_7_record_INDEX_t size; + struct __pyx_vtabstruct_7sklearn_5earth_7_record_Iteration *__pyx_vtab; + __pyx_t_7sklearn_5earth_7_record_FLOAT_t mse; + __pyx_t_7sklearn_5earth_7_record_INDEX_t size; }; -/* "_record.pxd":55 +/* "_record.pxd":57 * pass * * cdef class ForwardPassIteration(Iteration): # <<<<<<<<<<<<<< * cdef INDEX_t parent * cdef INDEX_t variable */ -struct __pyx_obj_7_record_ForwardPassIteration { - struct __pyx_obj_7_record_Iteration __pyx_base; - __pyx_t_7_record_INDEX_t parent; - __pyx_t_7_record_INDEX_t variable; - __pyx_t_7_record_FLOAT_t knot; +struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration { + struct __pyx_obj_7sklearn_5earth_7_record_Iteration __pyx_base; + __pyx_t_7sklearn_5earth_7_record_INDEX_t parent; + __pyx_t_7sklearn_5earth_7_record_INDEX_t variable; + __pyx_t_7sklearn_5earth_7_record_FLOAT_t knot; int code; int no_candidates; }; -/* "_record.pxd":66 - * cpdef no_further_candidates(ForwardPassIteration self) +/* "_basis.pxd":7 + * ctypedef cnp.uint8_t BOOL_t + * + * cdef class BasisFunction: # <<<<<<<<<<<<<< + * '''Abstract. Subclasses must implement the apply, translate, scale, and __init__ methods.''' * - * cdef class FirstForwardPassIteration(ForwardPassIteration): # <<<<<<<<<<<<<< - * cpdef INDEX_t get_size(FirstForwardPassIteration self) */ -struct __pyx_obj_7_record_FirstForwardPassIteration { - struct __pyx_obj_7_record_ForwardPassIteration __pyx_base; +struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction { + PyObject_HEAD + struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *__pyx_vtab; + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *parent; + PyObject *child_map; + PyObject *children; + int pruned; + int prunable; + int splittable; }; -/* "_basis.pxd":102 +/* "_basis.pxd":50 * * - * cdef class Basis: # <<<<<<<<<<<<<< - * '''A wrapper that provides functionality related to a set of BasisFunctions with a - * common ConstantBasisFunction ancestor. Retains the order in which BasisFunctions are + * cdef class ConstantBasisFunction(BasisFunction): # <<<<<<<<<<<<<< + * + * cpdef INDEX_t degree(ConstantBasisFunction self) */ -struct __pyx_obj_6_basis_Basis { - PyObject_HEAD - struct __pyx_vtabstruct_6_basis_Basis *__pyx_vtab; - PyObject *order; +struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction { + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction __pyx_base; }; -/* "_forward.pxd":17 +/* "sklearn/earth/_forward.pxd":17 * NOCAND=4 * * cdef class ForwardPasser: # <<<<<<<<<<<<<< * * #User selected parameters */ -struct __pyx_obj_8_forward_ForwardPasser { +struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser { PyObject_HEAD - struct __pyx_vtabstruct_8_forward_ForwardPasser *__pyx_vtab; + struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *__pyx_vtab; int endspan; int minspan; - __pyx_t_8_forward_FLOAT_t endspan_alpha; - __pyx_t_8_forward_FLOAT_t minspan_alpha; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t endspan_alpha; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t minspan_alpha; int max_terms; int max_degree; - __pyx_t_8_forward_FLOAT_t thresh; - __pyx_t_8_forward_FLOAT_t penalty; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t thresh; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t penalty; int check_every; int min_search_points; PyObject *xlabels; - __pyx_t_8_forward_FLOAT_t zero_tol; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t zero_tol; PyArrayObject *X; PyArrayObject *y; - PyArrayObject *weights; - __pyx_t_8_forward_INDEX_t m; - __pyx_t_8_forward_INDEX_t n; - __pyx_t_8_forward_FLOAT_t sst; - __pyx_t_8_forward_FLOAT_t y_squared; + PyArrayObject *sample_weight; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t m; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t n; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t sst; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t y_squared; PyArrayObject *B; PyArrayObject *B_orth; PyArrayObject *c; PyArrayObject *norms; PyArrayObject *u; PyArrayObject *B_orth_times_parent_cum; - __pyx_t_8_forward_FLOAT_t c_squared; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t c_squared; PyArrayObject *sort_tracker; PyArrayObject *sorting; PyArrayObject *mwork; PyArrayObject *linear_variables; - struct __pyx_obj_7_record_ForwardPassRecord *record; - struct __pyx_obj_6_basis_Basis *basis; + struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *record; + struct __pyx_obj_7sklearn_5earth_6_basis_Basis *basis; }; -/* "_basis.pxd":7 - * ctypedef cnp.uint8_t BOOL_t - * - * cdef class BasisFunction: # <<<<<<<<<<<<<< - * '''Abstract. Subclasses must implement the apply, translate, scale, and __init__ methods.''' +/* "_record.pxd":8 + * from _basis cimport Basis * + * cdef class Record: # <<<<<<<<<<<<<< + * cdef list iterations + * cdef int num_samples */ -struct __pyx_obj_6_basis_BasisFunction { +struct __pyx_obj_7sklearn_5earth_7_record_Record { PyObject_HEAD - struct __pyx_vtabstruct_6_basis_BasisFunction *__pyx_vtab; - struct __pyx_obj_6_basis_BasisFunction *parent; - PyObject *child_map; - PyObject *children; - int pruned; - int prunable; - int splittable; + struct __pyx_vtabstruct_7sklearn_5earth_7_record_Record *__pyx_vtab; + PyObject *iterations; + int num_samples; + int num_variables; + __pyx_t_7sklearn_5earth_7_record_FLOAT_t penalty; + __pyx_t_7sklearn_5earth_7_record_FLOAT_t sst; +}; + + +/* "_record.pxd":25 + * cpdef FLOAT_t grsq(Record self, INDEX_t iteration) + * + * cdef class PruningPassRecord(Record): # <<<<<<<<<<<<<< + * cdef INDEX_t selected + * + */ +struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord { + struct __pyx_obj_7sklearn_5earth_7_record_Record __pyx_base; + __pyx_t_7sklearn_5earth_7_record_INDEX_t selected; +}; + + +/* "_record.pxd":34 + * cpdef roll_back(PruningPassRecord self, Basis basis) + * + * cdef class ForwardPassRecord(Record): # <<<<<<<<<<<<<< + * cdef int stopping_condition + * + */ +struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord { + struct __pyx_obj_7sklearn_5earth_7_record_Record __pyx_base; + int stopping_condition; + PyObject *xlabels; }; @@ -1167,35 +1193,46 @@ struct __pyx_obj_6_basis_BasisFunction { * cdef INDEX_t variable * cdef str label */ -struct __pyx_obj_6_basis_LinearBasisFunction { - struct __pyx_obj_6_basis_BasisFunction __pyx_base; - __pyx_t_6_basis_INDEX_t variable; +struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction { + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction __pyx_base; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t variable; PyObject *label; }; -/* "_record.pxd":47 +/* "_record.pxd":49 * cpdef INDEX_t get_size(Iteration self) * * cdef class PruningPassIteration(Iteration): # <<<<<<<<<<<<<< * cdef INDEX_t pruned * */ -struct __pyx_obj_7_record_PruningPassIteration { - struct __pyx_obj_7_record_Iteration __pyx_base; - __pyx_t_7_record_INDEX_t pruned; +struct __pyx_obj_7sklearn_5earth_7_record_PruningPassIteration { + struct __pyx_obj_7sklearn_5earth_7_record_Iteration __pyx_base; + __pyx_t_7sklearn_5earth_7_record_INDEX_t pruned; }; -/* "_record.pxd":52 +/* "_record.pxd":54 * cpdef INDEX_t get_pruned(PruningPassIteration self) * * cdef class FirstPruningPassIteration(PruningPassIteration): # <<<<<<<<<<<<<< * pass * */ -struct __pyx_obj_7_record_FirstPruningPassIteration { - struct __pyx_obj_7_record_PruningPassIteration __pyx_base; +struct __pyx_obj_7sklearn_5earth_7_record_FirstPruningPassIteration { + struct __pyx_obj_7sklearn_5earth_7_record_PruningPassIteration __pyx_base; +}; + + +/* "_record.pxd":68 + * cpdef no_further_candidates(ForwardPassIteration self) + * + * cdef class FirstForwardPassIteration(ForwardPassIteration): # <<<<<<<<<<<<<< + * cpdef INDEX_t get_size(FirstForwardPassIteration self) + */ +struct __pyx_obj_7sklearn_5earth_7_record_FirstForwardPassIteration { + struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration __pyx_base; }; @@ -1206,61 +1243,45 @@ struct __pyx_obj_7_record_FirstPruningPassIteration { * cdef FLOAT_t knot * cdef INDEX_t knot_idx */ -struct __pyx_obj_6_basis_HingeBasisFunction { - struct __pyx_obj_6_basis_BasisFunction __pyx_base; - __pyx_t_6_basis_FLOAT_t knot; - __pyx_t_6_basis_INDEX_t knot_idx; - __pyx_t_6_basis_INDEX_t variable; +struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction { + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction __pyx_base; + __pyx_t_7sklearn_5earth_6_basis_FLOAT_t knot; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t knot_idx; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t variable; int reverse; PyObject *label; }; -/* "_record.pxd":34 - * cpdef roll_back(PruningPassRecord self, Basis basis) - * - * cdef class ForwardPassRecord(Record): # <<<<<<<<<<<<<< - * cdef int stopping_condition - * - */ -struct __pyx_obj_7_record_ForwardPassRecord { - struct __pyx_obj_7_record_Record __pyx_base; - int stopping_condition; -}; - -/* "_basis.pxd":50 - * - * - * cdef class ConstantBasisFunction(BasisFunction): # <<<<<<<<<<<<<< +/* "_record.pxd":41 + * cpdef set_stopping_condition(ForwardPassRecord self, int stopping_condition) * - * cpdef INDEX_t degree(ConstantBasisFunction self) + * cdef class Iteration: # <<<<<<<<<<<<<< + * cdef FLOAT_t mse + * cdef INDEX_t size */ -struct __pyx_obj_6_basis_ConstantBasisFunction { - struct __pyx_obj_6_basis_BasisFunction __pyx_base; -}; +struct __pyx_vtabstruct_7sklearn_5earth_7_record_Iteration { + __pyx_t_7sklearn_5earth_7_record_FLOAT_t (*get_mse)(struct __pyx_obj_7sklearn_5earth_7_record_Iteration *, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_7_record_INDEX_t (*get_size)(struct __pyx_obj_7sklearn_5earth_7_record_Iteration *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_7sklearn_5earth_7_record_Iteration *__pyx_vtabptr_7sklearn_5earth_7_record_Iteration; -/* "_basis.pxd":102 +/* "_record.pxd":49 + * cpdef INDEX_t get_size(Iteration self) * + * cdef class PruningPassIteration(Iteration): # <<<<<<<<<<<<<< + * cdef INDEX_t pruned * - * cdef class Basis: # <<<<<<<<<<<<<< - * '''A wrapper that provides functionality related to a set of BasisFunctions with a - * common ConstantBasisFunction ancestor. Retains the order in which BasisFunctions are */ -struct __pyx_vtabstruct_6_basis_Basis { - PyObject *(*translate)(struct __pyx_obj_6_basis_Basis *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); - PyObject *(*scale)(struct __pyx_obj_6_basis_Basis *, PyArrayObject *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); - struct __pyx_obj_6_basis_BasisFunction *(*get_root)(struct __pyx_obj_6_basis_Basis *, int __pyx_skip_dispatch); - PyObject *(*append)(struct __pyx_obj_6_basis_Basis *, struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - __pyx_t_6_basis_INDEX_t (*plen)(struct __pyx_obj_6_basis_Basis *, int __pyx_skip_dispatch); - struct __pyx_obj_6_basis_BasisFunction *(*get)(struct __pyx_obj_6_basis_Basis *, __pyx_t_6_basis_INDEX_t, int __pyx_skip_dispatch); - PyObject *(*transform)(struct __pyx_obj_6_basis_Basis *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); - PyObject *(*weighted_transform)(struct __pyx_obj_6_basis_Basis *, PyArrayObject *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); +struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassIteration { + struct __pyx_vtabstruct_7sklearn_5earth_7_record_Iteration __pyx_base; + __pyx_t_7sklearn_5earth_7_record_INDEX_t (*get_pruned)(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassIteration *, int __pyx_skip_dispatch); }; -static struct __pyx_vtabstruct_6_basis_Basis *__pyx_vtabptr_6_basis_Basis; +static struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassIteration *__pyx_vtabptr_7sklearn_5earth_7_record_PruningPassIteration; /* "_basis.pxd":7 @@ -1271,25 +1292,25 @@ static struct __pyx_vtabstruct_6_basis_Basis *__pyx_vtabptr_6_basis_Basis; * */ -struct __pyx_vtabstruct_6_basis_BasisFunction { - int (*has_knot)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - int (*is_prunable)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - int (*is_pruned)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - int (*is_splittable)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - int (*make_splittable)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - int (*make_unsplittable)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - PyObject *(*get_children)(struct __pyx_obj_6_basis_BasisFunction *); - PyObject *(*_set_parent)(struct __pyx_obj_6_basis_BasisFunction *, struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - PyObject *(*_add_child)(struct __pyx_obj_6_basis_BasisFunction *, struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - struct __pyx_obj_6_basis_BasisFunction *(*get_parent)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - PyObject *(*prune)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - PyObject *(*unprune)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - PyObject *(*knots)(struct __pyx_obj_6_basis_BasisFunction *, __pyx_t_6_basis_INDEX_t, int __pyx_skip_dispatch); - __pyx_t_6_basis_INDEX_t (*degree)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - PyObject *(*apply)(struct __pyx_obj_6_basis_BasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_6_basis_13BasisFunction_apply *__pyx_optional_args); - PyArrayObject *(*valid_knots)(struct __pyx_obj_6_basis_BasisFunction *, PyArrayObject *, PyArrayObject *, int, __pyx_t_6_basis_INDEX_t, int, int, __pyx_t_6_basis_FLOAT_t, __pyx_t_6_basis_INDEX_t, PyArrayObject *, int __pyx_skip_dispatch); +struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction { + int (*has_knot)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + int (*is_prunable)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + int (*is_pruned)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + int (*is_splittable)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + int (*make_splittable)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + int (*make_unsplittable)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*get_children)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *); + PyObject *(*_set_parent)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*_add_child)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *(*get_parent)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*prune)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*unprune)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*knots)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, __pyx_t_7sklearn_5earth_6_basis_INDEX_t, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_6_basis_INDEX_t (*degree)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*apply)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_7sklearn_5earth_6_basis_13BasisFunction_apply *__pyx_optional_args); + PyArrayObject *(*valid_knots)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, PyArrayObject *, PyArrayObject *, int, __pyx_t_7sklearn_5earth_6_basis_INDEX_t, int, int, __pyx_t_7sklearn_5earth_6_basis_FLOAT_t, __pyx_t_7sklearn_5earth_6_basis_INDEX_t, PyArrayObject *, int __pyx_skip_dispatch); }; -static struct __pyx_vtabstruct_6_basis_BasisFunction *__pyx_vtabptr_6_basis_BasisFunction; +static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *__pyx_vtabptr_7sklearn_5earth_6_basis_BasisFunction; /* "_basis.pxd":88 @@ -1300,72 +1321,66 @@ static struct __pyx_vtabstruct_6_basis_BasisFunction *__pyx_vtabptr_6_basis_Basi * cdef str label */ -struct __pyx_vtabstruct_6_basis_LinearBasisFunction { - struct __pyx_vtabstruct_6_basis_BasisFunction __pyx_base; - PyObject *(*translate)(struct __pyx_obj_6_basis_LinearBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch); - __pyx_t_6_basis_FLOAT_t (*scale)(struct __pyx_obj_6_basis_LinearBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); - __pyx_t_6_basis_INDEX_t (*get_variable)(struct __pyx_obj_6_basis_LinearBasisFunction *, int __pyx_skip_dispatch); +struct __pyx_vtabstruct_7sklearn_5earth_6_basis_LinearBasisFunction { + struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction __pyx_base; + PyObject *(*translate)(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_6_basis_FLOAT_t (*scale)(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_6_basis_INDEX_t (*get_variable)(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *, int __pyx_skip_dispatch); }; -static struct __pyx_vtabstruct_6_basis_LinearBasisFunction *__pyx_vtabptr_6_basis_LinearBasisFunction; +static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_LinearBasisFunction *__pyx_vtabptr_7sklearn_5earth_6_basis_LinearBasisFunction; -/* "_record.pxd":39 - * cpdef set_stopping_condition(ForwardPassRecord self, int stopping_condition) +/* "_record.pxd":8 + * from _basis cimport Basis * - * cdef class Iteration: # <<<<<<<<<<<<<< - * cdef FLOAT_t mse - * cdef INDEX_t size + * cdef class Record: # <<<<<<<<<<<<<< + * cdef list iterations + * cdef int num_samples */ -struct __pyx_vtabstruct_7_record_Iteration { - __pyx_t_7_record_FLOAT_t (*get_mse)(struct __pyx_obj_7_record_Iteration *, int __pyx_skip_dispatch); - __pyx_t_7_record_INDEX_t (*get_size)(struct __pyx_obj_7_record_Iteration *, int __pyx_skip_dispatch); +struct __pyx_vtabstruct_7sklearn_5earth_7_record_Record { + PyObject *(*append)(struct __pyx_obj_7sklearn_5earth_7_record_Record *, struct __pyx_obj_7sklearn_5earth_7_record_Iteration *, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_7_record_FLOAT_t (*mse)(struct __pyx_obj_7sklearn_5earth_7_record_Record *, __pyx_t_7sklearn_5earth_7_record_INDEX_t, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_7_record_FLOAT_t (*rsq)(struct __pyx_obj_7sklearn_5earth_7_record_Record *, __pyx_t_7sklearn_5earth_7_record_INDEX_t, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_7_record_FLOAT_t (*gcv)(struct __pyx_obj_7sklearn_5earth_7_record_Record *, __pyx_t_7sklearn_5earth_7_record_INDEX_t, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_7_record_FLOAT_t (*grsq)(struct __pyx_obj_7sklearn_5earth_7_record_Record *, __pyx_t_7sklearn_5earth_7_record_INDEX_t, int __pyx_skip_dispatch); }; -static struct __pyx_vtabstruct_7_record_Iteration *__pyx_vtabptr_7_record_Iteration; +static struct __pyx_vtabstruct_7sklearn_5earth_7_record_Record *__pyx_vtabptr_7sklearn_5earth_7_record_Record; -/* "_record.pxd":55 - * pass +/* "_record.pxd":34 + * cpdef roll_back(PruningPassRecord self, Basis basis) * - * cdef class ForwardPassIteration(Iteration): # <<<<<<<<<<<<<< - * cdef INDEX_t parent - * cdef INDEX_t variable - */ - -struct __pyx_vtabstruct_7_record_ForwardPassIteration { - struct __pyx_vtabstruct_7_record_Iteration __pyx_base; - PyObject *(*set_no_candidates)(struct __pyx_obj_7_record_ForwardPassIteration *, int, int __pyx_skip_dispatch); - PyObject *(*no_further_candidates)(struct __pyx_obj_7_record_ForwardPassIteration *, int __pyx_skip_dispatch); -}; -static struct __pyx_vtabstruct_7_record_ForwardPassIteration *__pyx_vtabptr_7_record_ForwardPassIteration; - - -/* "_record.pxd":66 - * cpdef no_further_candidates(ForwardPassIteration self) + * cdef class ForwardPassRecord(Record): # <<<<<<<<<<<<<< + * cdef int stopping_condition * - * cdef class FirstForwardPassIteration(ForwardPassIteration): # <<<<<<<<<<<<<< - * cpdef INDEX_t get_size(FirstForwardPassIteration self) */ -struct __pyx_vtabstruct_7_record_FirstForwardPassIteration { - struct __pyx_vtabstruct_7_record_ForwardPassIteration __pyx_base; +struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord { + struct __pyx_vtabstruct_7sklearn_5earth_7_record_Record __pyx_base; + PyObject *(*set_stopping_condition)(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *, int, int __pyx_skip_dispatch); }; -static struct __pyx_vtabstruct_7_record_FirstForwardPassIteration *__pyx_vtabptr_7_record_FirstForwardPassIteration; +static struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord *__pyx_vtabptr_7sklearn_5earth_7_record_ForwardPassRecord; -/* "_record.pxd":47 - * cpdef INDEX_t get_size(Iteration self) +/* "_basis.pxd":65 * - * cdef class PruningPassIteration(Iteration): # <<<<<<<<<<<<<< - * cdef INDEX_t pruned * + * cdef class HingeBasisFunction(BasisFunction): # <<<<<<<<<<<<<< + * cdef FLOAT_t knot + * cdef INDEX_t knot_idx */ -struct __pyx_vtabstruct_7_record_PruningPassIteration { - struct __pyx_vtabstruct_7_record_Iteration __pyx_base; - __pyx_t_7_record_INDEX_t (*get_pruned)(struct __pyx_obj_7_record_PruningPassIteration *, int __pyx_skip_dispatch); +struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction { + struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction __pyx_base; + PyObject *(*translate)(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_6_basis_FLOAT_t (*scale)(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_6_basis_INDEX_t (*get_variable)(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_6_basis_FLOAT_t (*get_knot)(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); + int (*get_reverse)(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_6_basis_INDEX_t (*get_knot_idx)(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); }; -static struct __pyx_vtabstruct_7_record_PruningPassIteration *__pyx_vtabptr_7_record_PruningPassIteration; +static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction *__pyx_vtabptr_7sklearn_5earth_6_basis_HingeBasisFunction; /* "_basis.pxd":50 @@ -1376,106 +1391,103 @@ static struct __pyx_vtabstruct_7_record_PruningPassIteration *__pyx_vtabptr_7_re * cpdef INDEX_t degree(ConstantBasisFunction self) */ -struct __pyx_vtabstruct_6_basis_ConstantBasisFunction { - struct __pyx_vtabstruct_6_basis_BasisFunction __pyx_base; - PyObject *(*translate)(struct __pyx_obj_6_basis_ConstantBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch); - __pyx_t_6_basis_FLOAT_t (*scale)(struct __pyx_obj_6_basis_ConstantBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); +struct __pyx_vtabstruct_7sklearn_5earth_6_basis_ConstantBasisFunction { + struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction __pyx_base; + PyObject *(*translate)(struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_6_basis_FLOAT_t (*scale)(struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); }; -static struct __pyx_vtabstruct_6_basis_ConstantBasisFunction *__pyx_vtabptr_6_basis_ConstantBasisFunction; +static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_ConstantBasisFunction *__pyx_vtabptr_7sklearn_5earth_6_basis_ConstantBasisFunction; -/* "_record.pxd":8 - * from _basis cimport Basis +/* "_record.pxd":25 + * cpdef FLOAT_t grsq(Record self, INDEX_t iteration) + * + * cdef class PruningPassRecord(Record): # <<<<<<<<<<<<<< + * cdef INDEX_t selected * - * cdef class Record: # <<<<<<<<<<<<<< - * cdef list iterations - * cdef int num_samples */ -struct __pyx_vtabstruct_7_record_Record { - PyObject *(*append)(struct __pyx_obj_7_record_Record *, struct __pyx_obj_7_record_Iteration *, int __pyx_skip_dispatch); - __pyx_t_7_record_FLOAT_t (*mse)(struct __pyx_obj_7_record_Record *, __pyx_t_7_record_INDEX_t, int __pyx_skip_dispatch); - __pyx_t_7_record_FLOAT_t (*rsq)(struct __pyx_obj_7_record_Record *, __pyx_t_7_record_INDEX_t, int __pyx_skip_dispatch); - __pyx_t_7_record_FLOAT_t (*gcv)(struct __pyx_obj_7_record_Record *, __pyx_t_7_record_INDEX_t, int __pyx_skip_dispatch); - __pyx_t_7_record_FLOAT_t (*grsq)(struct __pyx_obj_7_record_Record *, __pyx_t_7_record_INDEX_t, int __pyx_skip_dispatch); +struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord { + struct __pyx_vtabstruct_7sklearn_5earth_7_record_Record __pyx_base; + PyObject *(*set_selected)(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *, __pyx_t_7sklearn_5earth_7_record_INDEX_t, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_7_record_INDEX_t (*get_selected)(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *, int __pyx_skip_dispatch); + PyObject *(*roll_back)(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *, struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, int __pyx_skip_dispatch); }; -static struct __pyx_vtabstruct_7_record_Record *__pyx_vtabptr_7_record_Record; +static struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord *__pyx_vtabptr_7sklearn_5earth_7_record_PruningPassRecord; -/* "_record.pxd":25 - * cpdef FLOAT_t grsq(Record self, INDEX_t iteration) - * - * cdef class PruningPassRecord(Record): # <<<<<<<<<<<<<< - * cdef INDEX_t selected +/* "_record.pxd":57 + * pass * + * cdef class ForwardPassIteration(Iteration): # <<<<<<<<<<<<<< + * cdef INDEX_t parent + * cdef INDEX_t variable */ -struct __pyx_vtabstruct_7_record_PruningPassRecord { - struct __pyx_vtabstruct_7_record_Record __pyx_base; - PyObject *(*set_selected)(struct __pyx_obj_7_record_PruningPassRecord *, __pyx_t_7_record_INDEX_t, int __pyx_skip_dispatch); - __pyx_t_7_record_INDEX_t (*get_selected)(struct __pyx_obj_7_record_PruningPassRecord *, int __pyx_skip_dispatch); - PyObject *(*roll_back)(struct __pyx_obj_7_record_PruningPassRecord *, struct __pyx_obj_6_basis_Basis *, int __pyx_skip_dispatch); +struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassIteration { + struct __pyx_vtabstruct_7sklearn_5earth_7_record_Iteration __pyx_base; + PyObject *(*set_no_candidates)(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration *, int, int __pyx_skip_dispatch); + PyObject *(*no_further_candidates)(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration *, int __pyx_skip_dispatch); }; -static struct __pyx_vtabstruct_7_record_PruningPassRecord *__pyx_vtabptr_7_record_PruningPassRecord; +static struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassIteration *__pyx_vtabptr_7sklearn_5earth_7_record_ForwardPassIteration; -/* "_record.pxd":34 - * cpdef roll_back(PruningPassRecord self, Basis basis) +/* "sklearn/earth/_forward.pyx":23 + * } * - * cdef class ForwardPassRecord(Record): # <<<<<<<<<<<<<< - * cdef int stopping_condition + * cdef class ForwardPasser: # <<<<<<<<<<<<<< * + * def __init__(ForwardPasser self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] sample_weight, **kwargs): */ -struct __pyx_vtabstruct_7_record_ForwardPassRecord { - struct __pyx_vtabstruct_7_record_Record __pyx_base; - PyObject *(*set_stopping_condition)(struct __pyx_obj_7_record_ForwardPassRecord *, int, int __pyx_skip_dispatch); +struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser { + struct __pyx_obj_7sklearn_5earth_6_basis_Basis *(*get_basis)(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *, int __pyx_skip_dispatch); + PyObject *(*init_linear_variables)(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *, int __pyx_skip_dispatch); + PyObject *(*run)(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *, int __pyx_skip_dispatch); + PyObject *(*stop_check)(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *); + int (*orthonormal_update)(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *, __pyx_t_7sklearn_5earth_8_forward_INDEX_t, int __pyx_skip_dispatch); + PyObject *(*orthonormal_downdate)(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *, __pyx_t_7sklearn_5earth_8_forward_INDEX_t, int __pyx_skip_dispatch); + PyObject *(*next_pair)(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *); + PyObject *(*best_knot)(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *, __pyx_t_7sklearn_5earth_8_forward_INDEX_t, __pyx_t_7sklearn_5earth_8_forward_INDEX_t, __pyx_t_7sklearn_5earth_8_forward_INDEX_t, PyArrayObject *, PyArrayObject *, __pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_t_7sklearn_5earth_8_forward_INDEX_t *); }; -static struct __pyx_vtabstruct_7_record_ForwardPassRecord *__pyx_vtabptr_7_record_ForwardPassRecord; +static struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *__pyx_vtabptr_7sklearn_5earth_8_forward_ForwardPasser; -/* "_basis.pxd":65 +/* "_basis.pxd":102 * * - * cdef class HingeBasisFunction(BasisFunction): # <<<<<<<<<<<<<< - * cdef FLOAT_t knot - * cdef INDEX_t knot_idx + * cdef class Basis: # <<<<<<<<<<<<<< + * '''A wrapper that provides functionality related to a set of BasisFunctions with a + * common ConstantBasisFunction ancestor. Retains the order in which BasisFunctions are */ -struct __pyx_vtabstruct_6_basis_HingeBasisFunction { - struct __pyx_vtabstruct_6_basis_BasisFunction __pyx_base; - PyObject *(*translate)(struct __pyx_obj_6_basis_HingeBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch); - __pyx_t_6_basis_FLOAT_t (*scale)(struct __pyx_obj_6_basis_HingeBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); - __pyx_t_6_basis_INDEX_t (*get_variable)(struct __pyx_obj_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); - __pyx_t_6_basis_FLOAT_t (*get_knot)(struct __pyx_obj_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); - int (*get_reverse)(struct __pyx_obj_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); - __pyx_t_6_basis_INDEX_t (*get_knot_idx)(struct __pyx_obj_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); +struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis { + PyObject *(*translate)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); + PyObject *(*scale)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, PyArrayObject *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *(*get_root)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, int __pyx_skip_dispatch); + PyObject *(*append)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_6_basis_INDEX_t (*plen)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, int __pyx_skip_dispatch); + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *(*get)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, __pyx_t_7sklearn_5earth_6_basis_INDEX_t, int __pyx_skip_dispatch); + PyObject *(*transform)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); + PyObject *(*weighted_transform)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, PyArrayObject *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); }; -static struct __pyx_vtabstruct_6_basis_HingeBasisFunction *__pyx_vtabptr_6_basis_HingeBasisFunction; +static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *__pyx_vtabptr_7sklearn_5earth_6_basis_Basis; -/* "_forward.pyx":23 - * } - * - * cdef class ForwardPasser: # <<<<<<<<<<<<<< +/* "_record.pxd":68 + * cpdef no_further_candidates(ForwardPassIteration self) * - * def __init__(ForwardPasser self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] weights, **kwargs): + * cdef class FirstForwardPassIteration(ForwardPassIteration): # <<<<<<<<<<<<<< + * cpdef INDEX_t get_size(FirstForwardPassIteration self) */ -struct __pyx_vtabstruct_8_forward_ForwardPasser { - struct __pyx_obj_6_basis_Basis *(*get_basis)(struct __pyx_obj_8_forward_ForwardPasser *, int __pyx_skip_dispatch); - PyObject *(*init_linear_variables)(struct __pyx_obj_8_forward_ForwardPasser *, int __pyx_skip_dispatch); - PyObject *(*run)(struct __pyx_obj_8_forward_ForwardPasser *, int __pyx_skip_dispatch); - PyObject *(*stop_check)(struct __pyx_obj_8_forward_ForwardPasser *); - int (*orthonormal_update)(struct __pyx_obj_8_forward_ForwardPasser *, __pyx_t_8_forward_INDEX_t, int __pyx_skip_dispatch); - PyObject *(*orthonormal_downdate)(struct __pyx_obj_8_forward_ForwardPasser *, __pyx_t_8_forward_INDEX_t, int __pyx_skip_dispatch); - PyObject *(*next_pair)(struct __pyx_obj_8_forward_ForwardPasser *); - PyObject *(*best_knot)(struct __pyx_obj_8_forward_ForwardPasser *, __pyx_t_8_forward_INDEX_t, __pyx_t_8_forward_INDEX_t, __pyx_t_8_forward_INDEX_t, PyArrayObject *, PyArrayObject *, __pyx_t_8_forward_FLOAT_t *, __pyx_t_8_forward_FLOAT_t *, __pyx_t_8_forward_INDEX_t *); +struct __pyx_vtabstruct_7sklearn_5earth_7_record_FirstForwardPassIteration { + struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassIteration __pyx_base; }; -static struct __pyx_vtabstruct_8_forward_ForwardPasser *__pyx_vtabptr_8_forward_ForwardPasser; +static struct __pyx_vtabstruct_7sklearn_5earth_7_record_FirstForwardPassIteration *__pyx_vtabptr_7sklearn_5earth_7_record_FirstForwardPassIteration; -/* "_record.pxd":52 +/* "_record.pxd":54 * cpdef INDEX_t get_pruned(PruningPassIteration self) * * cdef class FirstPruningPassIteration(PruningPassIteration): # <<<<<<<<<<<<<< @@ -1483,10 +1495,10 @@ static struct __pyx_vtabstruct_8_forward_ForwardPasser *__pyx_vtabptr_8_forward_ * */ -struct __pyx_vtabstruct_7_record_FirstPruningPassIteration { - struct __pyx_vtabstruct_7_record_PruningPassIteration __pyx_base; +struct __pyx_vtabstruct_7sklearn_5earth_7_record_FirstPruningPassIteration { + struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassIteration __pyx_base; }; -static struct __pyx_vtabstruct_7_record_FirstPruningPassIteration *__pyx_vtabptr_7_record_FirstPruningPassIteration; +static struct __pyx_vtabstruct_7sklearn_5earth_7_record_FirstPruningPassIteration *__pyx_vtabptr_7sklearn_5earth_7_record_FirstPruningPassIteration; #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif @@ -1661,6 +1673,9 @@ static void __Pyx_RaiseBufferFallbackError(void); /*proto*/ #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) #define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1) +static void __Pyx_WriteUnraisable(const char *name, int clineno, + int lineno, const char *filename); /*proto*/ + #define __Pyx_PyObject_DelSlice(obj, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound) \ __Pyx_PyObject_SetSlice(obj, (PyObject*)NULL, cstart, cstop, py_start, py_stop, py_slice, has_cstart, has_cstop, wraparound) static CYTHON_INLINE int __Pyx_PyObject_SetSlice( @@ -1680,6 +1695,10 @@ static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ +static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ + +static void* __Pyx_GetVtable(PyObject *dict); /*proto*/ + static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/ typedef struct { @@ -1841,13 +1860,8 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); -static void __Pyx_WriteUnraisable(const char *name, int clineno, - int lineno, const char *filename); /*proto*/ - static int __Pyx_check_binary_version(void); -static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ - #if !defined(__Pyx_PyIdentifier_FromString) #if PY_MAJOR_VERSION < 3 #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) @@ -1860,8 +1874,6 @@ static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ -static void* __Pyx_GetVtable(PyObject *dict); /*proto*/ - static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig); /*proto*/ typedef struct { @@ -1911,54 +1923,54 @@ static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ -/* Module declarations from '_basis' */ -static PyTypeObject *__pyx_ptype_6_basis_BasisFunction = 0; -static PyTypeObject *__pyx_ptype_6_basis_ConstantBasisFunction = 0; -static PyTypeObject *__pyx_ptype_6_basis_HingeBasisFunction = 0; -static PyTypeObject *__pyx_ptype_6_basis_LinearBasisFunction = 0; -static PyTypeObject *__pyx_ptype_6_basis_Basis = 0; - -/* Module declarations from '_record' */ -static PyTypeObject *__pyx_ptype_7_record_Record = 0; -static PyTypeObject *__pyx_ptype_7_record_PruningPassRecord = 0; -static PyTypeObject *__pyx_ptype_7_record_ForwardPassRecord = 0; -static PyTypeObject *__pyx_ptype_7_record_Iteration = 0; -static PyTypeObject *__pyx_ptype_7_record_PruningPassIteration = 0; -static PyTypeObject *__pyx_ptype_7_record_FirstPruningPassIteration = 0; -static PyTypeObject *__pyx_ptype_7_record_ForwardPassIteration = 0; -static PyTypeObject *__pyx_ptype_7_record_FirstForwardPassIteration = 0; - -/* Module declarations from '_util' */ -static __pyx_t_5_util_FLOAT_t (*__pyx_f_5_util_log2)(__pyx_t_5_util_FLOAT_t); /*proto*/ -static PyObject *(*__pyx_f_5_util_apply_weights_1d)(PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); /*proto*/ -static __pyx_t_5_util_FLOAT_t (*__pyx_f_5_util_gcv_adjust)(__pyx_t_5_util_INDEX_t, __pyx_t_5_util_INDEX_t, __pyx_t_5_util_FLOAT_t, int __pyx_skip_dispatch); /*proto*/ +/* Module declarations from 'sklearn.earth._basis' */ +static PyTypeObject *__pyx_ptype_7sklearn_5earth_6_basis_BasisFunction = 0; +static PyTypeObject *__pyx_ptype_7sklearn_5earth_6_basis_ConstantBasisFunction = 0; +static PyTypeObject *__pyx_ptype_7sklearn_5earth_6_basis_HingeBasisFunction = 0; +static PyTypeObject *__pyx_ptype_7sklearn_5earth_6_basis_LinearBasisFunction = 0; +static PyTypeObject *__pyx_ptype_7sklearn_5earth_6_basis_Basis = 0; + +/* Module declarations from 'sklearn.earth._record' */ +static PyTypeObject *__pyx_ptype_7sklearn_5earth_7_record_Record = 0; +static PyTypeObject *__pyx_ptype_7sklearn_5earth_7_record_PruningPassRecord = 0; +static PyTypeObject *__pyx_ptype_7sklearn_5earth_7_record_ForwardPassRecord = 0; +static PyTypeObject *__pyx_ptype_7sklearn_5earth_7_record_Iteration = 0; +static PyTypeObject *__pyx_ptype_7sklearn_5earth_7_record_PruningPassIteration = 0; +static PyTypeObject *__pyx_ptype_7sklearn_5earth_7_record_FirstPruningPassIteration = 0; +static PyTypeObject *__pyx_ptype_7sklearn_5earth_7_record_ForwardPassIteration = 0; +static PyTypeObject *__pyx_ptype_7sklearn_5earth_7_record_FirstForwardPassIteration = 0; + +/* Module declarations from 'sklearn.earth._util' */ +static __pyx_t_7sklearn_5earth_5_util_FLOAT_t (*__pyx_f_7sklearn_5earth_5_util_log2)(__pyx_t_7sklearn_5earth_5_util_FLOAT_t); /*proto*/ +static PyObject *(*__pyx_f_7sklearn_5earth_5_util_apply_weights_1d)(PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); /*proto*/ +static __pyx_t_7sklearn_5earth_5_util_FLOAT_t (*__pyx_f_7sklearn_5earth_5_util_gcv_adjust)(__pyx_t_7sklearn_5earth_5_util_INDEX_t, __pyx_t_7sklearn_5earth_5_util_INDEX_t, __pyx_t_7sklearn_5earth_5_util_FLOAT_t, int __pyx_skip_dispatch); /*proto*/ /* Module declarations from 'libc.math' */ -/* Module declarations from '_forward' */ -static PyTypeObject *__pyx_ptype_8_forward_ForwardPasser = 0; -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t = { "FLOAT_t", NULL, sizeof(__pyx_t_8_forward_FLOAT_t), { 0 }, 0, 'R', 0, 0 }; -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_8_forward_INT_t = { "INT_t", NULL, sizeof(__pyx_t_8_forward_INT_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_8_forward_INT_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_8_forward_INT_t), 0 }; -#define __Pyx_MODULE_NAME "_forward" -int __pyx_module_is_main__forward = 0; +/* Module declarations from 'sklearn.earth._forward' */ +static PyTypeObject *__pyx_ptype_7sklearn_5earth_8_forward_ForwardPasser = 0; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t = { "FLOAT_t", NULL, sizeof(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t), { 0 }, 0, 'R', 0, 0 }; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_INT_t = { "INT_t", NULL, sizeof(__pyx_t_7sklearn_5earth_8_forward_INT_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_7sklearn_5earth_8_forward_INT_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_7sklearn_5earth_8_forward_INT_t), 0 }; +#define __Pyx_MODULE_NAME "sklearn.earth._forward" +int __pyx_module_is_main_sklearn__earth___forward = 0; -/* Implementation of '_forward' */ +/* Implementation of 'sklearn.earth._forward' */ static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_IndexError; static PyObject *__pyx_builtin_round; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_RuntimeError; -static int __pyx_pf_8_forward_13ForwardPasser___init__(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_y, PyArrayObject *__pyx_v_weights, PyObject *__pyx_v_kwargs); /* proto */ -static PyObject *__pyx_pf_8_forward_13ForwardPasser_2get_basis(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8_forward_13ForwardPasser_4init_linear_variables(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8_forward_13ForwardPasser_6get_B_orth(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8_forward_13ForwardPasser_8run(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8_forward_13ForwardPasser_10orthonormal_update(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self, __pyx_t_8_forward_INDEX_t __pyx_v_k); /* proto */ -static PyObject *__pyx_pf_8_forward_13ForwardPasser_12orthonormal_downdate(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self, __pyx_t_8_forward_INDEX_t __pyx_v_k); /* proto */ -static PyObject *__pyx_pf_8_forward_13ForwardPasser_14trace(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self); /* proto */ +static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_y, PyArrayObject *__pyx_v_sample_weight, PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_2get_basis(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_4init_linear_variables(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_6get_B_orth(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_8run(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_10orthonormal_update(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *__pyx_v_self, __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_v_k); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_12orthonormal_downdate(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *__pyx_v_self, __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_v_k); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_14trace(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *__pyx_v_self); /* proto */ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ -static PyObject *__pyx_tp_new_8_forward_ForwardPasser(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7sklearn_5earth_8_forward_ForwardPasser(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static char __pyx_k_1[] = "Unknown variable selected in linvars argument."; static char __pyx_k_3[] = "init_linear_variables"; static char __pyx_k_6[] = "no_further_candidates"; @@ -2021,7 +2033,6 @@ static char __pyx_k__endspan[] = "endspan"; static char __pyx_k__linvars[] = "linvars"; static char __pyx_k__minspan[] = "minspan"; static char __pyx_k__penalty[] = "penalty"; -static char __pyx_k__weights[] = "weights"; static char __pyx_k__xlabels[] = "xlabels"; static char __pyx_k____main__[] = "__main__"; static char __pyx_k____test__[] = "__test__"; @@ -2036,6 +2047,8 @@ static char __pyx_k__check_every[] = "check_every"; static char __pyx_k__RuntimeError[] = "RuntimeError"; static char __pyx_k__endspan_alpha[] = "endspan_alpha"; static char __pyx_k__minspan_alpha[] = "minspan_alpha"; +static char __pyx_k__sample_weight[] = "sample_weight"; +static char __pyx_k____pyx_vtable__[] = "__pyx_vtable__"; static char __pyx_k____pyx_getbuffer[] = "__pyx_getbuffer"; static char __pyx_k__min_search_points[] = "min_search_points"; static char __pyx_k__set_no_candidates[] = "set_no_candidates"; @@ -2067,6 +2080,7 @@ static PyObject *__pyx_n_s____len__; static PyObject *__pyx_n_s____main__; static PyObject *__pyx_n_s____pyx_getbuffer; static PyObject *__pyx_n_s____pyx_releasebuffer; +static PyObject *__pyx_n_s____pyx_vtable__; static PyObject *__pyx_n_s____test__; static PyObject *__pyx_n_s__argsort; static PyObject *__pyx_n_s__check_every; @@ -2097,13 +2111,13 @@ static PyObject *__pyx_n_s__penalty; static PyObject *__pyx_n_s__range; static PyObject *__pyx_n_s__round; static PyObject *__pyx_n_s__run; +static PyObject *__pyx_n_s__sample_weight; static PyObject *__pyx_n_s__set_no_candidates; static PyObject *__pyx_n_s__shape; static PyObject *__pyx_n_s__sqrt; static PyObject *__pyx_n_s__stopping_conditions; static PyObject *__pyx_n_s__sum; static PyObject *__pyx_n_s__thresh; -static PyObject *__pyx_n_s__weights; static PyObject *__pyx_n_s__x; static PyObject *__pyx_n_s__xlabels; static PyObject *__pyx_n_s__y; @@ -2140,11 +2154,11 @@ static PyObject *__pyx_k_tuple_32; static PyObject *__pyx_k_tuple_34; /* Python wrapper */ -static int __pyx_pw_8_forward_13ForwardPasser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_8_forward_13ForwardPasser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static int __pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_X = 0; PyArrayObject *__pyx_v_y = 0; - PyArrayObject *__pyx_v_weights = 0; + PyArrayObject *__pyx_v_sample_weight = 0; PyObject *__pyx_v_kwargs = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -2155,7 +2169,7 @@ static int __pyx_pw_8_forward_13ForwardPasser_1__init__(PyObject *__pyx_v_self, __pyx_v_kwargs = PyDict_New(); if (unlikely(!__pyx_v_kwargs)) return -1; __Pyx_GOTREF(__pyx_v_kwargs); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__y,&__pyx_n_s__weights,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__X,&__pyx_n_s__y,&__pyx_n_s__sample_weight,0}; PyObject* values[3] = {0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; @@ -2178,7 +2192,7 @@ static int __pyx_pw_8_forward_13ForwardPasser_1__init__(PyObject *__pyx_v_self, __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weights)) != 0)) kw_args--; + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sample_weight)) != 0)) kw_args--; else { __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } @@ -2195,21 +2209,21 @@ static int __pyx_pw_8_forward_13ForwardPasser_1__init__(PyObject *__pyx_v_self, } __pyx_v_X = ((PyArrayObject *)values[0]); __pyx_v_y = ((PyArrayObject *)values[1]); - __pyx_v_weights = ((PyArrayObject *)values[2]); + __pyx_v_sample_weight = ((PyArrayObject *)values[2]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; - __Pyx_AddTraceback("_forward.ForwardPasser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._forward.ForwardPasser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weights), __pyx_ptype_5numpy_ndarray, 1, "weights", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_8_forward_13ForwardPasser___init__(((struct __pyx_obj_8_forward_ForwardPasser *)__pyx_v_self), __pyx_v_X, __pyx_v_y, __pyx_v_weights, __pyx_v_kwargs); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_sample_weight), __pyx_ptype_5numpy_ndarray, 1, "sample_weight", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(((struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self), __pyx_v_X, __pyx_v_y, __pyx_v_sample_weight, __pyx_v_kwargs); goto __pyx_L0; __pyx_L1_error:; __pyx_r = -1; @@ -2219,21 +2233,21 @@ static int __pyx_pw_8_forward_13ForwardPasser_1__init__(PyObject *__pyx_v_self, return __pyx_r; } -/* "_forward.pyx":25 +/* "sklearn/earth/_forward.pyx":25 * cdef class ForwardPasser: * - * def __init__(ForwardPasser self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] weights, **kwargs): # <<<<<<<<<<<<<< + * def __init__(ForwardPasser self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] sample_weight, **kwargs): # <<<<<<<<<<<<<< * cdef INDEX_t i * self.X = X */ -static int __pyx_pf_8_forward_13ForwardPasser___init__(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_y, PyArrayObject *__pyx_v_weights, PyObject *__pyx_v_kwargs) { - __pyx_t_8_forward_INDEX_t __pyx_v_i; +static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_y, PyArrayObject *__pyx_v_sample_weight, PyObject *__pyx_v_kwargs) { + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_v_i; PyObject *__pyx_v_linvar = NULL; __Pyx_LocalBuf_ND __pyx_pybuffernd_X; __Pyx_Buffer __pyx_pybuffer_X; - __Pyx_LocalBuf_ND __pyx_pybuffernd_weights; - __Pyx_Buffer __pyx_pybuffer_weights; + __Pyx_LocalBuf_ND __pyx_pybuffernd_sample_weight; + __Pyx_Buffer __pyx_pybuffer_sample_weight; __Pyx_LocalBuf_ND __pyx_pybuffernd_y; __Pyx_Buffer __pyx_pybuffer_y; int __pyx_r; @@ -2243,15 +2257,16 @@ static int __pyx_pf_8_forward_13ForwardPasser___init__(struct __pyx_obj_8_forwar PyObject *__pyx_t_3 = NULL; int __pyx_t_4; int __pyx_t_5; - __pyx_t_8_forward_FLOAT_t __pyx_t_6; - __pyx_t_8_forward_INDEX_t __pyx_t_7; - __pyx_t_8_forward_INDEX_t __pyx_t_8; - PyObject *__pyx_t_9 = NULL; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t __pyx_t_6; + int __pyx_t_7; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_8; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_9; long __pyx_t_10; PyObject *__pyx_t_11 = NULL; PyObject *__pyx_t_12 = NULL; - Py_ssize_t __pyx_t_13; - PyObject *(*__pyx_t_14)(PyObject *); + PyObject *__pyx_t_13 = NULL; + Py_ssize_t __pyx_t_14; + PyObject *(*__pyx_t_15)(PyObject *); int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -2264,32 +2279,32 @@ static int __pyx_pf_8_forward_13ForwardPasser___init__(struct __pyx_obj_8_forwar __pyx_pybuffer_y.refcount = 0; __pyx_pybuffernd_y.data = NULL; __pyx_pybuffernd_y.rcbuffer = &__pyx_pybuffer_y; - __pyx_pybuffer_weights.pybuffer.buf = NULL; - __pyx_pybuffer_weights.refcount = 0; - __pyx_pybuffernd_weights.data = NULL; - __pyx_pybuffernd_weights.rcbuffer = &__pyx_pybuffer_weights; + __pyx_pybuffer_sample_weight.pybuffer.buf = NULL; + __pyx_pybuffer_sample_weight.refcount = 0; + __pyx_pybuffernd_sample_weight.data = NULL; + __pyx_pybuffernd_sample_weight.rcbuffer = &__pyx_pybuffer_sample_weight; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_y.diminfo[0].strides = __pyx_pybuffernd_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y.diminfo[0].shape = __pyx_pybuffernd_y.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sample_weight.rcbuffer->pybuffer, (PyObject*)__pyx_v_sample_weight, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_pybuffernd_weights.diminfo[0].strides = __pyx_pybuffernd_weights.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weights.diminfo[0].shape = __pyx_pybuffernd_weights.rcbuffer->pybuffer.shape[0]; + __pyx_pybuffernd_sample_weight.diminfo[0].strides = __pyx_pybuffernd_sample_weight.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sample_weight.diminfo[0].shape = __pyx_pybuffernd_sample_weight.rcbuffer->pybuffer.shape[0]; - /* "_forward.pyx":27 - * def __init__(ForwardPasser self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] weights, **kwargs): + /* "sklearn/earth/_forward.pyx":27 + * def __init__(ForwardPasser self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] sample_weight, **kwargs): * cdef INDEX_t i * self.X = X # <<<<<<<<<<<<<< * self.y = y.copy() - * self.weights = weights + * self.sample_weight = sample_weight */ __Pyx_INCREF(((PyObject *)__pyx_v_X)); __Pyx_GIVEREF(((PyObject *)__pyx_v_X)); @@ -2297,12 +2312,12 @@ static int __pyx_pf_8_forward_13ForwardPasser___init__(struct __pyx_obj_8_forwar __Pyx_DECREF(((PyObject *)__pyx_v_self->X)); __pyx_v_self->X = ((PyArrayObject *)__pyx_v_X); - /* "_forward.pyx":28 + /* "sklearn/earth/_forward.pyx":28 * cdef INDEX_t i * self.X = X * self.y = y.copy() # <<<<<<<<<<<<<< - * self.weights = weights - * apply_weights_1d(self.y, self.weights) + * self.sample_weight = sample_weight + * apply_weights_1d(self.y, self.sample_weight) */ __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_y), __pyx_n_s__copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); @@ -2316,47 +2331,47 @@ static int __pyx_pf_8_forward_13ForwardPasser___init__(struct __pyx_obj_8_forwar __pyx_v_self->y = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "_forward.pyx":29 + /* "sklearn/earth/_forward.pyx":29 * self.X = X * self.y = y.copy() - * self.weights = weights # <<<<<<<<<<<<<< - * apply_weights_1d(self.y, self.weights) + * self.sample_weight = sample_weight # <<<<<<<<<<<<<< + * apply_weights_1d(self.y, self.sample_weight) * self.m = self.X.shape[0] */ - __Pyx_INCREF(((PyObject *)__pyx_v_weights)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_weights)); - __Pyx_GOTREF(__pyx_v_self->weights); - __Pyx_DECREF(((PyObject *)__pyx_v_self->weights)); - __pyx_v_self->weights = ((PyArrayObject *)__pyx_v_weights); + __Pyx_INCREF(((PyObject *)__pyx_v_sample_weight)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_sample_weight)); + __Pyx_GOTREF(__pyx_v_self->sample_weight); + __Pyx_DECREF(((PyObject *)__pyx_v_self->sample_weight)); + __pyx_v_self->sample_weight = ((PyArrayObject *)__pyx_v_sample_weight); - /* "_forward.pyx":30 + /* "sklearn/earth/_forward.pyx":30 * self.y = y.copy() - * self.weights = weights - * apply_weights_1d(self.y, self.weights) # <<<<<<<<<<<<<< + * self.sample_weight = sample_weight + * apply_weights_1d(self.y, self.sample_weight) # <<<<<<<<<<<<<< * self.m = self.X.shape[0] * self.n = self.X.shape[1] */ __pyx_t_2 = ((PyObject *)__pyx_v_self->y); __Pyx_INCREF(__pyx_t_2); - __pyx_t_1 = ((PyObject *)__pyx_v_self->weights); + __pyx_t_1 = ((PyObject *)__pyx_v_self->sample_weight); __Pyx_INCREF(__pyx_t_1); - __pyx_t_3 = __pyx_f_5_util_apply_weights_1d(((PyArrayObject *)__pyx_t_2), ((PyArrayObject *)__pyx_t_1), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_f_7sklearn_5earth_5_util_apply_weights_1d(((PyArrayObject *)__pyx_t_2), ((PyArrayObject *)__pyx_t_1), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "_forward.pyx":31 - * self.weights = weights - * apply_weights_1d(self.y, self.weights) + /* "sklearn/earth/_forward.pyx":31 + * self.sample_weight = sample_weight + * apply_weights_1d(self.y, self.sample_weight) * self.m = self.X.shape[0] # <<<<<<<<<<<<<< * self.n = self.X.shape[1] * self.endspan = kwargs['endspan'] if 'endspan' in kwargs else -1 */ __pyx_v_self->m = (__pyx_v_self->X->dimensions[0]); - /* "_forward.pyx":32 - * apply_weights_1d(self.y, self.weights) + /* "sklearn/earth/_forward.pyx":32 + * apply_weights_1d(self.y, self.sample_weight) * self.m = self.X.shape[0] * self.n = self.X.shape[1] # <<<<<<<<<<<<<< * self.endspan = kwargs['endspan'] if 'endspan' in kwargs else -1 @@ -2364,7 +2379,7 @@ static int __pyx_pf_8_forward_13ForwardPasser___init__(struct __pyx_obj_8_forwar */ __pyx_v_self->n = (__pyx_v_self->X->dimensions[1]); - /* "_forward.pyx":33 + /* "sklearn/earth/_forward.pyx":33 * self.m = self.X.shape[0] * self.n = self.X.shape[1] * self.endspan = kwargs['endspan'] if 'endspan' in kwargs else -1 # <<<<<<<<<<<<<< @@ -2372,7 +2387,7 @@ static int __pyx_pf_8_forward_13ForwardPasser___init__(struct __pyx_obj_8_forwar * self.endspan_alpha = kwargs['endspan_alpha'] if 'endspan_alpha' in kwargs else .05 */ __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__endspan), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_4) { + if ((__pyx_t_4 != 0)) { __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__endspan)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; @@ -2385,7 +2400,7 @@ static int __pyx_pf_8_forward_13ForwardPasser___init__(struct __pyx_obj_8_forwar __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_self->endspan = __pyx_t_5; - /* "_forward.pyx":34 + /* "sklearn/earth/_forward.pyx":34 * self.n = self.X.shape[1] * self.endspan = kwargs['endspan'] if 'endspan' in kwargs else -1 * self.minspan = kwargs['minspan'] if 'minspan' in kwargs else -1 # <<<<<<<<<<<<<< @@ -2393,7 +2408,7 @@ static int __pyx_pf_8_forward_13ForwardPasser___init__(struct __pyx_obj_8_forwar * self.minspan_alpha = kwargs['minspan_alpha'] if 'minspan_alpha' in kwargs else .05 */ __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__minspan), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_4) { + if ((__pyx_t_4 != 0)) { __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__minspan)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; @@ -2406,7 +2421,7 @@ static int __pyx_pf_8_forward_13ForwardPasser___init__(struct __pyx_obj_8_forwar __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_self->minspan = __pyx_t_5; - /* "_forward.pyx":35 + /* "sklearn/earth/_forward.pyx":35 * self.endspan = kwargs['endspan'] if 'endspan' in kwargs else -1 * self.minspan = kwargs['minspan'] if 'minspan' in kwargs else -1 * self.endspan_alpha = kwargs['endspan_alpha'] if 'endspan_alpha' in kwargs else .05 # <<<<<<<<<<<<<< @@ -2414,7 +2429,7 @@ static int __pyx_pf_8_forward_13ForwardPasser___init__(struct __pyx_obj_8_forwar * self.max_terms = kwargs['max_terms'] if 'max_terms' in kwargs else 2*self.n + 10 */ __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__endspan_alpha), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_4) { + if ((__pyx_t_4 != 0)) { __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__endspan_alpha)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; @@ -2429,7 +2444,7 @@ static int __pyx_pf_8_forward_13ForwardPasser___init__(struct __pyx_obj_8_forwar __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_self->endspan_alpha = __pyx_t_6; - /* "_forward.pyx":36 + /* "sklearn/earth/_forward.pyx":36 * self.minspan = kwargs['minspan'] if 'minspan' in kwargs else -1 * self.endspan_alpha = kwargs['endspan_alpha'] if 'endspan_alpha' in kwargs else .05 * self.minspan_alpha = kwargs['minspan_alpha'] if 'minspan_alpha' in kwargs else .05 # <<<<<<<<<<<<<< @@ -2437,7 +2452,7 @@ static int __pyx_pf_8_forward_13ForwardPasser___init__(struct __pyx_obj_8_forwar * self.max_degree = kwargs['max_degree'] if 'max_degree' in kwargs else 1 */ __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__minspan_alpha), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_4) { + if ((__pyx_t_4 != 0)) { __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__minspan_alpha)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; @@ -2452,7 +2467,7 @@ static int __pyx_pf_8_forward_13ForwardPasser___init__(struct __pyx_obj_8_forwar __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_self->minspan_alpha = __pyx_t_6; - /* "_forward.pyx":37 + /* "sklearn/earth/_forward.pyx":37 * self.endspan_alpha = kwargs['endspan_alpha'] if 'endspan_alpha' in kwargs else .05 * self.minspan_alpha = kwargs['minspan_alpha'] if 'minspan_alpha' in kwargs else .05 * self.max_terms = kwargs['max_terms'] if 'max_terms' in kwargs else 2*self.n + 10 # <<<<<<<<<<<<<< @@ -2460,7 +2475,7 @@ static int __pyx_pf_8_forward_13ForwardPasser___init__(struct __pyx_obj_8_forwar * self.thresh = kwargs['thresh'] if 'thresh' in kwargs else 0.001 */ __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__max_terms), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_4) { + if ((__pyx_t_4 != 0)) { __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__max_terms)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; @@ -2475,7 +2490,7 @@ static int __pyx_pf_8_forward_13ForwardPasser___init__(struct __pyx_obj_8_forwar __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_self->max_terms = __pyx_t_5; - /* "_forward.pyx":38 + /* "sklearn/earth/_forward.pyx":38 * self.minspan_alpha = kwargs['minspan_alpha'] if 'minspan_alpha' in kwargs else .05 * self.max_terms = kwargs['max_terms'] if 'max_terms' in kwargs else 2*self.n + 10 * self.max_degree = kwargs['max_degree'] if 'max_degree' in kwargs else 1 # <<<<<<<<<<<<<< @@ -2483,7 +2498,7 @@ static int __pyx_pf_8_forward_13ForwardPasser___init__(struct __pyx_obj_8_forwar * self.penalty = kwargs['penalty'] if 'penalty' in kwargs else 3.0 */ __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__max_degree), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_4) { + if ((__pyx_t_4 != 0)) { __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__max_degree)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; @@ -2496,7 +2511,7 @@ static int __pyx_pf_8_forward_13ForwardPasser___init__(struct __pyx_obj_8_forwar __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_self->max_degree = __pyx_t_5; - /* "_forward.pyx":39 + /* "sklearn/earth/_forward.pyx":39 * self.max_terms = kwargs['max_terms'] if 'max_terms' in kwargs else 2*self.n + 10 * self.max_degree = kwargs['max_degree'] if 'max_degree' in kwargs else 1 * self.thresh = kwargs['thresh'] if 'thresh' in kwargs else 0.001 # <<<<<<<<<<<<<< @@ -2504,7 +2519,7 @@ static int __pyx_pf_8_forward_13ForwardPasser___init__(struct __pyx_obj_8_forwar * self.check_every = kwargs['check_every'] if 'check_every' in kwargs else -1 */ __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__thresh), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_4) { + if ((__pyx_t_4 != 0)) { __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__thresh)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; @@ -2519,7 +2534,7 @@ static int __pyx_pf_8_forward_13ForwardPasser___init__(struct __pyx_obj_8_forwar __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_self->thresh = __pyx_t_6; - /* "_forward.pyx":40 + /* "sklearn/earth/_forward.pyx":40 * self.max_degree = kwargs['max_degree'] if 'max_degree' in kwargs else 1 * self.thresh = kwargs['thresh'] if 'thresh' in kwargs else 0.001 * self.penalty = kwargs['penalty'] if 'penalty' in kwargs else 3.0 # <<<<<<<<<<<<<< @@ -2527,7 +2542,7 @@ static int __pyx_pf_8_forward_13ForwardPasser___init__(struct __pyx_obj_8_forwar * self.min_search_points = kwargs['min_search_points'] if 'min_search_points' in kwargs else 100 */ __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__penalty), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_4) { + if ((__pyx_t_4 != 0)) { __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__penalty)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; @@ -2542,15 +2557,15 @@ static int __pyx_pf_8_forward_13ForwardPasser___init__(struct __pyx_obj_8_forwar __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_self->penalty = __pyx_t_6; - /* "_forward.pyx":41 + /* "sklearn/earth/_forward.pyx":41 * self.thresh = kwargs['thresh'] if 'thresh' in kwargs else 0.001 * self.penalty = kwargs['penalty'] if 'penalty' in kwargs else 3.0 * self.check_every = kwargs['check_every'] if 'check_every' in kwargs else -1 # <<<<<<<<<<<<<< * self.min_search_points = kwargs['min_search_points'] if 'min_search_points' in kwargs else 100 - * self.xlabels = kwargs['xlabels'] if 'xlabels' in kwargs else ['x'+str(i) for i in range(self.n)] + * self.xlabels = kwargs['xlabels'] if 'xlabels' in kwargs else None */ __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__check_every), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_4) { + if ((__pyx_t_4 != 0)) { __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__check_every)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; @@ -2563,15 +2578,15 @@ static int __pyx_pf_8_forward_13ForwardPasser___init__(struct __pyx_obj_8_forwar __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_self->check_every = __pyx_t_5; - /* "_forward.pyx":42 + /* "sklearn/earth/_forward.pyx":42 * self.penalty = kwargs['penalty'] if 'penalty' in kwargs else 3.0 * self.check_every = kwargs['check_every'] if 'check_every' in kwargs else -1 * self.min_search_points = kwargs['min_search_points'] if 'min_search_points' in kwargs else 100 # <<<<<<<<<<<<<< - * self.xlabels = kwargs['xlabels'] if 'xlabels' in kwargs else ['x'+str(i) for i in range(self.n)] - * if self.check_every < 0: + * self.xlabels = kwargs['xlabels'] if 'xlabels' in kwargs else None + * if self.xlabels is None: */ __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__min_search_points), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_4) { + if ((__pyx_t_4 != 0)) { __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__min_search_points)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; @@ -2584,43 +2599,22 @@ static int __pyx_pf_8_forward_13ForwardPasser___init__(struct __pyx_obj_8_forwar __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_self->min_search_points = __pyx_t_5; - /* "_forward.pyx":43 + /* "sklearn/earth/_forward.pyx":43 * self.check_every = kwargs['check_every'] if 'check_every' in kwargs else -1 * self.min_search_points = kwargs['min_search_points'] if 'min_search_points' in kwargs else 100 - * self.xlabels = kwargs['xlabels'] if 'xlabels' in kwargs else ['x'+str(i) for i in range(self.n)] # <<<<<<<<<<<<<< - * if self.check_every < 0: - * self.check_every = (self.m / self.min_search_points) if self.m > self.min_search_points else 1 + * self.xlabels = kwargs['xlabels'] if 'xlabels' in kwargs else None # <<<<<<<<<<<<<< + * if self.xlabels is None: + * self.xlabels = ['x'+str(i) for i in range(self.n)] */ __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__xlabels), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_4) { + if ((__pyx_t_4 != 0)) { __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__xlabels)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_1 = 0; } else { - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = __pyx_v_self->n; - for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { - __pyx_v_i = __pyx_t_8; - __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - __pyx_t_9 = PyNumber_Add(((PyObject *)__pyx_n_s__x), __pyx_t_2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_1, (PyObject*)__pyx_t_9))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - } - __pyx_t_3 = ((PyObject *)__pyx_t_1); - __pyx_t_1 = 0; + __Pyx_INCREF(Py_None); + __pyx_t_3 = Py_None; } if (!(likely(PyList_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_3); @@ -2629,46 +2623,94 @@ static int __pyx_pf_8_forward_13ForwardPasser___init__(struct __pyx_obj_8_forwar __pyx_v_self->xlabels = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "_forward.pyx":44 + /* "sklearn/earth/_forward.pyx":44 * self.min_search_points = kwargs['min_search_points'] if 'min_search_points' in kwargs else 100 - * self.xlabels = kwargs['xlabels'] if 'xlabels' in kwargs else ['x'+str(i) for i in range(self.n)] + * self.xlabels = kwargs['xlabels'] if 'xlabels' in kwargs else None + * if self.xlabels is None: # <<<<<<<<<<<<<< + * self.xlabels = ['x'+str(i) for i in range(self.n)] + * if self.check_every < 0: + */ + __pyx_t_4 = (__pyx_v_self->xlabels == ((PyObject*)Py_None)); + __pyx_t_7 = (__pyx_t_4 != 0); + if (__pyx_t_7) { + + /* "sklearn/earth/_forward.pyx":45 + * self.xlabels = kwargs['xlabels'] if 'xlabels' in kwargs else None + * if self.xlabels is None: + * self.xlabels = ['x'+str(i) for i in range(self.n)] # <<<<<<<<<<<<<< + * if self.check_every < 0: + * self.check_every = (self.m / self.min_search_points) if self.m > self.min_search_points else 1 + */ + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_8 = __pyx_v_self->n; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Add(((PyObject *)__pyx_n_s__x), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + } + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_v_self->xlabels); + __Pyx_DECREF(((PyObject *)__pyx_v_self->xlabels)); + __pyx_v_self->xlabels = ((PyObject*)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "sklearn/earth/_forward.pyx":46 + * if self.xlabels is None: + * self.xlabels = ['x'+str(i) for i in range(self.n)] * if self.check_every < 0: # <<<<<<<<<<<<<< * self.check_every = (self.m / self.min_search_points) if self.m > self.min_search_points else 1 - * self.sst = (np.dot(self.y,self.y) - (np.dot(np.sqrt(self.weights),self.y) / np.sqrt(np.sum(self.weights)))**2) / self.m + * self.sst = (np.dot(self.y,self.y) - (np.dot(np.sqrt(self.sample_weight),self.y) / np.sqrt(np.sum(self.sample_weight)))**2) / self.m */ - __pyx_t_4 = (__pyx_v_self->check_every < 0); - if (__pyx_t_4) { + __pyx_t_7 = ((__pyx_v_self->check_every < 0) != 0); + if (__pyx_t_7) { - /* "_forward.pyx":45 - * self.xlabels = kwargs['xlabels'] if 'xlabels' in kwargs else ['x'+str(i) for i in range(self.n)] + /* "sklearn/earth/_forward.pyx":47 + * self.xlabels = ['x'+str(i) for i in range(self.n)] * if self.check_every < 0: * self.check_every = (self.m / self.min_search_points) if self.m > self.min_search_points else 1 # <<<<<<<<<<<<<< - * self.sst = (np.dot(self.y,self.y) - (np.dot(np.sqrt(self.weights),self.y) / np.sqrt(np.sum(self.weights)))**2) / self.m + * self.sst = (np.dot(self.y,self.y) - (np.dot(np.sqrt(self.sample_weight),self.y) / np.sqrt(np.sum(self.sample_weight)))**2) / self.m * self.y_squared = np.dot(self.y,self.y) */ - if ((__pyx_v_self->m > __pyx_v_self->min_search_points)) { + if (((__pyx_v_self->m > __pyx_v_self->min_search_points) != 0)) { __pyx_t_10 = ((int)(__pyx_v_self->m / __pyx_v_self->min_search_points)); } else { __pyx_t_10 = 1; } __pyx_v_self->check_every = __pyx_t_10; - goto __pyx_L5; + goto __pyx_L6; } - __pyx_L5:; + __pyx_L6:; - /* "_forward.pyx":46 + /* "sklearn/earth/_forward.pyx":48 * if self.check_every < 0: * self.check_every = (self.m / self.min_search_points) if self.m > self.min_search_points else 1 - * self.sst = (np.dot(self.y,self.y) - (np.dot(np.sqrt(self.weights),self.y) / np.sqrt(np.sum(self.weights)))**2) / self.m # <<<<<<<<<<<<<< + * self.sst = (np.dot(self.y,self.y) - (np.dot(np.sqrt(self.sample_weight),self.y) / np.sqrt(np.sum(self.sample_weight)))**2) / self.m # <<<<<<<<<<<<<< * self.y_squared = np.dot(self.y,self.y) - * self.record = ForwardPassRecord(self.m,self.n,self.penalty,self.sst) + * self.record = ForwardPassRecord(self.m,self.n,self.penalty,self.sst,self.xlabels) */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__dot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_self->y)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self->y)); @@ -2676,518 +2718,521 @@ static int __pyx_pf_8_forward_13ForwardPasser___init__(struct __pyx_obj_8_forwar __Pyx_INCREF(((PyObject *)__pyx_v_self->y)); PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_self->y)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self->y)); - __pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__dot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__sqrt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_v_self->weights)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self->weights)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self->weights)); - __pyx_t_11 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__sqrt); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_self->sample_weight)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self->sample_weight)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->sample_weight)); + __pyx_t_12 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_11); - __Pyx_GIVEREF(__pyx_t_11); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); __Pyx_INCREF(((PyObject *)__pyx_v_self->y)); PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_self->y)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self->y)); - __pyx_t_11 = 0; - __pyx_t_11 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_12 = 0; + __pyx_t_12 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__sqrt); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__sqrt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__sum); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__sum); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_v_self->weights)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self->weights)); - __Pyx_GIVEREF(((PyObject *)__pyx_v_self->weights)); - __pyx_t_12 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_INCREF(((PyObject *)__pyx_v_self->sample_weight)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self->sample_weight)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->sample_weight)); + __pyx_t_13 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_12); - __Pyx_GIVEREF(__pyx_t_12); - __pyx_t_12 = 0; - __pyx_t_12 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_13); + __Pyx_GIVEREF(__pyx_t_13); + __pyx_t_13 = 0; + __pyx_t_13 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_11, __pyx_t_12); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_12, __pyx_t_13); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyNumber_Power(__pyx_t_3, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = PyNumber_Power(__pyx_t_3, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_t_9, __pyx_t_12); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_13); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_9 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_12); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_13); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_9); if (unlikely((__pyx_t_6 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_6 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->sst = __pyx_t_6; - /* "_forward.pyx":47 + /* "sklearn/earth/_forward.pyx":49 * self.check_every = (self.m / self.min_search_points) if self.m > self.min_search_points else 1 - * self.sst = (np.dot(self.y,self.y) - (np.dot(np.sqrt(self.weights),self.y) / np.sqrt(np.sum(self.weights)))**2) / self.m + * self.sst = (np.dot(self.y,self.y) - (np.dot(np.sqrt(self.sample_weight),self.y) / np.sqrt(np.sum(self.sample_weight)))**2) / self.m * self.y_squared = np.dot(self.y,self.y) # <<<<<<<<<<<<<< - * self.record = ForwardPassRecord(self.m,self.n,self.penalty,self.sst) + * self.record = ForwardPassRecord(self.m,self.n,self.penalty,self.sst,self.xlabels) * self.basis = Basis() */ - __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__dot); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__dot); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_self->y)); - PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_v_self->y)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self->y)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self->y)); __Pyx_INCREF(((PyObject *)__pyx_v_self->y)); - PyTuple_SET_ITEM(__pyx_t_9, 1, ((PyObject *)__pyx_v_self->y)); + PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self->y)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self->y)); - __pyx_t_3 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_self->y_squared = __pyx_t_6; - /* "_forward.pyx":48 - * self.sst = (np.dot(self.y,self.y) - (np.dot(np.sqrt(self.weights),self.y) / np.sqrt(np.sum(self.weights)))**2) / self.m + /* "sklearn/earth/_forward.pyx":50 + * self.sst = (np.dot(self.y,self.y) - (np.dot(np.sqrt(self.sample_weight),self.y) / np.sqrt(np.sum(self.sample_weight)))**2) / self.m * self.y_squared = np.dot(self.y,self.y) - * self.record = ForwardPassRecord(self.m,self.n,self.penalty,self.sst) # <<<<<<<<<<<<<< + * self.record = ForwardPassRecord(self.m,self.n,self.penalty,self.sst,self.xlabels) # <<<<<<<<<<<<<< * self.basis = Basis() * self.basis.append(ConstantBasisFunction()) */ - __pyx_t_3 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_9 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->n); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_12 = PyFloat_FromDouble(__pyx_v_self->penalty); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_11 = PyFloat_FromDouble(__pyx_v_self->sst); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __pyx_t_13 = PyFloat_FromDouble(__pyx_v_self->penalty); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_12 = PyFloat_FromDouble(__pyx_v_self->sst); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_9); - __Pyx_GIVEREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_13); + __Pyx_GIVEREF(__pyx_t_13); + PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_t_12); __Pyx_GIVEREF(__pyx_t_12); - PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_11); - __Pyx_GIVEREF(__pyx_t_11); + __Pyx_INCREF(((PyObject *)__pyx_v_self->xlabels)); + PyTuple_SET_ITEM(__pyx_t_2, 4, ((PyObject *)__pyx_v_self->xlabels)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->xlabels)); __pyx_t_3 = 0; - __pyx_t_9 = 0; + __pyx_t_1 = 0; + __pyx_t_13 = 0; __pyx_t_12 = 0; - __pyx_t_11 = 0; - __pyx_t_11 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7_record_ForwardPassRecord)), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_GIVEREF(__pyx_t_11); + __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_ForwardPassRecord)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_t_12); __Pyx_GOTREF(__pyx_v_self->record); __Pyx_DECREF(((PyObject *)__pyx_v_self->record)); - __pyx_v_self->record = ((struct __pyx_obj_7_record_ForwardPassRecord *)__pyx_t_11); - __pyx_t_11 = 0; + __pyx_v_self->record = ((struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *)__pyx_t_12); + __pyx_t_12 = 0; - /* "_forward.pyx":49 + /* "sklearn/earth/_forward.pyx":51 * self.y_squared = np.dot(self.y,self.y) - * self.record = ForwardPassRecord(self.m,self.n,self.penalty,self.sst) + * self.record = ForwardPassRecord(self.m,self.n,self.penalty,self.sst,self.xlabels) * self.basis = Basis() # <<<<<<<<<<<<<< * self.basis.append(ConstantBasisFunction()) * */ - __pyx_t_11 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6_basis_Basis)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __Pyx_GIVEREF(__pyx_t_11); + __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_Basis)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); __Pyx_GOTREF(__pyx_v_self->basis); __Pyx_DECREF(((PyObject *)__pyx_v_self->basis)); - __pyx_v_self->basis = ((struct __pyx_obj_6_basis_Basis *)__pyx_t_11); - __pyx_t_11 = 0; + __pyx_v_self->basis = ((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)__pyx_t_12); + __pyx_t_12 = 0; - /* "_forward.pyx":50 - * self.record = ForwardPassRecord(self.m,self.n,self.penalty,self.sst) + /* "sklearn/earth/_forward.pyx":52 + * self.record = ForwardPassRecord(self.m,self.n,self.penalty,self.sst,self.xlabels) * self.basis = Basis() * self.basis.append(ConstantBasisFunction()) # <<<<<<<<<<<<<< * * self.sorting = np.empty(shape=self.m, dtype=np.int) */ - __pyx_t_11 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6_basis_ConstantBasisFunction)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->append(__pyx_v_self->basis, ((struct __pyx_obj_6_basis_BasisFunction *)__pyx_t_11), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_ConstantBasisFunction)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_2 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->append(__pyx_v_self->basis, ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_12), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "_forward.pyx":52 + /* "sklearn/earth/_forward.pyx":54 * self.basis.append(ConstantBasisFunction()) * * self.sorting = np.empty(shape=self.m, dtype=np.int) # <<<<<<<<<<<<<< * self.mwork = np.empty(shape=self.m, dtype=np.int) * self.u = np.empty(shape=self.max_terms, dtype=float) */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_13 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__shape), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s__int); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_12 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__shape), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__int); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); + __pyx_t_1 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GIVEREF(__pyx_t_9); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->sorting); __Pyx_DECREF(((PyObject *)__pyx_v_self->sorting)); - __pyx_v_self->sorting = ((PyArrayObject *)__pyx_t_9); - __pyx_t_9 = 0; + __pyx_v_self->sorting = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; - /* "_forward.pyx":53 + /* "sklearn/earth/_forward.pyx":55 * * self.sorting = np.empty(shape=self.m, dtype=np.int) * self.mwork = np.empty(shape=self.m, dtype=np.int) # <<<<<<<<<<<<<< * self.u = np.empty(shape=self.max_terms, dtype=float) * self.B_orth_times_parent_cum = np.empty(shape=self.max_terms,dtype=np.float) */ - __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_9)); - __pyx_t_11 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__shape), __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s__int); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_12 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__shape), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GIVEREF(__pyx_t_12); + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__int); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_13) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_13, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_13); __Pyx_GOTREF(__pyx_v_self->mwork); __Pyx_DECREF(((PyObject *)__pyx_v_self->mwork)); - __pyx_v_self->mwork = ((PyArrayObject *)__pyx_t_12); - __pyx_t_12 = 0; + __pyx_v_self->mwork = ((PyArrayObject *)__pyx_t_13); + __pyx_t_13 = 0; - /* "_forward.pyx":54 + /* "sklearn/earth/_forward.pyx":56 * self.sorting = np.empty(shape=self.m, dtype=np.int) * self.mwork = np.empty(shape=self.m, dtype=np.int) * self.u = np.empty(shape=self.max_terms, dtype=float) # <<<<<<<<<<<<<< * self.B_orth_times_parent_cum = np.empty(shape=self.max_terms,dtype=np.float) * self.B = np.ones(shape=(self.m,self.max_terms), order='C',dtype=np.float) */ - __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_12); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__empty); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_12)); - __pyx_t_1 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__shape), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_13)); + __pyx_t_2 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__shape), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)(&PyFloat_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)(&PyFloat_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GIVEREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_2); __Pyx_GOTREF(__pyx_v_self->u); __Pyx_DECREF(((PyObject *)__pyx_v_self->u)); - __pyx_v_self->u = ((PyArrayObject *)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_v_self->u = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; - /* "_forward.pyx":55 + /* "sklearn/earth/_forward.pyx":57 * self.mwork = np.empty(shape=self.m, dtype=np.int) * self.u = np.empty(shape=self.max_terms, dtype=float) * self.B_orth_times_parent_cum = np.empty(shape=self.max_terms,dtype=np.float) # <<<<<<<<<<<<<< * self.B = np.ones(shape=(self.m,self.max_terms), order='C',dtype=np.float) - * self.basis.weighted_transform(self.X,self.B,self.weights) + * self.basis.weighted_transform(self.X,self.B,self.sample_weight) */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__shape), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__float); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_9 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__shape), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__float); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_11) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_11, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GIVEREF(__pyx_t_11); + __pyx_t_12 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_12); __Pyx_GOTREF(__pyx_v_self->B_orth_times_parent_cum); __Pyx_DECREF(((PyObject *)__pyx_v_self->B_orth_times_parent_cum)); - __pyx_v_self->B_orth_times_parent_cum = ((PyArrayObject *)__pyx_t_11); - __pyx_t_11 = 0; + __pyx_v_self->B_orth_times_parent_cum = ((PyArrayObject *)__pyx_t_12); + __pyx_t_12 = 0; - /* "_forward.pyx":56 + /* "sklearn/earth/_forward.pyx":58 * self.u = np.empty(shape=self.max_terms, dtype=float) * self.B_orth_times_parent_cum = np.empty(shape=self.max_terms,dtype=np.float) * self.B = np.ones(shape=(self.m,self.max_terms), order='C',dtype=np.float) # <<<<<<<<<<<<<< - * self.basis.weighted_transform(self.X,self.B,self.weights) + * self.basis.weighted_transform(self.X,self.B,self.sample_weight) * self.B_orth = self.B.copy() #An orthogonal matrix with the same column space as B */ - __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s__ones); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_11)); - __pyx_t_12 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - __pyx_t_9 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__ones); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_12)); + __pyx_t_13 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_13); + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_12); - __Pyx_GIVEREF(__pyx_t_12); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_9); - __Pyx_GIVEREF(__pyx_t_9); - __pyx_t_12 = 0; - __pyx_t_9 = 0; - if (PyDict_SetItem(__pyx_t_11, ((PyObject *)__pyx_n_s__shape), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_13); + __Pyx_GIVEREF(__pyx_t_13); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_13 = 0; + __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__shape), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_11, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__float); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__float); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_11, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_11)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; - if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->B); __Pyx_DECREF(((PyObject *)__pyx_v_self->B)); - __pyx_v_self->B = ((PyArrayObject *)__pyx_t_9); - __pyx_t_9 = 0; + __pyx_v_self->B = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; - /* "_forward.pyx":57 + /* "sklearn/earth/_forward.pyx":59 * self.B_orth_times_parent_cum = np.empty(shape=self.max_terms,dtype=np.float) * self.B = np.ones(shape=(self.m,self.max_terms), order='C',dtype=np.float) - * self.basis.weighted_transform(self.X,self.B,self.weights) # <<<<<<<<<<<<<< + * self.basis.weighted_transform(self.X,self.B,self.sample_weight) # <<<<<<<<<<<<<< * self.B_orth = self.B.copy() #An orthogonal matrix with the same column space as B * self.u = np.empty(shape=self.max_terms, dtype=np.float) */ - __pyx_t_9 = ((PyObject *)__pyx_v_self->X); - __Pyx_INCREF(__pyx_t_9); - __pyx_t_11 = ((PyObject *)__pyx_v_self->B); - __Pyx_INCREF(__pyx_t_11); - __pyx_t_1 = ((PyObject *)__pyx_v_self->weights); + __pyx_t_1 = ((PyObject *)__pyx_v_self->X); __Pyx_INCREF(__pyx_t_1); - __pyx_t_3 = ((struct __pyx_vtabstruct_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->weighted_transform(__pyx_v_self->basis, ((PyArrayObject *)__pyx_t_9), ((PyArrayObject *)__pyx_t_11), ((PyArrayObject *)__pyx_t_1), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = ((PyObject *)__pyx_v_self->B); + __Pyx_INCREF(__pyx_t_12); + __pyx_t_2 = ((PyObject *)__pyx_v_self->sample_weight); + __Pyx_INCREF(__pyx_t_2); + __pyx_t_3 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->weighted_transform(__pyx_v_self->basis, ((PyArrayObject *)__pyx_t_1), ((PyArrayObject *)__pyx_t_12), ((PyArrayObject *)__pyx_t_2), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "_forward.pyx":58 + /* "sklearn/earth/_forward.pyx":60 * self.B = np.ones(shape=(self.m,self.max_terms), order='C',dtype=np.float) - * self.basis.weighted_transform(self.X,self.B,self.weights) + * self.basis.weighted_transform(self.X,self.B,self.sample_weight) * self.B_orth = self.B.copy() #An orthogonal matrix with the same column space as B # <<<<<<<<<<<<<< * self.u = np.empty(shape=self.max_terms, dtype=np.float) * self.c = np.empty(shape=self.max_terms, dtype=np.float) */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->B), __pyx_n_s__copy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->B), __pyx_n_s__copy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GIVEREF(__pyx_t_1); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_2); __Pyx_GOTREF(__pyx_v_self->B_orth); __Pyx_DECREF(((PyObject *)__pyx_v_self->B_orth)); - __pyx_v_self->B_orth = ((PyArrayObject *)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_v_self->B_orth = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; - /* "_forward.pyx":59 - * self.basis.weighted_transform(self.X,self.B,self.weights) + /* "sklearn/earth/_forward.pyx":61 + * self.basis.weighted_transform(self.X,self.B,self.sample_weight) * self.B_orth = self.B.copy() #An orthogonal matrix with the same column space as B * self.u = np.empty(shape=self.max_terms, dtype=np.float) # <<<<<<<<<<<<<< * self.c = np.empty(shape=self.max_terms, dtype=np.float) * self.norms = np.empty(shape=self.max_terms, dtype=np.float) */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_12 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__shape), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__float); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_11 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__shape), __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s__float); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GIVEREF(__pyx_t_9); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->u); __Pyx_DECREF(((PyObject *)__pyx_v_self->u)); - __pyx_v_self->u = ((PyArrayObject *)__pyx_t_9); - __pyx_t_9 = 0; + __pyx_v_self->u = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; - /* "_forward.pyx":60 + /* "sklearn/earth/_forward.pyx":62 * self.B_orth = self.B.copy() #An orthogonal matrix with the same column space as B * self.u = np.empty(shape=self.max_terms, dtype=np.float) * self.c = np.empty(shape=self.max_terms, dtype=np.float) # <<<<<<<<<<<<<< * self.norms = np.empty(shape=self.max_terms, dtype=np.float) * self.c_squared = 0.0 */ - __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_9)); - __pyx_t_3 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_3 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__shape), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__shape), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__float); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - if (!(likely(((__pyx_t_11) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_11, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GIVEREF(__pyx_t_11); + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__float); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_12); __Pyx_GOTREF(__pyx_v_self->c); __Pyx_DECREF(((PyObject *)__pyx_v_self->c)); - __pyx_v_self->c = ((PyArrayObject *)__pyx_t_11); - __pyx_t_11 = 0; + __pyx_v_self->c = ((PyArrayObject *)__pyx_t_12); + __pyx_t_12 = 0; - /* "_forward.pyx":61 + /* "sklearn/earth/_forward.pyx":63 * self.u = np.empty(shape=self.max_terms, dtype=np.float) * self.c = np.empty(shape=self.max_terms, dtype=np.float) * self.norms = np.empty(shape=self.max_terms, dtype=np.float) # <<<<<<<<<<<<<< * self.c_squared = 0.0 * self.sort_tracker = np.empty(shape=self.m, dtype=np.int) */ - __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s__empty); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = PyDict_New(); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_11)); - __pyx_t_1 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_11, ((PyObject *)__pyx_n_s__shape), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__float); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_12)); + __pyx_t_2 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__shape), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__float); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_t_11, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_11)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_3); __Pyx_GOTREF(__pyx_v_self->norms); __Pyx_DECREF(((PyObject *)__pyx_v_self->norms)); __pyx_v_self->norms = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "_forward.pyx":62 + /* "sklearn/earth/_forward.pyx":64 * self.c = np.empty(shape=self.max_terms, dtype=np.float) * self.norms = np.empty(shape=self.max_terms, dtype=np.float) * self.c_squared = 0.0 # <<<<<<<<<<<<<< @@ -3196,67 +3241,67 @@ static int __pyx_pf_8_forward_13ForwardPasser___init__(struct __pyx_obj_8_forwar */ __pyx_v_self->c_squared = 0.0; - /* "_forward.pyx":63 + /* "sklearn/earth/_forward.pyx":65 * self.norms = np.empty(shape=self.max_terms, dtype=np.float) * self.c_squared = 0.0 * self.sort_tracker = np.empty(shape=self.m, dtype=np.int) # <<<<<<<<<<<<<< * for i in range(self.m): * self.sort_tracker[i] = i */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_9 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__shape), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__int); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__shape), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__int); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GIVEREF(__pyx_t_1); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_2); __Pyx_GOTREF(__pyx_v_self->sort_tracker); __Pyx_DECREF(((PyObject *)__pyx_v_self->sort_tracker)); - __pyx_v_self->sort_tracker = ((PyArrayObject *)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_v_self->sort_tracker = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; - /* "_forward.pyx":64 + /* "sklearn/earth/_forward.pyx":66 * self.c_squared = 0.0 * self.sort_tracker = np.empty(shape=self.m, dtype=np.int) * for i in range(self.m): # <<<<<<<<<<<<<< * self.sort_tracker[i] = i * self.zero_tol = 1e-6 */ - __pyx_t_7 = __pyx_v_self->m; - for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { - __pyx_v_i = __pyx_t_8; + __pyx_t_8 = __pyx_v_self->m; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { + __pyx_v_i = __pyx_t_9; - /* "_forward.pyx":65 + /* "sklearn/earth/_forward.pyx":67 * self.sort_tracker = np.empty(shape=self.m, dtype=np.int) * for i in range(self.m): * self.sort_tracker[i] = i # <<<<<<<<<<<<<< * self.zero_tol = 1e-6 * */ - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_self->sort_tracker), __pyx_v_i, __pyx_t_1, sizeof(__pyx_t_8_forward_INDEX_t)+1, __Pyx_PyInt_to_py_npy_ulonglong, 0, 0, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_self->sort_tracker), __pyx_v_i, __pyx_t_2, sizeof(__pyx_t_7sklearn_5earth_8_forward_INDEX_t)+1, __Pyx_PyInt_to_py_npy_ulonglong, 0, 0, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } - /* "_forward.pyx":66 + /* "sklearn/earth/_forward.pyx":68 * for i in range(self.m): * self.sort_tracker[i] = i * self.zero_tol = 1e-6 # <<<<<<<<<<<<<< @@ -3265,205 +3310,208 @@ static int __pyx_pf_8_forward_13ForwardPasser___init__(struct __pyx_obj_8_forwar */ __pyx_v_self->zero_tol = 1e-6; - /* "_forward.pyx":68 + /* "sklearn/earth/_forward.pyx":70 * self.zero_tol = 1e-6 * * self.linear_variables = np.zeros(shape=self.n,dtype=np.int) # <<<<<<<<<<<<<< * self.init_linear_variables() * */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_12 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->n); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__shape), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__int); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_11 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->n); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__shape), __pyx_t_11) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_11, __pyx_n_s__int); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GIVEREF(__pyx_t_9); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->linear_variables); __Pyx_DECREF(((PyObject *)__pyx_v_self->linear_variables)); - __pyx_v_self->linear_variables = ((PyArrayObject *)__pyx_t_9); - __pyx_t_9 = 0; + __pyx_v_self->linear_variables = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; - /* "_forward.pyx":69 + /* "sklearn/earth/_forward.pyx":71 * * self.linear_variables = np.zeros(shape=self.n,dtype=np.int) * self.init_linear_variables() # <<<<<<<<<<<<<< * * #Add in user selected linear variables */ - __pyx_t_9 = ((struct __pyx_vtabstruct_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->init_linear_variables(__pyx_v_self, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->init_linear_variables(__pyx_v_self, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "_forward.pyx":72 + /* "sklearn/earth/_forward.pyx":74 * * #Add in user selected linear variables * if 'linvars' in kwargs: # <<<<<<<<<<<<<< * for linvar in kwargs['linvars']: * if linvar in self.xlabels: */ - __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__linvars), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__linvars), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (__pyx_t_7 != 0); if (__pyx_t_4) { - /* "_forward.pyx":73 + /* "sklearn/earth/_forward.pyx":75 * #Add in user selected linear variables * if 'linvars' in kwargs: * for linvar in kwargs['linvars']: # <<<<<<<<<<<<<< * if linvar in self.xlabels: * self.linear_variables[self.xlabels.index(linvar)] = 1 */ - __pyx_t_9 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__linvars)); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - if (PyList_CheckExact(__pyx_t_9) || PyTuple_CheckExact(__pyx_t_9)) { - __pyx_t_1 = __pyx_t_9; __Pyx_INCREF(__pyx_t_1); __pyx_t_13 = 0; - __pyx_t_14 = NULL; + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__linvars)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_14 = 0; + __pyx_t_15 = NULL; } else { - __pyx_t_13 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_14 = Py_TYPE(__pyx_t_1)->tp_iternext; + __pyx_t_14 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_15 = Py_TYPE(__pyx_t_2)->tp_iternext; } - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; for (;;) { - if (!__pyx_t_14 && PyList_CheckExact(__pyx_t_1)) { - if (__pyx_t_13 >= PyList_GET_SIZE(__pyx_t_1)) break; + if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_2)) { + if (__pyx_t_14 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_9 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_9); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_14); __Pyx_INCREF(__pyx_t_1); __pyx_t_14++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_9 = PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif - } else if (!__pyx_t_14 && PyTuple_CheckExact(__pyx_t_1)) { - if (__pyx_t_13 >= PyTuple_GET_SIZE(__pyx_t_1)) break; + } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_2)) { + if (__pyx_t_14 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_13); __Pyx_INCREF(__pyx_t_9); __pyx_t_13++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_14); __Pyx_INCREF(__pyx_t_1); __pyx_t_14++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_9 = PySequence_ITEM(__pyx_t_1, __pyx_t_13); __pyx_t_13++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { - __pyx_t_9 = __pyx_t_14(__pyx_t_1); - if (unlikely(!__pyx_t_9)) { + __pyx_t_1 = __pyx_t_15(__pyx_t_2); + if (unlikely(!__pyx_t_1)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } - __Pyx_GOTREF(__pyx_t_9); + __Pyx_GOTREF(__pyx_t_1); } __Pyx_XDECREF(__pyx_v_linvar); - __pyx_v_linvar = __pyx_t_9; - __pyx_t_9 = 0; + __pyx_v_linvar = __pyx_t_1; + __pyx_t_1 = 0; - /* "_forward.pyx":74 + /* "sklearn/earth/_forward.pyx":76 * if 'linvars' in kwargs: * for linvar in kwargs['linvars']: * if linvar in self.xlabels: # <<<<<<<<<<<<<< * self.linear_variables[self.xlabels.index(linvar)] = 1 * elif linvar in range(self.n): */ - __pyx_t_4 = (__Pyx_PySequence_Contains(__pyx_v_linvar, ((PyObject *)__pyx_v_self->xlabels), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_4) { + __pyx_t_4 = (__Pyx_PySequence_Contains(__pyx_v_linvar, ((PyObject *)__pyx_v_self->xlabels), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = (__pyx_t_4 != 0); + if (__pyx_t_7) { - /* "_forward.pyx":75 + /* "sklearn/earth/_forward.pyx":77 * for linvar in kwargs['linvars']: * if linvar in self.xlabels: * self.linear_variables[self.xlabels.index(linvar)] = 1 # <<<<<<<<<<<<<< * elif linvar in range(self.n): * self.linear_variables[linvar] = 1 */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->xlabels), __pyx_n_s__index); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->xlabels), __pyx_n_s__index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_linvar); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_linvar); __Pyx_GIVEREF(__pyx_v_linvar); - __pyx_t_11 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_12 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (PyObject_SetItem(((PyObject *)__pyx_v_self->linear_variables), __pyx_t_11, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - goto __pyx_L11; + if (PyObject_SetItem(((PyObject *)__pyx_v_self->linear_variables), __pyx_t_12, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + goto __pyx_L12; } - /* "_forward.pyx":76 + /* "sklearn/earth/_forward.pyx":78 * if linvar in self.xlabels: * self.linear_variables[self.xlabels.index(linvar)] = 1 * elif linvar in range(self.n): # <<<<<<<<<<<<<< * self.linear_variables[linvar] = 1 * else: */ - __pyx_t_11 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->n); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->n); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_11); - __Pyx_GIVEREF(__pyx_t_11); - __pyx_t_11 = 0; - __pyx_t_11 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + __pyx_t_12 = 0; + __pyx_t_12 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_4 = (__Pyx_PySequence_Contains(__pyx_v_linvar, __pyx_t_11, Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __pyx_t_7 = (__Pyx_PySequence_Contains(__pyx_v_linvar, __pyx_t_12, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_4 = (__pyx_t_7 != 0); if (__pyx_t_4) { - /* "_forward.pyx":77 + /* "sklearn/earth/_forward.pyx":79 * self.linear_variables[self.xlabels.index(linvar)] = 1 * elif linvar in range(self.n): * self.linear_variables[linvar] = 1 # <<<<<<<<<<<<<< * else: * raise IndexError('Unknown variable selected in linvars argument.') */ - if (PyObject_SetItem(((PyObject *)__pyx_v_self->linear_variables), __pyx_v_linvar, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L11; + if (PyObject_SetItem(((PyObject *)__pyx_v_self->linear_variables), __pyx_v_linvar, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L12; } /*else*/ { - /* "_forward.pyx":79 + /* "sklearn/earth/_forward.pyx":81 * self.linear_variables[linvar] = 1 * else: * raise IndexError('Unknown variable selected in linvars argument.') # <<<<<<<<<<<<<< * * #Initialize B_orth, c, and c_squared (assuming column 0 of B_orth is already filled with 1) */ - __pyx_t_11 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_11); - __Pyx_Raise(__pyx_t_11, 0, 0, 0); - __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_Raise(__pyx_t_12, 0, 0, 0); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L11:; + __pyx_L12:; } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - goto __pyx_L8; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + goto __pyx_L9; } - __pyx_L8:; + __pyx_L9:; - /* "_forward.pyx":82 + /* "sklearn/earth/_forward.pyx":84 * * #Initialize B_orth, c, and c_squared (assuming column 0 of B_orth is already filled with 1) * self.orthonormal_update(0) # <<<<<<<<<<<<<< * * cpdef Basis get_basis(ForwardPasser self): */ - ((struct __pyx_vtabstruct_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_update(__pyx_v_self, 0, 0); + ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_update(__pyx_v_self, 0, 0); __pyx_r = 0; goto __pyx_L0; @@ -3471,21 +3519,21 @@ static int __pyx_pf_8_forward_13ForwardPasser___init__(struct __pyx_obj_8_forwar __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_12); + __Pyx_XDECREF(__pyx_t_13); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sample_weight.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("_forward.ForwardPasser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._forward.ForwardPasser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; goto __pyx_L2; __pyx_L0:; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); - __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sample_weight.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer); __pyx_L2:; __Pyx_XDECREF(__pyx_v_linvar); @@ -3493,7 +3541,7 @@ static int __pyx_pf_8_forward_13ForwardPasser___init__(struct __pyx_obj_8_forwar return __pyx_r; } -/* "_forward.pyx":84 +/* "sklearn/earth/_forward.pyx":86 * self.orthonormal_update(0) * * cpdef Basis get_basis(ForwardPasser self): # <<<<<<<<<<<<<< @@ -3501,9 +3549,9 @@ static int __pyx_pf_8_forward_13ForwardPasser___init__(struct __pyx_obj_8_forwar * */ -static PyObject *__pyx_pw_8_forward_13ForwardPasser_3get_basis(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static struct __pyx_obj_6_basis_Basis *__pyx_f_8_forward_13ForwardPasser_get_basis(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self, int __pyx_skip_dispatch) { - struct __pyx_obj_6_basis_Basis *__pyx_r = NULL; +static PyObject *__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_3get_basis(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_get_basis(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *__pyx_v_self, int __pyx_skip_dispatch) { + struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; @@ -3515,14 +3563,14 @@ static struct __pyx_obj_6_basis_Basis *__pyx_f_8_forward_13ForwardPasser_get_bas if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_basis); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_basis); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8_forward_13ForwardPasser_3get_basis)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_3get_basis)) { __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_6_basis_Basis))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = ((struct __pyx_obj_6_basis_Basis *)__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7sklearn_5earth_6_basis_Basis))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; @@ -3530,7 +3578,7 @@ static struct __pyx_obj_6_basis_Basis *__pyx_f_8_forward_13ForwardPasser_get_bas __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_forward.pyx":85 + /* "sklearn/earth/_forward.pyx":87 * * cpdef Basis get_basis(ForwardPasser self): * return self.basis # <<<<<<<<<<<<<< @@ -3542,12 +3590,12 @@ static struct __pyx_obj_6_basis_Basis *__pyx_f_8_forward_13ForwardPasser_get_bas __pyx_r = __pyx_v_self->basis; goto __pyx_L0; - __pyx_r = ((struct __pyx_obj_6_basis_Basis *)Py_None); __Pyx_INCREF(Py_None); + __pyx_r = ((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)Py_None); __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_forward.ForwardPasser.get_basis", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._forward.ForwardPasser.get_basis", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF((PyObject *)__pyx_r); @@ -3556,17 +3604,17 @@ static struct __pyx_obj_6_basis_Basis *__pyx_f_8_forward_13ForwardPasser_get_bas } /* Python wrapper */ -static PyObject *__pyx_pw_8_forward_13ForwardPasser_3get_basis(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_8_forward_13ForwardPasser_3get_basis(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_3get_basis(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_3get_basis(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_basis (wrapper)", 0); - __pyx_r = __pyx_pf_8_forward_13ForwardPasser_2get_basis(((struct __pyx_obj_8_forward_ForwardPasser *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_2get_basis(((struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_forward.pyx":84 +/* "sklearn/earth/_forward.pyx":86 * self.orthonormal_update(0) * * cpdef Basis get_basis(ForwardPasser self): # <<<<<<<<<<<<<< @@ -3574,7 +3622,7 @@ static PyObject *__pyx_pw_8_forward_13ForwardPasser_3get_basis(PyObject *__pyx_v * */ -static PyObject *__pyx_pf_8_forward_13ForwardPasser_2get_basis(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_2get_basis(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3583,7 +3631,7 @@ static PyObject *__pyx_pf_8_forward_13ForwardPasser_2get_basis(struct __pyx_obj_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_basis", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->get_basis(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->get_basis(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3593,7 +3641,7 @@ static PyObject *__pyx_pf_8_forward_13ForwardPasser_2get_basis(struct __pyx_obj_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_forward.ForwardPasser.get_basis", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._forward.ForwardPasser.get_basis", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3601,7 +3649,7 @@ static PyObject *__pyx_pf_8_forward_13ForwardPasser_2get_basis(struct __pyx_obj_ return __pyx_r; } -/* "_forward.pyx":87 +/* "sklearn/earth/_forward.pyx":89 * return self.basis * * cpdef init_linear_variables(ForwardPasser self): # <<<<<<<<<<<<<< @@ -3609,15 +3657,15 @@ static PyObject *__pyx_pf_8_forward_13ForwardPasser_2get_basis(struct __pyx_obj_ * cdef INDEX_t endspan */ -static PyObject *__pyx_pw_8_forward_13ForwardPasser_5init_linear_variables(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_f_8_forward_13ForwardPasser_init_linear_variables(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self, int __pyx_skip_dispatch) { - __pyx_t_8_forward_INDEX_t __pyx_v_variable; - __pyx_t_8_forward_INDEX_t __pyx_v_endspan; +static PyObject *__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_5init_linear_variables(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_init_linear_variables(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *__pyx_v_self, int __pyx_skip_dispatch) { + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_v_variable; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_v_endspan; PyArrayObject *__pyx_v_order = 0; PyArrayObject *__pyx_v_linear_variables = 0; PyArrayObject *__pyx_v_B = 0; PyArrayObject *__pyx_v_X = 0; - struct __pyx_obj_6_basis_ConstantBasisFunction *__pyx_v_root_basis_function = 0; + struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *__pyx_v_root_basis_function = 0; __Pyx_LocalBuf_ND __pyx_pybuffernd_B; __Pyx_Buffer __pyx_pybuffer_B; __Pyx_LocalBuf_ND __pyx_pybuffernd_X; @@ -3634,8 +3682,8 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_init_linear_variables(struct PyArrayObject *__pyx_t_4 = NULL; PyArrayObject *__pyx_t_5 = NULL; int __pyx_t_6; - __pyx_t_8_forward_INDEX_t __pyx_t_7; - __pyx_t_8_forward_INDEX_t __pyx_t_8; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_7; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_8; PyObject *__pyx_t_9 = NULL; PyArrayObject *__pyx_t_10 = NULL; int __pyx_t_11; @@ -3643,8 +3691,8 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_init_linear_variables(struct PyObject *__pyx_t_13 = NULL; PyObject *__pyx_t_14 = NULL; PyObject *__pyx_t_15 = NULL; - __pyx_t_8_forward_INDEX_t __pyx_t_16; - __pyx_t_8_forward_INDEX_t __pyx_t_17; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_16; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_17; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -3669,11 +3717,11 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_init_linear_variables(struct if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8_forward_13ForwardPasser_5init_linear_variables)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_5init_linear_variables)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -3683,7 +3731,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_init_linear_variables(struct __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_forward.pyx":91 + /* "sklearn/earth/_forward.pyx":93 * cdef INDEX_t endspan * cdef cnp.ndarray[INT_t, ndim=1] order * cdef cnp.ndarray[INT_t, ndim=1] linear_variables = self.linear_variables # <<<<<<<<<<<<<< @@ -3693,9 +3741,9 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_init_linear_variables(struct __pyx_t_3 = ((PyArrayObject *)__pyx_v_self->linear_variables); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_linear_variables.rcbuffer->pybuffer, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_linear_variables.rcbuffer->pybuffer, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_linear_variables = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_linear_variables.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_linear_variables.diminfo[0].strides = __pyx_pybuffernd_linear_variables.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_linear_variables.diminfo[0].shape = __pyx_pybuffernd_linear_variables.rcbuffer->pybuffer.shape[0]; } } @@ -3703,7 +3751,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_init_linear_variables(struct __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->linear_variables))); __pyx_v_linear_variables = ((PyArrayObject *)__pyx_v_self->linear_variables); - /* "_forward.pyx":92 + /* "sklearn/earth/_forward.pyx":94 * cdef cnp.ndarray[INT_t, ndim=1] order * cdef cnp.ndarray[INT_t, ndim=1] linear_variables = self.linear_variables * cdef cnp.ndarray[FLOAT_t, ndim=2] B = self.B # <<<<<<<<<<<<<< @@ -3713,9 +3761,9 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_init_linear_variables(struct __pyx_t_4 = ((PyArrayObject *)__pyx_v_self->B); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { __pyx_v_B = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_B.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_B.diminfo[0].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B.diminfo[0].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B.diminfo[1].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B.diminfo[1].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[1]; } } @@ -3723,7 +3771,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_init_linear_variables(struct __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->B))); __pyx_v_B = ((PyArrayObject *)__pyx_v_self->B); - /* "_forward.pyx":93 + /* "sklearn/earth/_forward.pyx":95 * cdef cnp.ndarray[INT_t, ndim=1] linear_variables = self.linear_variables * cdef cnp.ndarray[FLOAT_t, ndim=2] B = self.B * cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X # <<<<<<<<<<<<<< @@ -3733,9 +3781,9 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_init_linear_variables(struct __pyx_t_5 = ((PyArrayObject *)__pyx_v_self->X); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { __pyx_v_X = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; } } @@ -3743,54 +3791,54 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_init_linear_variables(struct __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->X))); __pyx_v_X = ((PyArrayObject *)__pyx_v_self->X); - /* "_forward.pyx":94 + /* "sklearn/earth/_forward.pyx":96 * cdef cnp.ndarray[FLOAT_t, ndim=2] B = self.B * cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X * if self.endspan < 0: # <<<<<<<<<<<<<< * endspan = round(3 - log2(self.endspan_alpha/self.n)) * cdef ConstantBasisFunction root_basis_function = self.basis[0] */ - __pyx_t_6 = (__pyx_v_self->endspan < 0); + __pyx_t_6 = ((__pyx_v_self->endspan < 0) != 0); if (__pyx_t_6) { - /* "_forward.pyx":95 + /* "sklearn/earth/_forward.pyx":97 * cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X * if self.endspan < 0: * endspan = round(3 - log2(self.endspan_alpha/self.n)) # <<<<<<<<<<<<<< * cdef ConstantBasisFunction root_basis_function = self.basis[0] * for variable in range(self.n): */ - __pyx_t_1 = PyFloat_FromDouble((3.0 - __pyx_f_5_util_log2((__pyx_v_self->endspan_alpha / __pyx_v_self->n)))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble((3.0 - __pyx_f_7sklearn_5earth_5_util_log2((__pyx_v_self->endspan_alpha / __pyx_v_self->n)))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_round, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_round, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_7 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_7 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_7 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_endspan = __pyx_t_7; goto __pyx_L3; } __pyx_L3:; - /* "_forward.pyx":96 + /* "sklearn/earth/_forward.pyx":98 * if self.endspan < 0: * endspan = round(3 - log2(self.endspan_alpha/self.n)) * cdef ConstantBasisFunction root_basis_function = self.basis[0] # <<<<<<<<<<<<<< * for variable in range(self.n): * order = np.argsort(X[:,variable])[::-1] */ - __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->basis), 0, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->basis), 0, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_6_basis_ConstantBasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_root_basis_function = ((struct __pyx_obj_6_basis_ConstantBasisFunction *)__pyx_t_1); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7sklearn_5earth_6_basis_ConstantBasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_root_basis_function = ((struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *)__pyx_t_1); __pyx_t_1 = 0; - /* "_forward.pyx":97 + /* "sklearn/earth/_forward.pyx":99 * endspan = round(3 - log2(self.endspan_alpha/self.n)) * cdef ConstantBasisFunction root_basis_function = self.basis[0] * for variable in range(self.n): # <<<<<<<<<<<<<< @@ -3801,21 +3849,21 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_init_linear_variables(struct for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { __pyx_v_variable = __pyx_t_8; - /* "_forward.pyx":98 + /* "sklearn/earth/_forward.pyx":100 * cdef ConstantBasisFunction root_basis_function = self.basis[0] * for variable in range(self.n): * order = np.argsort(X[:,variable])[::-1] # <<<<<<<<<<<<<< * if root_basis_function.valid_knots(B[order,0], X[order,variable], * variable, self.check_every, endspan, */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__argsort); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__argsort); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_INCREF(__pyx_k_slice_4); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_k_slice_4); @@ -3823,30 +3871,30 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_init_linear_variables(struct PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_X), ((PyObject *)__pyx_t_9)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_X), ((PyObject *)__pyx_t_9)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - __pyx_t_9 = PyObject_GetItem(__pyx_t_1, __pyx_k_slice_5); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetItem(__pyx_t_1, __pyx_k_slice_5); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_10 = ((PyArrayObject *)__pyx_t_9); { __Pyx_BufFmt_StackElem __pyx_stack[1]; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_order.rcbuffer->pybuffer); - __pyx_t_11 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_order.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); + __pyx_t_11 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_order.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); if (unlikely(__pyx_t_11 < 0)) { PyErr_Fetch(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_order.rcbuffer->pybuffer, (PyObject*)__pyx_v_order, &__Pyx_TypeInfo_nn___pyx_t_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_order.rcbuffer->pybuffer, (PyObject*)__pyx_v_order, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14); __Pyx_RaiseBufferFallbackError(); } else { @@ -3854,21 +3902,21 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_init_linear_variables(struct } } __pyx_pybuffernd_order.diminfo[0].strides = __pyx_pybuffernd_order.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_order.diminfo[0].shape = __pyx_pybuffernd_order.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_10 = 0; __Pyx_XDECREF(((PyObject *)__pyx_v_order)); __pyx_v_order = ((PyArrayObject *)__pyx_t_9); __pyx_t_9 = 0; - /* "_forward.pyx":99 + /* "sklearn/earth/_forward.pyx":101 * for variable in range(self.n): * order = np.argsort(X[:,variable])[::-1] * if root_basis_function.valid_knots(B[order,0], X[order,variable], # <<<<<<<<<<<<<< * variable, self.check_every, endspan, * self.minspan, self.minspan_alpha, */ - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_INCREF(((PyObject *)__pyx_v_order)); PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_v_order)); @@ -3876,13 +3924,13 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_init_linear_variables(struct __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_9)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_9)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_9 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_order)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_order)); @@ -3890,12 +3938,12 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_init_linear_variables(struct PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyObject_GetItem(((PyObject *)__pyx_v_X), ((PyObject *)__pyx_t_2)); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetItem(((PyObject *)__pyx_v_X), ((PyObject *)__pyx_t_2)); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "_forward.pyx":102 + /* "sklearn/earth/_forward.pyx":104 * variable, self.check_every, endspan, * self.minspan, self.minspan_alpha, * self.n, self.mwork).shape[0] == 0: # <<<<<<<<<<<<<< @@ -3904,16 +3952,16 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_init_linear_variables(struct */ __pyx_t_2 = ((PyObject *)__pyx_v_self->mwork); __Pyx_INCREF(__pyx_t_2); - __pyx_t_15 = ((PyObject *)((struct __pyx_vtabstruct_6_basis_ConstantBasisFunction *)__pyx_v_root_basis_function->__pyx_base.__pyx_vtab)->__pyx_base.valid_knots(((struct __pyx_obj_6_basis_BasisFunction *)__pyx_v_root_basis_function), ((PyArrayObject *)__pyx_t_1), ((PyArrayObject *)__pyx_t_9), __pyx_v_variable, __pyx_v_self->check_every, __pyx_v_endspan, __pyx_v_self->minspan, __pyx_v_self->minspan_alpha, __pyx_v_self->n, ((PyArrayObject *)__pyx_t_2), 0)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_ConstantBasisFunction *)__pyx_v_root_basis_function->__pyx_base.__pyx_vtab)->__pyx_base.valid_knots(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_root_basis_function), ((PyArrayObject *)__pyx_t_1), ((PyArrayObject *)__pyx_t_9), __pyx_v_variable, __pyx_v_self->check_every, __pyx_v_endspan, __pyx_v_self->minspan, __pyx_v_self->minspan_alpha, __pyx_v_self->n, ((PyArrayObject *)__pyx_t_2), 0)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_6 = ((((PyArrayObject *)__pyx_t_15)->dimensions[0]) == 0); + __pyx_t_6 = (((((PyArrayObject *)__pyx_t_15)->dimensions[0]) == 0) != 0); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; if (__pyx_t_6) { - /* "_forward.pyx":103 + /* "sklearn/earth/_forward.pyx":105 * self.minspan, self.minspan_alpha, * self.n, self.mwork).shape[0] == 0: * linear_variables[variable] = 1 # <<<<<<<<<<<<<< @@ -3921,12 +3969,12 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_init_linear_variables(struct * linear_variables[variable] = 0 */ __pyx_t_16 = __pyx_v_variable; - *__Pyx_BufPtrStrided1d(__pyx_t_8_forward_INT_t *, __pyx_pybuffernd_linear_variables.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_linear_variables.diminfo[0].strides) = 1; + *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_INT_t *, __pyx_pybuffernd_linear_variables.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_linear_variables.diminfo[0].strides) = 1; goto __pyx_L6; } /*else*/ { - /* "_forward.pyx":105 + /* "sklearn/earth/_forward.pyx":107 * linear_variables[variable] = 1 * else: * linear_variables[variable] = 0 # <<<<<<<<<<<<<< @@ -3934,7 +3982,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_init_linear_variables(struct * def get_B_orth(ForwardPasser self): */ __pyx_t_17 = __pyx_v_variable; - *__Pyx_BufPtrStrided1d(__pyx_t_8_forward_INT_t *, __pyx_pybuffernd_linear_variables.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_linear_variables.diminfo[0].strides) = 0; + *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_INT_t *, __pyx_pybuffernd_linear_variables.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_linear_variables.diminfo[0].strides) = 0; } __pyx_L6:; } @@ -3953,7 +4001,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_init_linear_variables(struct __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_linear_variables.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_order.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("_forward.ForwardPasser.init_linear_variables", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._forward.ForwardPasser.init_linear_variables", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; goto __pyx_L2; __pyx_L0:; @@ -3973,17 +4021,17 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_init_linear_variables(struct } /* Python wrapper */ -static PyObject *__pyx_pw_8_forward_13ForwardPasser_5init_linear_variables(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_8_forward_13ForwardPasser_5init_linear_variables(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_5init_linear_variables(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_5init_linear_variables(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("init_linear_variables (wrapper)", 0); - __pyx_r = __pyx_pf_8_forward_13ForwardPasser_4init_linear_variables(((struct __pyx_obj_8_forward_ForwardPasser *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_4init_linear_variables(((struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_forward.pyx":87 +/* "sklearn/earth/_forward.pyx":89 * return self.basis * * cpdef init_linear_variables(ForwardPasser self): # <<<<<<<<<<<<<< @@ -3991,7 +4039,7 @@ static PyObject *__pyx_pw_8_forward_13ForwardPasser_5init_linear_variables(PyObj * cdef INDEX_t endspan */ -static PyObject *__pyx_pf_8_forward_13ForwardPasser_4init_linear_variables(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_4init_linear_variables(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -4000,7 +4048,7 @@ static PyObject *__pyx_pf_8_forward_13ForwardPasser_4init_linear_variables(struc int __pyx_clineno = 0; __Pyx_RefNannySetupContext("init_linear_variables", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->init_linear_variables(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->init_linear_variables(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4010,7 +4058,7 @@ static PyObject *__pyx_pf_8_forward_13ForwardPasser_4init_linear_variables(struc goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_forward.ForwardPasser.init_linear_variables", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._forward.ForwardPasser.init_linear_variables", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -4019,17 +4067,17 @@ static PyObject *__pyx_pf_8_forward_13ForwardPasser_4init_linear_variables(struc } /* Python wrapper */ -static PyObject *__pyx_pw_8_forward_13ForwardPasser_7get_B_orth(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_8_forward_13ForwardPasser_7get_B_orth(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_7get_B_orth(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_7get_B_orth(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_B_orth (wrapper)", 0); - __pyx_r = __pyx_pf_8_forward_13ForwardPasser_6get_B_orth(((struct __pyx_obj_8_forward_ForwardPasser *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_6get_B_orth(((struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_forward.pyx":107 +/* "sklearn/earth/_forward.pyx":109 * linear_variables[variable] = 0 * * def get_B_orth(ForwardPasser self): # <<<<<<<<<<<<<< @@ -4037,12 +4085,12 @@ static PyObject *__pyx_pw_8_forward_13ForwardPasser_7get_B_orth(PyObject *__pyx_ * */ -static PyObject *__pyx_pf_8_forward_13ForwardPasser_6get_B_orth(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_6get_B_orth(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_B_orth", 0); - /* "_forward.pyx":108 + /* "sklearn/earth/_forward.pyx":110 * * def get_B_orth(ForwardPasser self): * return self.B_orth # <<<<<<<<<<<<<< @@ -4061,7 +4109,7 @@ static PyObject *__pyx_pf_8_forward_13ForwardPasser_6get_B_orth(struct __pyx_obj return __pyx_r; } -/* "_forward.pyx":110 +/* "sklearn/earth/_forward.pyx":112 * return self.B_orth * * cpdef run(ForwardPasser self): # <<<<<<<<<<<<<< @@ -4069,8 +4117,8 @@ static PyObject *__pyx_pf_8_forward_13ForwardPasser_6get_B_orth(struct __pyx_obj * while True: */ -static PyObject *__pyx_pw_8_forward_13ForwardPasser_9run(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_f_8_forward_13ForwardPasser_run(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_9run(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_run(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *__pyx_v_self, int __pyx_skip_dispatch) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -4084,11 +4132,11 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_run(struct __pyx_obj_8_forwar if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__run); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__run); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8_forward_13ForwardPasser_9run)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_9run)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -4098,7 +4146,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_run(struct __pyx_obj_8_forwar __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_forward.pyx":112 + /* "sklearn/earth/_forward.pyx":114 * cpdef run(ForwardPasser self): * cdef INDEX_t i * while True: # <<<<<<<<<<<<<< @@ -4108,31 +4156,31 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_run(struct __pyx_obj_8_forwar while (1) { if (!1) break; - /* "_forward.pyx":113 + /* "sklearn/earth/_forward.pyx":115 * cdef INDEX_t i * while True: * self.next_pair() # <<<<<<<<<<<<<< * if self.stop_check(): * break */ - __pyx_t_1 = ((struct __pyx_vtabstruct_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->next_pair(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->next_pair(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "_forward.pyx":114 + /* "sklearn/earth/_forward.pyx":116 * while True: * self.next_pair() * if self.stop_check(): # <<<<<<<<<<<<<< * break * */ - __pyx_t_1 = ((struct __pyx_vtabstruct_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->stop_check(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->stop_check(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_3) { - /* "_forward.pyx":115 + /* "sklearn/earth/_forward.pyx":117 * self.next_pair() * if self.stop_check(): * break # <<<<<<<<<<<<<< @@ -4151,7 +4199,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_run(struct __pyx_obj_8_forwar __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_forward.ForwardPasser.run", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._forward.ForwardPasser.run", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -4160,17 +4208,17 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_run(struct __pyx_obj_8_forwar } /* Python wrapper */ -static PyObject *__pyx_pw_8_forward_13ForwardPasser_9run(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_8_forward_13ForwardPasser_9run(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_9run(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_9run(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("run (wrapper)", 0); - __pyx_r = __pyx_pf_8_forward_13ForwardPasser_8run(((struct __pyx_obj_8_forward_ForwardPasser *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_8run(((struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_forward.pyx":110 +/* "sklearn/earth/_forward.pyx":112 * return self.B_orth * * cpdef run(ForwardPasser self): # <<<<<<<<<<<<<< @@ -4178,7 +4226,7 @@ static PyObject *__pyx_pw_8_forward_13ForwardPasser_9run(PyObject *__pyx_v_self, * while True: */ -static PyObject *__pyx_pf_8_forward_13ForwardPasser_8run(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_8run(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -4187,7 +4235,7 @@ static PyObject *__pyx_pf_8_forward_13ForwardPasser_8run(struct __pyx_obj_8_forw int __pyx_clineno = 0; __Pyx_RefNannySetupContext("run", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->run(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->run(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4197,7 +4245,7 @@ static PyObject *__pyx_pf_8_forward_13ForwardPasser_8run(struct __pyx_obj_8_forw goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_forward.ForwardPasser.run", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._forward.ForwardPasser.run", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -4205,7 +4253,7 @@ static PyObject *__pyx_pf_8_forward_13ForwardPasser_8run(struct __pyx_obj_8_forw return __pyx_r; } -/* "_forward.pyx":117 +/* "sklearn/earth/_forward.pyx":119 * break * * cdef stop_check(ForwardPasser self): # <<<<<<<<<<<<<< @@ -4213,7 +4261,7 @@ static PyObject *__pyx_pf_8_forward_13ForwardPasser_8run(struct __pyx_obj_8_forw * if self.record.iterations[last].get_size() + 2 > self.max_terms: */ -static PyObject *__pyx_f_8_forward_13ForwardPasser_stop_check(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self) { +static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_stop_check(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *__pyx_v_self) { PyObject *__pyx_v_last = NULL; PyObject *__pyx_v_rsq = NULL; PyObject *__pyx_v_previous_rsq = NULL; @@ -4223,31 +4271,31 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_stop_check(struct __pyx_obj_8 PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; int __pyx_t_4; - __pyx_t_7_record_INDEX_t __pyx_t_5; + __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_t_5; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("stop_check", 0); - /* "_forward.pyx":118 + /* "sklearn/earth/_forward.pyx":120 * * cdef stop_check(ForwardPasser self): * last = self.record.__len__() - 1 # <<<<<<<<<<<<<< * if self.record.iterations[last].get_size() + 2 > self.max_terms: * self.record.stopping_condition = MAXTERMS */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->record), __pyx_n_s____len__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->record), __pyx_n_s____len__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_last = __pyx_t_1; __pyx_t_1 = 0; - /* "_forward.pyx":119 + /* "sklearn/earth/_forward.pyx":121 * cdef stop_check(ForwardPasser self): * last = self.record.__len__() - 1 * if self.record.iterations[last].get_size() + 2 > self.max_terms: # <<<<<<<<<<<<<< @@ -4256,38 +4304,38 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_stop_check(struct __pyx_obj_8 */ if (unlikely(((PyObject *)__pyx_v_self->record->__pyx_base.iterations) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self->record->__pyx_base.iterations), __pyx_v_last); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self->record->__pyx_base.iterations), __pyx_v_last); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__get_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__get_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_int_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_int_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_4) { - /* "_forward.pyx":120 + /* "sklearn/earth/_forward.pyx":122 * last = self.record.__len__() - 1 * if self.record.iterations[last].get_size() + 2 > self.max_terms: * self.record.stopping_condition = MAXTERMS # <<<<<<<<<<<<<< * return True * rsq = self.record.rsq(last) */ - __pyx_v_self->record->stopping_condition = __pyx_e_8_forward_MAXTERMS; + __pyx_v_self->record->stopping_condition = __pyx_e_7sklearn_5earth_8_forward_MAXTERMS; - /* "_forward.pyx":121 + /* "sklearn/earth/_forward.pyx":123 * if self.record.iterations[last].get_size() + 2 > self.max_terms: * self.record.stopping_condition = MAXTERMS * return True # <<<<<<<<<<<<<< @@ -4295,7 +4343,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_stop_check(struct __pyx_obj_8 * if rsq > 1 - self.thresh: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; @@ -4304,44 +4352,44 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_stop_check(struct __pyx_obj_8 } __pyx_L3:; - /* "_forward.pyx":122 + /* "sklearn/earth/_forward.pyx":124 * self.record.stopping_condition = MAXTERMS * return True * rsq = self.record.rsq(last) # <<<<<<<<<<<<<< * if rsq > 1 - self.thresh: * self.record.stopping_condition = MAXRSQ */ - __pyx_t_5 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_last); if (unlikely((__pyx_t_5 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7_record_ForwardPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->__pyx_base.rsq(((struct __pyx_obj_7_record_Record *)__pyx_v_self->record), __pyx_t_5, 0)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_last); if (unlikely((__pyx_t_5 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->__pyx_base.rsq(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self->record), __pyx_t_5, 0)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_v_rsq = __pyx_t_3; __pyx_t_3 = 0; - /* "_forward.pyx":123 + /* "sklearn/earth/_forward.pyx":125 * return True * rsq = self.record.rsq(last) * if rsq > 1 - self.thresh: # <<<<<<<<<<<<<< * self.record.stopping_condition = MAXRSQ * return True */ - __pyx_t_3 = PyFloat_FromDouble((1.0 - __pyx_v_self->thresh)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble((1.0 - __pyx_v_self->thresh)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_RichCompare(__pyx_v_rsq, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_v_rsq, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_4) { - /* "_forward.pyx":124 + /* "sklearn/earth/_forward.pyx":126 * rsq = self.record.rsq(last) * if rsq > 1 - self.thresh: * self.record.stopping_condition = MAXRSQ # <<<<<<<<<<<<<< * return True * previous_rsq = self.record.rsq(last - 1) */ - __pyx_v_self->record->stopping_condition = __pyx_e_8_forward_MAXRSQ; + __pyx_v_self->record->stopping_condition = __pyx_e_7sklearn_5earth_8_forward_MAXRSQ; - /* "_forward.pyx":125 + /* "sklearn/earth/_forward.pyx":127 * if rsq > 1 - self.thresh: * self.record.stopping_condition = MAXRSQ * return True # <<<<<<<<<<<<<< @@ -4349,7 +4397,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_stop_check(struct __pyx_obj_8 * if rsq - previous_rsq < self.thresh: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4358,50 +4406,50 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_stop_check(struct __pyx_obj_8 } __pyx_L4:; - /* "_forward.pyx":126 + /* "sklearn/earth/_forward.pyx":128 * self.record.stopping_condition = MAXRSQ * return True * previous_rsq = self.record.rsq(last - 1) # <<<<<<<<<<<<<< * if rsq - previous_rsq < self.thresh: * self.record.stopping_condition = NOIMPRV */ - __pyx_t_1 = PyNumber_Subtract(__pyx_v_last, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Subtract(__pyx_v_last, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_5 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_5 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7_record_ForwardPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->__pyx_base.rsq(((struct __pyx_obj_7_record_Record *)__pyx_v_self->record), __pyx_t_5, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->__pyx_base.rsq(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self->record), __pyx_t_5, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_previous_rsq = __pyx_t_1; __pyx_t_1 = 0; - /* "_forward.pyx":127 + /* "sklearn/earth/_forward.pyx":129 * return True * previous_rsq = self.record.rsq(last - 1) * if rsq - previous_rsq < self.thresh: # <<<<<<<<<<<<<< * self.record.stopping_condition = NOIMPRV * return True */ - __pyx_t_1 = PyNumber_Subtract(__pyx_v_rsq, __pyx_v_previous_rsq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Subtract(__pyx_v_rsq, __pyx_v_previous_rsq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->thresh); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->thresh); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_4) { - /* "_forward.pyx":128 + /* "sklearn/earth/_forward.pyx":130 * previous_rsq = self.record.rsq(last - 1) * if rsq - previous_rsq < self.thresh: * self.record.stopping_condition = NOIMPRV # <<<<<<<<<<<<<< * return True * if self.record.grsq(last) < -10: */ - __pyx_v_self->record->stopping_condition = __pyx_e_8_forward_NOIMPRV; + __pyx_v_self->record->stopping_condition = __pyx_e_7sklearn_5earth_8_forward_NOIMPRV; - /* "_forward.pyx":129 + /* "sklearn/earth/_forward.pyx":131 * if rsq - previous_rsq < self.thresh: * self.record.stopping_condition = NOIMPRV * return True # <<<<<<<<<<<<<< @@ -4409,7 +4457,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_stop_check(struct __pyx_obj_8 * self.record.stopping_condition = LOWGRSQ */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -4418,27 +4466,27 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_stop_check(struct __pyx_obj_8 } __pyx_L5:; - /* "_forward.pyx":130 + /* "sklearn/earth/_forward.pyx":132 * self.record.stopping_condition = NOIMPRV * return True * if self.record.grsq(last) < -10: # <<<<<<<<<<<<<< * self.record.stopping_condition = LOWGRSQ * return True */ - __pyx_t_5 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_last); if (unlikely((__pyx_t_5 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = (((struct __pyx_vtabstruct_7_record_ForwardPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->__pyx_base.grsq(((struct __pyx_obj_7_record_Record *)__pyx_v_self->record), __pyx_t_5, 0) < -10.0); + __pyx_t_5 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_last); if (unlikely((__pyx_t_5 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = ((((struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->__pyx_base.grsq(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self->record), __pyx_t_5, 0) < -10.0) != 0); if (__pyx_t_4) { - /* "_forward.pyx":131 + /* "sklearn/earth/_forward.pyx":133 * return True * if self.record.grsq(last) < -10: * self.record.stopping_condition = LOWGRSQ # <<<<<<<<<<<<<< * return True * if self.record.iterations[last].no_further_candidates(): */ - __pyx_v_self->record->stopping_condition = __pyx_e_8_forward_LOWGRSQ; + __pyx_v_self->record->stopping_condition = __pyx_e_7sklearn_5earth_8_forward_LOWGRSQ; - /* "_forward.pyx":132 + /* "sklearn/earth/_forward.pyx":134 * if self.record.grsq(last) < -10: * self.record.stopping_condition = LOWGRSQ * return True # <<<<<<<<<<<<<< @@ -4446,7 +4494,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_stop_check(struct __pyx_obj_8 * self.record.stopping_condition = NOCAND */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -4455,7 +4503,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_stop_check(struct __pyx_obj_8 } __pyx_L6:; - /* "_forward.pyx":133 + /* "sklearn/earth/_forward.pyx":135 * self.record.stopping_condition = LOWGRSQ * return True * if self.record.iterations[last].no_further_candidates(): # <<<<<<<<<<<<<< @@ -4464,30 +4512,30 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_stop_check(struct __pyx_obj_8 */ if (unlikely(((PyObject *)__pyx_v_self->record->__pyx_base.iterations) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_self->record->__pyx_base.iterations), __pyx_v_last); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_self->record->__pyx_base.iterations), __pyx_v_last); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_4) { - /* "_forward.pyx":134 + /* "sklearn/earth/_forward.pyx":136 * return True * if self.record.iterations[last].no_further_candidates(): * self.record.stopping_condition = NOCAND # <<<<<<<<<<<<<< * return True * return False */ - __pyx_v_self->record->stopping_condition = __pyx_e_8_forward_NOCAND; + __pyx_v_self->record->stopping_condition = __pyx_e_7sklearn_5earth_8_forward_NOCAND; - /* "_forward.pyx":135 + /* "sklearn/earth/_forward.pyx":137 * if self.record.iterations[last].no_further_candidates(): * self.record.stopping_condition = NOCAND * return True # <<<<<<<<<<<<<< @@ -4495,7 +4543,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_stop_check(struct __pyx_obj_8 * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -4504,7 +4552,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_stop_check(struct __pyx_obj_8 } __pyx_L7:; - /* "_forward.pyx":136 + /* "sklearn/earth/_forward.pyx":138 * self.record.stopping_condition = NOCAND * return True * return False # <<<<<<<<<<<<<< @@ -4512,7 +4560,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_stop_check(struct __pyx_obj_8 * cpdef int orthonormal_update(ForwardPasser self, INDEX_t k): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -4524,7 +4572,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_stop_check(struct __pyx_obj_8 __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_forward.ForwardPasser.stop_check", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._forward.ForwardPasser.stop_check", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_last); @@ -4535,7 +4583,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_stop_check(struct __pyx_obj_8 return __pyx_r; } -/* "_forward.pyx":138 +/* "sklearn/earth/_forward.pyx":140 * return False * * cpdef int orthonormal_update(ForwardPasser self, INDEX_t k): # <<<<<<<<<<<<<< @@ -4543,17 +4591,17 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_stop_check(struct __pyx_obj_8 * #Currently implemented using modified Gram-Schmidt process */ -static PyObject *__pyx_pw_8_forward_13ForwardPasser_11orthonormal_update(PyObject *__pyx_v_self, PyObject *__pyx_arg_k); /*proto*/ -static int __pyx_f_8_forward_13ForwardPasser_orthonormal_update(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self, __pyx_t_8_forward_INDEX_t __pyx_v_k, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_11orthonormal_update(PyObject *__pyx_v_self, PyObject *__pyx_arg_k); /*proto*/ +static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *__pyx_v_self, __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_v_k, int __pyx_skip_dispatch) { PyArrayObject *__pyx_v_B_orth = 0; PyArrayObject *__pyx_v_c = 0; PyArrayObject *__pyx_v_y = 0; PyArrayObject *__pyx_v_norms = 0; - __pyx_t_8_forward_INDEX_t __pyx_v_i; - __pyx_t_8_forward_INDEX_t __pyx_v_j; - __pyx_t_8_forward_FLOAT_t __pyx_v_nrm; - __pyx_t_8_forward_FLOAT_t __pyx_v_nrm0; - __pyx_t_8_forward_FLOAT_t __pyx_v_dot_prod; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_v_i; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_v_j; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t __pyx_v_nrm; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t __pyx_v_nrm0; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t __pyx_v_dot_prod; __Pyx_LocalBuf_ND __pyx_pybuffernd_B_orth; __Pyx_Buffer __pyx_pybuffer_B_orth; __Pyx_LocalBuf_ND __pyx_pybuffernd_c; @@ -4572,38 +4620,38 @@ static int __pyx_f_8_forward_13ForwardPasser_orthonormal_update(struct __pyx_obj PyArrayObject *__pyx_t_6 = NULL; PyArrayObject *__pyx_t_7 = NULL; PyArrayObject *__pyx_t_8 = NULL; - __pyx_t_8_forward_INDEX_t __pyx_t_9; - __pyx_t_8_forward_INDEX_t __pyx_t_10; - __pyx_t_8_forward_INDEX_t __pyx_t_11; - __pyx_t_8_forward_INDEX_t __pyx_t_12; - __pyx_t_8_forward_INDEX_t __pyx_t_13; - __pyx_t_8_forward_INDEX_t __pyx_t_14; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_9; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_10; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_11; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_12; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_13; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_14; int __pyx_t_15; - __pyx_t_8_forward_INDEX_t __pyx_t_16; - __pyx_t_8_forward_INDEX_t __pyx_t_17; - __pyx_t_8_forward_INDEX_t __pyx_t_18; - __pyx_t_8_forward_INDEX_t __pyx_t_19; - __pyx_t_8_forward_INDEX_t __pyx_t_20; - __pyx_t_8_forward_INDEX_t __pyx_t_21; - __pyx_t_8_forward_INDEX_t __pyx_t_22; - __pyx_t_8_forward_INDEX_t __pyx_t_23; - __pyx_t_8_forward_INDEX_t __pyx_t_24; - __pyx_t_8_forward_INDEX_t __pyx_t_25; - __pyx_t_8_forward_INDEX_t __pyx_t_26; - __pyx_t_8_forward_INDEX_t __pyx_t_27; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_16; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_17; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_18; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_19; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_20; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_21; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_22; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_23; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_24; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_25; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_26; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_27; int __pyx_t_28; int __pyx_t_29; - __pyx_t_8_forward_INDEX_t __pyx_t_30; - __pyx_t_8_forward_INDEX_t __pyx_t_31; - __pyx_t_8_forward_INDEX_t __pyx_t_32; - __pyx_t_8_forward_INDEX_t __pyx_t_33; - __pyx_t_8_forward_INDEX_t __pyx_t_34; - __pyx_t_8_forward_INDEX_t __pyx_t_35; - __pyx_t_8_forward_INDEX_t __pyx_t_36; - __pyx_t_8_forward_INDEX_t __pyx_t_37; - __pyx_t_8_forward_INDEX_t __pyx_t_38; - __pyx_t_8_forward_INDEX_t __pyx_t_39; - __pyx_t_8_forward_INDEX_t __pyx_t_40; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_30; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_31; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_32; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_33; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_34; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_35; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_36; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_37; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_38; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_39; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_40; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -4628,20 +4676,20 @@ static int __pyx_f_8_forward_13ForwardPasser_orthonormal_update(struct __pyx_obj if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__orthonormal_update); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__orthonormal_update); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8_forward_13ForwardPasser_11orthonormal_update)) { - __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_11orthonormal_update)) { + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_4; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -4650,7 +4698,7 @@ static int __pyx_f_8_forward_13ForwardPasser_orthonormal_update(struct __pyx_obj __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_forward.pyx":143 + /* "sklearn/earth/_forward.pyx":145 * #TODO: Optimize - replace some for loops with calls to blas * * cdef cnp.ndarray[FLOAT_t, ndim=2] B_orth = self.B_orth # <<<<<<<<<<<<<< @@ -4660,9 +4708,9 @@ static int __pyx_f_8_forward_13ForwardPasser_orthonormal_update(struct __pyx_obj __pyx_t_5 = ((PyArrayObject *)__pyx_v_self->B_orth); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B_orth.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B_orth.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { __pyx_v_B_orth = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_B_orth.diminfo[0].strides = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B_orth.diminfo[0].shape = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B_orth.diminfo[1].strides = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B_orth.diminfo[1].shape = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.shape[1]; } } @@ -4670,7 +4718,7 @@ static int __pyx_f_8_forward_13ForwardPasser_orthonormal_update(struct __pyx_obj __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->B_orth))); __pyx_v_B_orth = ((PyArrayObject *)__pyx_v_self->B_orth); - /* "_forward.pyx":144 + /* "sklearn/earth/_forward.pyx":146 * * cdef cnp.ndarray[FLOAT_t, ndim=2] B_orth = self.B_orth * cdef cnp.ndarray[FLOAT_t, ndim=1] c = self.c # <<<<<<<<<<<<<< @@ -4680,9 +4728,9 @@ static int __pyx_f_8_forward_13ForwardPasser_orthonormal_update(struct __pyx_obj __pyx_t_6 = ((PyArrayObject *)__pyx_v_self->c); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_c.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_c.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_c = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_c.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_c.diminfo[0].strides = __pyx_pybuffernd_c.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_c.diminfo[0].shape = __pyx_pybuffernd_c.rcbuffer->pybuffer.shape[0]; } } @@ -4690,7 +4738,7 @@ static int __pyx_f_8_forward_13ForwardPasser_orthonormal_update(struct __pyx_obj __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->c))); __pyx_v_c = ((PyArrayObject *)__pyx_v_self->c); - /* "_forward.pyx":145 + /* "sklearn/earth/_forward.pyx":147 * cdef cnp.ndarray[FLOAT_t, ndim=2] B_orth = self.B_orth * cdef cnp.ndarray[FLOAT_t, ndim=1] c = self.c * cdef cnp.ndarray[FLOAT_t, ndim=1] y = self.y # <<<<<<<<<<<<<< @@ -4700,9 +4748,9 @@ static int __pyx_f_8_forward_13ForwardPasser_orthonormal_update(struct __pyx_obj __pyx_t_7 = ((PyArrayObject *)__pyx_v_self->y); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_y = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_y.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_y.diminfo[0].strides = __pyx_pybuffernd_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y.diminfo[0].shape = __pyx_pybuffernd_y.rcbuffer->pybuffer.shape[0]; } } @@ -4710,7 +4758,7 @@ static int __pyx_f_8_forward_13ForwardPasser_orthonormal_update(struct __pyx_obj __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->y))); __pyx_v_y = ((PyArrayObject *)__pyx_v_self->y); - /* "_forward.pyx":146 + /* "sklearn/earth/_forward.pyx":148 * cdef cnp.ndarray[FLOAT_t, ndim=1] c = self.c * cdef cnp.ndarray[FLOAT_t, ndim=1] y = self.y * cdef cnp.ndarray[FLOAT_t, ndim=1] norms = self.norms # <<<<<<<<<<<<<< @@ -4720,9 +4768,9 @@ static int __pyx_f_8_forward_13ForwardPasser_orthonormal_update(struct __pyx_obj __pyx_t_8 = ((PyArrayObject *)__pyx_v_self->norms); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_norms.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_norms.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_norms = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_norms.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_norms.diminfo[0].strides = __pyx_pybuffernd_norms.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_norms.diminfo[0].shape = __pyx_pybuffernd_norms.rcbuffer->pybuffer.shape[0]; } } @@ -4730,7 +4778,7 @@ static int __pyx_f_8_forward_13ForwardPasser_orthonormal_update(struct __pyx_obj __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->norms))); __pyx_v_norms = ((PyArrayObject *)__pyx_v_self->norms); - /* "_forward.pyx":155 + /* "sklearn/earth/_forward.pyx":157 * * #Get the original norm * nrm0 = 0.0 # <<<<<<<<<<<<<< @@ -4739,7 +4787,7 @@ static int __pyx_f_8_forward_13ForwardPasser_orthonormal_update(struct __pyx_obj */ __pyx_v_nrm0 = 0.0; - /* "_forward.pyx":156 + /* "sklearn/earth/_forward.pyx":158 * #Get the original norm * nrm0 = 0.0 * for i in range(self.m): # <<<<<<<<<<<<<< @@ -4750,7 +4798,7 @@ static int __pyx_f_8_forward_13ForwardPasser_orthonormal_update(struct __pyx_obj for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { __pyx_v_i = __pyx_t_10; - /* "_forward.pyx":157 + /* "sklearn/earth/_forward.pyx":159 * nrm0 = 0.0 * for i in range(self.m): * nrm0 += B_orth[i,k]*B_orth[i,k] # <<<<<<<<<<<<<< @@ -4761,10 +4809,10 @@ static int __pyx_f_8_forward_13ForwardPasser_orthonormal_update(struct __pyx_obj __pyx_t_12 = __pyx_v_k; __pyx_t_13 = __pyx_v_i; __pyx_t_14 = __pyx_v_k; - __pyx_v_nrm0 = (__pyx_v_nrm0 + ((*__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_B_orth.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_B_orth.diminfo[1].strides)))); + __pyx_v_nrm0 = (__pyx_v_nrm0 + ((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_B_orth.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_B_orth.diminfo[1].strides)))); } - /* "_forward.pyx":158 + /* "sklearn/earth/_forward.pyx":160 * for i in range(self.m): * nrm0 += B_orth[i,k]*B_orth[i,k] * nrm0 = sqrt(nrm0) # <<<<<<<<<<<<<< @@ -4773,17 +4821,17 @@ static int __pyx_f_8_forward_13ForwardPasser_orthonormal_update(struct __pyx_obj */ __pyx_v_nrm0 = sqrt(__pyx_v_nrm0); - /* "_forward.pyx":161 + /* "sklearn/earth/_forward.pyx":163 * * #Orthogonalize * if k > 0: # <<<<<<<<<<<<<< * for i in range(k): * dot_prod = 0.0 */ - __pyx_t_15 = (__pyx_v_k > 0); + __pyx_t_15 = ((__pyx_v_k > 0) != 0); if (__pyx_t_15) { - /* "_forward.pyx":162 + /* "sklearn/earth/_forward.pyx":164 * #Orthogonalize * if k > 0: * for i in range(k): # <<<<<<<<<<<<<< @@ -4794,7 +4842,7 @@ static int __pyx_f_8_forward_13ForwardPasser_orthonormal_update(struct __pyx_obj for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { __pyx_v_i = __pyx_t_10; - /* "_forward.pyx":163 + /* "sklearn/earth/_forward.pyx":165 * if k > 0: * for i in range(k): * dot_prod = 0.0 # <<<<<<<<<<<<<< @@ -4803,7 +4851,7 @@ static int __pyx_f_8_forward_13ForwardPasser_orthonormal_update(struct __pyx_obj */ __pyx_v_dot_prod = 0.0; - /* "_forward.pyx":164 + /* "sklearn/earth/_forward.pyx":166 * for i in range(k): * dot_prod = 0.0 * for j in range(self.m): # <<<<<<<<<<<<<< @@ -4814,7 +4862,7 @@ static int __pyx_f_8_forward_13ForwardPasser_orthonormal_update(struct __pyx_obj for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { __pyx_v_j = __pyx_t_17; - /* "_forward.pyx":165 + /* "sklearn/earth/_forward.pyx":167 * dot_prod = 0.0 * for j in range(self.m): * dot_prod += B_orth[j,k]*B_orth[j,i] # <<<<<<<<<<<<<< @@ -4825,10 +4873,10 @@ static int __pyx_f_8_forward_13ForwardPasser_orthonormal_update(struct __pyx_obj __pyx_t_19 = __pyx_v_k; __pyx_t_20 = __pyx_v_j; __pyx_t_21 = __pyx_v_i; - __pyx_v_dot_prod = (__pyx_v_dot_prod + ((*__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_B_orth.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_B_orth.diminfo[1].strides)))); + __pyx_v_dot_prod = (__pyx_v_dot_prod + ((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_B_orth.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_B_orth.diminfo[1].strides)))); } - /* "_forward.pyx":166 + /* "sklearn/earth/_forward.pyx":168 * for j in range(self.m): * dot_prod += B_orth[j,k]*B_orth[j,i] * for j in range(self.m): # <<<<<<<<<<<<<< @@ -4839,7 +4887,7 @@ static int __pyx_f_8_forward_13ForwardPasser_orthonormal_update(struct __pyx_obj for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { __pyx_v_j = __pyx_t_17; - /* "_forward.pyx":167 + /* "sklearn/earth/_forward.pyx":169 * dot_prod += B_orth[j,k]*B_orth[j,i] * for j in range(self.m): * B_orth[j,k] -= B_orth[j,i] * dot_prod # <<<<<<<<<<<<<< @@ -4850,14 +4898,14 @@ static int __pyx_f_8_forward_13ForwardPasser_orthonormal_update(struct __pyx_obj __pyx_t_23 = __pyx_v_i; __pyx_t_24 = __pyx_v_j; __pyx_t_25 = __pyx_v_k; - *__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_B_orth.diminfo[1].strides) -= ((*__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_B_orth.diminfo[1].strides)) * __pyx_v_dot_prod); + *__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_B_orth.diminfo[1].strides) -= ((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_B_orth.diminfo[1].strides)) * __pyx_v_dot_prod); } } goto __pyx_L5; } __pyx_L5:; - /* "_forward.pyx":170 + /* "sklearn/earth/_forward.pyx":172 * * #Normalize * nrm = 0.0 # <<<<<<<<<<<<<< @@ -4866,7 +4914,7 @@ static int __pyx_f_8_forward_13ForwardPasser_orthonormal_update(struct __pyx_obj */ __pyx_v_nrm = 0.0; - /* "_forward.pyx":171 + /* "sklearn/earth/_forward.pyx":173 * #Normalize * nrm = 0.0 * for i in range(self.m): # <<<<<<<<<<<<<< @@ -4877,7 +4925,7 @@ static int __pyx_f_8_forward_13ForwardPasser_orthonormal_update(struct __pyx_obj for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { __pyx_v_i = __pyx_t_10; - /* "_forward.pyx":172 + /* "sklearn/earth/_forward.pyx":174 * nrm = 0.0 * for i in range(self.m): * nrm += B_orth[i,k]*B_orth[i,k] # <<<<<<<<<<<<<< @@ -4888,10 +4936,10 @@ static int __pyx_f_8_forward_13ForwardPasser_orthonormal_update(struct __pyx_obj __pyx_t_17 = __pyx_v_k; __pyx_t_26 = __pyx_v_i; __pyx_t_27 = __pyx_v_k; - __pyx_v_nrm = (__pyx_v_nrm + ((*__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_B_orth.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_B_orth.diminfo[1].strides)))); + __pyx_v_nrm = (__pyx_v_nrm + ((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_B_orth.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_B_orth.diminfo[1].strides)))); } - /* "_forward.pyx":173 + /* "sklearn/earth/_forward.pyx":175 * for i in range(self.m): * nrm += B_orth[i,k]*B_orth[i,k] * nrm = sqrt(nrm) # <<<<<<<<<<<<<< @@ -4900,7 +4948,7 @@ static int __pyx_f_8_forward_13ForwardPasser_orthonormal_update(struct __pyx_obj */ __pyx_v_nrm = sqrt(__pyx_v_nrm); - /* "_forward.pyx":174 + /* "sklearn/earth/_forward.pyx":176 * nrm += B_orth[i,k]*B_orth[i,k] * nrm = sqrt(nrm) * norms[k] = nrm # <<<<<<<<<<<<<< @@ -4908,25 +4956,25 @@ static int __pyx_f_8_forward_13ForwardPasser_orthonormal_update(struct __pyx_obj * if nrm0 <= self.zero_tol or nrm/nrm0 <= self.zero_tol: */ __pyx_t_9 = __pyx_v_k; - *__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_norms.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_norms.diminfo[0].strides) = __pyx_v_nrm; + *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_norms.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_norms.diminfo[0].strides) = __pyx_v_nrm; - /* "_forward.pyx":176 + /* "sklearn/earth/_forward.pyx":178 * norms[k] = nrm * * if nrm0 <= self.zero_tol or nrm/nrm0 <= self.zero_tol: # <<<<<<<<<<<<<< * for i in range(self.m): * B_orth[i,k] = 0.0 */ - __pyx_t_15 = (__pyx_v_nrm0 <= __pyx_v_self->zero_tol); + __pyx_t_15 = ((__pyx_v_nrm0 <= __pyx_v_self->zero_tol) != 0); if (!__pyx_t_15) { - __pyx_t_28 = ((__pyx_v_nrm / __pyx_v_nrm0) <= __pyx_v_self->zero_tol); + __pyx_t_28 = (((__pyx_v_nrm / __pyx_v_nrm0) <= __pyx_v_self->zero_tol) != 0); __pyx_t_29 = __pyx_t_28; } else { __pyx_t_29 = __pyx_t_15; } if (__pyx_t_29) { - /* "_forward.pyx":177 + /* "sklearn/earth/_forward.pyx":179 * * if nrm0 <= self.zero_tol or nrm/nrm0 <= self.zero_tol: * for i in range(self.m): # <<<<<<<<<<<<<< @@ -4937,7 +4985,7 @@ static int __pyx_f_8_forward_13ForwardPasser_orthonormal_update(struct __pyx_obj for (__pyx_t_30 = 0; __pyx_t_30 < __pyx_t_10; __pyx_t_30+=1) { __pyx_v_i = __pyx_t_30; - /* "_forward.pyx":178 + /* "sklearn/earth/_forward.pyx":180 * if nrm0 <= self.zero_tol or nrm/nrm0 <= self.zero_tol: * for i in range(self.m): * B_orth[i,k] = 0.0 # <<<<<<<<<<<<<< @@ -4946,10 +4994,10 @@ static int __pyx_f_8_forward_13ForwardPasser_orthonormal_update(struct __pyx_obj */ __pyx_t_31 = __pyx_v_i; __pyx_t_32 = __pyx_v_k; - *__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_B_orth.diminfo[1].strides) = 0.0; + *__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_B_orth.diminfo[1].strides) = 0.0; } - /* "_forward.pyx":179 + /* "sklearn/earth/_forward.pyx":181 * for i in range(self.m): * B_orth[i,k] = 0.0 * c[k] = 0.0 # <<<<<<<<<<<<<< @@ -4957,9 +5005,9 @@ static int __pyx_f_8_forward_13ForwardPasser_orthonormal_update(struct __pyx_obj * for i in range(self.m): */ __pyx_t_10 = __pyx_v_k; - *__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_c.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_c.diminfo[0].strides) = 0.0; + *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_c.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_c.diminfo[0].strides) = 0.0; - /* "_forward.pyx":180 + /* "sklearn/earth/_forward.pyx":182 * B_orth[i,k] = 0.0 * c[k] = 0.0 * return 1 #The new column is in the column space of the previous columns # <<<<<<<<<<<<<< @@ -4972,7 +5020,7 @@ static int __pyx_f_8_forward_13ForwardPasser_orthonormal_update(struct __pyx_obj } __pyx_L14:; - /* "_forward.pyx":181 + /* "sklearn/earth/_forward.pyx":183 * c[k] = 0.0 * return 1 #The new column is in the column space of the previous columns * for i in range(self.m): # <<<<<<<<<<<<<< @@ -4983,7 +5031,7 @@ static int __pyx_f_8_forward_13ForwardPasser_orthonormal_update(struct __pyx_obj for (__pyx_t_33 = 0; __pyx_t_33 < __pyx_t_30; __pyx_t_33+=1) { __pyx_v_i = __pyx_t_33; - /* "_forward.pyx":182 + /* "sklearn/earth/_forward.pyx":184 * return 1 #The new column is in the column space of the previous columns * for i in range(self.m): * B_orth[i,k] /= nrm # <<<<<<<<<<<<<< @@ -4992,10 +5040,10 @@ static int __pyx_f_8_forward_13ForwardPasser_orthonormal_update(struct __pyx_obj */ __pyx_t_34 = __pyx_v_i; __pyx_t_35 = __pyx_v_k; - *__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_B_orth.diminfo[1].strides) /= __pyx_v_nrm; + *__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_B_orth.diminfo[1].strides) /= __pyx_v_nrm; } - /* "_forward.pyx":185 + /* "sklearn/earth/_forward.pyx":187 * * #Update c * c[k] = 0.0 # <<<<<<<<<<<<<< @@ -5003,9 +5051,9 @@ static int __pyx_f_8_forward_13ForwardPasser_orthonormal_update(struct __pyx_obj * c[k] += B_orth[i,k]*y[i] */ __pyx_t_30 = __pyx_v_k; - *__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_c.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_c.diminfo[0].strides) = 0.0; + *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_c.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_c.diminfo[0].strides) = 0.0; - /* "_forward.pyx":186 + /* "sklearn/earth/_forward.pyx":188 * #Update c * c[k] = 0.0 * for i in range(self.m): # <<<<<<<<<<<<<< @@ -5016,7 +5064,7 @@ static int __pyx_f_8_forward_13ForwardPasser_orthonormal_update(struct __pyx_obj for (__pyx_t_36 = 0; __pyx_t_36 < __pyx_t_33; __pyx_t_36+=1) { __pyx_v_i = __pyx_t_36; - /* "_forward.pyx":187 + /* "sklearn/earth/_forward.pyx":189 * c[k] = 0.0 * for i in range(self.m): * c[k] += B_orth[i,k]*y[i] # <<<<<<<<<<<<<< @@ -5027,10 +5075,10 @@ static int __pyx_f_8_forward_13ForwardPasser_orthonormal_update(struct __pyx_obj __pyx_t_38 = __pyx_v_k; __pyx_t_39 = __pyx_v_i; __pyx_t_40 = __pyx_v_k; - *__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_c.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_c.diminfo[0].strides) += ((*__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_38, __pyx_pybuffernd_B_orth.diminfo[1].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_y.diminfo[0].strides))); + *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_c.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_c.diminfo[0].strides) += ((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_38, __pyx_pybuffernd_B_orth.diminfo[1].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_y.diminfo[0].strides))); } - /* "_forward.pyx":188 + /* "sklearn/earth/_forward.pyx":190 * for i in range(self.m): * c[k] += B_orth[i,k]*y[i] * self.c_squared += c[k]**2 # <<<<<<<<<<<<<< @@ -5038,9 +5086,9 @@ static int __pyx_f_8_forward_13ForwardPasser_orthonormal_update(struct __pyx_obj * return 0 #No problems */ __pyx_t_33 = __pyx_v_k; - __pyx_v_self->c_squared = (__pyx_v_self->c_squared + pow((*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_c.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_c.diminfo[0].strides)), 2.0)); + __pyx_v_self->c_squared = (__pyx_v_self->c_squared + pow((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_c.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_c.diminfo[0].strides)), 2.0)); - /* "_forward.pyx":190 + /* "sklearn/earth/_forward.pyx":192 * self.c_squared += c[k]**2 * * return 0 #No problems # <<<<<<<<<<<<<< @@ -5063,7 +5111,7 @@ static int __pyx_f_8_forward_13ForwardPasser_orthonormal_update(struct __pyx_obj __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_norms.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_WriteUnraisable("_forward.ForwardPasser.orthonormal_update", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("sklearn.earth._forward.ForwardPasser.orthonormal_update", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; goto __pyx_L2; __pyx_L0:; @@ -5081,10 +5129,10 @@ static int __pyx_f_8_forward_13ForwardPasser_orthonormal_update(struct __pyx_obj } /* Python wrapper */ -static PyObject *__pyx_pw_8_forward_13ForwardPasser_11orthonormal_update(PyObject *__pyx_v_self, PyObject *__pyx_arg_k); /*proto*/ -static char __pyx_doc_8_forward_13ForwardPasser_10orthonormal_update[] = "Orthogonalize and normalize column k of B_orth against all previous columns of B_orth."; -static PyObject *__pyx_pw_8_forward_13ForwardPasser_11orthonormal_update(PyObject *__pyx_v_self, PyObject *__pyx_arg_k) { - __pyx_t_8_forward_INDEX_t __pyx_v_k; +static PyObject *__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_11orthonormal_update(PyObject *__pyx_v_self, PyObject *__pyx_arg_k); /*proto*/ +static char __pyx_doc_7sklearn_5earth_8_forward_13ForwardPasser_10orthonormal_update[] = "Orthogonalize and normalize column k of B_orth against all previous columns of B_orth."; +static PyObject *__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_11orthonormal_update(PyObject *__pyx_v_self, PyObject *__pyx_arg_k) { + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_v_k; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -5092,20 +5140,20 @@ static PyObject *__pyx_pw_8_forward_13ForwardPasser_11orthonormal_update(PyObjec __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("orthonormal_update (wrapper)", 0); assert(__pyx_arg_k); { - __pyx_v_k = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_arg_k); if (unlikely((__pyx_v_k == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_k = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_arg_k); if (unlikely((__pyx_v_k == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_forward.ForwardPasser.orthonormal_update", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._forward.ForwardPasser.orthonormal_update", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_forward_13ForwardPasser_10orthonormal_update(((struct __pyx_obj_8_forward_ForwardPasser *)__pyx_v_self), ((__pyx_t_8_forward_INDEX_t)__pyx_v_k)); + __pyx_r = __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_10orthonormal_update(((struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self), ((__pyx_t_7sklearn_5earth_8_forward_INDEX_t)__pyx_v_k)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_forward.pyx":138 +/* "sklearn/earth/_forward.pyx":140 * return False * * cpdef int orthonormal_update(ForwardPasser self, INDEX_t k): # <<<<<<<<<<<<<< @@ -5113,7 +5161,7 @@ static PyObject *__pyx_pw_8_forward_13ForwardPasser_11orthonormal_update(PyObjec * #Currently implemented using modified Gram-Schmidt process */ -static PyObject *__pyx_pf_8_forward_13ForwardPasser_10orthonormal_update(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self, __pyx_t_8_forward_INDEX_t __pyx_v_k) { +static PyObject *__pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_10orthonormal_update(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *__pyx_v_self, __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_v_k) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -5122,7 +5170,7 @@ static PyObject *__pyx_pf_8_forward_13ForwardPasser_10orthonormal_update(struct int __pyx_clineno = 0; __Pyx_RefNannySetupContext("orthonormal_update", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(((struct __pyx_vtabstruct_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_update(__pyx_v_self, __pyx_v_k, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_update(__pyx_v_self, __pyx_v_k, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -5132,7 +5180,7 @@ static PyObject *__pyx_pf_8_forward_13ForwardPasser_10orthonormal_update(struct goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_forward.ForwardPasser.orthonormal_update", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._forward.ForwardPasser.orthonormal_update", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -5140,7 +5188,7 @@ static PyObject *__pyx_pf_8_forward_13ForwardPasser_10orthonormal_update(struct return __pyx_r; } -/* "_forward.pyx":192 +/* "sklearn/earth/_forward.pyx":194 * return 0 #No problems * * cpdef orthonormal_downdate(ForwardPasser self, INDEX_t k): # <<<<<<<<<<<<<< @@ -5148,14 +5196,14 @@ static PyObject *__pyx_pf_8_forward_13ForwardPasser_10orthonormal_update(struct * Undo the effects of the last orthonormal update. You can only undo the last orthonormal update this way. */ -static PyObject *__pyx_pw_8_forward_13ForwardPasser_13orthonormal_downdate(PyObject *__pyx_v_self, PyObject *__pyx_arg_k); /*proto*/ -static PyObject *__pyx_f_8_forward_13ForwardPasser_orthonormal_downdate(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self, __pyx_t_8_forward_INDEX_t __pyx_v_k, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_13orthonormal_downdate(PyObject *__pyx_v_self, PyObject *__pyx_arg_k); /*proto*/ +static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_downdate(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *__pyx_v_self, __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_v_k, int __pyx_skip_dispatch) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - __pyx_t_8_forward_FLOAT_t __pyx_t_4; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -5164,18 +5212,18 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_orthonormal_downdate(struct _ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8_forward_13ForwardPasser_13orthonormal_downdate)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_13orthonormal_downdate)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; @@ -5186,25 +5234,25 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_orthonormal_downdate(struct _ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_forward.pyx":199 + /* "sklearn/earth/_forward.pyx":201 * can simply be ignored until they are overwritten). * ''' * self.c_squared -= self.c[k]**2 # <<<<<<<<<<<<<< * * def trace(self): */ - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->c_squared); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->c_squared); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->c), __pyx_v_k, sizeof(__pyx_t_8_forward_INDEX_t)+1, __Pyx_PyInt_to_py_npy_ulonglong, 0, 0, 0); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->c), __pyx_v_k, sizeof(__pyx_t_7sklearn_5earth_8_forward_INDEX_t)+1, __Pyx_PyInt_to_py_npy_ulonglong, 0, 0, 0); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Power(__pyx_t_2, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Power(__pyx_t_2, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_InPlaceSubtract(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_InPlaceSubtract(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_self->c_squared = __pyx_t_4; @@ -5214,7 +5262,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_orthonormal_downdate(struct _ __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_forward.ForwardPasser.orthonormal_downdate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._forward.ForwardPasser.orthonormal_downdate", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -5223,10 +5271,10 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_orthonormal_downdate(struct _ } /* Python wrapper */ -static PyObject *__pyx_pw_8_forward_13ForwardPasser_13orthonormal_downdate(PyObject *__pyx_v_self, PyObject *__pyx_arg_k); /*proto*/ -static char __pyx_doc_8_forward_13ForwardPasser_12orthonormal_downdate[] = "\n Undo the effects of the last orthonormal update. You can only undo the last orthonormal update this way.\n There will be no warning of any kind if you mess this up. You'll just get wrong answers.\n In reality, all this does is downdate c_squared (the elements of c and B_orth are left alone, since they\n can simply be ignored until they are overwritten).\n "; -static PyObject *__pyx_pw_8_forward_13ForwardPasser_13orthonormal_downdate(PyObject *__pyx_v_self, PyObject *__pyx_arg_k) { - __pyx_t_8_forward_INDEX_t __pyx_v_k; +static PyObject *__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_13orthonormal_downdate(PyObject *__pyx_v_self, PyObject *__pyx_arg_k); /*proto*/ +static char __pyx_doc_7sklearn_5earth_8_forward_13ForwardPasser_12orthonormal_downdate[] = "\n Undo the effects of the last orthonormal update. You can only undo the last orthonormal update this way.\n There will be no warning of any kind if you mess this up. You'll just get wrong answers.\n In reality, all this does is downdate c_squared (the elements of c and B_orth are left alone, since they\n can simply be ignored until they are overwritten).\n "; +static PyObject *__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_13orthonormal_downdate(PyObject *__pyx_v_self, PyObject *__pyx_arg_k) { + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_v_k; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -5234,20 +5282,20 @@ static PyObject *__pyx_pw_8_forward_13ForwardPasser_13orthonormal_downdate(PyObj __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("orthonormal_downdate (wrapper)", 0); assert(__pyx_arg_k); { - __pyx_v_k = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_arg_k); if (unlikely((__pyx_v_k == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_k = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_arg_k); if (unlikely((__pyx_v_k == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_forward.ForwardPasser.orthonormal_downdate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._forward.ForwardPasser.orthonormal_downdate", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_8_forward_13ForwardPasser_12orthonormal_downdate(((struct __pyx_obj_8_forward_ForwardPasser *)__pyx_v_self), ((__pyx_t_8_forward_INDEX_t)__pyx_v_k)); + __pyx_r = __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_12orthonormal_downdate(((struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self), ((__pyx_t_7sklearn_5earth_8_forward_INDEX_t)__pyx_v_k)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_forward.pyx":192 +/* "sklearn/earth/_forward.pyx":194 * return 0 #No problems * * cpdef orthonormal_downdate(ForwardPasser self, INDEX_t k): # <<<<<<<<<<<<<< @@ -5255,7 +5303,7 @@ static PyObject *__pyx_pw_8_forward_13ForwardPasser_13orthonormal_downdate(PyObj * Undo the effects of the last orthonormal update. You can only undo the last orthonormal update this way. */ -static PyObject *__pyx_pf_8_forward_13ForwardPasser_12orthonormal_downdate(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self, __pyx_t_8_forward_INDEX_t __pyx_v_k) { +static PyObject *__pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_12orthonormal_downdate(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *__pyx_v_self, __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_v_k) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -5264,7 +5312,7 @@ static PyObject *__pyx_pf_8_forward_13ForwardPasser_12orthonormal_downdate(struc int __pyx_clineno = 0; __Pyx_RefNannySetupContext("orthonormal_downdate", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_downdate(__pyx_v_self, __pyx_v_k, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_downdate(__pyx_v_self, __pyx_v_k, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -5274,7 +5322,7 @@ static PyObject *__pyx_pf_8_forward_13ForwardPasser_12orthonormal_downdate(struc goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_forward.ForwardPasser.orthonormal_downdate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._forward.ForwardPasser.orthonormal_downdate", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -5283,17 +5331,17 @@ static PyObject *__pyx_pf_8_forward_13ForwardPasser_12orthonormal_downdate(struc } /* Python wrapper */ -static PyObject *__pyx_pw_8_forward_13ForwardPasser_15trace(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_8_forward_13ForwardPasser_15trace(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_15trace(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_15trace(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("trace (wrapper)", 0); - __pyx_r = __pyx_pf_8_forward_13ForwardPasser_14trace(((struct __pyx_obj_8_forward_ForwardPasser *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_14trace(((struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_forward.pyx":201 +/* "sklearn/earth/_forward.pyx":203 * self.c_squared -= self.c[k]**2 * * def trace(self): # <<<<<<<<<<<<<< @@ -5301,12 +5349,12 @@ static PyObject *__pyx_pw_8_forward_13ForwardPasser_15trace(PyObject *__pyx_v_se * */ -static PyObject *__pyx_pf_8_forward_13ForwardPasser_14trace(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_14trace(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("trace", 0); - /* "_forward.pyx":202 + /* "sklearn/earth/_forward.pyx":204 * * def trace(self): * return self.record # <<<<<<<<<<<<<< @@ -5325,7 +5373,7 @@ static PyObject *__pyx_pf_8_forward_13ForwardPasser_14trace(struct __pyx_obj_8_f return __pyx_r; } -/* "_forward.pyx":204 +/* "sklearn/earth/_forward.pyx":206 * return self.record * * cdef next_pair(ForwardPasser self): # <<<<<<<<<<<<<< @@ -5333,33 +5381,33 @@ static PyObject *__pyx_pf_8_forward_13ForwardPasser_14trace(struct __pyx_obj_8_f * cdef INDEX_t parent_idx */ -static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self) { - __pyx_t_8_forward_INDEX_t __pyx_v_variable; - __pyx_t_8_forward_INDEX_t __pyx_v_parent_idx; - __pyx_t_8_forward_INDEX_t __pyx_v_parent_degree; - struct __pyx_obj_6_basis_BasisFunction *__pyx_v_parent = 0; +static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *__pyx_v_self) { + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_v_variable; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_v_parent_idx; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_v_parent_degree; + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_parent = 0; PyArrayObject *__pyx_v_candidates_idx = 0; - __pyx_t_8_forward_FLOAT_t __pyx_v_knot; - __pyx_t_8_forward_FLOAT_t __pyx_v_mse; - __pyx_t_8_forward_INDEX_t __pyx_v_knot_idx; - __pyx_t_8_forward_FLOAT_t __pyx_v_knot_choice; - __pyx_t_8_forward_FLOAT_t __pyx_v_mse_choice; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t __pyx_v_knot; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t __pyx_v_mse; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_v_knot_idx; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t __pyx_v_knot_choice; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t __pyx_v_mse_choice; int __pyx_v_knot_idx_choice; - __pyx_t_8_forward_INDEX_t __pyx_v_parent_idx_choice; - struct __pyx_obj_6_basis_BasisFunction *__pyx_v_parent_choice = 0; - __pyx_t_8_forward_INDEX_t __pyx_v_variable_choice; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_v_parent_idx_choice; + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_parent_choice = 0; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_v_variable_choice; int __pyx_v_first; - struct __pyx_obj_6_basis_BasisFunction *__pyx_v_bf1 = 0; - struct __pyx_obj_6_basis_BasisFunction *__pyx_v_bf2 = 0; - __pyx_t_8_forward_INDEX_t __pyx_v_k; - __pyx_t_8_forward_INDEX_t __pyx_v_endspan; + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_bf1 = 0; + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_bf2 = 0; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_v_k; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_v_endspan; int __pyx_v_linear_dependence; int __pyx_v_dependent; - __pyx_t_8_forward_FLOAT_t __pyx_v_gcv_factor_k_plus_1; - __pyx_t_8_forward_FLOAT_t __pyx_v_gcv_factor_k_plus_2; - __pyx_t_8_forward_FLOAT_t __pyx_v_gcv_; - __pyx_t_8_forward_FLOAT_t __pyx_v_mse_; - __pyx_t_8_forward_INDEX_t __pyx_v_i; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t __pyx_v_gcv_factor_k_plus_1; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t __pyx_v_gcv_factor_k_plus_2; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t __pyx_v_gcv_; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t __pyx_v_mse_; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_v_i; PyArrayObject *__pyx_v_X = 0; PyArrayObject *__pyx_v_B = 0; PyArrayObject *__pyx_v_B_orth = 0; @@ -5393,29 +5441,29 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ PyArrayObject *__pyx_t_8 = NULL; int __pyx_t_9; PyObject *__pyx_t_10 = NULL; - __pyx_t_8_forward_INDEX_t __pyx_t_11; - __pyx_t_8_forward_INDEX_t __pyx_t_12; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_11; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_12; PyObject *__pyx_t_13 = NULL; - __pyx_t_8_forward_INDEX_t __pyx_t_14; - __pyx_t_8_forward_INDEX_t __pyx_t_15; - __pyx_t_8_forward_INDEX_t __pyx_t_16; - __pyx_t_8_forward_INDEX_t __pyx_t_17; - __pyx_t_8_forward_INDEX_t __pyx_t_18; - __pyx_t_8_forward_INDEX_t __pyx_t_19; - __pyx_t_8_forward_INDEX_t __pyx_t_20; - __pyx_t_8_forward_INDEX_t __pyx_t_21; - __pyx_t_8_forward_INDEX_t __pyx_t_22; - __pyx_t_8_forward_INDEX_t __pyx_t_23; - __pyx_t_8_forward_INDEX_t __pyx_t_24; - __pyx_t_8_forward_INDEX_t __pyx_t_25; - __pyx_t_8_forward_INDEX_t __pyx_t_26; - __pyx_t_8_forward_INDEX_t __pyx_t_27; - __pyx_t_8_forward_INT_t __pyx_t_28; - PyObject *__pyx_t_29 = NULL; - int __pyx_t_30; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_14; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_15; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_16; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_17; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_18; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_19; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_20; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_21; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_22; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_23; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_24; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_25; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_26; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_27; + PyObject *__pyx_t_28 = NULL; + int __pyx_t_29; + PyObject *__pyx_t_30 = NULL; PyObject *__pyx_t_31 = NULL; PyObject *__pyx_t_32 = NULL; - PyObject *__pyx_t_33 = NULL; + Py_ssize_t __pyx_t_33; PyObject *__pyx_t_34 = NULL; int __pyx_t_35; int __pyx_t_36; @@ -5453,7 +5501,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ __pyx_pybuffernd_sorting.data = NULL; __pyx_pybuffernd_sorting.rcbuffer = &__pyx_pybuffer_sorting; - /* "_forward.pyx":220 + /* "sklearn/earth/_forward.pyx":222 * cdef BasisFunction parent_choice * cdef INDEX_t variable_choice * cdef bint first = True # <<<<<<<<<<<<<< @@ -5462,7 +5510,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ */ __pyx_v_first = 1; - /* "_forward.pyx":223 + /* "sklearn/earth/_forward.pyx":225 * cdef BasisFunction bf1 * cdef BasisFunction bf2 * cdef INDEX_t k = len(self.basis) # <<<<<<<<<<<<<< @@ -5471,29 +5519,29 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ */ __pyx_t_1 = ((PyObject *)__pyx_v_self->basis); __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_k = __pyx_t_2; - /* "_forward.pyx":227 + /* "sklearn/earth/_forward.pyx":229 * cdef bint linear_dependence * cdef bint dependent * cdef FLOAT_t gcv_factor_k_plus_1 = gcv_adjust(k+1,self.m,self.penalty) # <<<<<<<<<<<<<< * cdef FLOAT_t gcv_factor_k_plus_2 = gcv_adjust(k+2,self.m,self.penalty) * cdef FLOAT_t gcv_ */ - __pyx_v_gcv_factor_k_plus_1 = __pyx_f_5_util_gcv_adjust((__pyx_v_k + 1), __pyx_v_self->m, __pyx_v_self->penalty, 0); + __pyx_v_gcv_factor_k_plus_1 = __pyx_f_7sklearn_5earth_5_util_gcv_adjust((__pyx_v_k + 1), __pyx_v_self->m, __pyx_v_self->penalty, 0); - /* "_forward.pyx":228 + /* "sklearn/earth/_forward.pyx":230 * cdef bint dependent * cdef FLOAT_t gcv_factor_k_plus_1 = gcv_adjust(k+1,self.m,self.penalty) * cdef FLOAT_t gcv_factor_k_plus_2 = gcv_adjust(k+2,self.m,self.penalty) # <<<<<<<<<<<<<< * cdef FLOAT_t gcv_ * cdef FLOAT_t mse_ */ - __pyx_v_gcv_factor_k_plus_2 = __pyx_f_5_util_gcv_adjust((__pyx_v_k + 2), __pyx_v_self->m, __pyx_v_self->penalty, 0); + __pyx_v_gcv_factor_k_plus_2 = __pyx_f_7sklearn_5earth_5_util_gcv_adjust((__pyx_v_k + 2), __pyx_v_self->m, __pyx_v_self->penalty, 0); - /* "_forward.pyx":233 + /* "sklearn/earth/_forward.pyx":235 * cdef INDEX_t i * * cdef cnp.ndarray[FLOAT_t,ndim=2] X = self.X # <<<<<<<<<<<<<< @@ -5503,9 +5551,9 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ __pyx_t_3 = ((PyArrayObject *)__pyx_v_self->X); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { __pyx_v_X = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; } } @@ -5513,7 +5561,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->X))); __pyx_v_X = ((PyArrayObject *)__pyx_v_self->X); - /* "_forward.pyx":234 + /* "sklearn/earth/_forward.pyx":236 * * cdef cnp.ndarray[FLOAT_t,ndim=2] X = self.X * cdef cnp.ndarray[FLOAT_t,ndim=2] B = self.B # <<<<<<<<<<<<<< @@ -5523,9 +5571,9 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ __pyx_t_4 = ((PyArrayObject *)__pyx_v_self->B); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { __pyx_v_B = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_B.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_B.diminfo[0].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B.diminfo[0].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B.diminfo[1].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B.diminfo[1].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[1]; } } @@ -5533,7 +5581,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->B))); __pyx_v_B = ((PyArrayObject *)__pyx_v_self->B); - /* "_forward.pyx":235 + /* "sklearn/earth/_forward.pyx":237 * cdef cnp.ndarray[FLOAT_t,ndim=2] X = self.X * cdef cnp.ndarray[FLOAT_t,ndim=2] B = self.B * cdef cnp.ndarray[FLOAT_t,ndim=2] B_orth = self.B_orth # <<<<<<<<<<<<<< @@ -5543,9 +5591,9 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ __pyx_t_5 = ((PyArrayObject *)__pyx_v_self->B_orth); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B_orth.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B_orth.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { __pyx_v_B_orth = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_B_orth.diminfo[0].strides = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B_orth.diminfo[0].shape = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B_orth.diminfo[1].strides = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B_orth.diminfo[1].shape = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.shape[1]; } } @@ -5553,7 +5601,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->B_orth))); __pyx_v_B_orth = ((PyArrayObject *)__pyx_v_self->B_orth); - /* "_forward.pyx":236 + /* "sklearn/earth/_forward.pyx":238 * cdef cnp.ndarray[FLOAT_t,ndim=2] B = self.B * cdef cnp.ndarray[FLOAT_t,ndim=2] B_orth = self.B_orth * cdef cnp.ndarray[FLOAT_t,ndim=1] y = self.y # <<<<<<<<<<<<<< @@ -5563,9 +5611,9 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ __pyx_t_6 = ((PyArrayObject *)__pyx_v_self->y); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_y = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_y.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_y.diminfo[0].strides = __pyx_pybuffernd_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y.diminfo[0].shape = __pyx_pybuffernd_y.rcbuffer->pybuffer.shape[0]; } } @@ -5573,7 +5621,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->y))); __pyx_v_y = ((PyArrayObject *)__pyx_v_self->y); - /* "_forward.pyx":237 + /* "sklearn/earth/_forward.pyx":239 * cdef cnp.ndarray[FLOAT_t,ndim=2] B_orth = self.B_orth * cdef cnp.ndarray[FLOAT_t,ndim=1] y = self.y * cdef cnp.ndarray[INT_t,ndim=1] linear_variables = self.linear_variables # <<<<<<<<<<<<<< @@ -5583,9 +5631,9 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ __pyx_t_7 = ((PyArrayObject *)__pyx_v_self->linear_variables); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_linear_variables.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_linear_variables.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_linear_variables = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_linear_variables.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_linear_variables.diminfo[0].strides = __pyx_pybuffernd_linear_variables.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_linear_variables.diminfo[0].shape = __pyx_pybuffernd_linear_variables.rcbuffer->pybuffer.shape[0]; } } @@ -5593,7 +5641,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->linear_variables))); __pyx_v_linear_variables = ((PyArrayObject *)__pyx_v_self->linear_variables); - /* "_forward.pyx":238 + /* "sklearn/earth/_forward.pyx":240 * cdef cnp.ndarray[FLOAT_t,ndim=1] y = self.y * cdef cnp.ndarray[INT_t,ndim=1] linear_variables = self.linear_variables * cdef cnp.ndarray[INT_t,ndim=1] sorting = self.sorting # <<<<<<<<<<<<<< @@ -5603,9 +5651,9 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ __pyx_t_8 = ((PyArrayObject *)__pyx_v_self->sorting); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sorting.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sorting.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_sorting = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_sorting.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_sorting.diminfo[0].strides = __pyx_pybuffernd_sorting.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sorting.diminfo[0].shape = __pyx_pybuffernd_sorting.rcbuffer->pybuffer.shape[0]; } } @@ -5613,41 +5661,41 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->sorting))); __pyx_v_sorting = ((PyArrayObject *)__pyx_v_self->sorting); - /* "_forward.pyx":240 + /* "sklearn/earth/_forward.pyx":242 * cdef cnp.ndarray[INT_t,ndim=1] sorting = self.sorting * * if self.endspan < 0: # <<<<<<<<<<<<<< * endspan = round(3 - log2(self.endspan_alpha/self.n)) * */ - __pyx_t_9 = (__pyx_v_self->endspan < 0); + __pyx_t_9 = ((__pyx_v_self->endspan < 0) != 0); if (__pyx_t_9) { - /* "_forward.pyx":241 + /* "sklearn/earth/_forward.pyx":243 * * if self.endspan < 0: * endspan = round(3 - log2(self.endspan_alpha/self.n)) # <<<<<<<<<<<<<< * * #Iterate over variables */ - __pyx_t_1 = PyFloat_FromDouble((3.0 - __pyx_f_5_util_log2((__pyx_v_self->endspan_alpha / __pyx_v_self->n)))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble((3.0 - __pyx_f_7sklearn_5earth_5_util_log2((__pyx_v_self->endspan_alpha / __pyx_v_self->n)))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_round, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_round, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - __pyx_t_11 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_11 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_11 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_endspan = __pyx_t_11; goto __pyx_L3; } __pyx_L3:; - /* "_forward.pyx":244 + /* "sklearn/earth/_forward.pyx":246 * * #Iterate over variables * for variable in range(self.n): # <<<<<<<<<<<<<< @@ -5658,21 +5706,21 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { __pyx_v_variable = __pyx_t_12; - /* "_forward.pyx":247 + /* "sklearn/earth/_forward.pyx":249 * * #Sort the data * sorting[:] = np.argsort(X[:,variable])[::-1] #TODO: eliminate Python call / data copy # <<<<<<<<<<<<<< * * #Iterate over parents */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__argsort); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__argsort); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_INCREF(__pyx_k_slice_8); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_k_slice_8); @@ -5680,25 +5728,25 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_X), ((PyObject *)__pyx_t_13)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_X), ((PyObject *)__pyx_t_13)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; - __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; - __pyx_t_13 = PyObject_GetItem(__pyx_t_1, __pyx_k_slice_9); if (!__pyx_t_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyObject_GetItem(__pyx_t_1, __pyx_k_slice_9); if (!__pyx_t_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__Pyx_PyObject_SetSlice(((PyObject *)__pyx_v_sorting), __pyx_t_13, 0, 0, NULL, NULL, &__pyx_k_slice_10, 0, 0, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_PyObject_SetSlice(((PyObject *)__pyx_v_sorting), __pyx_t_13, 0, 0, NULL, NULL, &__pyx_k_slice_10, 0, 0, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - /* "_forward.pyx":250 + /* "sklearn/earth/_forward.pyx":252 * * #Iterate over parents * for parent_idx in range(k): # <<<<<<<<<<<<<< @@ -5709,7 +5757,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { __pyx_v_parent_idx = __pyx_t_15; - /* "_forward.pyx":251 + /* "sklearn/earth/_forward.pyx":253 * #Iterate over parents * for parent_idx in range(k): * linear_dependence = False # <<<<<<<<<<<<<< @@ -5718,49 +5766,49 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ */ __pyx_v_linear_dependence = 0; - /* "_forward.pyx":253 + /* "sklearn/earth/_forward.pyx":255 * linear_dependence = False * * parent = self.basis.get(parent_idx) # <<<<<<<<<<<<<< * if self.max_degree >= 0: * parent_degree = parent.degree() */ - __pyx_t_13 = ((PyObject *)((struct __pyx_vtabstruct_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->get(__pyx_v_self->basis, __pyx_v_parent_idx, 0)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->get(__pyx_v_self->basis, __pyx_v_parent_idx, 0)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_XDECREF(((PyObject *)__pyx_v_parent)); - __pyx_v_parent = ((struct __pyx_obj_6_basis_BasisFunction *)__pyx_t_13); + __pyx_v_parent = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_13); __pyx_t_13 = 0; - /* "_forward.pyx":254 + /* "sklearn/earth/_forward.pyx":256 * * parent = self.basis.get(parent_idx) * if self.max_degree >= 0: # <<<<<<<<<<<<<< * parent_degree = parent.degree() * if parent_degree >= self.max_degree: */ - __pyx_t_9 = (__pyx_v_self->max_degree >= 0); + __pyx_t_9 = ((__pyx_v_self->max_degree >= 0) != 0); if (__pyx_t_9) { - /* "_forward.pyx":255 + /* "sklearn/earth/_forward.pyx":257 * parent = self.basis.get(parent_idx) * if self.max_degree >= 0: * parent_degree = parent.degree() # <<<<<<<<<<<<<< * if parent_degree >= self.max_degree: * continue */ - __pyx_v_parent_degree = ((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_parent->__pyx_vtab)->degree(__pyx_v_parent, 0); + __pyx_v_parent_degree = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_parent->__pyx_vtab)->degree(__pyx_v_parent, 0); - /* "_forward.pyx":256 + /* "sklearn/earth/_forward.pyx":258 * if self.max_degree >= 0: * parent_degree = parent.degree() * if parent_degree >= self.max_degree: # <<<<<<<<<<<<<< * continue * if not parent.is_splittable(): */ - __pyx_t_9 = (__pyx_v_parent_degree >= __pyx_v_self->max_degree); + __pyx_t_9 = ((__pyx_v_parent_degree >= __pyx_v_self->max_degree) != 0); if (__pyx_t_9) { - /* "_forward.pyx":257 + /* "sklearn/earth/_forward.pyx":259 * parent_degree = parent.degree() * if parent_degree >= self.max_degree: * continue # <<<<<<<<<<<<<< @@ -5775,17 +5823,17 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ } __pyx_L8:; - /* "_forward.pyx":258 + /* "sklearn/earth/_forward.pyx":260 * if parent_degree >= self.max_degree: * continue * if not parent.is_splittable(): # <<<<<<<<<<<<<< * continue * */ - __pyx_t_9 = (!((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_parent->__pyx_vtab)->is_splittable(__pyx_v_parent, 0)); + __pyx_t_9 = ((!(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_parent->__pyx_vtab)->is_splittable(__pyx_v_parent, 0) != 0)) != 0); if (__pyx_t_9) { - /* "_forward.pyx":259 + /* "sklearn/earth/_forward.pyx":261 * continue * if not parent.is_splittable(): * continue # <<<<<<<<<<<<<< @@ -5797,7 +5845,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ } __pyx_L10:; - /* "_forward.pyx":262 + /* "sklearn/earth/_forward.pyx":264 * * #Add the linear term to B * for i in range(self.m): # <<<<<<<<<<<<<< @@ -5808,7 +5856,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { __pyx_v_i = __pyx_t_17; - /* "_forward.pyx":263 + /* "sklearn/earth/_forward.pyx":265 * #Add the linear term to B * for i in range(self.m): * B[i,k] = B[i,parent_idx]*X[i,variable] # <<<<<<<<<<<<<< @@ -5821,10 +5869,10 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ __pyx_t_21 = __pyx_v_variable; __pyx_t_22 = __pyx_v_i; __pyx_t_23 = __pyx_v_k; - *__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_B.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_B.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_B.diminfo[1].strides) = ((*__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_B.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_B.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_B.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_X.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_X.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_X.diminfo[1].strides))); + *__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_B.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_B.diminfo[1].strides) = ((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_B.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_B.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_X.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_X.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_X.diminfo[1].strides))); } - /* "_forward.pyx":266 + /* "sklearn/earth/_forward.pyx":268 * * #Orthonormalize * for i in range(self.m): # <<<<<<<<<<<<<< @@ -5835,7 +5883,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { __pyx_v_i = __pyx_t_17; - /* "_forward.pyx":267 + /* "sklearn/earth/_forward.pyx":269 * #Orthonormalize * for i in range(self.m): * B_orth[i,k] = B[i,k] # <<<<<<<<<<<<<< @@ -5846,19 +5894,19 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ __pyx_t_25 = __pyx_v_k; __pyx_t_26 = __pyx_v_i; __pyx_t_27 = __pyx_v_k; - *__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_B_orth.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_B.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_B.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_B.diminfo[1].strides)); + *__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_B_orth.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_B.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_B.diminfo[1].strides)); } - /* "_forward.pyx":268 + /* "sklearn/earth/_forward.pyx":270 * for i in range(self.m): * B_orth[i,k] = B[i,k] * linear_dependence = self.orthonormal_update(k) # <<<<<<<<<<<<<< * * #If a new hinge function does not improve the gcv over the linear term */ - __pyx_v_linear_dependence = ((struct __pyx_vtabstruct_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_update(__pyx_v_self, __pyx_v_k, 0); + __pyx_v_linear_dependence = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_update(__pyx_v_self, __pyx_v_k, 0); - /* "_forward.pyx":275 + /* "sklearn/earth/_forward.pyx":277 * #another term never increases, but the gcv may because it penalizes additional * #terms. * mse_ = (self.y_squared - self.c_squared) / self.m # <<<<<<<<<<<<<< @@ -5867,7 +5915,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ */ __pyx_v_mse_ = ((__pyx_v_self->y_squared - __pyx_v_self->c_squared) / __pyx_v_self->m); - /* "_forward.pyx":276 + /* "sklearn/earth/_forward.pyx":278 * #terms. * mse_ = (self.y_squared - self.c_squared) / self.m * gcv_ = gcv_factor_k_plus_1*(self.y_squared - self.c_squared) / self.m # <<<<<<<<<<<<<< @@ -5876,7 +5924,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ */ __pyx_v_gcv_ = ((__pyx_v_gcv_factor_k_plus_1 * (__pyx_v_self->y_squared - __pyx_v_self->c_squared)) / __pyx_v_self->m); - /* "_forward.pyx":278 + /* "sklearn/earth/_forward.pyx":280 * gcv_ = gcv_factor_k_plus_1*(self.y_squared - self.c_squared) / self.m * * if linear_variables[variable]: # <<<<<<<<<<<<<< @@ -5884,10 +5932,10 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ * knot_idx = -1 */ __pyx_t_16 = __pyx_v_variable; - __pyx_t_28 = (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_INT_t *, __pyx_pybuffernd_linear_variables.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_linear_variables.diminfo[0].strides)); - if (__pyx_t_28) { + __pyx_t_9 = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_INT_t *, __pyx_pybuffernd_linear_variables.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_linear_variables.diminfo[0].strides)) != 0); + if (__pyx_t_9) { - /* "_forward.pyx":279 + /* "sklearn/earth/_forward.pyx":281 * * if linear_variables[variable]: * mse = mse_ # <<<<<<<<<<<<<< @@ -5896,7 +5944,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ */ __pyx_v_mse = __pyx_v_mse_; - /* "_forward.pyx":280 + /* "sklearn/earth/_forward.pyx":282 * if linear_variables[variable]: * mse = mse_ * knot_idx = -1 # <<<<<<<<<<<<<< @@ -5908,16 +5956,16 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ } /*else*/ { - /* "_forward.pyx":284 + /* "sklearn/earth/_forward.pyx":286 * * #Find the valid knot candidates * candidates_idx = parent.valid_knots(B[sorting,parent_idx], X[sorting,variable], variable, self.check_every, endspan, self.minspan, self.minspan_alpha, self.n, self.mwork) # <<<<<<<<<<<<<< * * if len(candidates_idx) > 0: */ - __pyx_t_13 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_parent_idx); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_parent_idx); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_sorting)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_sorting)); @@ -5925,13 +5973,13 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_13); __Pyx_GIVEREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_1)); if (!__pyx_t_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_1)); if (!__pyx_t_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_13) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_13, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_13) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_13, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_INCREF(((PyObject *)__pyx_v_sorting)); PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_v_sorting)); @@ -5939,70 +5987,70 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_X), ((PyObject *)__pyx_t_10)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_X), ((PyObject *)__pyx_t_10)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_10 = ((PyObject *)__pyx_v_self->mwork); __Pyx_INCREF(__pyx_t_10); - __pyx_t_29 = ((PyObject *)((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_parent->__pyx_vtab)->valid_knots(__pyx_v_parent, ((PyArrayObject *)__pyx_t_13), ((PyArrayObject *)__pyx_t_1), __pyx_v_variable, __pyx_v_self->check_every, __pyx_v_endspan, __pyx_v_self->minspan, __pyx_v_self->minspan_alpha, __pyx_v_self->n, ((PyArrayObject *)__pyx_t_10), 0)); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_29); + __pyx_t_28 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_parent->__pyx_vtab)->valid_knots(__pyx_v_parent, ((PyArrayObject *)__pyx_t_13), ((PyArrayObject *)__pyx_t_1), __pyx_v_variable, __pyx_v_self->check_every, __pyx_v_endspan, __pyx_v_self->minspan, __pyx_v_self->minspan_alpha, __pyx_v_self->n, ((PyArrayObject *)__pyx_t_10), 0)); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_28); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; { __Pyx_BufFmt_StackElem __pyx_stack[1]; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_candidates_idx.rcbuffer->pybuffer); - __pyx_t_30 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_candidates_idx.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_29), &__Pyx_TypeInfo_nn___pyx_t_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_30 < 0)) { - PyErr_Fetch(&__pyx_t_31, &__pyx_t_32, &__pyx_t_33); - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_candidates_idx.rcbuffer->pybuffer, (PyObject*)__pyx_v_candidates_idx, &__Pyx_TypeInfo_nn___pyx_t_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_31); Py_XDECREF(__pyx_t_32); Py_XDECREF(__pyx_t_33); + __pyx_t_29 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_candidates_idx.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_28), &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); + if (unlikely(__pyx_t_29 < 0)) { + PyErr_Fetch(&__pyx_t_30, &__pyx_t_31, &__pyx_t_32); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_candidates_idx.rcbuffer->pybuffer, (PyObject*)__pyx_v_candidates_idx, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_30); Py_XDECREF(__pyx_t_31); Py_XDECREF(__pyx_t_32); __Pyx_RaiseBufferFallbackError(); } else { - PyErr_Restore(__pyx_t_31, __pyx_t_32, __pyx_t_33); + PyErr_Restore(__pyx_t_30, __pyx_t_31, __pyx_t_32); } } __pyx_pybuffernd_candidates_idx.diminfo[0].strides = __pyx_pybuffernd_candidates_idx.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_candidates_idx.diminfo[0].shape = __pyx_pybuffernd_candidates_idx.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_30 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_29 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_XDECREF(((PyObject *)__pyx_v_candidates_idx)); - __pyx_v_candidates_idx = ((PyArrayObject *)__pyx_t_29); - __pyx_t_29 = 0; + __pyx_v_candidates_idx = ((PyArrayObject *)__pyx_t_28); + __pyx_t_28 = 0; - /* "_forward.pyx":286 + /* "sklearn/earth/_forward.pyx":288 * candidates_idx = parent.valid_knots(B[sorting,parent_idx], X[sorting,variable], variable, self.check_every, endspan, self.minspan, self.minspan_alpha, self.n, self.mwork) * * if len(candidates_idx) > 0: # <<<<<<<<<<<<<< * #Choose the best candidate (if no candidate is an improvement on the linear term in terms of gcv, knot_idx is set to -1 * */ - __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_candidates_idx)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_9 = (__pyx_t_2 > 0); + __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_candidates_idx)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = ((__pyx_t_2 > 0) != 0); if (__pyx_t_9) { - /* "_forward.pyx":290 + /* "sklearn/earth/_forward.pyx":292 * * #Find the best knot location for this parent and variable combination * self.best_knot(parent_idx,variable,k,candidates_idx,sorting,&mse,&knot,&knot_idx) # <<<<<<<<<<<<<< * * #If the hinge function does not decrease the gcv then just keep the linear term */ - __pyx_t_29 = ((struct __pyx_vtabstruct_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->best_knot(__pyx_v_self, __pyx_v_parent_idx, __pyx_v_variable, __pyx_v_k, ((PyArrayObject *)__pyx_v_candidates_idx), ((PyArrayObject *)__pyx_v_sorting), (&__pyx_v_mse), (&__pyx_v_knot), (&__pyx_v_knot_idx)); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_29); - __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; + __pyx_t_28 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->best_knot(__pyx_v_self, __pyx_v_parent_idx, __pyx_v_variable, __pyx_v_k, ((PyArrayObject *)__pyx_v_candidates_idx), ((PyArrayObject *)__pyx_v_sorting), (&__pyx_v_mse), (&__pyx_v_knot), (&__pyx_v_knot_idx)); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_28); + __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; - /* "_forward.pyx":293 + /* "sklearn/earth/_forward.pyx":295 * * #If the hinge function does not decrease the gcv then just keep the linear term * if gcv_factor_k_plus_2*mse >= gcv_: # <<<<<<<<<<<<<< * mse = mse_ * knot_idx = -1 */ - __pyx_t_9 = ((__pyx_v_gcv_factor_k_plus_2 * __pyx_v_mse) >= __pyx_v_gcv_); + __pyx_t_9 = (((__pyx_v_gcv_factor_k_plus_2 * __pyx_v_mse) >= __pyx_v_gcv_) != 0); if (__pyx_t_9) { - /* "_forward.pyx":294 + /* "sklearn/earth/_forward.pyx":296 * #If the hinge function does not decrease the gcv then just keep the linear term * if gcv_factor_k_plus_2*mse >= gcv_: * mse = mse_ # <<<<<<<<<<<<<< @@ -6011,7 +6059,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ */ __pyx_v_mse = __pyx_v_mse_; - /* "_forward.pyx":295 + /* "sklearn/earth/_forward.pyx":297 * if gcv_factor_k_plus_2*mse >= gcv_: * mse = mse_ * knot_idx = -1 # <<<<<<<<<<<<<< @@ -6026,18 +6074,18 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ } /*else*/ { - /* "_forward.pyx":299 + /* "sklearn/earth/_forward.pyx":301 * else: * #Do an orthonormal downdate and skip to the next iteration * self.orthonormal_downdate(k) # <<<<<<<<<<<<<< * continue * */ - __pyx_t_29 = ((struct __pyx_vtabstruct_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_downdate(__pyx_v_self, __pyx_v_k, 0); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_29); - __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; + __pyx_t_28 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_downdate(__pyx_v_self, __pyx_v_k, 0); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_28); + __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; - /* "_forward.pyx":300 + /* "sklearn/earth/_forward.pyx":302 * #Do an orthonormal downdate and skip to the next iteration * self.orthonormal_downdate(k) * continue # <<<<<<<<<<<<<< @@ -6050,27 +6098,28 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ } __pyx_L15:; - /* "_forward.pyx":303 + /* "sklearn/earth/_forward.pyx":305 * * #Do an orthonormal downdate * self.orthonormal_downdate(k) # <<<<<<<<<<<<<< * * #Update the choices */ - __pyx_t_29 = ((struct __pyx_vtabstruct_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_downdate(__pyx_v_self, __pyx_v_k, 0); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_29); - __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; + __pyx_t_28 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_downdate(__pyx_v_self, __pyx_v_k, 0); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_28); + __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; - /* "_forward.pyx":306 + /* "sklearn/earth/_forward.pyx":308 * * #Update the choices * if first: # <<<<<<<<<<<<<< * knot_choice = knot * mse_choice = mse */ - if (__pyx_v_first) { + __pyx_t_9 = (__pyx_v_first != 0); + if (__pyx_t_9) { - /* "_forward.pyx":307 + /* "sklearn/earth/_forward.pyx":309 * #Update the choices * if first: * knot_choice = knot # <<<<<<<<<<<<<< @@ -6079,7 +6128,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ */ __pyx_v_knot_choice = __pyx_v_knot; - /* "_forward.pyx":308 + /* "sklearn/earth/_forward.pyx":310 * if first: * knot_choice = knot * mse_choice = mse # <<<<<<<<<<<<<< @@ -6088,7 +6137,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ */ __pyx_v_mse_choice = __pyx_v_mse; - /* "_forward.pyx":309 + /* "sklearn/earth/_forward.pyx":311 * knot_choice = knot * mse_choice = mse * knot_idx_choice = knot_idx # <<<<<<<<<<<<<< @@ -6097,7 +6146,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ */ __pyx_v_knot_idx_choice = __pyx_v_knot_idx; - /* "_forward.pyx":310 + /* "sklearn/earth/_forward.pyx":312 * mse_choice = mse * knot_idx_choice = knot_idx * parent_idx_choice = parent_idx # <<<<<<<<<<<<<< @@ -6106,7 +6155,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ */ __pyx_v_parent_idx_choice = __pyx_v_parent_idx; - /* "_forward.pyx":311 + /* "sklearn/earth/_forward.pyx":313 * knot_idx_choice = knot_idx * parent_idx_choice = parent_idx * parent_choice = parent # <<<<<<<<<<<<<< @@ -6117,7 +6166,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ __Pyx_XDECREF(((PyObject *)__pyx_v_parent_choice)); __pyx_v_parent_choice = __pyx_v_parent; - /* "_forward.pyx":312 + /* "sklearn/earth/_forward.pyx":314 * parent_idx_choice = parent_idx * parent_choice = parent * variable_choice = variable # <<<<<<<<<<<<<< @@ -6126,7 +6175,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ */ __pyx_v_variable_choice = __pyx_v_variable; - /* "_forward.pyx":313 + /* "sklearn/earth/_forward.pyx":315 * parent_choice = parent * variable_choice = variable * first = False # <<<<<<<<<<<<<< @@ -6135,7 +6184,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ */ __pyx_v_first = 0; - /* "_forward.pyx":314 + /* "sklearn/earth/_forward.pyx":316 * variable_choice = variable * first = False * dependent = linear_dependence # <<<<<<<<<<<<<< @@ -6147,17 +6196,17 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ } __pyx_L18:; - /* "_forward.pyx":315 + /* "sklearn/earth/_forward.pyx":317 * first = False * dependent = linear_dependence * if mse < mse_choice: # <<<<<<<<<<<<<< * knot_choice = knot * mse_choice = mse */ - __pyx_t_9 = (__pyx_v_mse < __pyx_v_mse_choice); + __pyx_t_9 = ((__pyx_v_mse < __pyx_v_mse_choice) != 0); if (__pyx_t_9) { - /* "_forward.pyx":316 + /* "sklearn/earth/_forward.pyx":318 * dependent = linear_dependence * if mse < mse_choice: * knot_choice = knot # <<<<<<<<<<<<<< @@ -6166,7 +6215,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ */ __pyx_v_knot_choice = __pyx_v_knot; - /* "_forward.pyx":317 + /* "sklearn/earth/_forward.pyx":319 * if mse < mse_choice: * knot_choice = knot * mse_choice = mse # <<<<<<<<<<<<<< @@ -6175,7 +6224,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ */ __pyx_v_mse_choice = __pyx_v_mse; - /* "_forward.pyx":318 + /* "sklearn/earth/_forward.pyx":320 * knot_choice = knot * mse_choice = mse * knot_idx_choice = knot_idx # <<<<<<<<<<<<<< @@ -6184,7 +6233,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ */ __pyx_v_knot_idx_choice = __pyx_v_knot_idx; - /* "_forward.pyx":319 + /* "sklearn/earth/_forward.pyx":321 * mse_choice = mse * knot_idx_choice = knot_idx * parent_idx_choice = parent_idx # <<<<<<<<<<<<<< @@ -6193,7 +6242,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ */ __pyx_v_parent_idx_choice = __pyx_v_parent_idx; - /* "_forward.pyx":320 + /* "sklearn/earth/_forward.pyx":322 * knot_idx_choice = knot_idx * parent_idx_choice = parent_idx * parent_choice = parent # <<<<<<<<<<<<<< @@ -6204,7 +6253,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ __Pyx_XDECREF(((PyObject *)__pyx_v_parent_choice)); __pyx_v_parent_choice = __pyx_v_parent; - /* "_forward.pyx":321 + /* "sklearn/earth/_forward.pyx":323 * parent_idx_choice = parent_idx * parent_choice = parent * variable_choice = variable # <<<<<<<<<<<<<< @@ -6213,7 +6262,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ */ __pyx_v_variable_choice = __pyx_v_variable; - /* "_forward.pyx":322 + /* "sklearn/earth/_forward.pyx":324 * parent_choice = parent * variable_choice = variable * dependent = linear_dependence # <<<<<<<<<<<<<< @@ -6228,43 +6277,49 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ } } - /* "_forward.pyx":325 + /* "sklearn/earth/_forward.pyx":327 * * #Make sure at least one candidate was checked * if first: # <<<<<<<<<<<<<< - * self.record[-1].set_no_candidates(True) + * self.record[len(self.record) - 1].set_no_candidates(True) * return */ - if (__pyx_v_first) { + __pyx_t_9 = (__pyx_v_first != 0); + if (__pyx_t_9) { - /* "_forward.pyx":326 + /* "sklearn/earth/_forward.pyx":328 * #Make sure at least one candidate was checked * if first: - * self.record[-1].set_no_candidates(True) # <<<<<<<<<<<<<< + * self.record[len(self.record) - 1].set_no_candidates(True) # <<<<<<<<<<<<<< * return * */ - __pyx_t_29 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->record), -1, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_29) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_29); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_29, __pyx_n_s__set_no_candidates); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = ((PyObject *)__pyx_v_self->record); + __Pyx_INCREF(__pyx_t_28); + __pyx_t_2 = PyObject_Length(__pyx_t_28); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; + __pyx_t_33 = (__pyx_t_2 - 1); + __pyx_t_28 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->record), __pyx_t_33, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 0, 0); if (!__pyx_t_28) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_28); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_28, __pyx_n_s__set_no_candidates); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; - __pyx_t_29 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_29); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; + __pyx_t_28 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_28); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_29); - __Pyx_GIVEREF(__pyx_t_29); - __pyx_t_29 = 0; - __pyx_t_29 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_29); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_28); + __Pyx_GIVEREF(__pyx_t_28); + __pyx_t_28 = 0; + __pyx_t_28 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_28); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; + __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; - /* "_forward.pyx":327 + /* "sklearn/earth/_forward.pyx":329 * if first: - * self.record[-1].set_no_candidates(True) + * self.record[len(self.record) - 1].set_no_candidates(True) * return # <<<<<<<<<<<<<< * * #Add the new basis functions @@ -6276,20 +6331,20 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ } __pyx_L20:; - /* "_forward.pyx":330 + /* "sklearn/earth/_forward.pyx":332 * * #Add the new basis functions * parent = self.basis.get(parent_idx) # <<<<<<<<<<<<<< * label = self.xlabels[variable_choice] * if knot_idx_choice != -1: */ - __pyx_t_29 = ((PyObject *)((struct __pyx_vtabstruct_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->get(__pyx_v_self->basis, __pyx_v_parent_idx, 0)); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_29); + __pyx_t_28 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->get(__pyx_v_self->basis, __pyx_v_parent_idx, 0)); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_28); __Pyx_XDECREF(((PyObject *)__pyx_v_parent)); - __pyx_v_parent = ((struct __pyx_obj_6_basis_BasisFunction *)__pyx_t_29); - __pyx_t_29 = 0; + __pyx_v_parent = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_28); + __pyx_t_28 = 0; - /* "_forward.pyx":331 + /* "sklearn/earth/_forward.pyx":333 * #Add the new basis functions * parent = self.basis.get(parent_idx) * label = self.xlabels[variable_choice] # <<<<<<<<<<<<<< @@ -6298,46 +6353,46 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ */ if (unlikely(((PyObject *)__pyx_v_self->xlabels) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_29 = PyList_GET_ITEM(__pyx_v_self->xlabels, __pyx_v_variable_choice); - __Pyx_INCREF(__pyx_t_29); - __pyx_v_label = __pyx_t_29; - __pyx_t_29 = 0; + __pyx_t_28 = PyList_GET_ITEM(__pyx_v_self->xlabels, __pyx_v_variable_choice); + __Pyx_INCREF(__pyx_t_28); + __pyx_v_label = __pyx_t_28; + __pyx_t_28 = 0; - /* "_forward.pyx":332 + /* "sklearn/earth/_forward.pyx":334 * parent = self.basis.get(parent_idx) * label = self.xlabels[variable_choice] * if knot_idx_choice != -1: # <<<<<<<<<<<<<< * #Add the new basis functions * bf1 = HingeBasisFunction(parent_choice,knot_choice,knot_idx_choice,variable_choice,False,label) */ - __pyx_t_9 = (__pyx_v_knot_idx_choice != -1); + __pyx_t_9 = ((__pyx_v_knot_idx_choice != -1) != 0); if (__pyx_t_9) { - /* "_forward.pyx":334 + /* "sklearn/earth/_forward.pyx":336 * if knot_idx_choice != -1: * #Add the new basis functions * bf1 = HingeBasisFunction(parent_choice,knot_choice,knot_idx_choice,variable_choice,False,label) # <<<<<<<<<<<<<< * bf2 = HingeBasisFunction(parent_choice,knot_choice,knot_idx_choice,variable_choice,True,label) * bf1.apply(X,B[:,k]) */ - if (unlikely(!__pyx_v_parent_choice)) { __Pyx_RaiseUnboundLocalError("parent_choice"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_29 = PyFloat_FromDouble(__pyx_v_knot_choice); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_29); - __pyx_t_1 = PyInt_FromLong(__pyx_v_knot_idx_choice); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_v_parent_choice)) { __Pyx_RaiseUnboundLocalError("parent_choice"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_28 = PyFloat_FromDouble(__pyx_v_knot_choice); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_28); + __pyx_t_1 = PyInt_FromLong(__pyx_v_knot_idx_choice); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable_choice); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable_choice); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_13 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); - __pyx_t_34 = PyTuple_New(6); if (unlikely(!__pyx_t_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_34 = PyTuple_New(6); if (unlikely(!__pyx_t_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_34); __Pyx_INCREF(((PyObject *)__pyx_v_parent_choice)); PyTuple_SET_ITEM(__pyx_t_34, 0, ((PyObject *)__pyx_v_parent_choice)); __Pyx_GIVEREF(((PyObject *)__pyx_v_parent_choice)); - PyTuple_SET_ITEM(__pyx_t_34, 1, __pyx_t_29); - __Pyx_GIVEREF(__pyx_t_29); + PyTuple_SET_ITEM(__pyx_t_34, 1, __pyx_t_28); + __Pyx_GIVEREF(__pyx_t_28); PyTuple_SET_ITEM(__pyx_t_34, 2, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_34, 3, __pyx_t_10); @@ -6347,197 +6402,197 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ __Pyx_INCREF(__pyx_v_label); PyTuple_SET_ITEM(__pyx_t_34, 5, __pyx_v_label); __Pyx_GIVEREF(__pyx_v_label); - __pyx_t_29 = 0; + __pyx_t_28 = 0; __pyx_t_1 = 0; __pyx_t_10 = 0; __pyx_t_13 = 0; - __pyx_t_13 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6_basis_HingeBasisFunction)), ((PyObject *)__pyx_t_34), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_HingeBasisFunction)), ((PyObject *)__pyx_t_34), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(((PyObject *)__pyx_t_34)); __pyx_t_34 = 0; - __pyx_v_bf1 = ((struct __pyx_obj_6_basis_BasisFunction *)__pyx_t_13); + __pyx_v_bf1 = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_13); __pyx_t_13 = 0; - /* "_forward.pyx":335 + /* "sklearn/earth/_forward.pyx":337 * #Add the new basis functions * bf1 = HingeBasisFunction(parent_choice,knot_choice,knot_idx_choice,variable_choice,False,label) * bf2 = HingeBasisFunction(parent_choice,knot_choice,knot_idx_choice,variable_choice,True,label) # <<<<<<<<<<<<<< * bf1.apply(X,B[:,k]) * bf2.apply(X,B[:,k+1]) */ - __pyx_t_13 = PyFloat_FromDouble(__pyx_v_knot_choice); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyFloat_FromDouble(__pyx_v_knot_choice); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); - __pyx_t_34 = PyInt_FromLong(__pyx_v_knot_idx_choice); if (unlikely(!__pyx_t_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_34 = PyInt_FromLong(__pyx_v_knot_idx_choice); if (unlikely(!__pyx_t_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_34); - __pyx_t_10 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable_choice); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable_choice); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_29 = PyTuple_New(6); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_29); + __pyx_t_28 = PyTuple_New(6); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_28); __Pyx_INCREF(((PyObject *)__pyx_v_parent_choice)); - PyTuple_SET_ITEM(__pyx_t_29, 0, ((PyObject *)__pyx_v_parent_choice)); + PyTuple_SET_ITEM(__pyx_t_28, 0, ((PyObject *)__pyx_v_parent_choice)); __Pyx_GIVEREF(((PyObject *)__pyx_v_parent_choice)); - PyTuple_SET_ITEM(__pyx_t_29, 1, __pyx_t_13); + PyTuple_SET_ITEM(__pyx_t_28, 1, __pyx_t_13); __Pyx_GIVEREF(__pyx_t_13); - PyTuple_SET_ITEM(__pyx_t_29, 2, __pyx_t_34); + PyTuple_SET_ITEM(__pyx_t_28, 2, __pyx_t_34); __Pyx_GIVEREF(__pyx_t_34); - PyTuple_SET_ITEM(__pyx_t_29, 3, __pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_28, 3, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_29, 4, __pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_28, 4, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_label); - PyTuple_SET_ITEM(__pyx_t_29, 5, __pyx_v_label); + PyTuple_SET_ITEM(__pyx_t_28, 5, __pyx_v_label); __Pyx_GIVEREF(__pyx_v_label); __pyx_t_13 = 0; __pyx_t_34 = 0; __pyx_t_10 = 0; __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6_basis_HingeBasisFunction)), ((PyObject *)__pyx_t_29), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 335; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_HingeBasisFunction)), ((PyObject *)__pyx_t_28), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_29)); __pyx_t_29 = 0; - __pyx_v_bf2 = ((struct __pyx_obj_6_basis_BasisFunction *)__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_28)); __pyx_t_28 = 0; + __pyx_v_bf2 = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_1); __pyx_t_1 = 0; - /* "_forward.pyx":336 + /* "sklearn/earth/_forward.pyx":338 * bf1 = HingeBasisFunction(parent_choice,knot_choice,knot_idx_choice,variable_choice,False,label) * bf2 = HingeBasisFunction(parent_choice,knot_choice,knot_idx_choice,variable_choice,True,label) * bf1.apply(X,B[:,k]) # <<<<<<<<<<<<<< * bf2.apply(X,B[:,k+1]) * self.basis.append(bf1) */ - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_29 = PyTuple_New(2); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_29); + __pyx_t_28 = PyTuple_New(2); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_28); __Pyx_INCREF(__pyx_k_slice_11); - PyTuple_SET_ITEM(__pyx_t_29, 0, __pyx_k_slice_11); + PyTuple_SET_ITEM(__pyx_t_28, 0, __pyx_k_slice_11); __Pyx_GIVEREF(__pyx_k_slice_11); - PyTuple_SET_ITEM(__pyx_t_29, 1, __pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_28, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_29)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_28)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_29)); __pyx_t_29 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_29 = ((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_bf1->__pyx_vtab)->apply(__pyx_v_bf1, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_t_1), 0, NULL); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_29); + __Pyx_DECREF(((PyObject *)__pyx_t_28)); __pyx_t_28 = 0; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_bf1->__pyx_vtab)->apply(__pyx_v_bf1, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_t_1), 0, NULL); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_28); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; + __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; - /* "_forward.pyx":337 + /* "sklearn/earth/_forward.pyx":339 * bf2 = HingeBasisFunction(parent_choice,knot_choice,knot_idx_choice,variable_choice,True,label) * bf1.apply(X,B[:,k]) * bf2.apply(X,B[:,k+1]) # <<<<<<<<<<<<<< * self.basis.append(bf1) * self.basis.append(bf2) */ - __pyx_t_29 = __Pyx_PyInt_to_py_npy_ulonglong((__pyx_v_k + 1)); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_29); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = __Pyx_PyInt_to_py_npy_ulonglong((__pyx_v_k + 1)); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_28); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_k_slice_12); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_k_slice_12); __Pyx_GIVEREF(__pyx_k_slice_12); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_29); - __Pyx_GIVEREF(__pyx_t_29); - __pyx_t_29 = 0; - __pyx_t_29 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_1)); if (!__pyx_t_29) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_29); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_28); + __Pyx_GIVEREF(__pyx_t_28); + __pyx_t_28 = 0; + __pyx_t_28 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_1)); if (!__pyx_t_28) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_28); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_29) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_29, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_bf2->__pyx_vtab)->apply(__pyx_v_bf2, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_t_29), 0, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_28) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_28, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_bf2->__pyx_vtab)->apply(__pyx_v_bf2, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_t_28), 0, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; + __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "_forward.pyx":338 + /* "sklearn/earth/_forward.pyx":340 * bf1.apply(X,B[:,k]) * bf2.apply(X,B[:,k+1]) * self.basis.append(bf1) # <<<<<<<<<<<<<< * self.basis.append(bf2) * */ - __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->append(__pyx_v_self->basis, __pyx_v_bf1, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->append(__pyx_v_self->basis, __pyx_v_bf1, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "_forward.pyx":339 + /* "sklearn/earth/_forward.pyx":341 * bf2.apply(X,B[:,k+1]) * self.basis.append(bf1) * self.basis.append(bf2) # <<<<<<<<<<<<<< * * #Orthogonalize the new basis */ - __pyx_t_1 = ((struct __pyx_vtabstruct_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->append(__pyx_v_self->basis, __pyx_v_bf2, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->append(__pyx_v_self->basis, __pyx_v_bf2, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "_forward.pyx":342 + /* "sklearn/earth/_forward.pyx":344 * * #Orthogonalize the new basis * B_orth[:,k] = B[:,k] # <<<<<<<<<<<<<< * if self.orthonormal_update(k) == 1: * bf1.make_unsplittable() */ - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_29 = PyTuple_New(2); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_29); + __pyx_t_28 = PyTuple_New(2); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_28); __Pyx_INCREF(__pyx_k_slice_13); - PyTuple_SET_ITEM(__pyx_t_29, 0, __pyx_k_slice_13); + PyTuple_SET_ITEM(__pyx_t_28, 0, __pyx_k_slice_13); __Pyx_GIVEREF(__pyx_k_slice_13); - PyTuple_SET_ITEM(__pyx_t_29, 1, __pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_28, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_29)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_28)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_29)); __pyx_t_29 = 0; - __pyx_t_29 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_29); - __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_28)); __pyx_t_28 = 0; + __pyx_t_28 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_28); + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_INCREF(__pyx_k_slice_14); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_k_slice_14); __Pyx_GIVEREF(__pyx_k_slice_14); - PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_29); - __Pyx_GIVEREF(__pyx_t_29); - __pyx_t_29 = 0; - if (PyObject_SetItem(((PyObject *)__pyx_v_B_orth), ((PyObject *)__pyx_t_10), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_28); + __Pyx_GIVEREF(__pyx_t_28); + __pyx_t_28 = 0; + if (PyObject_SetItem(((PyObject *)__pyx_v_B_orth), ((PyObject *)__pyx_t_10), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "_forward.pyx":343 + /* "sklearn/earth/_forward.pyx":345 * #Orthogonalize the new basis * B_orth[:,k] = B[:,k] * if self.orthonormal_update(k) == 1: # <<<<<<<<<<<<<< * bf1.make_unsplittable() * B_orth[:,k+1] = B[:,k+1] */ - __pyx_t_9 = (((struct __pyx_vtabstruct_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_update(__pyx_v_self, __pyx_v_k, 0) == 1); + __pyx_t_9 = ((((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_update(__pyx_v_self, __pyx_v_k, 0) == 1) != 0); if (__pyx_t_9) { - /* "_forward.pyx":344 + /* "sklearn/earth/_forward.pyx":346 * B_orth[:,k] = B[:,k] * if self.orthonormal_update(k) == 1: * bf1.make_unsplittable() # <<<<<<<<<<<<<< * B_orth[:,k+1] = B[:,k+1] * if self.orthonormal_update(k+1) == 1: */ - ((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_bf1->__pyx_vtab)->make_unsplittable(__pyx_v_bf1, 0); + ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_bf1->__pyx_vtab)->make_unsplittable(__pyx_v_bf1, 0); goto __pyx_L22; } __pyx_L22:; - /* "_forward.pyx":345 + /* "sklearn/earth/_forward.pyx":347 * if self.orthonormal_update(k) == 1: * bf1.make_unsplittable() * B_orth[:,k+1] = B[:,k+1] # <<<<<<<<<<<<<< * if self.orthonormal_update(k+1) == 1: * bf2.make_unsplittable() */ - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong((__pyx_v_k + 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong((__pyx_v_k + 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_INCREF(__pyx_k_slice_15); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_k_slice_15); @@ -6545,150 +6600,150 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_10)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_10)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyInt_to_py_npy_ulonglong((__pyx_v_k + 1)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyInt_to_py_npy_ulonglong((__pyx_v_k + 1)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_29 = PyTuple_New(2); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_29); + __pyx_t_28 = PyTuple_New(2); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_28); __Pyx_INCREF(__pyx_k_slice_16); - PyTuple_SET_ITEM(__pyx_t_29, 0, __pyx_k_slice_16); + PyTuple_SET_ITEM(__pyx_t_28, 0, __pyx_k_slice_16); __Pyx_GIVEREF(__pyx_k_slice_16); - PyTuple_SET_ITEM(__pyx_t_29, 1, __pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_28, 1, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); __pyx_t_10 = 0; - if (PyObject_SetItem(((PyObject *)__pyx_v_B_orth), ((PyObject *)__pyx_t_29), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_29)); __pyx_t_29 = 0; + if (PyObject_SetItem(((PyObject *)__pyx_v_B_orth), ((PyObject *)__pyx_t_28), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_28)); __pyx_t_28 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "_forward.pyx":346 + /* "sklearn/earth/_forward.pyx":348 * bf1.make_unsplittable() * B_orth[:,k+1] = B[:,k+1] * if self.orthonormal_update(k+1) == 1: # <<<<<<<<<<<<<< * bf2.make_unsplittable() * elif not dependent and knot_idx_choice == -1: */ - __pyx_t_9 = (((struct __pyx_vtabstruct_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_update(__pyx_v_self, (__pyx_v_k + 1), 0) == 1); + __pyx_t_9 = ((((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_update(__pyx_v_self, (__pyx_v_k + 1), 0) == 1) != 0); if (__pyx_t_9) { - /* "_forward.pyx":347 + /* "sklearn/earth/_forward.pyx":349 * B_orth[:,k+1] = B[:,k+1] * if self.orthonormal_update(k+1) == 1: * bf2.make_unsplittable() # <<<<<<<<<<<<<< * elif not dependent and knot_idx_choice == -1: * #In this case, only add the linear basis function */ - ((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_bf2->__pyx_vtab)->make_unsplittable(__pyx_v_bf2, 0); + ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_bf2->__pyx_vtab)->make_unsplittable(__pyx_v_bf2, 0); goto __pyx_L23; } __pyx_L23:; goto __pyx_L21; } - /* "_forward.pyx":348 + /* "sklearn/earth/_forward.pyx":350 * if self.orthonormal_update(k+1) == 1: * bf2.make_unsplittable() * elif not dependent and knot_idx_choice == -1: # <<<<<<<<<<<<<< * #In this case, only add the linear basis function * bf1 = LinearBasisFunction(parent_choice,variable_choice,label) */ - __pyx_t_9 = (!__pyx_v_dependent); + __pyx_t_9 = ((!(__pyx_v_dependent != 0)) != 0); if (__pyx_t_9) { - __pyx_t_35 = (__pyx_v_knot_idx_choice == -1); + __pyx_t_35 = ((__pyx_v_knot_idx_choice == -1) != 0); __pyx_t_36 = __pyx_t_35; } else { __pyx_t_36 = __pyx_t_9; } if (__pyx_t_36) { - /* "_forward.pyx":350 + /* "sklearn/earth/_forward.pyx":352 * elif not dependent and knot_idx_choice == -1: * #In this case, only add the linear basis function * bf1 = LinearBasisFunction(parent_choice,variable_choice,label) # <<<<<<<<<<<<<< * bf1.apply(X,B[:,k]) * self.basis.append(bf1) */ - if (unlikely(!__pyx_v_parent_choice)) { __Pyx_RaiseUnboundLocalError("parent_choice"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable_choice); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_v_parent_choice)) { __Pyx_RaiseUnboundLocalError("parent_choice"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable_choice); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_29 = PyTuple_New(3); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_29); + __pyx_t_28 = PyTuple_New(3); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_28); __Pyx_INCREF(((PyObject *)__pyx_v_parent_choice)); - PyTuple_SET_ITEM(__pyx_t_29, 0, ((PyObject *)__pyx_v_parent_choice)); + PyTuple_SET_ITEM(__pyx_t_28, 0, ((PyObject *)__pyx_v_parent_choice)); __Pyx_GIVEREF(((PyObject *)__pyx_v_parent_choice)); - PyTuple_SET_ITEM(__pyx_t_29, 1, __pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_28, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_label); - PyTuple_SET_ITEM(__pyx_t_29, 2, __pyx_v_label); + PyTuple_SET_ITEM(__pyx_t_28, 2, __pyx_v_label); __Pyx_GIVEREF(__pyx_v_label); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_6_basis_LinearBasisFunction)), ((PyObject *)__pyx_t_29), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_LinearBasisFunction)), ((PyObject *)__pyx_t_28), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_29)); __pyx_t_29 = 0; - __pyx_v_bf1 = ((struct __pyx_obj_6_basis_BasisFunction *)__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_28)); __pyx_t_28 = 0; + __pyx_v_bf1 = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_1); __pyx_t_1 = 0; - /* "_forward.pyx":351 + /* "sklearn/earth/_forward.pyx":353 * #In this case, only add the linear basis function * bf1 = LinearBasisFunction(parent_choice,variable_choice,label) * bf1.apply(X,B[:,k]) # <<<<<<<<<<<<<< * self.basis.append(bf1) * */ - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_29 = PyTuple_New(2); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_29); + __pyx_t_28 = PyTuple_New(2); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_28); __Pyx_INCREF(__pyx_k_slice_17); - PyTuple_SET_ITEM(__pyx_t_29, 0, __pyx_k_slice_17); + PyTuple_SET_ITEM(__pyx_t_28, 0, __pyx_k_slice_17); __Pyx_GIVEREF(__pyx_k_slice_17); - PyTuple_SET_ITEM(__pyx_t_29, 1, __pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_28, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_29)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_28)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_29)); __pyx_t_29 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_29 = ((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_bf1->__pyx_vtab)->apply(__pyx_v_bf1, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_t_1), 0, NULL); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_29); + __Pyx_DECREF(((PyObject *)__pyx_t_28)); __pyx_t_28 = 0; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_bf1->__pyx_vtab)->apply(__pyx_v_bf1, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_t_1), 0, NULL); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_28); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; + __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; - /* "_forward.pyx":352 + /* "sklearn/earth/_forward.pyx":354 * bf1 = LinearBasisFunction(parent_choice,variable_choice,label) * bf1.apply(X,B[:,k]) * self.basis.append(bf1) # <<<<<<<<<<<<<< * * #Orthogonalize the new basis */ - __pyx_t_29 = ((struct __pyx_vtabstruct_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->append(__pyx_v_self->basis, __pyx_v_bf1, 0); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_29); - __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; + __pyx_t_28 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->append(__pyx_v_self->basis, __pyx_v_bf1, 0); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_28); + __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; - /* "_forward.pyx":355 + /* "sklearn/earth/_forward.pyx":357 * * #Orthogonalize the new basis * B_orth[:,k] = B[:,k] # <<<<<<<<<<<<<< * if self.orthonormal_update(k) == 1: * bf1.make_unsplittable() */ - __pyx_t_29 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_29); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_28); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_k_slice_18); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_k_slice_18); __Pyx_GIVEREF(__pyx_k_slice_18); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_29); - __Pyx_GIVEREF(__pyx_t_29); - __pyx_t_29 = 0; - __pyx_t_29 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_1)); if (!__pyx_t_29) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_29); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_28); + __Pyx_GIVEREF(__pyx_t_28); + __pyx_t_28 = 0; + __pyx_t_28 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_1)); if (!__pyx_t_28) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_28); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_INCREF(__pyx_k_slice_19); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_k_slice_19); @@ -6696,28 +6751,28 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyObject_SetItem(((PyObject *)__pyx_v_B_orth), ((PyObject *)__pyx_t_10), __pyx_t_29) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(((PyObject *)__pyx_v_B_orth), ((PyObject *)__pyx_t_10), __pyx_t_28) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; + __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; - /* "_forward.pyx":356 + /* "sklearn/earth/_forward.pyx":358 * #Orthogonalize the new basis * B_orth[:,k] = B[:,k] * if self.orthonormal_update(k) == 1: # <<<<<<<<<<<<<< * bf1.make_unsplittable() * else:#dependent and knot_idx_choice == -1 */ - __pyx_t_36 = (((struct __pyx_vtabstruct_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_update(__pyx_v_self, __pyx_v_k, 0) == 1); + __pyx_t_36 = ((((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_update(__pyx_v_self, __pyx_v_k, 0) == 1) != 0); if (__pyx_t_36) { - /* "_forward.pyx":357 + /* "sklearn/earth/_forward.pyx":359 * B_orth[:,k] = B[:,k] * if self.orthonormal_update(k) == 1: * bf1.make_unsplittable() # <<<<<<<<<<<<<< * else:#dependent and knot_idx_choice == -1 * #In this case there were no acceptable choices remaining, so end the forward pass */ - ((struct __pyx_vtabstruct_6_basis_BasisFunction *)__pyx_v_bf1->__pyx_vtab)->make_unsplittable(__pyx_v_bf1, 0); + ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_bf1->__pyx_vtab)->make_unsplittable(__pyx_v_bf1, 0); goto __pyx_L24; } __pyx_L24:; @@ -6725,34 +6780,39 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ } /*else*/ { - /* "_forward.pyx":360 + /* "sklearn/earth/_forward.pyx":362 * else:#dependent and knot_idx_choice == -1 * #In this case there were no acceptable choices remaining, so end the forward pass - * self.record[-1].set_no_candidates(True) # <<<<<<<<<<<<<< + * self.record[len(self.record) - 1].set_no_candidates(True) # <<<<<<<<<<<<<< * return * */ - __pyx_t_29 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->record), -1, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_29) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_29); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_29, __pyx_n_s__set_no_candidates); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = ((PyObject *)__pyx_v_self->record); + __Pyx_INCREF(__pyx_t_28); + __pyx_t_33 = PyObject_Length(__pyx_t_28); if (unlikely(__pyx_t_33 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; + __pyx_t_2 = (__pyx_t_33 - 1); + __pyx_t_28 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->record), __pyx_t_2, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 0, 0); if (!__pyx_t_28) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_28); + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_28, __pyx_n_s__set_no_candidates); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; - __pyx_t_29 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_29); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; + __pyx_t_28 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_28); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_29); - __Pyx_GIVEREF(__pyx_t_29); - __pyx_t_29 = 0; - __pyx_t_29 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_29); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_28); + __Pyx_GIVEREF(__pyx_t_28); + __pyx_t_28 = 0; + __pyx_t_28 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_28); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_29); __pyx_t_29 = 0; + __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; - /* "_forward.pyx":361 + /* "sklearn/earth/_forward.pyx":363 * #In this case there were no acceptable choices remaining, so end the forward pass - * self.record[-1].set_no_candidates(True) + * self.record[len(self.record) - 1].set_no_candidates(True) * return # <<<<<<<<<<<<<< * * #Update the build record @@ -6763,31 +6823,31 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ } __pyx_L21:; - /* "_forward.pyx":364 + /* "sklearn/earth/_forward.pyx":366 * * #Update the build record * self.record.append(ForwardPassIteration(parent_idx_choice,variable_choice,knot_idx_choice,mse_choice,len(self.basis))) # <<<<<<<<<<<<<< * * cdef best_knot(ForwardPasser self, INDEX_t parent, INDEX_t variable, INDEX_t k, cnp.ndarray[INT_t,ndim=1] candidates, cnp.ndarray[INT_t,ndim=1] order, FLOAT_t * mse, FLOAT_t * knot, INDEX_t * knot_idx): */ - __pyx_t_29 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_parent_idx_choice); if (unlikely(!__pyx_t_29)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_29); - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable_choice); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_parent_idx_choice); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_28); + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable_choice); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = PyInt_FromLong(__pyx_v_knot_idx_choice); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyInt_FromLong(__pyx_v_knot_idx_choice); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_34 = PyFloat_FromDouble(__pyx_v_mse_choice); if (unlikely(!__pyx_t_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_34 = PyFloat_FromDouble(__pyx_v_mse_choice); if (unlikely(!__pyx_t_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_34); __pyx_t_13 = ((PyObject *)__pyx_v_self->basis); __Pyx_INCREF(__pyx_t_13); - __pyx_t_2 = PyObject_Length(__pyx_t_13); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Length(__pyx_t_13); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); - __pyx_t_37 = PyTuple_New(5); if (unlikely(!__pyx_t_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_37 = PyTuple_New(5); if (unlikely(!__pyx_t_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_37); - PyTuple_SET_ITEM(__pyx_t_37, 0, __pyx_t_29); - __Pyx_GIVEREF(__pyx_t_29); + PyTuple_SET_ITEM(__pyx_t_37, 0, __pyx_t_28); + __Pyx_GIVEREF(__pyx_t_28); PyTuple_SET_ITEM(__pyx_t_37, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_37, 2, __pyx_t_10); @@ -6796,15 +6856,15 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ __Pyx_GIVEREF(__pyx_t_34); PyTuple_SET_ITEM(__pyx_t_37, 4, __pyx_t_13); __Pyx_GIVEREF(__pyx_t_13); - __pyx_t_29 = 0; + __pyx_t_28 = 0; __pyx_t_1 = 0; __pyx_t_10 = 0; __pyx_t_34 = 0; __pyx_t_13 = 0; - __pyx_t_13 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7_record_ForwardPassIteration)), ((PyObject *)__pyx_t_37), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_ForwardPassIteration)), ((PyObject *)__pyx_t_37), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(((PyObject *)__pyx_t_37)); __pyx_t_37 = 0; - __pyx_t_37 = ((struct __pyx_vtabstruct_7_record_ForwardPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->__pyx_base.append(((struct __pyx_obj_7_record_Record *)__pyx_v_self->record), ((struct __pyx_obj_7_record_Iteration *)__pyx_t_13), 0); if (unlikely(!__pyx_t_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_37 = ((struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->__pyx_base.append(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self->record), ((struct __pyx_obj_7sklearn_5earth_7_record_Iteration *)__pyx_t_13), 0); if (unlikely(!__pyx_t_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_37); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0; @@ -6815,7 +6875,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_13); - __Pyx_XDECREF(__pyx_t_29); + __Pyx_XDECREF(__pyx_t_28); __Pyx_XDECREF(__pyx_t_34); __Pyx_XDECREF(__pyx_t_37); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; @@ -6828,7 +6888,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sorting.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("_forward.ForwardPasser.next_pair", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._forward.ForwardPasser.next_pair", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; goto __pyx_L2; __pyx_L0:; @@ -6857,7 +6917,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ return __pyx_r; } -/* "_forward.pyx":366 +/* "sklearn/earth/_forward.pyx":368 * self.record.append(ForwardPassIteration(parent_idx_choice,variable_choice,knot_idx_choice,mse_choice,len(self.basis))) * * cdef best_knot(ForwardPasser self, INDEX_t parent, INDEX_t variable, INDEX_t k, cnp.ndarray[INT_t,ndim=1] candidates, cnp.ndarray[INT_t,ndim=1] order, FLOAT_t * mse, FLOAT_t * knot, INDEX_t * knot_idx): # <<<<<<<<<<<<<< @@ -6865,7 +6925,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_next_pair(struct __pyx_obj_8_ * Find the best knot location (in terms of squared error). */ -static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_forward_ForwardPasser *__pyx_v_self, __pyx_t_8_forward_INDEX_t __pyx_v_parent, __pyx_t_8_forward_INDEX_t __pyx_v_variable, __pyx_t_8_forward_INDEX_t __pyx_v_k, PyArrayObject *__pyx_v_candidates, PyArrayObject *__pyx_v_order, __pyx_t_8_forward_FLOAT_t *__pyx_v_mse, __pyx_t_8_forward_FLOAT_t *__pyx_v_knot, __pyx_t_8_forward_INDEX_t *__pyx_v_knot_idx) { +static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *__pyx_v_self, __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_v_parent, __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_v_variable, __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_v_k, PyArrayObject *__pyx_v_candidates, PyArrayObject *__pyx_v_order, __pyx_t_7sklearn_5earth_8_forward_FLOAT_t *__pyx_v_mse, __pyx_t_7sklearn_5earth_8_forward_FLOAT_t *__pyx_v_knot, __pyx_t_7sklearn_5earth_8_forward_INDEX_t *__pyx_v_knot_idx) { PyArrayObject *__pyx_v_b = 0; PyArrayObject *__pyx_v_b_parent = 0; PyArrayObject *__pyx_v_u = 0; @@ -6875,36 +6935,36 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ PyArrayObject *__pyx_v_c = 0; PyArrayObject *__pyx_v_B_orth_times_parent_cum = 0; CYTHON_UNUSED PyArrayObject *__pyx_v_B = 0; - __pyx_t_8_forward_INDEX_t __pyx_v_num_candidates; - __pyx_t_8_forward_INDEX_t __pyx_v_h; - __pyx_t_8_forward_INDEX_t __pyx_v_i; - __pyx_t_8_forward_INDEX_t __pyx_v_j; - __pyx_t_8_forward_INDEX_t __pyx_v_i_; - __pyx_t_8_forward_INDEX_t __pyx_v_j_; - __pyx_t_8_forward_FLOAT_t __pyx_v_u_end; - __pyx_t_8_forward_FLOAT_t __pyx_v_c_end; - __pyx_t_8_forward_FLOAT_t __pyx_v_z_end_squared; - __pyx_t_8_forward_INDEX_t __pyx_v_candidate_idx; - __pyx_t_8_forward_INDEX_t __pyx_v_last_candidate_idx; - __pyx_t_8_forward_INDEX_t __pyx_v_last_last_candidate_idx; - __pyx_t_8_forward_INDEX_t __pyx_v_best_candidate_idx; - __pyx_t_8_forward_FLOAT_t __pyx_v_candidate; - __pyx_t_8_forward_FLOAT_t __pyx_v_last_candidate; - __pyx_t_8_forward_FLOAT_t __pyx_v_best_candidate; - __pyx_t_8_forward_FLOAT_t __pyx_v_best_z_end_squared; - __pyx_t_8_forward_FLOAT_t __pyx_v_y_cum; - __pyx_t_8_forward_FLOAT_t __pyx_v_b_times_parent_cum; - __pyx_t_8_forward_FLOAT_t __pyx_v_diff; - __pyx_t_8_forward_FLOAT_t __pyx_v_delta_b_squared; - __pyx_t_8_forward_FLOAT_t __pyx_v_delta_c_end; - __pyx_t_8_forward_FLOAT_t __pyx_v_delta_u_end; - __pyx_t_8_forward_FLOAT_t __pyx_v_parent_squared_cum; - __pyx_t_8_forward_FLOAT_t __pyx_v_parent_times_y_cum; - __pyx_t_8_forward_FLOAT_t __pyx_v_u_dot_c; - __pyx_t_8_forward_FLOAT_t __pyx_v_u_dot_u; - __pyx_t_8_forward_FLOAT_t __pyx_v_float_tmp; - __pyx_t_8_forward_FLOAT_t __pyx_v_delta_b_j; - __pyx_t_8_forward_FLOAT_t __pyx_v_z_denom; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_v_num_candidates; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_v_h; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_v_i; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_v_j; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_v_i_; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_v_j_; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t __pyx_v_u_end; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t __pyx_v_c_end; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t __pyx_v_z_end_squared; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_v_candidate_idx; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_v_last_candidate_idx; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_v_last_last_candidate_idx; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_v_best_candidate_idx; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t __pyx_v_candidate; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t __pyx_v_last_candidate; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t __pyx_v_best_candidate; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t __pyx_v_best_z_end_squared; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t __pyx_v_y_cum; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t __pyx_v_b_times_parent_cum; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t __pyx_v_diff; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t __pyx_v_delta_b_squared; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t __pyx_v_delta_c_end; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t __pyx_v_delta_u_end; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t __pyx_v_parent_squared_cum; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t __pyx_v_parent_times_y_cum; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t __pyx_v_u_dot_c; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t __pyx_v_u_dot_u; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t __pyx_v_float_tmp; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t __pyx_v_delta_b_j; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t __pyx_v_z_denom; __Pyx_LocalBuf_ND __pyx_pybuffernd_B; __Pyx_Buffer __pyx_pybuffer_B; __Pyx_LocalBuf_ND __pyx_pybuffernd_B_orth; @@ -6939,71 +6999,71 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ PyArrayObject *__pyx_t_8 = NULL; PyArrayObject *__pyx_t_9 = NULL; long __pyx_t_10; - __pyx_t_8_forward_INDEX_t __pyx_t_11; - __pyx_t_8_forward_INT_t __pyx_t_12; - __pyx_t_8_forward_INDEX_t __pyx_t_13; - __pyx_t_8_forward_INDEX_t __pyx_t_14; - __pyx_t_8_forward_INDEX_t __pyx_t_15; - __pyx_t_8_forward_INDEX_t __pyx_t_16; - __pyx_t_8_forward_INDEX_t __pyx_t_17; - __pyx_t_8_forward_INDEX_t __pyx_t_18; - __pyx_t_8_forward_INDEX_t __pyx_t_19; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_11; + __pyx_t_7sklearn_5earth_8_forward_INT_t __pyx_t_12; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_13; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_14; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_15; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_16; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_17; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_18; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_19; int __pyx_t_20; - __pyx_t_8_forward_INDEX_t __pyx_t_21; - __pyx_t_8_forward_INDEX_t __pyx_t_22; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_21; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_22; PyObject *__pyx_t_23 = NULL; - __pyx_t_8_forward_INDEX_t __pyx_t_24; - __pyx_t_8_forward_INDEX_t __pyx_t_25; - __pyx_t_8_forward_INDEX_t __pyx_t_26; - __pyx_t_8_forward_INDEX_t __pyx_t_27; - __pyx_t_8_forward_INDEX_t __pyx_t_28; - __pyx_t_8_forward_INDEX_t __pyx_t_29; - __pyx_t_8_forward_INDEX_t __pyx_t_30; - __pyx_t_8_forward_INDEX_t __pyx_t_31; - __pyx_t_8_forward_FLOAT_t __pyx_t_32; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_24; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_25; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_26; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_27; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_28; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_29; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_30; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_31; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t __pyx_t_32; long __pyx_t_33; - __pyx_t_8_forward_INDEX_t __pyx_t_34; - __pyx_t_8_forward_INDEX_t __pyx_t_35; - __pyx_t_8_forward_INDEX_t __pyx_t_36; - __pyx_t_8_forward_INDEX_t __pyx_t_37; - __pyx_t_8_forward_INDEX_t __pyx_t_38; - __pyx_t_8_forward_INDEX_t __pyx_t_39; - __pyx_t_8_forward_INDEX_t __pyx_t_40; - __pyx_t_8_forward_INDEX_t __pyx_t_41; - __pyx_t_8_forward_INDEX_t __pyx_t_42; - __pyx_t_8_forward_INDEX_t __pyx_t_43; - __pyx_t_8_forward_INT_t __pyx_t_44; - __pyx_t_8_forward_INDEX_t __pyx_t_45; - __pyx_t_8_forward_INDEX_t __pyx_t_46; - __pyx_t_8_forward_INDEX_t __pyx_t_47; - __pyx_t_8_forward_INDEX_t __pyx_t_48; - __pyx_t_8_forward_INDEX_t __pyx_t_49; - __pyx_t_8_forward_INDEX_t __pyx_t_50; - __pyx_t_8_forward_INDEX_t __pyx_t_51; - __pyx_t_8_forward_INDEX_t __pyx_t_52; - __pyx_t_8_forward_INDEX_t __pyx_t_53; - __pyx_t_8_forward_INDEX_t __pyx_t_54; - __pyx_t_8_forward_INDEX_t __pyx_t_55; - __pyx_t_8_forward_INDEX_t __pyx_t_56; - __pyx_t_8_forward_INDEX_t __pyx_t_57; - __pyx_t_8_forward_INDEX_t __pyx_t_58; - __pyx_t_8_forward_INDEX_t __pyx_t_59; - __pyx_t_8_forward_INDEX_t __pyx_t_60; - __pyx_t_8_forward_INDEX_t __pyx_t_61; - __pyx_t_8_forward_INDEX_t __pyx_t_62; - __pyx_t_8_forward_INDEX_t __pyx_t_63; - __pyx_t_8_forward_INDEX_t __pyx_t_64; - __pyx_t_8_forward_INDEX_t __pyx_t_65; - __pyx_t_8_forward_INDEX_t __pyx_t_66; - __pyx_t_8_forward_INDEX_t __pyx_t_67; - __pyx_t_8_forward_INDEX_t __pyx_t_68; - __pyx_t_8_forward_INDEX_t __pyx_t_69; - __pyx_t_8_forward_INDEX_t __pyx_t_70; - __pyx_t_8_forward_INDEX_t __pyx_t_71; - __pyx_t_8_forward_INDEX_t __pyx_t_72; - __pyx_t_8_forward_INDEX_t __pyx_t_73; - __pyx_t_8_forward_INDEX_t __pyx_t_74; - __pyx_t_8_forward_INDEX_t __pyx_t_75; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_34; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_35; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_36; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_37; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_38; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_39; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_40; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_41; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_42; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_43; + __pyx_t_7sklearn_5earth_8_forward_INT_t __pyx_t_44; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_45; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_46; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_47; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_48; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_49; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_50; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_51; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_52; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_53; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_54; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_55; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_56; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_57; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_58; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_59; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_60; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_61; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_62; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_63; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_64; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_65; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_66; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_67; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_68; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_69; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_70; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_71; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_72; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_73; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_74; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_75; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -7054,25 +7114,25 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ __pyx_pybuffernd_order.rcbuffer = &__pyx_pybuffer_order; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_candidates.rcbuffer->pybuffer, (PyObject*)__pyx_v_candidates, &__Pyx_TypeInfo_nn___pyx_t_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_candidates.rcbuffer->pybuffer, (PyObject*)__pyx_v_candidates, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_candidates.diminfo[0].strides = __pyx_pybuffernd_candidates.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_candidates.diminfo[0].shape = __pyx_pybuffernd_candidates.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_order.rcbuffer->pybuffer, (PyObject*)__pyx_v_order, &__Pyx_TypeInfo_nn___pyx_t_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_order.rcbuffer->pybuffer, (PyObject*)__pyx_v_order, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_order.diminfo[0].strides = __pyx_pybuffernd_order.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_order.diminfo[0].shape = __pyx_pybuffernd_order.rcbuffer->pybuffer.shape[0]; - /* "_forward.pyx":377 + /* "sklearn/earth/_forward.pyx":379 * ''' * * cdef cnp.ndarray[FLOAT_t, ndim=1] b = self.B[:,k+1] # <<<<<<<<<<<<<< * cdef cnp.ndarray[FLOAT_t, ndim=1] b_parent = self.B[:,parent] * cdef cnp.ndarray[FLOAT_t, ndim=1] u = self.u */ - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong((__pyx_v_k + 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong((__pyx_v_k + 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_k_slice_20); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_k_slice_20); @@ -7080,7 +7140,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self->B), ((PyObject *)__pyx_t_2)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self->B), ((PyObject *)__pyx_t_2)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_t_2 = __pyx_t_1; @@ -7088,25 +7148,25 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_2), &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_2), &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_b = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_b.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_b.diminfo[0].strides = __pyx_pybuffernd_b.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_b.diminfo[0].shape = __pyx_pybuffernd_b.rcbuffer->pybuffer.shape[0]; } } __pyx_v_b = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "_forward.pyx":378 + /* "sklearn/earth/_forward.pyx":380 * * cdef cnp.ndarray[FLOAT_t, ndim=1] b = self.B[:,k+1] * cdef cnp.ndarray[FLOAT_t, ndim=1] b_parent = self.B[:,parent] # <<<<<<<<<<<<<< * cdef cnp.ndarray[FLOAT_t, ndim=1] u = self.u * cdef cnp.ndarray[FLOAT_t, ndim=2] B_orth = self.B_orth */ - __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_parent); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_parent); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_k_slice_21); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_k_slice_21); @@ -7114,7 +7174,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_self->B), ((PyObject *)__pyx_t_1)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_self->B), ((PyObject *)__pyx_t_1)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_1 = __pyx_t_2; @@ -7122,16 +7182,16 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b_parent.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b_parent.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_b_parent = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_b_parent.diminfo[0].strides = __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_b_parent.diminfo[0].shape = __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.shape[0]; } } __pyx_v_b_parent = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "_forward.pyx":379 + /* "sklearn/earth/_forward.pyx":381 * cdef cnp.ndarray[FLOAT_t, ndim=1] b = self.B[:,k+1] * cdef cnp.ndarray[FLOAT_t, ndim=1] b_parent = self.B[:,parent] * cdef cnp.ndarray[FLOAT_t, ndim=1] u = self.u # <<<<<<<<<<<<<< @@ -7141,9 +7201,9 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ __pyx_t_3 = ((PyArrayObject *)__pyx_v_self->u); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_u.rcbuffer->pybuffer, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_u.rcbuffer->pybuffer, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_u = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_u.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_u.diminfo[0].strides = __pyx_pybuffernd_u.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_u.diminfo[0].shape = __pyx_pybuffernd_u.rcbuffer->pybuffer.shape[0]; } } @@ -7151,7 +7211,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->u))); __pyx_v_u = ((PyArrayObject *)__pyx_v_self->u); - /* "_forward.pyx":380 + /* "sklearn/earth/_forward.pyx":382 * cdef cnp.ndarray[FLOAT_t, ndim=1] b_parent = self.B[:,parent] * cdef cnp.ndarray[FLOAT_t, ndim=1] u = self.u * cdef cnp.ndarray[FLOAT_t, ndim=2] B_orth = self.B_orth # <<<<<<<<<<<<<< @@ -7161,9 +7221,9 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ __pyx_t_4 = ((PyArrayObject *)__pyx_v_self->B_orth); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B_orth.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B_orth.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { __pyx_v_B_orth = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_B_orth.diminfo[0].strides = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B_orth.diminfo[0].shape = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B_orth.diminfo[1].strides = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B_orth.diminfo[1].shape = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.shape[1]; } } @@ -7171,7 +7231,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->B_orth))); __pyx_v_B_orth = ((PyArrayObject *)__pyx_v_self->B_orth); - /* "_forward.pyx":381 + /* "sklearn/earth/_forward.pyx":383 * cdef cnp.ndarray[FLOAT_t, ndim=1] u = self.u * cdef cnp.ndarray[FLOAT_t, ndim=2] B_orth = self.B_orth * cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X # <<<<<<<<<<<<<< @@ -7181,9 +7241,9 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ __pyx_t_5 = ((PyArrayObject *)__pyx_v_self->X); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { __pyx_v_X = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; } } @@ -7191,7 +7251,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->X))); __pyx_v_X = ((PyArrayObject *)__pyx_v_self->X); - /* "_forward.pyx":382 + /* "sklearn/earth/_forward.pyx":384 * cdef cnp.ndarray[FLOAT_t, ndim=2] B_orth = self.B_orth * cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X * cdef cnp.ndarray[FLOAT_t, ndim=1] y = self.y # <<<<<<<<<<<<<< @@ -7201,9 +7261,9 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ __pyx_t_6 = ((PyArrayObject *)__pyx_v_self->y); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_y = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_y.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_y.diminfo[0].strides = __pyx_pybuffernd_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y.diminfo[0].shape = __pyx_pybuffernd_y.rcbuffer->pybuffer.shape[0]; } } @@ -7211,7 +7271,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->y))); __pyx_v_y = ((PyArrayObject *)__pyx_v_self->y); - /* "_forward.pyx":383 + /* "sklearn/earth/_forward.pyx":385 * cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X * cdef cnp.ndarray[FLOAT_t, ndim=1] y = self.y * cdef cnp.ndarray[FLOAT_t, ndim=1] c = self.c # <<<<<<<<<<<<<< @@ -7221,9 +7281,9 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ __pyx_t_7 = ((PyArrayObject *)__pyx_v_self->c); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_c.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_c.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_c = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_c.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_c.diminfo[0].strides = __pyx_pybuffernd_c.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_c.diminfo[0].shape = __pyx_pybuffernd_c.rcbuffer->pybuffer.shape[0]; } } @@ -7231,7 +7291,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->c))); __pyx_v_c = ((PyArrayObject *)__pyx_v_self->c); - /* "_forward.pyx":384 + /* "sklearn/earth/_forward.pyx":386 * cdef cnp.ndarray[FLOAT_t, ndim=1] y = self.y * cdef cnp.ndarray[FLOAT_t, ndim=1] c = self.c * cdef cnp.ndarray[FLOAT_t, ndim=1] B_orth_times_parent_cum = self.B_orth_times_parent_cum # <<<<<<<<<<<<<< @@ -7241,9 +7301,9 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ __pyx_t_8 = ((PyArrayObject *)__pyx_v_self->B_orth_times_parent_cum); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B_orth_times_parent_cum.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B_orth_times_parent_cum.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_B_orth_times_parent_cum = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_B_orth_times_parent_cum.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_B_orth_times_parent_cum.diminfo[0].strides = __pyx_pybuffernd_B_orth_times_parent_cum.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B_orth_times_parent_cum.diminfo[0].shape = __pyx_pybuffernd_B_orth_times_parent_cum.rcbuffer->pybuffer.shape[0]; } } @@ -7251,7 +7311,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->B_orth_times_parent_cum))); __pyx_v_B_orth_times_parent_cum = ((PyArrayObject *)__pyx_v_self->B_orth_times_parent_cum); - /* "_forward.pyx":385 + /* "sklearn/earth/_forward.pyx":387 * cdef cnp.ndarray[FLOAT_t, ndim=1] c = self.c * cdef cnp.ndarray[FLOAT_t, ndim=1] B_orth_times_parent_cum = self.B_orth_times_parent_cum * cdef cnp.ndarray[FLOAT_t, ndim=2] B = self.B # <<<<<<<<<<<<<< @@ -7261,9 +7321,9 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ __pyx_t_9 = ((PyArrayObject *)__pyx_v_self->B); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { __pyx_v_B = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_B.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_B.diminfo[0].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B.diminfo[0].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B.diminfo[1].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B.diminfo[1].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[1]; } } @@ -7271,7 +7331,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->B))); __pyx_v_B = ((PyArrayObject *)__pyx_v_self->B); - /* "_forward.pyx":387 + /* "sklearn/earth/_forward.pyx":389 * cdef cnp.ndarray[FLOAT_t, ndim=2] B = self.B * * cdef INDEX_t num_candidates = candidates.shape[0] # <<<<<<<<<<<<<< @@ -7280,7 +7340,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ */ __pyx_v_num_candidates = (__pyx_v_candidates->dimensions[0]); - /* "_forward.pyx":421 + /* "sklearn/earth/_forward.pyx":423 * * #Compute the initial basis function * candidate_idx = candidates[0] # <<<<<<<<<<<<<< @@ -7288,9 +7348,9 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ * for i in range(self.m):#TODO: Vectorize? */ __pyx_t_10 = 0; - __pyx_v_candidate_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_INT_t *, __pyx_pybuffernd_candidates.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_candidates.diminfo[0].strides)); + __pyx_v_candidate_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_INT_t *, __pyx_pybuffernd_candidates.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_candidates.diminfo[0].strides)); - /* "_forward.pyx":422 + /* "sklearn/earth/_forward.pyx":424 * #Compute the initial basis function * candidate_idx = candidates[0] * candidate = X[order[candidate_idx],variable] # <<<<<<<<<<<<<< @@ -7298,11 +7358,11 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ * b[i] = 0 */ __pyx_t_11 = __pyx_v_candidate_idx; - __pyx_t_12 = (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_INT_t *, __pyx_pybuffernd_order.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_order.diminfo[0].strides)); + __pyx_t_12 = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_INT_t *, __pyx_pybuffernd_order.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_order.diminfo[0].strides)); __pyx_t_13 = __pyx_v_variable; - __pyx_v_candidate = (*__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_X.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_X.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_X.diminfo[1].strides)); + __pyx_v_candidate = (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_X.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_X.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_X.diminfo[1].strides)); - /* "_forward.pyx":423 + /* "sklearn/earth/_forward.pyx":425 * candidate_idx = candidates[0] * candidate = X[order[candidate_idx],variable] * for i in range(self.m):#TODO: Vectorize? # <<<<<<<<<<<<<< @@ -7313,7 +7373,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { __pyx_v_i = __pyx_t_15; - /* "_forward.pyx":424 + /* "sklearn/earth/_forward.pyx":426 * candidate = X[order[candidate_idx],variable] * for i in range(self.m):#TODO: Vectorize? * b[i] = 0 # <<<<<<<<<<<<<< @@ -7321,10 +7381,10 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ * i = order[i_] */ __pyx_t_16 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_b.diminfo[0].strides) = 0.0; + *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_b.diminfo[0].strides) = 0.0; } - /* "_forward.pyx":425 + /* "sklearn/earth/_forward.pyx":427 * for i in range(self.m):#TODO: Vectorize? * b[i] = 0 * for i_ in range(self.m): # <<<<<<<<<<<<<< @@ -7335,7 +7395,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { __pyx_v_i_ = __pyx_t_15; - /* "_forward.pyx":426 + /* "sklearn/earth/_forward.pyx":428 * b[i] = 0 * for i_ in range(self.m): * i = order[i_] # <<<<<<<<<<<<<< @@ -7343,9 +7403,9 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ * if float_tmp > 0: */ __pyx_t_17 = __pyx_v_i_; - __pyx_v_i = (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_INT_t *, __pyx_pybuffernd_order.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_order.diminfo[0].strides)); + __pyx_v_i = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_INT_t *, __pyx_pybuffernd_order.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_order.diminfo[0].strides)); - /* "_forward.pyx":427 + /* "sklearn/earth/_forward.pyx":429 * for i_ in range(self.m): * i = order[i_] * float_tmp = X[i,variable] - candidate # <<<<<<<<<<<<<< @@ -7354,19 +7414,19 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ */ __pyx_t_18 = __pyx_v_i; __pyx_t_19 = __pyx_v_variable; - __pyx_v_float_tmp = ((*__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_X.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_X.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_X.diminfo[1].strides)) - __pyx_v_candidate); + __pyx_v_float_tmp = ((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_X.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_X.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_X.diminfo[1].strides)) - __pyx_v_candidate); - /* "_forward.pyx":428 + /* "sklearn/earth/_forward.pyx":430 * i = order[i_] * float_tmp = X[i,variable] - candidate * if float_tmp > 0: # <<<<<<<<<<<<<< * b[i] = b_parent[i]*float_tmp * else: */ - __pyx_t_20 = (__pyx_v_float_tmp > 0.0); + __pyx_t_20 = ((__pyx_v_float_tmp > 0.0) != 0); if (__pyx_t_20) { - /* "_forward.pyx":429 + /* "sklearn/earth/_forward.pyx":431 * float_tmp = X[i,variable] - candidate * if float_tmp > 0: * b[i] = b_parent[i]*float_tmp # <<<<<<<<<<<<<< @@ -7375,12 +7435,12 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ */ __pyx_t_21 = __pyx_v_i; __pyx_t_22 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_b.diminfo[0].strides) = ((*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_b_parent.diminfo[0].strides)) * __pyx_v_float_tmp); + *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_b.diminfo[0].strides) = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_21, __pyx_pybuffernd_b_parent.diminfo[0].strides)) * __pyx_v_float_tmp); goto __pyx_L7; } /*else*/ { - /* "_forward.pyx":431 + /* "sklearn/earth/_forward.pyx":433 * b[i] = b_parent[i]*float_tmp * else: * break # <<<<<<<<<<<<<< @@ -7393,24 +7453,24 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ } __pyx_L6_break:; - /* "_forward.pyx":434 + /* "sklearn/earth/_forward.pyx":436 * * #Compute the initial covariance column, u (not including the final element) * u[0:k+1] = np.dot(b,B_orth[:,0:k+1]) # <<<<<<<<<<<<<< * * #Compute the new last elements of c and u */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong((__pyx_v_k + 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong((__pyx_v_k + 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_23 = PySlice_New(__pyx_int_0, __pyx_t_1, Py_None); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_23 = PySlice_New(__pyx_int_0, __pyx_t_1, Py_None); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_23); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_k_slice_22); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_k_slice_22); @@ -7418,10 +7478,10 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_23); __Pyx_GIVEREF(__pyx_t_23); __pyx_t_23 = 0; - __pyx_t_23 = PyObject_GetItem(((PyObject *)__pyx_v_B_orth), ((PyObject *)__pyx_t_1)); if (!__pyx_t_23) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_23 = PyObject_GetItem(((PyObject *)__pyx_v_B_orth), ((PyObject *)__pyx_t_1)); if (!__pyx_t_23) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_23); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_b)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_b)); @@ -7429,14 +7489,14 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_23); __Pyx_GIVEREF(__pyx_t_23); __pyx_t_23 = 0; - __pyx_t_23 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_23 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_23); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (__Pyx_PyObject_SetSlice(((PyObject *)__pyx_v_u), __pyx_t_23, 0, (__pyx_v_k + 1), NULL, NULL, NULL, 1, 1, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_PyObject_SetSlice(((PyObject *)__pyx_v_u), __pyx_t_23, 0, (__pyx_v_k + 1), NULL, NULL, NULL, 1, 1, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; - /* "_forward.pyx":437 + /* "sklearn/earth/_forward.pyx":439 * * #Compute the new last elements of c and u * c_end = 0.0 # <<<<<<<<<<<<<< @@ -7445,7 +7505,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ */ __pyx_v_c_end = 0.0; - /* "_forward.pyx":438 + /* "sklearn/earth/_forward.pyx":440 * #Compute the new last elements of c and u * c_end = 0.0 * u_end = 0.0 # <<<<<<<<<<<<<< @@ -7454,7 +7514,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ */ __pyx_v_u_end = 0.0; - /* "_forward.pyx":439 + /* "sklearn/earth/_forward.pyx":441 * c_end = 0.0 * u_end = 0.0 * for i in range(self.m): # <<<<<<<<<<<<<< @@ -7465,7 +7525,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { __pyx_v_i = __pyx_t_15; - /* "_forward.pyx":440 + /* "sklearn/earth/_forward.pyx":442 * u_end = 0.0 * for i in range(self.m): * u_end += b[i]*b[i] # <<<<<<<<<<<<<< @@ -7474,9 +7534,9 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ */ __pyx_t_24 = __pyx_v_i; __pyx_t_25 = __pyx_v_i; - __pyx_v_u_end = (__pyx_v_u_end + ((*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_b.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_b.diminfo[0].strides)))); + __pyx_v_u_end = (__pyx_v_u_end + ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_b.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_b.diminfo[0].strides)))); - /* "_forward.pyx":441 + /* "sklearn/earth/_forward.pyx":443 * for i in range(self.m): * u_end += b[i]*b[i] * c_end += b[i]*y[i] # <<<<<<<<<<<<<< @@ -7485,10 +7545,10 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ */ __pyx_t_26 = __pyx_v_i; __pyx_t_27 = __pyx_v_i; - __pyx_v_c_end = (__pyx_v_c_end + ((*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_b.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_y.diminfo[0].strides)))); + __pyx_v_c_end = (__pyx_v_c_end + ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_b.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_y.diminfo[0].strides)))); } - /* "_forward.pyx":444 + /* "sklearn/earth/_forward.pyx":446 * * #Compute the last element of z (the others are identical to c) * u_dot_c = 0.0 # <<<<<<<<<<<<<< @@ -7497,7 +7557,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ */ __pyx_v_u_dot_c = 0.0; - /* "_forward.pyx":445 + /* "sklearn/earth/_forward.pyx":447 * #Compute the last element of z (the others are identical to c) * u_dot_c = 0.0 * u_dot_u = 0.0 # <<<<<<<<<<<<<< @@ -7506,7 +7566,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ */ __pyx_v_u_dot_u = 0.0; - /* "_forward.pyx":446 + /* "sklearn/earth/_forward.pyx":448 * u_dot_c = 0.0 * u_dot_u = 0.0 * for i in range(k+1): # <<<<<<<<<<<<<< @@ -7517,7 +7577,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { __pyx_v_i = __pyx_t_15; - /* "_forward.pyx":447 + /* "sklearn/earth/_forward.pyx":449 * u_dot_u = 0.0 * for i in range(k+1): * u_dot_u += u[i]*u[i] # <<<<<<<<<<<<<< @@ -7526,9 +7586,9 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ */ __pyx_t_28 = __pyx_v_i; __pyx_t_29 = __pyx_v_i; - __pyx_v_u_dot_u = (__pyx_v_u_dot_u + ((*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_u.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_u.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_u.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_u.diminfo[0].strides)))); + __pyx_v_u_dot_u = (__pyx_v_u_dot_u + ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_u.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_u.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_u.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_u.diminfo[0].strides)))); - /* "_forward.pyx":448 + /* "sklearn/earth/_forward.pyx":450 * for i in range(k+1): * u_dot_u += u[i]*u[i] * u_dot_c += u[i]*c[i] # <<<<<<<<<<<<<< @@ -7537,10 +7597,10 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ */ __pyx_t_30 = __pyx_v_i; __pyx_t_31 = __pyx_v_i; - __pyx_v_u_dot_c = (__pyx_v_u_dot_c + ((*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_u.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_u.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_c.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_c.diminfo[0].strides)))); + __pyx_v_u_dot_c = (__pyx_v_u_dot_c + ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_u.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_u.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_c.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_c.diminfo[0].strides)))); } - /* "_forward.pyx":449 + /* "sklearn/earth/_forward.pyx":451 * u_dot_u += u[i]*u[i] * u_dot_c += u[i]*c[i] * z_denom = u_end - u_dot_u # <<<<<<<<<<<<<< @@ -7549,36 +7609,36 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ */ __pyx_v_z_denom = (__pyx_v_u_end - __pyx_v_u_dot_u); - /* "_forward.pyx":450 + /* "sklearn/earth/_forward.pyx":452 * u_dot_c += u[i]*c[i] * z_denom = u_end - u_dot_u * if z_denom <= self.zero_tol: # <<<<<<<<<<<<<< * z_end_squared = np.nan * else: */ - __pyx_t_20 = (__pyx_v_z_denom <= __pyx_v_self->zero_tol); + __pyx_t_20 = ((__pyx_v_z_denom <= __pyx_v_self->zero_tol) != 0); if (__pyx_t_20) { - /* "_forward.pyx":451 + /* "sklearn/earth/_forward.pyx":453 * z_denom = u_end - u_dot_u * if z_denom <= self.zero_tol: * z_end_squared = np.nan # <<<<<<<<<<<<<< * else: * z_end_squared = ((c_end - u_dot_c)**2) / z_denom */ - __pyx_t_23 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_23 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_23); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_23, __pyx_n_s__nan); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_23, __pyx_n_s__nan); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; - __pyx_t_32 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_32 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_32 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_32 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_z_end_squared = __pyx_t_32; goto __pyx_L12; } /*else*/ { - /* "_forward.pyx":453 + /* "sklearn/earth/_forward.pyx":455 * z_end_squared = np.nan * else: * z_end_squared = ((c_end - u_dot_c)**2) / z_denom # <<<<<<<<<<<<<< @@ -7589,7 +7649,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ } __pyx_L12:; - /* "_forward.pyx":457 + /* "sklearn/earth/_forward.pyx":459 * #Minimizing the norm is actually equivalent to maximizing z_end_squared * #Store z_end_squared and the current candidate as the best knot choice * best_z_end_squared = z_end_squared # <<<<<<<<<<<<<< @@ -7598,7 +7658,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ */ __pyx_v_best_z_end_squared = __pyx_v_z_end_squared; - /* "_forward.pyx":458 + /* "sklearn/earth/_forward.pyx":460 * #Store z_end_squared and the current candidate as the best knot choice * best_z_end_squared = z_end_squared * best_candidate_idx = candidate_idx # <<<<<<<<<<<<<< @@ -7607,7 +7667,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ */ __pyx_v_best_candidate_idx = __pyx_v_candidate_idx; - /* "_forward.pyx":459 + /* "sklearn/earth/_forward.pyx":461 * best_z_end_squared = z_end_squared * best_candidate_idx = candidate_idx * best_candidate = candidate # <<<<<<<<<<<<<< @@ -7616,7 +7676,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ */ __pyx_v_best_candidate = __pyx_v_candidate; - /* "_forward.pyx":462 + /* "sklearn/earth/_forward.pyx":464 * * #Initialize the accumulators * i = order[0] # <<<<<<<<<<<<<< @@ -7624,9 +7684,9 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ * y_cum = y[i] */ __pyx_t_33 = 0; - __pyx_v_i = (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_INT_t *, __pyx_pybuffernd_order.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_order.diminfo[0].strides)); + __pyx_v_i = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_INT_t *, __pyx_pybuffernd_order.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_order.diminfo[0].strides)); - /* "_forward.pyx":463 + /* "sklearn/earth/_forward.pyx":465 * #Initialize the accumulators * i = order[0] * last_candidate_idx = 0 # <<<<<<<<<<<<<< @@ -7635,7 +7695,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ */ __pyx_v_last_candidate_idx = 0; - /* "_forward.pyx":464 + /* "sklearn/earth/_forward.pyx":466 * i = order[0] * last_candidate_idx = 0 * y_cum = y[i] # <<<<<<<<<<<<<< @@ -7643,23 +7703,23 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ * b_times_parent_cum = b[i] * b_parent[i] */ __pyx_t_14 = __pyx_v_i; - __pyx_v_y_cum = (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_y.diminfo[0].strides)); + __pyx_v_y_cum = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_y.diminfo[0].strides)); - /* "_forward.pyx":465 + /* "sklearn/earth/_forward.pyx":467 * last_candidate_idx = 0 * y_cum = y[i] * B_orth_times_parent_cum[0:k+1] = B_orth[i,0:k+1] * b_parent[i] # <<<<<<<<<<<<<< * b_times_parent_cum = b[i] * b_parent[i] * parent_squared_cum = b_parent[i] ** 2 */ - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_23 = __Pyx_PyInt_to_py_npy_ulonglong((__pyx_v_k + 1)); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_23 = __Pyx_PyInt_to_py_npy_ulonglong((__pyx_v_k + 1)); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_23); - __pyx_t_2 = PySlice_New(__pyx_int_0, __pyx_t_23, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PySlice_New(__pyx_int_0, __pyx_t_23, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; - __pyx_t_23 = PyTuple_New(2); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_23 = PyTuple_New(2); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_23); PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); @@ -7667,20 +7727,20 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ __Pyx_GIVEREF(__pyx_t_2); __pyx_t_1 = 0; __pyx_t_2 = 0; - __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_B_orth), ((PyObject *)__pyx_t_23)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_B_orth), ((PyObject *)__pyx_t_23)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_23)); __pyx_t_23 = 0; __pyx_t_15 = __pyx_v_i; - __pyx_t_23 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_b_parent.diminfo[0].strides))); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_23 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_b_parent.diminfo[0].strides))); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_23); - __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_t_23); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_t_23); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; - if (__Pyx_PyObject_SetSlice(((PyObject *)__pyx_v_B_orth_times_parent_cum), __pyx_t_1, 0, (__pyx_v_k + 1), NULL, NULL, NULL, 1, 1, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_PyObject_SetSlice(((PyObject *)__pyx_v_B_orth_times_parent_cum), __pyx_t_1, 0, (__pyx_v_k + 1), NULL, NULL, NULL, 1, 1, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "_forward.pyx":466 + /* "sklearn/earth/_forward.pyx":468 * y_cum = y[i] * B_orth_times_parent_cum[0:k+1] = B_orth[i,0:k+1] * b_parent[i] * b_times_parent_cum = b[i] * b_parent[i] # <<<<<<<<<<<<<< @@ -7689,9 +7749,9 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ */ __pyx_t_34 = __pyx_v_i; __pyx_t_35 = __pyx_v_i; - __pyx_v_b_times_parent_cum = ((*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_b.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_b_parent.diminfo[0].strides))); + __pyx_v_b_times_parent_cum = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_b.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_b_parent.diminfo[0].strides))); - /* "_forward.pyx":467 + /* "sklearn/earth/_forward.pyx":469 * B_orth_times_parent_cum[0:k+1] = B_orth[i,0:k+1] * b_parent[i] * b_times_parent_cum = b[i] * b_parent[i] * parent_squared_cum = b_parent[i] ** 2 # <<<<<<<<<<<<<< @@ -7699,9 +7759,9 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ * */ __pyx_t_36 = __pyx_v_i; - __pyx_v_parent_squared_cum = pow((*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_b_parent.diminfo[0].strides)), 2.0); + __pyx_v_parent_squared_cum = pow((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_b_parent.diminfo[0].strides)), 2.0); - /* "_forward.pyx":468 + /* "sklearn/earth/_forward.pyx":470 * b_times_parent_cum = b[i] * b_parent[i] * parent_squared_cum = b_parent[i] ** 2 * parent_times_y_cum = b_parent[i] * y[i] # <<<<<<<<<<<<<< @@ -7710,9 +7770,9 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ */ __pyx_t_37 = __pyx_v_i; __pyx_t_38 = __pyx_v_i; - __pyx_v_parent_times_y_cum = ((*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_b_parent.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_y.diminfo[0].strides))); + __pyx_v_parent_times_y_cum = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_b_parent.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_y.diminfo[0].strides))); - /* "_forward.pyx":471 + /* "sklearn/earth/_forward.pyx":473 * * #Now loop over the remaining candidates and update z_end_squared for each, looking for the greatest value * for i_ in range(1,num_candidates): # <<<<<<<<<<<<<< @@ -7723,7 +7783,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ for (__pyx_t_40 = 1; __pyx_t_40 < __pyx_t_39; __pyx_t_40+=1) { __pyx_v_i_ = __pyx_t_40; - /* "_forward.pyx":472 + /* "sklearn/earth/_forward.pyx":474 * #Now loop over the remaining candidates and update z_end_squared for each, looking for the greatest value * for i_ in range(1,num_candidates): * i = order[i_] # <<<<<<<<<<<<<< @@ -7731,9 +7791,9 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ * #Update the candidate */ __pyx_t_41 = __pyx_v_i_; - __pyx_v_i = (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_INT_t *, __pyx_pybuffernd_order.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_order.diminfo[0].strides)); + __pyx_v_i = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_INT_t *, __pyx_pybuffernd_order.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_order.diminfo[0].strides)); - /* "_forward.pyx":475 + /* "sklearn/earth/_forward.pyx":477 * * #Update the candidate * last_last_candidate_idx = last_candidate_idx # <<<<<<<<<<<<<< @@ -7742,7 +7802,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ */ __pyx_v_last_last_candidate_idx = __pyx_v_last_candidate_idx; - /* "_forward.pyx":476 + /* "sklearn/earth/_forward.pyx":478 * #Update the candidate * last_last_candidate_idx = last_candidate_idx * last_candidate_idx = candidate_idx # <<<<<<<<<<<<<< @@ -7751,7 +7811,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ */ __pyx_v_last_candidate_idx = __pyx_v_candidate_idx; - /* "_forward.pyx":477 + /* "sklearn/earth/_forward.pyx":479 * last_last_candidate_idx = last_candidate_idx * last_candidate_idx = candidate_idx * last_candidate = candidate # <<<<<<<<<<<<<< @@ -7760,7 +7820,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ */ __pyx_v_last_candidate = __pyx_v_candidate; - /* "_forward.pyx":478 + /* "sklearn/earth/_forward.pyx":480 * last_candidate_idx = candidate_idx * last_candidate = candidate * candidate_idx = candidates[i_] # <<<<<<<<<<<<<< @@ -7768,9 +7828,9 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ * */ __pyx_t_42 = __pyx_v_i_; - __pyx_v_candidate_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_INT_t *, __pyx_pybuffernd_candidates.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_candidates.diminfo[0].strides)); + __pyx_v_candidate_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_INT_t *, __pyx_pybuffernd_candidates.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_candidates.diminfo[0].strides)); - /* "_forward.pyx":479 + /* "sklearn/earth/_forward.pyx":481 * last_candidate = candidate * candidate_idx = candidates[i_] * candidate = X[order[candidate_idx],variable] # <<<<<<<<<<<<<< @@ -7778,11 +7838,11 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ * #Update the accumulators and compute delta_b */ __pyx_t_43 = __pyx_v_candidate_idx; - __pyx_t_44 = (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_INT_t *, __pyx_pybuffernd_order.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_order.diminfo[0].strides)); + __pyx_t_44 = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_INT_t *, __pyx_pybuffernd_order.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_order.diminfo[0].strides)); __pyx_t_45 = __pyx_v_variable; - __pyx_v_candidate = (*__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_X.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_X.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_X.diminfo[1].strides)); + __pyx_v_candidate = (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_X.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_X.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_X.diminfo[1].strides)); - /* "_forward.pyx":482 + /* "sklearn/earth/_forward.pyx":484 * * #Update the accumulators and compute delta_b * diff = last_candidate - candidate # <<<<<<<<<<<<<< @@ -7791,7 +7851,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ */ __pyx_v_diff = (__pyx_v_last_candidate - __pyx_v_candidate); - /* "_forward.pyx":483 + /* "sklearn/earth/_forward.pyx":485 * #Update the accumulators and compute delta_b * diff = last_candidate - candidate * delta_c_end = 0.0 # <<<<<<<<<<<<<< @@ -7800,7 +7860,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ */ __pyx_v_delta_c_end = 0.0; - /* "_forward.pyx":514 + /* "sklearn/earth/_forward.pyx":516 * * #BEGIN HYPER-OPTIMIZED * delta_b_squared = 0.0 # <<<<<<<<<<<<<< @@ -7809,7 +7869,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ */ __pyx_v_delta_b_squared = 0.0; - /* "_forward.pyx":515 + /* "sklearn/earth/_forward.pyx":517 * #BEGIN HYPER-OPTIMIZED * delta_b_squared = 0.0 * delta_c_end = 0.0 # <<<<<<<<<<<<<< @@ -7818,7 +7878,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ */ __pyx_v_delta_c_end = 0.0; - /* "_forward.pyx":516 + /* "sklearn/earth/_forward.pyx":518 * delta_b_squared = 0.0 * delta_c_end = 0.0 * delta_u_end = 0.0 # <<<<<<<<<<<<<< @@ -7827,7 +7887,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ */ __pyx_v_delta_u_end = 0.0; - /* "_forward.pyx":519 + /* "sklearn/earth/_forward.pyx":521 * * #Update the accumulators * for j_ in range(last_last_candidate_idx+1,last_candidate_idx+1): # <<<<<<<<<<<<<< @@ -7838,7 +7898,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ for (__pyx_t_47 = (__pyx_v_last_last_candidate_idx + 1); __pyx_t_47 < __pyx_t_46; __pyx_t_47+=1) { __pyx_v_j_ = __pyx_t_47; - /* "_forward.pyx":520 + /* "sklearn/earth/_forward.pyx":522 * #Update the accumulators * for j_ in range(last_last_candidate_idx+1,last_candidate_idx+1): * j = order[j_] # <<<<<<<<<<<<<< @@ -7846,9 +7906,9 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ * for h in range(k+1):#TODO: BLAS */ __pyx_t_48 = __pyx_v_j_; - __pyx_v_j = (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_INT_t *, __pyx_pybuffernd_order.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_order.diminfo[0].strides)); + __pyx_v_j = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_INT_t *, __pyx_pybuffernd_order.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_order.diminfo[0].strides)); - /* "_forward.pyx":521 + /* "sklearn/earth/_forward.pyx":523 * for j_ in range(last_last_candidate_idx+1,last_candidate_idx+1): * j = order[j_] * y_cum += y[j] # <<<<<<<<<<<<<< @@ -7856,9 +7916,9 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ * B_orth_times_parent_cum[h] += B_orth[j,h]*b_parent[j] */ __pyx_t_49 = __pyx_v_j; - __pyx_v_y_cum = (__pyx_v_y_cum + (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_49, __pyx_pybuffernd_y.diminfo[0].strides))); + __pyx_v_y_cum = (__pyx_v_y_cum + (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_49, __pyx_pybuffernd_y.diminfo[0].strides))); - /* "_forward.pyx":522 + /* "sklearn/earth/_forward.pyx":524 * j = order[j_] * y_cum += y[j] * for h in range(k+1):#TODO: BLAS # <<<<<<<<<<<<<< @@ -7869,7 +7929,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ for (__pyx_t_51 = 0; __pyx_t_51 < __pyx_t_50; __pyx_t_51+=1) { __pyx_v_h = __pyx_t_51; - /* "_forward.pyx":523 + /* "sklearn/earth/_forward.pyx":525 * y_cum += y[j] * for h in range(k+1):#TODO: BLAS * B_orth_times_parent_cum[h] += B_orth[j,h]*b_parent[j] # <<<<<<<<<<<<<< @@ -7880,10 +7940,10 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ __pyx_t_53 = __pyx_v_h; __pyx_t_54 = __pyx_v_j; __pyx_t_55 = __pyx_v_h; - *__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth_times_parent_cum.rcbuffer->pybuffer.buf, __pyx_t_55, __pyx_pybuffernd_B_orth_times_parent_cum.diminfo[0].strides) += ((*__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_52, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_53, __pyx_pybuffernd_B_orth.diminfo[1].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_54, __pyx_pybuffernd_b_parent.diminfo[0].strides))); + *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth_times_parent_cum.rcbuffer->pybuffer.buf, __pyx_t_55, __pyx_pybuffernd_B_orth_times_parent_cum.diminfo[0].strides) += ((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_52, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_53, __pyx_pybuffernd_B_orth.diminfo[1].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_54, __pyx_pybuffernd_b_parent.diminfo[0].strides))); } - /* "_forward.pyx":524 + /* "sklearn/earth/_forward.pyx":526 * for h in range(k+1):#TODO: BLAS * B_orth_times_parent_cum[h] += B_orth[j,h]*b_parent[j] * b_times_parent_cum += b[j]*b_parent[j] # <<<<<<<<<<<<<< @@ -7892,9 +7952,9 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ */ __pyx_t_50 = __pyx_v_j; __pyx_t_51 = __pyx_v_j; - __pyx_v_b_times_parent_cum = (__pyx_v_b_times_parent_cum + ((*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_50, __pyx_pybuffernd_b.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_51, __pyx_pybuffernd_b_parent.diminfo[0].strides)))); + __pyx_v_b_times_parent_cum = (__pyx_v_b_times_parent_cum + ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_50, __pyx_pybuffernd_b.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_51, __pyx_pybuffernd_b_parent.diminfo[0].strides)))); - /* "_forward.pyx":525 + /* "sklearn/earth/_forward.pyx":527 * B_orth_times_parent_cum[h] += B_orth[j,h]*b_parent[j] * b_times_parent_cum += b[j]*b_parent[j] * parent_squared_cum += b_parent[j] ** 2 # <<<<<<<<<<<<<< @@ -7902,9 +7962,9 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ * delta_c_end += diff * parent_times_y_cum */ __pyx_t_56 = __pyx_v_j; - __pyx_v_parent_squared_cum = (__pyx_v_parent_squared_cum + pow((*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_56, __pyx_pybuffernd_b_parent.diminfo[0].strides)), 2.0)); + __pyx_v_parent_squared_cum = (__pyx_v_parent_squared_cum + pow((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_56, __pyx_pybuffernd_b_parent.diminfo[0].strides)), 2.0)); - /* "_forward.pyx":526 + /* "sklearn/earth/_forward.pyx":528 * b_times_parent_cum += b[j]*b_parent[j] * parent_squared_cum += b_parent[j] ** 2 * parent_times_y_cum += b_parent[j] * y[j] # <<<<<<<<<<<<<< @@ -7913,10 +7973,10 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ */ __pyx_t_57 = __pyx_v_j; __pyx_t_58 = __pyx_v_j; - __pyx_v_parent_times_y_cum = (__pyx_v_parent_times_y_cum + ((*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_57, __pyx_pybuffernd_b_parent.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_58, __pyx_pybuffernd_y.diminfo[0].strides)))); + __pyx_v_parent_times_y_cum = (__pyx_v_parent_times_y_cum + ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_57, __pyx_pybuffernd_b_parent.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_58, __pyx_pybuffernd_y.diminfo[0].strides)))); } - /* "_forward.pyx":527 + /* "sklearn/earth/_forward.pyx":529 * parent_squared_cum += b_parent[j] ** 2 * parent_times_y_cum += b_parent[j] * y[j] * delta_c_end += diff * parent_times_y_cum # <<<<<<<<<<<<<< @@ -7925,7 +7985,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ */ __pyx_v_delta_c_end = (__pyx_v_delta_c_end + (__pyx_v_diff * __pyx_v_parent_times_y_cum)); - /* "_forward.pyx":528 + /* "sklearn/earth/_forward.pyx":530 * parent_times_y_cum += b_parent[j] * y[j] * delta_c_end += diff * parent_times_y_cum * delta_u_end += 2*diff * b_times_parent_cum # <<<<<<<<<<<<<< @@ -7934,7 +7994,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ */ __pyx_v_delta_u_end = (__pyx_v_delta_u_end + ((2.0 * __pyx_v_diff) * __pyx_v_b_times_parent_cum)); - /* "_forward.pyx":529 + /* "sklearn/earth/_forward.pyx":531 * delta_c_end += diff * parent_times_y_cum * delta_u_end += 2*diff * b_times_parent_cum * delta_b_squared = (diff**2)*parent_squared_cum # <<<<<<<<<<<<<< @@ -7943,7 +8003,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ */ __pyx_v_delta_b_squared = (pow(__pyx_v_diff, 2.0) * __pyx_v_parent_squared_cum); - /* "_forward.pyx":532 + /* "sklearn/earth/_forward.pyx":534 * * #Update u and a bunch of other stuff * for j in range(k+1): # <<<<<<<<<<<<<< @@ -7954,7 +8014,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ for (__pyx_t_47 = 0; __pyx_t_47 < __pyx_t_46; __pyx_t_47+=1) { __pyx_v_j = __pyx_t_47; - /* "_forward.pyx":533 + /* "sklearn/earth/_forward.pyx":535 * #Update u and a bunch of other stuff * for j in range(k+1): * float_tmp = diff*B_orth_times_parent_cum[j] # <<<<<<<<<<<<<< @@ -7962,9 +8022,9 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ * u_dot_u += 2*u[j]*float_tmp + float_tmp*float_tmp */ __pyx_t_59 = __pyx_v_j; - __pyx_v_float_tmp = (__pyx_v_diff * (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth_times_parent_cum.rcbuffer->pybuffer.buf, __pyx_t_59, __pyx_pybuffernd_B_orth_times_parent_cum.diminfo[0].strides))); + __pyx_v_float_tmp = (__pyx_v_diff * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth_times_parent_cum.rcbuffer->pybuffer.buf, __pyx_t_59, __pyx_pybuffernd_B_orth_times_parent_cum.diminfo[0].strides))); - /* "_forward.pyx":534 + /* "sklearn/earth/_forward.pyx":536 * for j in range(k+1): * float_tmp = diff*B_orth_times_parent_cum[j] * u_dot_c += float_tmp * c[j] # <<<<<<<<<<<<<< @@ -7972,9 +8032,9 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ * u[j] += float_tmp */ __pyx_t_60 = __pyx_v_j; - __pyx_v_u_dot_c = (__pyx_v_u_dot_c + (__pyx_v_float_tmp * (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_c.rcbuffer->pybuffer.buf, __pyx_t_60, __pyx_pybuffernd_c.diminfo[0].strides)))); + __pyx_v_u_dot_c = (__pyx_v_u_dot_c + (__pyx_v_float_tmp * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_c.rcbuffer->pybuffer.buf, __pyx_t_60, __pyx_pybuffernd_c.diminfo[0].strides)))); - /* "_forward.pyx":535 + /* "sklearn/earth/_forward.pyx":537 * float_tmp = diff*B_orth_times_parent_cum[j] * u_dot_c += float_tmp * c[j] * u_dot_u += 2*u[j]*float_tmp + float_tmp*float_tmp # <<<<<<<<<<<<<< @@ -7982,9 +8042,9 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ * for j_ in range(last_candidate_idx+1,candidate_idx): */ __pyx_t_61 = __pyx_v_j; - __pyx_v_u_dot_u = (__pyx_v_u_dot_u + (((2.0 * (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_u.rcbuffer->pybuffer.buf, __pyx_t_61, __pyx_pybuffernd_u.diminfo[0].strides))) * __pyx_v_float_tmp) + (__pyx_v_float_tmp * __pyx_v_float_tmp))); + __pyx_v_u_dot_u = (__pyx_v_u_dot_u + (((2.0 * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_u.rcbuffer->pybuffer.buf, __pyx_t_61, __pyx_pybuffernd_u.diminfo[0].strides))) * __pyx_v_float_tmp) + (__pyx_v_float_tmp * __pyx_v_float_tmp))); - /* "_forward.pyx":536 + /* "sklearn/earth/_forward.pyx":538 * u_dot_c += float_tmp * c[j] * u_dot_u += 2*u[j]*float_tmp + float_tmp*float_tmp * u[j] += float_tmp # <<<<<<<<<<<<<< @@ -7992,10 +8052,10 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ * j = order[j_] */ __pyx_t_62 = __pyx_v_j; - *__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_u.rcbuffer->pybuffer.buf, __pyx_t_62, __pyx_pybuffernd_u.diminfo[0].strides) += __pyx_v_float_tmp; + *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_u.rcbuffer->pybuffer.buf, __pyx_t_62, __pyx_pybuffernd_u.diminfo[0].strides) += __pyx_v_float_tmp; } - /* "_forward.pyx":537 + /* "sklearn/earth/_forward.pyx":539 * u_dot_u += 2*u[j]*float_tmp + float_tmp*float_tmp * u[j] += float_tmp * for j_ in range(last_candidate_idx+1,candidate_idx): # <<<<<<<<<<<<<< @@ -8006,7 +8066,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ for (__pyx_t_47 = (__pyx_v_last_candidate_idx + 1); __pyx_t_47 < __pyx_t_46; __pyx_t_47+=1) { __pyx_v_j_ = __pyx_t_47; - /* "_forward.pyx":538 + /* "sklearn/earth/_forward.pyx":540 * u[j] += float_tmp * for j_ in range(last_candidate_idx+1,candidate_idx): * j = order[j_] # <<<<<<<<<<<<<< @@ -8014,9 +8074,9 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ * delta_b_squared += delta_b_j**2 */ __pyx_t_63 = __pyx_v_j_; - __pyx_v_j = (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_INT_t *, __pyx_pybuffernd_order.rcbuffer->pybuffer.buf, __pyx_t_63, __pyx_pybuffernd_order.diminfo[0].strides)); + __pyx_v_j = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_INT_t *, __pyx_pybuffernd_order.rcbuffer->pybuffer.buf, __pyx_t_63, __pyx_pybuffernd_order.diminfo[0].strides)); - /* "_forward.pyx":539 + /* "sklearn/earth/_forward.pyx":541 * for j_ in range(last_candidate_idx+1,candidate_idx): * j = order[j_] * delta_b_j = (X[j,variable] - candidate) * b_parent[j] # <<<<<<<<<<<<<< @@ -8026,9 +8086,9 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ __pyx_t_64 = __pyx_v_j; __pyx_t_65 = __pyx_v_variable; __pyx_t_66 = __pyx_v_j; - __pyx_v_delta_b_j = (((*__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_X.rcbuffer->pybuffer.buf, __pyx_t_64, __pyx_pybuffernd_X.diminfo[0].strides, __pyx_t_65, __pyx_pybuffernd_X.diminfo[1].strides)) - __pyx_v_candidate) * (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_66, __pyx_pybuffernd_b_parent.diminfo[0].strides))); + __pyx_v_delta_b_j = (((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_X.rcbuffer->pybuffer.buf, __pyx_t_64, __pyx_pybuffernd_X.diminfo[0].strides, __pyx_t_65, __pyx_pybuffernd_X.diminfo[1].strides)) - __pyx_v_candidate) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_66, __pyx_pybuffernd_b_parent.diminfo[0].strides))); - /* "_forward.pyx":540 + /* "sklearn/earth/_forward.pyx":542 * j = order[j_] * delta_b_j = (X[j,variable] - candidate) * b_parent[j] * delta_b_squared += delta_b_j**2 # <<<<<<<<<<<<<< @@ -8037,7 +8097,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ */ __pyx_v_delta_b_squared = (__pyx_v_delta_b_squared + pow(__pyx_v_delta_b_j, 2.0)); - /* "_forward.pyx":541 + /* "sklearn/earth/_forward.pyx":543 * delta_b_j = (X[j,variable] - candidate) * b_parent[j] * delta_b_squared += delta_b_j**2 * delta_c_end += delta_b_j * y[j] # <<<<<<<<<<<<<< @@ -8045,9 +8105,9 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ * for h in range(k+1): */ __pyx_t_67 = __pyx_v_j; - __pyx_v_delta_c_end = (__pyx_v_delta_c_end + (__pyx_v_delta_b_j * (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_67, __pyx_pybuffernd_y.diminfo[0].strides)))); + __pyx_v_delta_c_end = (__pyx_v_delta_c_end + (__pyx_v_delta_b_j * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_67, __pyx_pybuffernd_y.diminfo[0].strides)))); - /* "_forward.pyx":542 + /* "sklearn/earth/_forward.pyx":544 * delta_b_squared += delta_b_j**2 * delta_c_end += delta_b_j * y[j] * delta_u_end += 2*delta_b_j*b[j] # <<<<<<<<<<<<<< @@ -8055,9 +8115,9 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ * float_tmp = delta_b_j * B_orth[j,h] */ __pyx_t_68 = __pyx_v_j; - __pyx_v_delta_u_end = (__pyx_v_delta_u_end + ((2.0 * __pyx_v_delta_b_j) * (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_68, __pyx_pybuffernd_b.diminfo[0].strides)))); + __pyx_v_delta_u_end = (__pyx_v_delta_u_end + ((2.0 * __pyx_v_delta_b_j) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_68, __pyx_pybuffernd_b.diminfo[0].strides)))); - /* "_forward.pyx":543 + /* "sklearn/earth/_forward.pyx":545 * delta_c_end += delta_b_j * y[j] * delta_u_end += 2*delta_b_j*b[j] * for h in range(k+1): # <<<<<<<<<<<<<< @@ -8068,7 +8128,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ for (__pyx_t_70 = 0; __pyx_t_70 < __pyx_t_69; __pyx_t_70+=1) { __pyx_v_h = __pyx_t_70; - /* "_forward.pyx":544 + /* "sklearn/earth/_forward.pyx":546 * delta_u_end += 2*delta_b_j*b[j] * for h in range(k+1): * float_tmp = delta_b_j * B_orth[j,h] # <<<<<<<<<<<<<< @@ -8077,9 +8137,9 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ */ __pyx_t_71 = __pyx_v_j; __pyx_t_72 = __pyx_v_h; - __pyx_v_float_tmp = (__pyx_v_delta_b_j * (*__Pyx_BufPtrStrided2d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_71, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_72, __pyx_pybuffernd_B_orth.diminfo[1].strides))); + __pyx_v_float_tmp = (__pyx_v_delta_b_j * (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_71, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_72, __pyx_pybuffernd_B_orth.diminfo[1].strides))); - /* "_forward.pyx":545 + /* "sklearn/earth/_forward.pyx":547 * for h in range(k+1): * float_tmp = delta_b_j * B_orth[j,h] * u_dot_c += float_tmp * c[h] # <<<<<<<<<<<<<< @@ -8087,9 +8147,9 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ * u[h] += float_tmp */ __pyx_t_73 = __pyx_v_h; - __pyx_v_u_dot_c = (__pyx_v_u_dot_c + (__pyx_v_float_tmp * (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_c.rcbuffer->pybuffer.buf, __pyx_t_73, __pyx_pybuffernd_c.diminfo[0].strides)))); + __pyx_v_u_dot_c = (__pyx_v_u_dot_c + (__pyx_v_float_tmp * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_c.rcbuffer->pybuffer.buf, __pyx_t_73, __pyx_pybuffernd_c.diminfo[0].strides)))); - /* "_forward.pyx":546 + /* "sklearn/earth/_forward.pyx":548 * float_tmp = delta_b_j * B_orth[j,h] * u_dot_c += float_tmp * c[h] * u_dot_u += 2*u[h]*float_tmp + float_tmp*float_tmp # <<<<<<<<<<<<<< @@ -8097,9 +8157,9 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ * b[j] += delta_b_j */ __pyx_t_74 = __pyx_v_h; - __pyx_v_u_dot_u = (__pyx_v_u_dot_u + (((2.0 * (*__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_u.rcbuffer->pybuffer.buf, __pyx_t_74, __pyx_pybuffernd_u.diminfo[0].strides))) * __pyx_v_float_tmp) + (__pyx_v_float_tmp * __pyx_v_float_tmp))); + __pyx_v_u_dot_u = (__pyx_v_u_dot_u + (((2.0 * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_u.rcbuffer->pybuffer.buf, __pyx_t_74, __pyx_pybuffernd_u.diminfo[0].strides))) * __pyx_v_float_tmp) + (__pyx_v_float_tmp * __pyx_v_float_tmp))); - /* "_forward.pyx":547 + /* "sklearn/earth/_forward.pyx":549 * u_dot_c += float_tmp * c[h] * u_dot_u += 2*u[h]*float_tmp + float_tmp*float_tmp * u[h] += float_tmp # <<<<<<<<<<<<<< @@ -8107,10 +8167,10 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ * */ __pyx_t_75 = __pyx_v_h; - *__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_u.rcbuffer->pybuffer.buf, __pyx_t_75, __pyx_pybuffernd_u.diminfo[0].strides) += __pyx_v_float_tmp; + *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_u.rcbuffer->pybuffer.buf, __pyx_t_75, __pyx_pybuffernd_u.diminfo[0].strides) += __pyx_v_float_tmp; } - /* "_forward.pyx":548 + /* "sklearn/earth/_forward.pyx":550 * u_dot_u += 2*u[h]*float_tmp + float_tmp*float_tmp * u[h] += float_tmp * b[j] += delta_b_j # <<<<<<<<<<<<<< @@ -8118,10 +8178,10 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ * #Update u_end */ __pyx_t_69 = __pyx_v_j; - *__Pyx_BufPtrStrided1d(__pyx_t_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_69, __pyx_pybuffernd_b.diminfo[0].strides) += __pyx_v_delta_b_j; + *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_69, __pyx_pybuffernd_b.diminfo[0].strides) += __pyx_v_delta_b_j; } - /* "_forward.pyx":551 + /* "sklearn/earth/_forward.pyx":553 * * #Update u_end * delta_u_end += delta_b_squared # <<<<<<<<<<<<<< @@ -8130,7 +8190,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ */ __pyx_v_delta_u_end = (__pyx_v_delta_u_end + __pyx_v_delta_b_squared); - /* "_forward.pyx":552 + /* "sklearn/earth/_forward.pyx":554 * #Update u_end * delta_u_end += delta_b_squared * u_end += delta_u_end # <<<<<<<<<<<<<< @@ -8139,7 +8199,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ */ __pyx_v_u_end = (__pyx_v_u_end + __pyx_v_delta_u_end); - /* "_forward.pyx":555 + /* "sklearn/earth/_forward.pyx":557 * * #Update c_end * c_end += delta_c_end # <<<<<<<<<<<<<< @@ -8148,7 +8208,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ */ __pyx_v_c_end = (__pyx_v_c_end + __pyx_v_delta_c_end); - /* "_forward.pyx":558 + /* "sklearn/earth/_forward.pyx":560 * * #Update b_times_parent_cum * b_times_parent_cum += parent_squared_cum * diff # <<<<<<<<<<<<<< @@ -8157,17 +8217,17 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ */ __pyx_v_b_times_parent_cum = (__pyx_v_b_times_parent_cum + (__pyx_v_parent_squared_cum * __pyx_v_diff)); - /* "_forward.pyx":561 + /* "sklearn/earth/_forward.pyx":563 * * #Compute the new z_end_squared (this is the quantity we're optimizing) * if (u_end - u_dot_u) <= self.zero_tol: # <<<<<<<<<<<<<< * continue * z_end_squared = ((c_end - u_dot_c)**2) / (u_end - u_dot_u) */ - __pyx_t_20 = ((__pyx_v_u_end - __pyx_v_u_dot_u) <= __pyx_v_self->zero_tol); + __pyx_t_20 = (((__pyx_v_u_end - __pyx_v_u_dot_u) <= __pyx_v_self->zero_tol) != 0); if (__pyx_t_20) { - /* "_forward.pyx":562 + /* "sklearn/earth/_forward.pyx":564 * #Compute the new z_end_squared (this is the quantity we're optimizing) * if (u_end - u_dot_u) <= self.zero_tol: * continue # <<<<<<<<<<<<<< @@ -8179,7 +8239,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ } __pyx_L25:; - /* "_forward.pyx":563 + /* "sklearn/earth/_forward.pyx":565 * if (u_end - u_dot_u) <= self.zero_tol: * continue * z_end_squared = ((c_end - u_dot_c)**2) / (u_end - u_dot_u) # <<<<<<<<<<<<<< @@ -8188,17 +8248,17 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ */ __pyx_v_z_end_squared = (pow((__pyx_v_c_end - __pyx_v_u_dot_c), 2.0) / (__pyx_v_u_end - __pyx_v_u_dot_u)); - /* "_forward.pyx":567 + /* "sklearn/earth/_forward.pyx":569 * * #Update the best if necessary * if z_end_squared > best_z_end_squared: # <<<<<<<<<<<<<< * best_z_end_squared = z_end_squared * best_candidate_idx = candidate_idx */ - __pyx_t_20 = (__pyx_v_z_end_squared > __pyx_v_best_z_end_squared); + __pyx_t_20 = ((__pyx_v_z_end_squared > __pyx_v_best_z_end_squared) != 0); if (__pyx_t_20) { - /* "_forward.pyx":568 + /* "sklearn/earth/_forward.pyx":570 * #Update the best if necessary * if z_end_squared > best_z_end_squared: * best_z_end_squared = z_end_squared # <<<<<<<<<<<<<< @@ -8207,7 +8267,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ */ __pyx_v_best_z_end_squared = __pyx_v_z_end_squared; - /* "_forward.pyx":569 + /* "sklearn/earth/_forward.pyx":571 * if z_end_squared > best_z_end_squared: * best_z_end_squared = z_end_squared * best_candidate_idx = candidate_idx # <<<<<<<<<<<<<< @@ -8216,7 +8276,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ */ __pyx_v_best_candidate_idx = __pyx_v_candidate_idx; - /* "_forward.pyx":570 + /* "sklearn/earth/_forward.pyx":572 * best_z_end_squared = z_end_squared * best_candidate_idx = candidate_idx * best_candidate = candidate # <<<<<<<<<<<<<< @@ -8230,7 +8290,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ __pyx_L13_continue:; } - /* "_forward.pyx":573 + /* "sklearn/earth/_forward.pyx":575 * * #Compute the mse for the best z_end and set return values * mse[0] = (self.y_squared - self.c_squared - best_z_end_squared)/self.m # <<<<<<<<<<<<<< @@ -8239,7 +8299,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ */ (__pyx_v_mse[0]) = (((__pyx_v_self->y_squared - __pyx_v_self->c_squared) - __pyx_v_best_z_end_squared) / __pyx_v_self->m); - /* "_forward.pyx":574 + /* "sklearn/earth/_forward.pyx":576 * #Compute the mse for the best z_end and set return values * mse[0] = (self.y_squared - self.c_squared - best_z_end_squared)/self.m * knot[0] = best_candidate # <<<<<<<<<<<<<< @@ -8248,7 +8308,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ */ (__pyx_v_knot[0]) = __pyx_v_best_candidate; - /* "_forward.pyx":575 + /* "sklearn/earth/_forward.pyx":577 * mse[0] = (self.y_squared - self.c_squared - best_z_end_squared)/self.m * knot[0] = best_candidate * knot_idx[0] = best_candidate_idx # <<<<<<<<<<<<<< @@ -8277,7 +8337,7 @@ static PyObject *__pyx_f_8_forward_13ForwardPasser_best_knot(struct __pyx_obj_8_ __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_u.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("_forward.ForwardPasser.best_knot", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._forward.ForwardPasser.best_knot", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; goto __pyx_L2; __pyx_L0:; @@ -8364,7 +8424,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * * cdef int copy_shape, i, ndim */ - __pyx_t_1 = (__pyx_v_info == NULL); + __pyx_t_1 = ((__pyx_v_info == NULL) != 0); if (__pyx_t_1) { __pyx_r = 0; goto __pyx_L0; @@ -8406,7 +8466,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * copy_shape = 1 * else: */ - __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); if (__pyx_t_1) { /* "numpy.pxd":209 @@ -8439,7 +8499,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); + __pyx_t_1 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0); if (__pyx_t_1) { /* "numpy.pxd":214 @@ -8449,7 +8509,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * raise ValueError(u"ndarray is not C contiguous") * */ - __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS)); + __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; @@ -8479,7 +8539,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") */ - __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); + __pyx_t_3 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0); if (__pyx_t_3) { /* "numpy.pxd":218 @@ -8489,7 +8549,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * raise ValueError(u"ndarray is not Fortran contiguous") * */ - __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS)); + __pyx_t_1 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; @@ -8537,7 +8597,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. */ - if (__pyx_v_copy_shape) { + __pyx_t_2 = (__pyx_v_copy_shape != 0); + if (__pyx_t_2) { /* "numpy.pxd":226 * # Allocate new buffer for strides and shape info. @@ -8635,7 +8696,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * * cdef int t */ - __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self)); + __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0)); /* "numpy.pxd":239 * @@ -8674,9 +8735,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * # do not call releasebuffer * info.obj = None */ - __pyx_t_2 = (!__pyx_v_hasfields); + __pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0); if (__pyx_t_2) { - __pyx_t_3 = (!__pyx_v_copy_shape); + __pyx_t_3 = ((!(__pyx_v_copy_shape != 0)) != 0); __pyx_t_1 = __pyx_t_3; } else { __pyx_t_1 = __pyx_t_2; @@ -8721,7 +8782,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or */ - __pyx_t_1 = (!__pyx_v_hasfields); + __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0); if (__pyx_t_1) { /* "numpy.pxd":254 @@ -8741,9 +8802,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ - __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); + __pyx_t_1 = ((__pyx_v_descr->byteorder == '>') != 0); if (__pyx_t_1) { - __pyx_t_2 = __pyx_v_little_endian; + __pyx_t_2 = (__pyx_v_little_endian != 0); } else { __pyx_t_2 = __pyx_t_1; } @@ -8756,9 +8817,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" */ - __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); + __pyx_t_1 = ((__pyx_v_descr->byteorder == '<') != 0); if (__pyx_t_1) { - __pyx_t_3 = (!__pyx_v_little_endian); + __pyx_t_3 = ((!(__pyx_v_little_endian != 0)) != 0); __pyx_t_7 = __pyx_t_3; } else { __pyx_t_7 = __pyx_t_1; @@ -9130,7 +9191,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self); + __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0); if (__pyx_t_1) { /* "numpy.pxd":290 @@ -9152,7 +9213,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s * stdlib.free(info.strides) * # info.shape was stored after info.strides in the same block */ - __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); if (__pyx_t_1) { /* "numpy.pxd":292 @@ -9583,9 +9644,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ - __pyx_t_7 = (__pyx_v_child->byteorder == '>'); + __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0); if (__pyx_t_7) { - __pyx_t_8 = __pyx_v_little_endian; + __pyx_t_8 = (__pyx_v_little_endian != 0); } else { __pyx_t_8 = __pyx_t_7; } @@ -9598,9 +9659,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ - __pyx_t_7 = (__pyx_v_child->byteorder == '<'); + __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0); if (__pyx_t_7) { - __pyx_t_9 = (!__pyx_v_little_endian); + __pyx_t_9 = ((!(__pyx_v_little_endian != 0)) != 0); __pyx_t_10 = __pyx_t_9; } else { __pyx_t_10 = __pyx_t_7; @@ -9689,7 +9750,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * t = child.type_num * if end - f < 5: */ - __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child)); + __pyx_t_7 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0); if (__pyx_t_7) { /* "numpy.pxd":821 @@ -9712,7 +9773,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * raise RuntimeError(u"Format string allocated too short.") * */ - __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5); + __pyx_t_7 = (((__pyx_v_end - __pyx_v_f) < 5) != 0); if (__pyx_t_7) { /* "numpy.pxd":823 @@ -10134,6 +10195,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a PyObject *__pyx_v_baseptr; __Pyx_RefNannyDeclarations int __pyx_t_1; + int __pyx_t_2; __Pyx_RefNannySetupContext("set_array_base", 0); /* "numpy.pxd":967 @@ -10144,7 +10206,8 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a * else: */ __pyx_t_1 = (__pyx_v_base == Py_None); - if (__pyx_t_1) { + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { /* "numpy.pxd":968 * cdef PyObject* baseptr @@ -10220,7 +10283,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py * return None * else: */ - __pyx_t_1 = (__pyx_v_arr->base == NULL); + __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0); if (__pyx_t_1) { /* "numpy.pxd":977 @@ -10256,19 +10319,19 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __Pyx_RefNannyFinishContext(); return __pyx_r; } -static struct __pyx_vtabstruct_8_forward_ForwardPasser __pyx_vtable_8_forward_ForwardPasser; +static struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser __pyx_vtable_7sklearn_5earth_8_forward_ForwardPasser; -static PyObject *__pyx_tp_new_8_forward_ForwardPasser(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_8_forward_ForwardPasser *p; +static PyObject *__pyx_tp_new_7sklearn_5earth_8_forward_ForwardPasser(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *p; PyObject *o; o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_8_forward_ForwardPasser *)o); - p->__pyx_vtab = __pyx_vtabptr_8_forward_ForwardPasser; + p = ((struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *)o); + p->__pyx_vtab = __pyx_vtabptr_7sklearn_5earth_8_forward_ForwardPasser; p->xlabels = ((PyObject*)Py_None); Py_INCREF(Py_None); p->X = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); p->y = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - p->weights = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + p->sample_weight = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); p->B = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); p->B_orth = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); p->c = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); @@ -10279,18 +10342,18 @@ static PyObject *__pyx_tp_new_8_forward_ForwardPasser(PyTypeObject *t, CYTHON_UN p->sorting = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); p->mwork = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); p->linear_variables = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - p->record = ((struct __pyx_obj_7_record_ForwardPassRecord *)Py_None); Py_INCREF(Py_None); - p->basis = ((struct __pyx_obj_6_basis_Basis *)Py_None); Py_INCREF(Py_None); + p->record = ((struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *)Py_None); Py_INCREF(Py_None); + p->basis = ((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)Py_None); Py_INCREF(Py_None); return o; } -static void __pyx_tp_dealloc_8_forward_ForwardPasser(PyObject *o) { - struct __pyx_obj_8_forward_ForwardPasser *p = (struct __pyx_obj_8_forward_ForwardPasser *)o; +static void __pyx_tp_dealloc_7sklearn_5earth_8_forward_ForwardPasser(PyObject *o) { + struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *p = (struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->xlabels); Py_CLEAR(p->X); Py_CLEAR(p->y); - Py_CLEAR(p->weights); + Py_CLEAR(p->sample_weight); Py_CLEAR(p->B); Py_CLEAR(p->B_orth); Py_CLEAR(p->c); @@ -10306,9 +10369,9 @@ static void __pyx_tp_dealloc_8_forward_ForwardPasser(PyObject *o) { (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_8_forward_ForwardPasser(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_7sklearn_5earth_8_forward_ForwardPasser(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_8_forward_ForwardPasser *p = (struct __pyx_obj_8_forward_ForwardPasser *)o; + struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *p = (struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *)o; if (p->xlabels) { e = (*v)(p->xlabels, a); if (e) return e; } @@ -10318,8 +10381,8 @@ static int __pyx_tp_traverse_8_forward_ForwardPasser(PyObject *o, visitproc v, v if (p->y) { e = (*v)(((PyObject*)p->y), a); if (e) return e; } - if (p->weights) { - e = (*v)(((PyObject*)p->weights), a); if (e) return e; + if (p->sample_weight) { + e = (*v)(((PyObject*)p->sample_weight), a); if (e) return e; } if (p->B) { e = (*v)(((PyObject*)p->B), a); if (e) return e; @@ -10360,8 +10423,8 @@ static int __pyx_tp_traverse_8_forward_ForwardPasser(PyObject *o, visitproc v, v return 0; } -static int __pyx_tp_clear_8_forward_ForwardPasser(PyObject *o) { - struct __pyx_obj_8_forward_ForwardPasser *p = (struct __pyx_obj_8_forward_ForwardPasser *)o; +static int __pyx_tp_clear_7sklearn_5earth_8_forward_ForwardPasser(PyObject *o) { + struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *p = (struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *)o; PyObject* tmp; tmp = ((PyObject*)p->xlabels); p->xlabels = ((PyObject*)Py_None); Py_INCREF(Py_None); @@ -10372,8 +10435,8 @@ static int __pyx_tp_clear_8_forward_ForwardPasser(PyObject *o) { tmp = ((PyObject*)p->y); p->y = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->weights); - p->weights = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + tmp = ((PyObject*)p->sample_weight); + p->sample_weight = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->B); p->B = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); @@ -10406,129 +10469,31 @@ static int __pyx_tp_clear_8_forward_ForwardPasser(PyObject *o) { p->linear_variables = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->record); - p->record = ((struct __pyx_obj_7_record_ForwardPassRecord *)Py_None); Py_INCREF(Py_None); + p->record = ((struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->basis); - p->basis = ((struct __pyx_obj_6_basis_Basis *)Py_None); Py_INCREF(Py_None); + p->basis = ((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyMethodDef __pyx_methods_8_forward_ForwardPasser[] = { - {__Pyx_NAMESTR("get_basis"), (PyCFunction)__pyx_pw_8_forward_13ForwardPasser_3get_basis, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("init_linear_variables"), (PyCFunction)__pyx_pw_8_forward_13ForwardPasser_5init_linear_variables, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_B_orth"), (PyCFunction)__pyx_pw_8_forward_13ForwardPasser_7get_B_orth, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("run"), (PyCFunction)__pyx_pw_8_forward_13ForwardPasser_9run, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("orthonormal_update"), (PyCFunction)__pyx_pw_8_forward_13ForwardPasser_11orthonormal_update, METH_O, __Pyx_DOCSTR(__pyx_doc_8_forward_13ForwardPasser_10orthonormal_update)}, - {__Pyx_NAMESTR("orthonormal_downdate"), (PyCFunction)__pyx_pw_8_forward_13ForwardPasser_13orthonormal_downdate, METH_O, __Pyx_DOCSTR(__pyx_doc_8_forward_13ForwardPasser_12orthonormal_downdate)}, - {__Pyx_NAMESTR("trace"), (PyCFunction)__pyx_pw_8_forward_13ForwardPasser_15trace, METH_NOARGS, __Pyx_DOCSTR(0)}, +static PyMethodDef __pyx_methods_7sklearn_5earth_8_forward_ForwardPasser[] = { + {__Pyx_NAMESTR("get_basis"), (PyCFunction)__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_3get_basis, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("init_linear_variables"), (PyCFunction)__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_5init_linear_variables, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_B_orth"), (PyCFunction)__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_7get_B_orth, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("run"), (PyCFunction)__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_9run, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("orthonormal_update"), (PyCFunction)__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_11orthonormal_update, METH_O, __Pyx_DOCSTR(__pyx_doc_7sklearn_5earth_8_forward_13ForwardPasser_10orthonormal_update)}, + {__Pyx_NAMESTR("orthonormal_downdate"), (PyCFunction)__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_13orthonormal_downdate, METH_O, __Pyx_DOCSTR(__pyx_doc_7sklearn_5earth_8_forward_13ForwardPasser_12orthonormal_downdate)}, + {__Pyx_NAMESTR("trace"), (PyCFunction)__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_15trace, METH_NOARGS, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; -static PyNumberMethods __pyx_tp_as_number_ForwardPasser = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_long*/ - #else - 0, /*reserved*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if PY_VERSION_HEX >= 0x02050000 - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_ForwardPasser = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_ForwardPasser = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_ForwardPasser = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -static PyTypeObject __pyx_type_8_forward_ForwardPasser = { +static PyTypeObject __pyx_type_7sklearn_5earth_8_forward_ForwardPasser = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_forward.ForwardPasser"), /*tp_name*/ - sizeof(struct __pyx_obj_8_forward_ForwardPasser), /*tp_basicsize*/ + __Pyx_NAMESTR("sklearn.earth._forward.ForwardPasser"), /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_8_forward_ForwardPasser, /*tp_dealloc*/ + __pyx_tp_dealloc_7sklearn_5earth_8_forward_ForwardPasser, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -10538,24 +10503,24 @@ static PyTypeObject __pyx_type_8_forward_ForwardPasser = { 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number_ForwardPasser, /*tp_as_number*/ - &__pyx_tp_as_sequence_ForwardPasser, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_ForwardPasser, /*tp_as_mapping*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_ForwardPasser, /*tp_as_buffer*/ + 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_8_forward_ForwardPasser, /*tp_traverse*/ - __pyx_tp_clear_8_forward_ForwardPasser, /*tp_clear*/ + __pyx_tp_traverse_7sklearn_5earth_8_forward_ForwardPasser, /*tp_traverse*/ + __pyx_tp_clear_7sklearn_5earth_8_forward_ForwardPasser, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_8_forward_ForwardPasser, /*tp_methods*/ + __pyx_methods_7sklearn_5earth_8_forward_ForwardPasser, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -10563,9 +10528,9 @@ static PyTypeObject __pyx_type_8_forward_ForwardPasser = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pw_8_forward_13ForwardPasser_1__init__, /*tp_init*/ + __pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_1__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_8_forward_ForwardPasser, /*tp_new*/ + __pyx_tp_new_7sklearn_5earth_8_forward_ForwardPasser, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -10627,6 +10592,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, {&__pyx_n_s____pyx_getbuffer, __pyx_k____pyx_getbuffer, sizeof(__pyx_k____pyx_getbuffer), 0, 0, 1, 1}, {&__pyx_n_s____pyx_releasebuffer, __pyx_k____pyx_releasebuffer, sizeof(__pyx_k____pyx_releasebuffer), 0, 0, 1, 1}, + {&__pyx_n_s____pyx_vtable__, __pyx_k____pyx_vtable__, sizeof(__pyx_k____pyx_vtable__), 0, 0, 1, 1}, {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, {&__pyx_n_s__argsort, __pyx_k__argsort, sizeof(__pyx_k__argsort), 0, 0, 1, 1}, {&__pyx_n_s__check_every, __pyx_k__check_every, sizeof(__pyx_k__check_every), 0, 0, 1, 1}, @@ -10657,13 +10623,13 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, {&__pyx_n_s__round, __pyx_k__round, sizeof(__pyx_k__round), 0, 0, 1, 1}, {&__pyx_n_s__run, __pyx_k__run, sizeof(__pyx_k__run), 0, 0, 1, 1}, + {&__pyx_n_s__sample_weight, __pyx_k__sample_weight, sizeof(__pyx_k__sample_weight), 0, 0, 1, 1}, {&__pyx_n_s__set_no_candidates, __pyx_k__set_no_candidates, sizeof(__pyx_k__set_no_candidates), 0, 0, 1, 1}, {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1}, {&__pyx_n_s__sqrt, __pyx_k__sqrt, sizeof(__pyx_k__sqrt), 0, 0, 1, 1}, {&__pyx_n_s__stopping_conditions, __pyx_k__stopping_conditions, sizeof(__pyx_k__stopping_conditions), 0, 0, 1, 1}, {&__pyx_n_s__sum, __pyx_k__sum, sizeof(__pyx_k__sum), 0, 0, 1, 1}, {&__pyx_n_s__thresh, __pyx_k__thresh, sizeof(__pyx_k__thresh), 0, 0, 1, 1}, - {&__pyx_n_s__weights, __pyx_k__weights, sizeof(__pyx_k__weights), 0, 0, 1, 1}, {&__pyx_n_s__x, __pyx_k__x, sizeof(__pyx_k__x), 0, 0, 1, 1}, {&__pyx_n_s__xlabels, __pyx_k__xlabels, sizeof(__pyx_k__xlabels), 0, 0, 1, 1}, {&__pyx_n_s__y, __pyx_k__y, sizeof(__pyx_k__y), 0, 0, 1, 1}, @@ -10671,9 +10637,9 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_round = __Pyx_GetBuiltinName(__pyx_n_s__round); if (!__pyx_builtin_round) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_round = __Pyx_GetBuiltinName(__pyx_n_s__round); if (!__pyx_builtin_round) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; @@ -10685,153 +10651,153 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "_forward.pyx":79 + /* "sklearn/earth/_forward.pyx":81 * self.linear_variables[linvar] = 1 * else: * raise IndexError('Unknown variable selected in linvars argument.') # <<<<<<<<<<<<<< * * #Initialize B_orth, c, and c_squared (assuming column 0 of B_orth is already filled with 1) */ - __pyx_k_tuple_2 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_1)); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_2 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_1)); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_2); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); - /* "_forward.pyx":98 + /* "sklearn/earth/_forward.pyx":100 * cdef ConstantBasisFunction root_basis_function = self.basis[0] * for variable in range(self.n): * order = np.argsort(X[:,variable])[::-1] # <<<<<<<<<<<<<< * if root_basis_function.valid_knots(B[order,0], X[order,variable], * variable, self.check_every, endspan, */ - __pyx_k_slice_4 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_4 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_4); __Pyx_GIVEREF(__pyx_k_slice_4); - __pyx_k_slice_5 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_k_slice_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_5 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_k_slice_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_5); __Pyx_GIVEREF(__pyx_k_slice_5); - /* "_forward.pyx":247 + /* "sklearn/earth/_forward.pyx":249 * * #Sort the data * sorting[:] = np.argsort(X[:,variable])[::-1] #TODO: eliminate Python call / data copy # <<<<<<<<<<<<<< * * #Iterate over parents */ - __pyx_k_slice_8 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_8 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_8); __Pyx_GIVEREF(__pyx_k_slice_8); - __pyx_k_slice_9 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_k_slice_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_9 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_k_slice_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_9); __Pyx_GIVEREF(__pyx_k_slice_9); - __pyx_k_slice_10 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_10 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_10); __Pyx_GIVEREF(__pyx_k_slice_10); - /* "_forward.pyx":336 + /* "sklearn/earth/_forward.pyx":338 * bf1 = HingeBasisFunction(parent_choice,knot_choice,knot_idx_choice,variable_choice,False,label) * bf2 = HingeBasisFunction(parent_choice,knot_choice,knot_idx_choice,variable_choice,True,label) * bf1.apply(X,B[:,k]) # <<<<<<<<<<<<<< * bf2.apply(X,B[:,k+1]) * self.basis.append(bf1) */ - __pyx_k_slice_11 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_11 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_11); __Pyx_GIVEREF(__pyx_k_slice_11); - /* "_forward.pyx":337 + /* "sklearn/earth/_forward.pyx":339 * bf2 = HingeBasisFunction(parent_choice,knot_choice,knot_idx_choice,variable_choice,True,label) * bf1.apply(X,B[:,k]) * bf2.apply(X,B[:,k+1]) # <<<<<<<<<<<<<< * self.basis.append(bf1) * self.basis.append(bf2) */ - __pyx_k_slice_12 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_12 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_12); __Pyx_GIVEREF(__pyx_k_slice_12); - /* "_forward.pyx":342 + /* "sklearn/earth/_forward.pyx":344 * * #Orthogonalize the new basis * B_orth[:,k] = B[:,k] # <<<<<<<<<<<<<< * if self.orthonormal_update(k) == 1: * bf1.make_unsplittable() */ - __pyx_k_slice_13 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_13 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_13); __Pyx_GIVEREF(__pyx_k_slice_13); - __pyx_k_slice_14 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_14 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_14); __Pyx_GIVEREF(__pyx_k_slice_14); - /* "_forward.pyx":345 + /* "sklearn/earth/_forward.pyx":347 * if self.orthonormal_update(k) == 1: * bf1.make_unsplittable() * B_orth[:,k+1] = B[:,k+1] # <<<<<<<<<<<<<< * if self.orthonormal_update(k+1) == 1: * bf2.make_unsplittable() */ - __pyx_k_slice_15 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_15 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_15); __Pyx_GIVEREF(__pyx_k_slice_15); - __pyx_k_slice_16 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_16 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_16); __Pyx_GIVEREF(__pyx_k_slice_16); - /* "_forward.pyx":351 + /* "sklearn/earth/_forward.pyx":353 * #In this case, only add the linear basis function * bf1 = LinearBasisFunction(parent_choice,variable_choice,label) * bf1.apply(X,B[:,k]) # <<<<<<<<<<<<<< * self.basis.append(bf1) * */ - __pyx_k_slice_17 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 351; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_17 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_17); __Pyx_GIVEREF(__pyx_k_slice_17); - /* "_forward.pyx":355 + /* "sklearn/earth/_forward.pyx":357 * * #Orthogonalize the new basis * B_orth[:,k] = B[:,k] # <<<<<<<<<<<<<< * if self.orthonormal_update(k) == 1: * bf1.make_unsplittable() */ - __pyx_k_slice_18 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_18 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_18); __Pyx_GIVEREF(__pyx_k_slice_18); - __pyx_k_slice_19 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_19 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_19); __Pyx_GIVEREF(__pyx_k_slice_19); - /* "_forward.pyx":377 + /* "sklearn/earth/_forward.pyx":379 * ''' * * cdef cnp.ndarray[FLOAT_t, ndim=1] b = self.B[:,k+1] # <<<<<<<<<<<<<< * cdef cnp.ndarray[FLOAT_t, ndim=1] b_parent = self.B[:,parent] * cdef cnp.ndarray[FLOAT_t, ndim=1] u = self.u */ - __pyx_k_slice_20 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_20 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_20); __Pyx_GIVEREF(__pyx_k_slice_20); - /* "_forward.pyx":378 + /* "sklearn/earth/_forward.pyx":380 * * cdef cnp.ndarray[FLOAT_t, ndim=1] b = self.B[:,k+1] * cdef cnp.ndarray[FLOAT_t, ndim=1] b_parent = self.B[:,parent] # <<<<<<<<<<<<<< * cdef cnp.ndarray[FLOAT_t, ndim=1] u = self.u * cdef cnp.ndarray[FLOAT_t, ndim=2] B_orth = self.B_orth */ - __pyx_k_slice_21 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_21 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_21); __Pyx_GIVEREF(__pyx_k_slice_21); - /* "_forward.pyx":434 + /* "sklearn/earth/_forward.pyx":436 * * #Compute the initial covariance column, u (not including the final element) * u[0:k+1] = np.dot(b,B_orth[:,0:k+1]) # <<<<<<<<<<<<<< * * #Compute the new last elements of c and u */ - __pyx_k_slice_22 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_22 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_22); __Pyx_GIVEREF(__pyx_k_slice_22); @@ -10976,8 +10942,8 @@ PyMODINIT_FUNC PyInit__forward(void) #if PY_MAJOR_VERSION >= 3 { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (!PyDict_GetItemString(modules, "_forward")) { - if (unlikely(PyDict_SetItemString(modules, "_forward", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyDict_GetItemString(modules, "sklearn.earth._forward")) { + if (unlikely(PyDict_SetItemString(modules, "sklearn.earth._forward", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif @@ -10991,7 +10957,7 @@ PyMODINIT_FUNC PyInit__forward(void) #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif - if (__pyx_module_is_main__forward) { + if (__pyx_module_is_main_sklearn__earth___forward) { if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; } /*--- Builtin init code ---*/ @@ -11002,19 +10968,19 @@ PyMODINIT_FUNC PyInit__forward(void) /*--- Variable export code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ - __pyx_vtabptr_8_forward_ForwardPasser = &__pyx_vtable_8_forward_ForwardPasser; - __pyx_vtable_8_forward_ForwardPasser.get_basis = (struct __pyx_obj_6_basis_Basis *(*)(struct __pyx_obj_8_forward_ForwardPasser *, int __pyx_skip_dispatch))__pyx_f_8_forward_13ForwardPasser_get_basis; - __pyx_vtable_8_forward_ForwardPasser.init_linear_variables = (PyObject *(*)(struct __pyx_obj_8_forward_ForwardPasser *, int __pyx_skip_dispatch))__pyx_f_8_forward_13ForwardPasser_init_linear_variables; - __pyx_vtable_8_forward_ForwardPasser.run = (PyObject *(*)(struct __pyx_obj_8_forward_ForwardPasser *, int __pyx_skip_dispatch))__pyx_f_8_forward_13ForwardPasser_run; - __pyx_vtable_8_forward_ForwardPasser.stop_check = (PyObject *(*)(struct __pyx_obj_8_forward_ForwardPasser *))__pyx_f_8_forward_13ForwardPasser_stop_check; - __pyx_vtable_8_forward_ForwardPasser.orthonormal_update = (int (*)(struct __pyx_obj_8_forward_ForwardPasser *, __pyx_t_8_forward_INDEX_t, int __pyx_skip_dispatch))__pyx_f_8_forward_13ForwardPasser_orthonormal_update; - __pyx_vtable_8_forward_ForwardPasser.orthonormal_downdate = (PyObject *(*)(struct __pyx_obj_8_forward_ForwardPasser *, __pyx_t_8_forward_INDEX_t, int __pyx_skip_dispatch))__pyx_f_8_forward_13ForwardPasser_orthonormal_downdate; - __pyx_vtable_8_forward_ForwardPasser.next_pair = (PyObject *(*)(struct __pyx_obj_8_forward_ForwardPasser *))__pyx_f_8_forward_13ForwardPasser_next_pair; - __pyx_vtable_8_forward_ForwardPasser.best_knot = (PyObject *(*)(struct __pyx_obj_8_forward_ForwardPasser *, __pyx_t_8_forward_INDEX_t, __pyx_t_8_forward_INDEX_t, __pyx_t_8_forward_INDEX_t, PyArrayObject *, PyArrayObject *, __pyx_t_8_forward_FLOAT_t *, __pyx_t_8_forward_FLOAT_t *, __pyx_t_8_forward_INDEX_t *))__pyx_f_8_forward_13ForwardPasser_best_knot; - if (PyType_Ready(&__pyx_type_8_forward_ForwardPasser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_8_forward_ForwardPasser.tp_dict, __pyx_vtabptr_8_forward_ForwardPasser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "ForwardPasser", (PyObject *)&__pyx_type_8_forward_ForwardPasser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_8_forward_ForwardPasser = &__pyx_type_8_forward_ForwardPasser; + __pyx_vtabptr_7sklearn_5earth_8_forward_ForwardPasser = &__pyx_vtable_7sklearn_5earth_8_forward_ForwardPasser; + __pyx_vtable_7sklearn_5earth_8_forward_ForwardPasser.get_basis = (struct __pyx_obj_7sklearn_5earth_6_basis_Basis *(*)(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_get_basis; + __pyx_vtable_7sklearn_5earth_8_forward_ForwardPasser.init_linear_variables = (PyObject *(*)(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_init_linear_variables; + __pyx_vtable_7sklearn_5earth_8_forward_ForwardPasser.run = (PyObject *(*)(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_run; + __pyx_vtable_7sklearn_5earth_8_forward_ForwardPasser.stop_check = (PyObject *(*)(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *))__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_stop_check; + __pyx_vtable_7sklearn_5earth_8_forward_ForwardPasser.orthonormal_update = (int (*)(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *, __pyx_t_7sklearn_5earth_8_forward_INDEX_t, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update; + __pyx_vtable_7sklearn_5earth_8_forward_ForwardPasser.orthonormal_downdate = (PyObject *(*)(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *, __pyx_t_7sklearn_5earth_8_forward_INDEX_t, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_downdate; + __pyx_vtable_7sklearn_5earth_8_forward_ForwardPasser.next_pair = (PyObject *(*)(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *))__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair; + __pyx_vtable_7sklearn_5earth_8_forward_ForwardPasser.best_knot = (PyObject *(*)(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *, __pyx_t_7sklearn_5earth_8_forward_INDEX_t, __pyx_t_7sklearn_5earth_8_forward_INDEX_t, __pyx_t_7sklearn_5earth_8_forward_INDEX_t, PyArrayObject *, PyArrayObject *, __pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_t_7sklearn_5earth_8_forward_INDEX_t *))__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot; + if (PyType_Ready(&__pyx_type_7sklearn_5earth_8_forward_ForwardPasser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_5earth_8_forward_ForwardPasser.tp_dict, __pyx_vtabptr_7sklearn_5earth_8_forward_ForwardPasser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "ForwardPasser", (PyObject *)&__pyx_type_7sklearn_5earth_8_forward_ForwardPasser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_8_forward_ForwardPasser = &__pyx_type_7sklearn_5earth_8_forward_ForwardPasser; /*--- Type import code ---*/ __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", #if CYTHON_COMPILING_IN_PYPY @@ -11028,42 +10994,42 @@ PyMODINIT_FUNC PyInit__forward(void) __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_6_basis_BasisFunction = __Pyx_ImportType("_basis", "BasisFunction", sizeof(struct __pyx_obj_6_basis_BasisFunction), 1); if (unlikely(!__pyx_ptype_6_basis_BasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_vtabptr_6_basis_BasisFunction = (struct __pyx_vtabstruct_6_basis_BasisFunction*)__Pyx_GetVtable(__pyx_ptype_6_basis_BasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_6_basis_BasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_6_basis_ConstantBasisFunction = __Pyx_ImportType("_basis", "ConstantBasisFunction", sizeof(struct __pyx_obj_6_basis_ConstantBasisFunction), 1); if (unlikely(!__pyx_ptype_6_basis_ConstantBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_vtabptr_6_basis_ConstantBasisFunction = (struct __pyx_vtabstruct_6_basis_ConstantBasisFunction*)__Pyx_GetVtable(__pyx_ptype_6_basis_ConstantBasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_6_basis_ConstantBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_6_basis_HingeBasisFunction = __Pyx_ImportType("_basis", "HingeBasisFunction", sizeof(struct __pyx_obj_6_basis_HingeBasisFunction), 1); if (unlikely(!__pyx_ptype_6_basis_HingeBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_vtabptr_6_basis_HingeBasisFunction = (struct __pyx_vtabstruct_6_basis_HingeBasisFunction*)__Pyx_GetVtable(__pyx_ptype_6_basis_HingeBasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_6_basis_HingeBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_6_basis_LinearBasisFunction = __Pyx_ImportType("_basis", "LinearBasisFunction", sizeof(struct __pyx_obj_6_basis_LinearBasisFunction), 1); if (unlikely(!__pyx_ptype_6_basis_LinearBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_vtabptr_6_basis_LinearBasisFunction = (struct __pyx_vtabstruct_6_basis_LinearBasisFunction*)__Pyx_GetVtable(__pyx_ptype_6_basis_LinearBasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_6_basis_LinearBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_6_basis_Basis = __Pyx_ImportType("_basis", "Basis", sizeof(struct __pyx_obj_6_basis_Basis), 1); if (unlikely(!__pyx_ptype_6_basis_Basis)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_vtabptr_6_basis_Basis = (struct __pyx_vtabstruct_6_basis_Basis*)__Pyx_GetVtable(__pyx_ptype_6_basis_Basis->tp_dict); if (unlikely(!__pyx_vtabptr_6_basis_Basis)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7_record_Record = __Pyx_ImportType("_record", "Record", sizeof(struct __pyx_obj_7_record_Record), 1); if (unlikely(!__pyx_ptype_7_record_Record)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_vtabptr_7_record_Record = (struct __pyx_vtabstruct_7_record_Record*)__Pyx_GetVtable(__pyx_ptype_7_record_Record->tp_dict); if (unlikely(!__pyx_vtabptr_7_record_Record)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7_record_PruningPassRecord = __Pyx_ImportType("_record", "PruningPassRecord", sizeof(struct __pyx_obj_7_record_PruningPassRecord), 1); if (unlikely(!__pyx_ptype_7_record_PruningPassRecord)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_vtabptr_7_record_PruningPassRecord = (struct __pyx_vtabstruct_7_record_PruningPassRecord*)__Pyx_GetVtable(__pyx_ptype_7_record_PruningPassRecord->tp_dict); if (unlikely(!__pyx_vtabptr_7_record_PruningPassRecord)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7_record_ForwardPassRecord = __Pyx_ImportType("_record", "ForwardPassRecord", sizeof(struct __pyx_obj_7_record_ForwardPassRecord), 1); if (unlikely(!__pyx_ptype_7_record_ForwardPassRecord)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_vtabptr_7_record_ForwardPassRecord = (struct __pyx_vtabstruct_7_record_ForwardPassRecord*)__Pyx_GetVtable(__pyx_ptype_7_record_ForwardPassRecord->tp_dict); if (unlikely(!__pyx_vtabptr_7_record_ForwardPassRecord)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7_record_Iteration = __Pyx_ImportType("_record", "Iteration", sizeof(struct __pyx_obj_7_record_Iteration), 1); if (unlikely(!__pyx_ptype_7_record_Iteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_vtabptr_7_record_Iteration = (struct __pyx_vtabstruct_7_record_Iteration*)__Pyx_GetVtable(__pyx_ptype_7_record_Iteration->tp_dict); if (unlikely(!__pyx_vtabptr_7_record_Iteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7_record_PruningPassIteration = __Pyx_ImportType("_record", "PruningPassIteration", sizeof(struct __pyx_obj_7_record_PruningPassIteration), 1); if (unlikely(!__pyx_ptype_7_record_PruningPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_vtabptr_7_record_PruningPassIteration = (struct __pyx_vtabstruct_7_record_PruningPassIteration*)__Pyx_GetVtable(__pyx_ptype_7_record_PruningPassIteration->tp_dict); if (unlikely(!__pyx_vtabptr_7_record_PruningPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7_record_FirstPruningPassIteration = __Pyx_ImportType("_record", "FirstPruningPassIteration", sizeof(struct __pyx_obj_7_record_FirstPruningPassIteration), 1); if (unlikely(!__pyx_ptype_7_record_FirstPruningPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_vtabptr_7_record_FirstPruningPassIteration = (struct __pyx_vtabstruct_7_record_FirstPruningPassIteration*)__Pyx_GetVtable(__pyx_ptype_7_record_FirstPruningPassIteration->tp_dict); if (unlikely(!__pyx_vtabptr_7_record_FirstPruningPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7_record_ForwardPassIteration = __Pyx_ImportType("_record", "ForwardPassIteration", sizeof(struct __pyx_obj_7_record_ForwardPassIteration), 1); if (unlikely(!__pyx_ptype_7_record_ForwardPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_vtabptr_7_record_ForwardPassIteration = (struct __pyx_vtabstruct_7_record_ForwardPassIteration*)__Pyx_GetVtable(__pyx_ptype_7_record_ForwardPassIteration->tp_dict); if (unlikely(!__pyx_vtabptr_7_record_ForwardPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7_record_FirstForwardPassIteration = __Pyx_ImportType("_record", "FirstForwardPassIteration", sizeof(struct __pyx_obj_7_record_FirstForwardPassIteration), 1); if (unlikely(!__pyx_ptype_7_record_FirstForwardPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_vtabptr_7_record_FirstForwardPassIteration = (struct __pyx_vtabstruct_7_record_FirstForwardPassIteration*)__Pyx_GetVtable(__pyx_ptype_7_record_FirstForwardPassIteration->tp_dict); if (unlikely(!__pyx_vtabptr_7_record_FirstForwardPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction = __Pyx_ImportType("sklearn.earth._basis", "BasisFunction", sizeof(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_6_basis_BasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5earth_6_basis_BasisFunction = (struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_6_basis_BasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_6_basis_BasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_6_basis_ConstantBasisFunction = __Pyx_ImportType("sklearn.earth._basis", "ConstantBasisFunction", sizeof(struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_6_basis_ConstantBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5earth_6_basis_ConstantBasisFunction = (struct __pyx_vtabstruct_7sklearn_5earth_6_basis_ConstantBasisFunction*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_6_basis_ConstantBasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_6_basis_ConstantBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_6_basis_HingeBasisFunction = __Pyx_ImportType("sklearn.earth._basis", "HingeBasisFunction", sizeof(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_6_basis_HingeBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5earth_6_basis_HingeBasisFunction = (struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_6_basis_HingeBasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_6_basis_HingeBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_6_basis_LinearBasisFunction = __Pyx_ImportType("sklearn.earth._basis", "LinearBasisFunction", sizeof(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_6_basis_LinearBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5earth_6_basis_LinearBasisFunction = (struct __pyx_vtabstruct_7sklearn_5earth_6_basis_LinearBasisFunction*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_6_basis_LinearBasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_6_basis_LinearBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_6_basis_Basis = __Pyx_ImportType("sklearn.earth._basis", "Basis", sizeof(struct __pyx_obj_7sklearn_5earth_6_basis_Basis), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_6_basis_Basis)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5earth_6_basis_Basis = (struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_6_basis_Basis->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_6_basis_Basis)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_7_record_Record = __Pyx_ImportType("sklearn.earth._record", "Record", sizeof(struct __pyx_obj_7sklearn_5earth_7_record_Record), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_7_record_Record)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5earth_7_record_Record = (struct __pyx_vtabstruct_7sklearn_5earth_7_record_Record*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_7_record_Record->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_7_record_Record)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_7_record_PruningPassRecord = __Pyx_ImportType("sklearn.earth._record", "PruningPassRecord", sizeof(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_7_record_PruningPassRecord)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5earth_7_record_PruningPassRecord = (struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_7_record_PruningPassRecord->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_7_record_PruningPassRecord)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_7_record_ForwardPassRecord = __Pyx_ImportType("sklearn.earth._record", "ForwardPassRecord", sizeof(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_7_record_ForwardPassRecord)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5earth_7_record_ForwardPassRecord = (struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_7_record_ForwardPassRecord->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_7_record_ForwardPassRecord)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_7_record_Iteration = __Pyx_ImportType("sklearn.earth._record", "Iteration", sizeof(struct __pyx_obj_7sklearn_5earth_7_record_Iteration), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_7_record_Iteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5earth_7_record_Iteration = (struct __pyx_vtabstruct_7sklearn_5earth_7_record_Iteration*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_7_record_Iteration->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_7_record_Iteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_7_record_PruningPassIteration = __Pyx_ImportType("sklearn.earth._record", "PruningPassIteration", sizeof(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassIteration), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_7_record_PruningPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5earth_7_record_PruningPassIteration = (struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassIteration*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_7_record_PruningPassIteration->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_7_record_PruningPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_7_record_FirstPruningPassIteration = __Pyx_ImportType("sklearn.earth._record", "FirstPruningPassIteration", sizeof(struct __pyx_obj_7sklearn_5earth_7_record_FirstPruningPassIteration), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_7_record_FirstPruningPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5earth_7_record_FirstPruningPassIteration = (struct __pyx_vtabstruct_7sklearn_5earth_7_record_FirstPruningPassIteration*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_7_record_FirstPruningPassIteration->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_7_record_FirstPruningPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_7_record_ForwardPassIteration = __Pyx_ImportType("sklearn.earth._record", "ForwardPassIteration", sizeof(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_7_record_ForwardPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5earth_7_record_ForwardPassIteration = (struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassIteration*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_7_record_ForwardPassIteration->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_7_record_ForwardPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_7_record_FirstForwardPassIteration = __Pyx_ImportType("sklearn.earth._record", "FirstForwardPassIteration", sizeof(struct __pyx_obj_7sklearn_5earth_7_record_FirstForwardPassIteration), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_7_record_FirstForwardPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5earth_7_record_FirstForwardPassIteration = (struct __pyx_vtabstruct_7sklearn_5earth_7_record_FirstForwardPassIteration*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_7_record_FirstForwardPassIteration->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_7_record_FirstForwardPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Variable import code ---*/ /*--- Function import code ---*/ - __pyx_t_1 = __Pyx_ImportModule("_util"); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_ImportFunction(__pyx_t_1, "log2", (void (**)(void))&__pyx_f_5_util_log2, "__pyx_t_5_util_FLOAT_t (__pyx_t_5_util_FLOAT_t)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_ImportFunction(__pyx_t_1, "apply_weights_1d", (void (**)(void))&__pyx_f_5_util_apply_weights_1d, "PyObject *(PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_ImportFunction(__pyx_t_1, "gcv_adjust", (void (**)(void))&__pyx_f_5_util_gcv_adjust, "__pyx_t_5_util_FLOAT_t (__pyx_t_5_util_INDEX_t, __pyx_t_5_util_INDEX_t, __pyx_t_5_util_FLOAT_t, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_ImportModule("sklearn.earth._util"); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_t_1, "log2", (void (**)(void))&__pyx_f_7sklearn_5earth_5_util_log2, "__pyx_t_7sklearn_5earth_5_util_FLOAT_t (__pyx_t_7sklearn_5earth_5_util_FLOAT_t)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_t_1, "apply_weights_1d", (void (**)(void))&__pyx_f_7sklearn_5earth_5_util_apply_weights_1d, "PyObject *(PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_t_1, "gcv_adjust", (void (**)(void))&__pyx_f_7sklearn_5earth_5_util_gcv_adjust, "__pyx_t_7sklearn_5earth_5_util_FLOAT_t (__pyx_t_7sklearn_5earth_5_util_INDEX_t, __pyx_t_7sklearn_5earth_5_util_INDEX_t, __pyx_t_7sklearn_5earth_5_util_FLOAT_t, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_t_1); __pyx_t_1 = 0; /*--- Execution code ---*/ - /* "_forward.pyx":12 + /* "sklearn/earth/_forward.pyx":12 * * from libc.math cimport sqrt, abs, log * import numpy as np # <<<<<<<<<<<<<< @@ -11075,7 +11041,7 @@ PyMODINIT_FUNC PyInit__forward(void) if (PyDict_SetItem(__pyx_d, __pyx_n_s__np, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "_forward.pyx":13 + /* "sklearn/earth/_forward.pyx":13 * from libc.math cimport sqrt, abs, log * import numpy as np * cnp.import_array() # <<<<<<<<<<<<<< @@ -11084,7 +11050,7 @@ PyMODINIT_FUNC PyInit__forward(void) */ import_array(); - /* "_forward.pyx":15 + /* "sklearn/earth/_forward.pyx":15 * cnp.import_array() * * stopping_conditions = { # <<<<<<<<<<<<<< @@ -11094,69 +11060,69 @@ PyMODINIT_FUNC PyInit__forward(void) __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - /* "_forward.pyx":16 + /* "sklearn/earth/_forward.pyx":16 * * stopping_conditions = { * MAXTERMS:"Reached maximum number of terms", # <<<<<<<<<<<<<< * MAXRSQ:"Achieved RSQ value within threshold of 1", * NOIMPRV:"Improvement below threshold", */ - __pyx_t_3 = PyInt_FromLong(__pyx_e_8_forward_MAXTERMS); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_e_7sklearn_5earth_8_forward_MAXTERMS); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_kp_s_35)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "_forward.pyx":17 + /* "sklearn/earth/_forward.pyx":17 * stopping_conditions = { * MAXTERMS:"Reached maximum number of terms", * MAXRSQ:"Achieved RSQ value within threshold of 1", # <<<<<<<<<<<<<< * NOIMPRV:"Improvement below threshold", * LOWGRSQ:"GRSQ too low", */ - __pyx_t_3 = PyInt_FromLong(__pyx_e_8_forward_MAXRSQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_e_7sklearn_5earth_8_forward_MAXRSQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_kp_s_36)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "_forward.pyx":18 + /* "sklearn/earth/_forward.pyx":18 * MAXTERMS:"Reached maximum number of terms", * MAXRSQ:"Achieved RSQ value within threshold of 1", * NOIMPRV:"Improvement below threshold", # <<<<<<<<<<<<<< * LOWGRSQ:"GRSQ too low", * NOCAND:"No remaining candidate knot locations" */ - __pyx_t_3 = PyInt_FromLong(__pyx_e_8_forward_NOIMPRV); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_e_7sklearn_5earth_8_forward_NOIMPRV); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_kp_s_37)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "_forward.pyx":19 + /* "sklearn/earth/_forward.pyx":19 * MAXRSQ:"Achieved RSQ value within threshold of 1", * NOIMPRV:"Improvement below threshold", * LOWGRSQ:"GRSQ too low", # <<<<<<<<<<<<<< * NOCAND:"No remaining candidate knot locations" * } */ - __pyx_t_3 = PyInt_FromLong(__pyx_e_8_forward_LOWGRSQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_e_7sklearn_5earth_8_forward_LOWGRSQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_kp_s_38)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "_forward.pyx":20 + /* "sklearn/earth/_forward.pyx":20 * NOIMPRV:"Improvement below threshold", * LOWGRSQ:"GRSQ too low", * NOCAND:"No remaining candidate knot locations" # <<<<<<<<<<<<<< * } * */ - __pyx_t_3 = PyInt_FromLong(__pyx_e_8_forward_NOCAND); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_e_7sklearn_5earth_8_forward_NOCAND); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_kp_s_39)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (PyDict_SetItem(__pyx_d, __pyx_n_s__stopping_conditions, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - /* "_forward.pyx":1 + /* "sklearn/earth/_forward.pyx":1 * # distutils: language = c # <<<<<<<<<<<<<< * # cython: cdivision = True * # cython: boundscheck = False @@ -11179,10 +11145,10 @@ PyMODINIT_FUNC PyInit__forward(void) __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); if (__pyx_m) { - __Pyx_AddTraceback("init _forward", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("init sklearn.earth._forward", __pyx_clineno, __pyx_lineno, __pyx_filename); Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init _forward"); + PyErr_SetString(PyExc_ImportError, "init sklearn.earth._forward"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -12268,6 +12234,25 @@ static void __Pyx_RaiseBufferFallbackError(void) { "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!"); } +static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, + CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) { + PyObject *old_exc, *old_val, *old_tb; + PyObject *ctx; + __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); + #if PY_MAJOR_VERSION < 3 + ctx = PyString_FromString(name); + #else + ctx = PyUnicode_FromString(name); + #endif + __Pyx_ErrRestore(old_exc, old_val, old_tb); + if (!ctx) { + PyErr_WriteUnraisable(Py_None); + } else { + PyErr_WriteUnraisable(ctx); + Py_DECREF(ctx); + } +} + static CYTHON_INLINE int __Pyx_PyObject_SetSlice( PyObject* obj, PyObject* value, Py_ssize_t cstart, Py_ssize_t cstop, PyObject** _py_start, PyObject** _py_stop, PyObject** _py_slice, @@ -12430,6 +12415,42 @@ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { return 0; } +static int __Pyx_SetVtable(PyObject *dict, void *vtable) { +#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) + PyObject *ob = PyCapsule_New(vtable, 0, 0); +#else + PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); +#endif + if (!ob) + goto bad; + if (PyDict_SetItem(dict, __pyx_n_s____pyx_vtable__, ob) < 0) + goto bad; + Py_DECREF(ob); + return 0; +bad: + Py_XDECREF(ob); + return -1; +} + +static void* __Pyx_GetVtable(PyObject *dict) { + void* ptr; + PyObject *ob = PyObject_GetItem(dict, __pyx_n_s____pyx_vtable__); + if (!ob) + goto bad; +#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) + ptr = PyCapsule_GetPointer(ob, 0); +#else + ptr = PyCObject_AsVoidPtr(ob); +#endif + if (!ptr && !PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); + Py_DECREF(ob); + return ptr; +bad: + Py_XDECREF(ob); + return NULL; +} + static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { PyObject *empty_list = 0; PyObject *module = 0; @@ -13455,25 +13476,6 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* } } -static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, - CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) { - PyObject *old_exc, *old_val, *old_tb; - PyObject *ctx; - __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); - #if PY_MAJOR_VERSION < 3 - ctx = PyString_FromString(name); - #else - ctx = PyUnicode_FromString(name); - #endif - __Pyx_ErrRestore(old_exc, old_val, old_tb); - if (!ctx) { - PyErr_WriteUnraisable(Py_None); - } else { - PyErr_WriteUnraisable(ctx); - Py_DECREF(ctx); - } -} - static int __Pyx_check_binary_version(void) { char ctversion[4], rtversion[4]; PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); @@ -13493,23 +13495,6 @@ static int __Pyx_check_binary_version(void) { return 0; } -static int __Pyx_SetVtable(PyObject *dict, void *vtable) { -#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) - PyObject *ob = PyCapsule_New(vtable, 0, 0); -#else - PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); -#endif - if (!ob) - goto bad; - if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0) - goto bad; - Py_DECREF(ob); - return 0; -bad: - Py_XDECREF(ob); - return -1; -} - #ifndef __PYX_HAVE_RT_ImportModule #define __PYX_HAVE_RT_ImportModule static PyObject *__Pyx_ImportModule(const char *name) { @@ -13595,25 +13580,6 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class } #endif -static void* __Pyx_GetVtable(PyObject *dict) { - void* ptr; - PyObject *ob = PyMapping_GetItemString(dict, (char *)"__pyx_vtable__"); - if (!ob) - goto bad; -#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) - ptr = PyCapsule_GetPointer(ob, 0); -#else - ptr = PyCObject_AsVoidPtr(ob); -#endif - if (!ptr && !PyErr_Occurred()) - PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); - Py_DECREF(ob); - return ptr; -bad: - Py_XDECREF(ob); - return NULL; -} - #ifndef __PYX_HAVE_RT_ImportFunction #define __PYX_HAVE_RT_ImportFunction static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { diff --git a/sklearn/earth/_forward.pxd b/sklearn/earth/_forward.pxd index a17189dc10cec..35a1f15277bc7 100644 --- a/sklearn/earth/_forward.pxd +++ b/sklearn/earth/_forward.pxd @@ -33,7 +33,7 @@ cdef class ForwardPasser: #Input data cdef cnp.ndarray X cdef cnp.ndarray y - cdef cnp.ndarray weights + cdef cnp.ndarray sample_weight cdef INDEX_t m cdef INDEX_t n cdef FLOAT_t sst diff --git a/sklearn/earth/_forward.pyx b/sklearn/earth/_forward.pyx index a80f2b2862e0e..8e1353afee138 100644 --- a/sklearn/earth/_forward.pyx +++ b/sklearn/earth/_forward.pyx @@ -22,12 +22,12 @@ stopping_conditions = { cdef class ForwardPasser: - def __init__(ForwardPasser self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] weights, **kwargs): + def __init__(ForwardPasser self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] sample_weight, **kwargs): cdef INDEX_t i self.X = X self.y = y.copy() - self.weights = weights - apply_weights_1d(self.y, self.weights) + self.sample_weight = sample_weight + apply_weights_1d(self.y, self.sample_weight) self.m = self.X.shape[0] self.n = self.X.shape[1] self.endspan = kwargs['endspan'] if 'endspan' in kwargs else -1 @@ -40,12 +40,14 @@ cdef class ForwardPasser: self.penalty = kwargs['penalty'] if 'penalty' in kwargs else 3.0 self.check_every = kwargs['check_every'] if 'check_every' in kwargs else -1 self.min_search_points = kwargs['min_search_points'] if 'min_search_points' in kwargs else 100 - self.xlabels = kwargs['xlabels_'] if 'xlabels_' in kwargs else ['x'+str(i) for i in range(self.n)] + self.xlabels = kwargs['xlabels'] if 'xlabels' in kwargs else None + if self.xlabels is None: + self.xlabels = ['x'+str(i) for i in range(self.n)] if self.check_every < 0: self.check_every = (self.m / self.min_search_points) if self.m > self.min_search_points else 1 - self.sst = (np.dot(self.y,self.y) - (np.dot(np.sqrt(self.weights),self.y) / np.sqrt(np.sum(self.weights)))**2) / self.m + self.sst = (np.dot(self.y,self.y) - (np.dot(np.sqrt(self.sample_weight),self.y) / np.sqrt(np.sum(self.sample_weight)))**2) / self.m self.y_squared = np.dot(self.y,self.y) - self.record = ForwardPassRecord(self.m,self.n,self.penalty,self.sst) + self.record = ForwardPassRecord(self.m,self.n,self.penalty,self.sst,self.xlabels) self.basis = Basis() self.basis.append(ConstantBasisFunction()) @@ -54,7 +56,7 @@ cdef class ForwardPasser: self.u = np.empty(shape=self.max_terms, dtype=float) self.B_orth_times_parent_cum = np.empty(shape=self.max_terms,dtype=np.float) self.B = np.ones(shape=(self.m,self.max_terms), order='C',dtype=np.float) - self.basis.weighted_transform(self.X,self.B,self.weights) + self.basis.weighted_transform(self.X,self.B,self.sample_weight) self.B_orth = self.B.copy() #An orthogonal matrix with the same column space as B self.u = np.empty(shape=self.max_terms, dtype=np.float) self.c = np.empty(shape=self.max_terms, dtype=np.float) @@ -323,7 +325,7 @@ cdef class ForwardPasser: #Make sure at least one candidate was checked if first: - self.record[-1].set_no_candidates(True) + self.record[len(self.record) - 1].set_no_candidates(True) return #Add the new basis functions @@ -357,7 +359,7 @@ cdef class ForwardPasser: bf1.make_unsplittable() else:#dependent and knot_idx_choice == -1 #In this case there were no acceptable choices remaining, so end the forward pass - self.record[-1].set_no_candidates(True) + self.record[len(self.record) - 1].set_no_candidates(True) return #Update the build record diff --git a/sklearn/earth/_pruning.c b/sklearn/earth/_pruning.c index e35e7126debbe..523be93b499e1 100644 --- a/sklearn/earth/_pruning.c +++ b/sklearn/earth/_pruning.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19 on Sat Jul 20 23:46:45 2013 */ +/* Generated by Cython 0.19.1 on Thu Jul 25 22:12:25 2013 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS @@ -261,6 +261,17 @@ #define CYTHON_INLINE #endif #endif +#ifndef CYTHON_RESTRICT + #if defined(__GNUC__) + #define CYTHON_RESTRICT __restrict__ + #elif defined(_MSC_VER) + #define CYTHON_RESTRICT __restrict + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_RESTRICT restrict + #else + #define CYTHON_RESTRICT + #endif +#endif #ifdef NAN #define __PYX_NAN() ((float) NAN) #else @@ -295,8 +306,8 @@ static CYTHON_INLINE float __PYX_NAN() { #define _USE_MATH_DEFINES #endif #include -#define __PYX_HAVE___pruning -#define __PYX_HAVE_API___pruning +#define __PYX_HAVE__sklearn__earth___pruning +#define __PYX_HAVE_API__sklearn__earth___pruning #include "string.h" #include "stdio.h" #include "stdlib.h" @@ -732,7 +743,7 @@ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; * ctypedef cnp.intp_t INT_t * ctypedef cnp.ulong_t INDEX_t */ -typedef __pyx_t_5numpy_float64_t __pyx_t_6_basis_FLOAT_t; +typedef __pyx_t_5numpy_float64_t __pyx_t_7sklearn_5earth_6_basis_FLOAT_t; /* "_basis.pxd":3 * cimport numpy as cnp @@ -741,7 +752,7 @@ typedef __pyx_t_5numpy_float64_t __pyx_t_6_basis_FLOAT_t; * ctypedef cnp.ulong_t INDEX_t * ctypedef cnp.uint8_t BOOL_t */ -typedef __pyx_t_5numpy_intp_t __pyx_t_6_basis_INT_t; +typedef __pyx_t_5numpy_intp_t __pyx_t_7sklearn_5earth_6_basis_INT_t; /* "_basis.pxd":4 * ctypedef cnp.float64_t FLOAT_t @@ -750,7 +761,7 @@ typedef __pyx_t_5numpy_intp_t __pyx_t_6_basis_INT_t; * ctypedef cnp.uint8_t BOOL_t * */ -typedef __pyx_t_5numpy_ulong_t __pyx_t_6_basis_INDEX_t; +typedef __pyx_t_5numpy_ulong_t __pyx_t_7sklearn_5earth_6_basis_INDEX_t; /* "_basis.pxd":5 * ctypedef cnp.intp_t INT_t @@ -759,7 +770,7 @@ typedef __pyx_t_5numpy_ulong_t __pyx_t_6_basis_INDEX_t; * * cdef class BasisFunction: */ -typedef __pyx_t_5numpy_uint8_t __pyx_t_6_basis_BOOL_t; +typedef __pyx_t_5numpy_uint8_t __pyx_t_7sklearn_5earth_6_basis_BOOL_t; /* "_record.pxd":2 * cimport numpy as cnp @@ -767,7 +778,7 @@ typedef __pyx_t_5numpy_uint8_t __pyx_t_6_basis_BOOL_t; * ctypedef cnp.intp_t INT_t * ctypedef cnp.ulong_t INDEX_t */ -typedef __pyx_t_5numpy_float64_t __pyx_t_7_record_FLOAT_t; +typedef __pyx_t_5numpy_float64_t __pyx_t_7sklearn_5earth_7_record_FLOAT_t; /* "_record.pxd":3 * cimport numpy as cnp @@ -776,7 +787,7 @@ typedef __pyx_t_5numpy_float64_t __pyx_t_7_record_FLOAT_t; * ctypedef cnp.ulong_t INDEX_t * ctypedef cnp.uint8_t BOOL_t */ -typedef __pyx_t_5numpy_intp_t __pyx_t_7_record_INT_t; +typedef __pyx_t_5numpy_intp_t __pyx_t_7sklearn_5earth_7_record_INT_t; /* "_record.pxd":4 * ctypedef cnp.float64_t FLOAT_t @@ -785,7 +796,7 @@ typedef __pyx_t_5numpy_intp_t __pyx_t_7_record_INT_t; * ctypedef cnp.uint8_t BOOL_t * from _basis cimport Basis */ -typedef __pyx_t_5numpy_ulong_t __pyx_t_7_record_INDEX_t; +typedef __pyx_t_5numpy_ulong_t __pyx_t_7sklearn_5earth_7_record_INDEX_t; /* "_record.pxd":5 * ctypedef cnp.intp_t INT_t @@ -794,7 +805,7 @@ typedef __pyx_t_5numpy_ulong_t __pyx_t_7_record_INDEX_t; * from _basis cimport Basis * */ -typedef __pyx_t_5numpy_uint8_t __pyx_t_7_record_BOOL_t; +typedef __pyx_t_5numpy_uint8_t __pyx_t_7sklearn_5earth_7_record_BOOL_t; /* "_util.pxd":2 * cimport numpy as cnp @@ -802,7 +813,7 @@ typedef __pyx_t_5numpy_uint8_t __pyx_t_7_record_BOOL_t; * ctypedef cnp.intp_t INT_t * ctypedef cnp.ulong_t INDEX_t */ -typedef __pyx_t_5numpy_float64_t __pyx_t_5_util_FLOAT_t; +typedef __pyx_t_5numpy_float64_t __pyx_t_7sklearn_5earth_5_util_FLOAT_t; /* "_util.pxd":3 * cimport numpy as cnp @@ -811,7 +822,7 @@ typedef __pyx_t_5numpy_float64_t __pyx_t_5_util_FLOAT_t; * ctypedef cnp.ulong_t INDEX_t * ctypedef cnp.uint8_t BOOL_t */ -typedef __pyx_t_5numpy_intp_t __pyx_t_5_util_INT_t; +typedef __pyx_t_5numpy_intp_t __pyx_t_7sklearn_5earth_5_util_INT_t; /* "_util.pxd":4 * ctypedef cnp.float64_t FLOAT_t @@ -820,7 +831,7 @@ typedef __pyx_t_5numpy_intp_t __pyx_t_5_util_INT_t; * ctypedef cnp.uint8_t BOOL_t * */ -typedef __pyx_t_5numpy_ulong_t __pyx_t_5_util_INDEX_t; +typedef __pyx_t_5numpy_ulong_t __pyx_t_7sklearn_5earth_5_util_INDEX_t; /* "_util.pxd":5 * ctypedef cnp.intp_t INT_t @@ -829,42 +840,42 @@ typedef __pyx_t_5numpy_ulong_t __pyx_t_5_util_INDEX_t; * * cdef FLOAT_t log2(FLOAT_t x) */ -typedef __pyx_t_5numpy_uint8_t __pyx_t_5_util_BOOL_t; +typedef __pyx_t_5numpy_uint8_t __pyx_t_7sklearn_5earth_5_util_BOOL_t; -/* "_pruning.pxd":2 +/* "sklearn/earth/_pruning.pxd":2 * cimport numpy as cnp * ctypedef cnp.float64_t FLOAT_t # <<<<<<<<<<<<<< * ctypedef cnp.intp_t INT_t * ctypedef cnp.ulong_t INDEX_t */ -typedef __pyx_t_5numpy_float64_t __pyx_t_8_pruning_FLOAT_t; +typedef __pyx_t_5numpy_float64_t __pyx_t_7sklearn_5earth_8_pruning_FLOAT_t; -/* "_pruning.pxd":3 +/* "sklearn/earth/_pruning.pxd":3 * cimport numpy as cnp * ctypedef cnp.float64_t FLOAT_t * ctypedef cnp.intp_t INT_t # <<<<<<<<<<<<<< * ctypedef cnp.ulong_t INDEX_t * ctypedef cnp.uint8_t BOOL_t */ -typedef __pyx_t_5numpy_intp_t __pyx_t_8_pruning_INT_t; +typedef __pyx_t_5numpy_intp_t __pyx_t_7sklearn_5earth_8_pruning_INT_t; -/* "_pruning.pxd":4 +/* "sklearn/earth/_pruning.pxd":4 * ctypedef cnp.float64_t FLOAT_t * ctypedef cnp.intp_t INT_t * ctypedef cnp.ulong_t INDEX_t # <<<<<<<<<<<<<< * ctypedef cnp.uint8_t BOOL_t * from _basis cimport Basis */ -typedef __pyx_t_5numpy_ulong_t __pyx_t_8_pruning_INDEX_t; +typedef __pyx_t_5numpy_ulong_t __pyx_t_7sklearn_5earth_8_pruning_INDEX_t; -/* "_pruning.pxd":5 +/* "sklearn/earth/_pruning.pxd":5 * ctypedef cnp.intp_t INT_t * ctypedef cnp.ulong_t INDEX_t * ctypedef cnp.uint8_t BOOL_t # <<<<<<<<<<<<<< * from _basis cimport Basis * from _record cimport PruningPassRecord */ -typedef __pyx_t_5numpy_uint8_t __pyx_t_8_pruning_BOOL_t; +typedef __pyx_t_5numpy_uint8_t __pyx_t_7sklearn_5earth_8_pruning_BOOL_t; #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; @@ -887,20 +898,20 @@ typedef __pyx_t_5numpy_uint8_t __pyx_t_8_pruning_BOOL_t; /*--- Type declarations ---*/ -struct __pyx_obj_7_record_Record; -struct __pyx_obj_7_record_PruningPassRecord; -struct __pyx_obj_7_record_Iteration; -struct __pyx_obj_7_record_ForwardPassIteration; -struct __pyx_obj_7_record_FirstForwardPassIteration; -struct __pyx_obj_6_basis_Basis; -struct __pyx_obj_6_basis_BasisFunction; -struct __pyx_obj_6_basis_LinearBasisFunction; -struct __pyx_obj_7_record_PruningPassIteration; -struct __pyx_obj_7_record_FirstPruningPassIteration; -struct __pyx_obj_8_pruning_PruningPasser; -struct __pyx_obj_6_basis_HingeBasisFunction; -struct __pyx_obj_7_record_ForwardPassRecord; -struct __pyx_obj_6_basis_ConstantBasisFunction; +struct __pyx_obj_7sklearn_5earth_6_basis_Basis; +struct __pyx_obj_7sklearn_5earth_7_record_Iteration; +struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration; +struct __pyx_obj_7sklearn_5earth_8_pruning_PruningPasser; +struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction; +struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction; +struct __pyx_obj_7sklearn_5earth_7_record_Record; +struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord; +struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord; +struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction; +struct __pyx_obj_7sklearn_5earth_7_record_PruningPassIteration; +struct __pyx_obj_7sklearn_5earth_7_record_FirstPruningPassIteration; +struct __pyx_obj_7sklearn_5earth_7_record_FirstForwardPassIteration; +struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction; /* "numpy.pxd":762 * ctypedef npy_longdouble longdouble_t @@ -937,10 +948,10 @@ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; * cdef inline object PyArray_MultiIterNew1(a): */ typedef npy_cdouble __pyx_t_5numpy_complex_t; -struct __pyx_opt_args_6_basis_13BasisFunction_apply; -struct __pyx_opt_args_6_basis_21ConstantBasisFunction_apply; -struct __pyx_opt_args_6_basis_18HingeBasisFunction_apply; -struct __pyx_opt_args_6_basis_19LinearBasisFunction_apply; +struct __pyx_opt_args_7sklearn_5earth_6_basis_13BasisFunction_apply; +struct __pyx_opt_args_7sklearn_5earth_6_basis_21ConstantBasisFunction_apply; +struct __pyx_opt_args_7sklearn_5earth_6_basis_18HingeBasisFunction_apply; +struct __pyx_opt_args_7sklearn_5earth_6_basis_19LinearBasisFunction_apply; /* "_basis.pxd":45 * cpdef INDEX_t degree(BasisFunction self) @@ -949,7 +960,7 @@ struct __pyx_opt_args_6_basis_19LinearBasisFunction_apply; * * cpdef cnp.ndarray[INT_t, ndim=1] valid_knots(BasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] values, cnp.ndarray[FLOAT_t,ndim=1] variable, int variable_idx, INDEX_t check_every, int endspan, int minspan, FLOAT_t minspan_alpha, INDEX_t n, cnp.ndarray[INT_t,ndim=1] workspace) */ -struct __pyx_opt_args_6_basis_13BasisFunction_apply { +struct __pyx_opt_args_7sklearn_5earth_6_basis_13BasisFunction_apply { int __pyx_n; int recurse; }; @@ -961,7 +972,7 @@ struct __pyx_opt_args_6_basis_13BasisFunction_apply { * * */ -struct __pyx_opt_args_6_basis_21ConstantBasisFunction_apply { +struct __pyx_opt_args_7sklearn_5earth_6_basis_21ConstantBasisFunction_apply { int __pyx_n; int recurse; }; @@ -973,7 +984,7 @@ struct __pyx_opt_args_6_basis_21ConstantBasisFunction_apply { * * cdef class LinearBasisFunction(BasisFunction): */ -struct __pyx_opt_args_6_basis_18HingeBasisFunction_apply { +struct __pyx_opt_args_7sklearn_5earth_6_basis_18HingeBasisFunction_apply { int __pyx_n; int recurse; }; @@ -985,96 +996,77 @@ struct __pyx_opt_args_6_basis_18HingeBasisFunction_apply { * * */ -struct __pyx_opt_args_6_basis_19LinearBasisFunction_apply { +struct __pyx_opt_args_7sklearn_5earth_6_basis_19LinearBasisFunction_apply { int __pyx_n; int recurse; }; -/* "_record.pxd":8 - * from _basis cimport Basis - * - * cdef class Record: # <<<<<<<<<<<<<< - * cdef list iterations - * cdef int num_samples - */ -struct __pyx_obj_7_record_Record { - PyObject_HEAD - struct __pyx_vtabstruct_7_record_Record *__pyx_vtab; - PyObject *iterations; - int num_samples; - int num_variables; - __pyx_t_7_record_FLOAT_t penalty; - __pyx_t_7_record_FLOAT_t sst; -}; - - -/* "_record.pxd":25 - * cpdef FLOAT_t grsq(Record self, INDEX_t iteration) +/* "_basis.pxd":102 * - * cdef class PruningPassRecord(Record): # <<<<<<<<<<<<<< - * cdef INDEX_t selected * + * cdef class Basis: # <<<<<<<<<<<<<< + * '''A wrapper that provides functionality related to a set of BasisFunctions with a + * common ConstantBasisFunction ancestor. Retains the order in which BasisFunctions are */ -struct __pyx_obj_7_record_PruningPassRecord { - struct __pyx_obj_7_record_Record __pyx_base; - __pyx_t_7_record_INDEX_t selected; +struct __pyx_obj_7sklearn_5earth_6_basis_Basis { + PyObject_HEAD + struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *__pyx_vtab; + PyObject *order; }; -/* "_record.pxd":39 +/* "_record.pxd":41 * cpdef set_stopping_condition(ForwardPassRecord self, int stopping_condition) * * cdef class Iteration: # <<<<<<<<<<<<<< * cdef FLOAT_t mse * cdef INDEX_t size */ -struct __pyx_obj_7_record_Iteration { +struct __pyx_obj_7sklearn_5earth_7_record_Iteration { PyObject_HEAD - struct __pyx_vtabstruct_7_record_Iteration *__pyx_vtab; - __pyx_t_7_record_FLOAT_t mse; - __pyx_t_7_record_INDEX_t size; + struct __pyx_vtabstruct_7sklearn_5earth_7_record_Iteration *__pyx_vtab; + __pyx_t_7sklearn_5earth_7_record_FLOAT_t mse; + __pyx_t_7sklearn_5earth_7_record_INDEX_t size; }; -/* "_record.pxd":55 +/* "_record.pxd":57 * pass * * cdef class ForwardPassIteration(Iteration): # <<<<<<<<<<<<<< * cdef INDEX_t parent * cdef INDEX_t variable */ -struct __pyx_obj_7_record_ForwardPassIteration { - struct __pyx_obj_7_record_Iteration __pyx_base; - __pyx_t_7_record_INDEX_t parent; - __pyx_t_7_record_INDEX_t variable; - __pyx_t_7_record_FLOAT_t knot; +struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration { + struct __pyx_obj_7sklearn_5earth_7_record_Iteration __pyx_base; + __pyx_t_7sklearn_5earth_7_record_INDEX_t parent; + __pyx_t_7sklearn_5earth_7_record_INDEX_t variable; + __pyx_t_7sklearn_5earth_7_record_FLOAT_t knot; int code; int no_candidates; }; -/* "_record.pxd":66 - * cpdef no_further_candidates(ForwardPassIteration self) - * - * cdef class FirstForwardPassIteration(ForwardPassIteration): # <<<<<<<<<<<<<< - * cpdef INDEX_t get_size(FirstForwardPassIteration self) - */ -struct __pyx_obj_7_record_FirstForwardPassIteration { - struct __pyx_obj_7_record_ForwardPassIteration __pyx_base; -}; - - -/* "_basis.pxd":102 - * +/* "sklearn/earth/_pruning.pxd":9 + * from _record cimport PruningPassRecord * - * cdef class Basis: # <<<<<<<<<<<<<< - * '''A wrapper that provides functionality related to a set of BasisFunctions with a - * common ConstantBasisFunction ancestor. Retains the order in which BasisFunctions are + * cdef class PruningPasser: # <<<<<<<<<<<<<< + * cdef cnp.ndarray X + * cdef cnp.ndarray B */ -struct __pyx_obj_6_basis_Basis { +struct __pyx_obj_7sklearn_5earth_8_pruning_PruningPasser { PyObject_HEAD - struct __pyx_vtabstruct_6_basis_Basis *__pyx_vtab; - PyObject *order; + struct __pyx_vtabstruct_7sklearn_5earth_8_pruning_PruningPasser *__pyx_vtab; + PyArrayObject *X; + PyArrayObject *B; + PyArrayObject *y; + PyArrayObject *weights; + __pyx_t_7sklearn_5earth_8_pruning_INDEX_t m; + __pyx_t_7sklearn_5earth_8_pruning_INDEX_t n; + struct __pyx_obj_7sklearn_5earth_6_basis_Basis *basis; + __pyx_t_7sklearn_5earth_8_pruning_FLOAT_t penalty; + __pyx_t_7sklearn_5earth_8_pruning_FLOAT_t sst; + struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *record; }; @@ -1085,10 +1077,10 @@ struct __pyx_obj_6_basis_Basis { * '''Abstract. Subclasses must implement the apply, translate, scale, and __init__ methods.''' * */ -struct __pyx_obj_6_basis_BasisFunction { +struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction { PyObject_HEAD - struct __pyx_vtabstruct_6_basis_BasisFunction *__pyx_vtab; - struct __pyx_obj_6_basis_BasisFunction *parent; + struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *__pyx_vtab; + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *parent; PyObject *child_map; PyObject *children; int pruned; @@ -1097,6 +1089,63 @@ struct __pyx_obj_6_basis_BasisFunction { }; +/* "_basis.pxd":50 + * + * + * cdef class ConstantBasisFunction(BasisFunction): # <<<<<<<<<<<<<< + * + * cpdef INDEX_t degree(ConstantBasisFunction self) + */ +struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction { + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction __pyx_base; +}; + + +/* "_record.pxd":8 + * from _basis cimport Basis + * + * cdef class Record: # <<<<<<<<<<<<<< + * cdef list iterations + * cdef int num_samples + */ +struct __pyx_obj_7sklearn_5earth_7_record_Record { + PyObject_HEAD + struct __pyx_vtabstruct_7sklearn_5earth_7_record_Record *__pyx_vtab; + PyObject *iterations; + int num_samples; + int num_variables; + __pyx_t_7sklearn_5earth_7_record_FLOAT_t penalty; + __pyx_t_7sklearn_5earth_7_record_FLOAT_t sst; +}; + + +/* "_record.pxd":25 + * cpdef FLOAT_t grsq(Record self, INDEX_t iteration) + * + * cdef class PruningPassRecord(Record): # <<<<<<<<<<<<<< + * cdef INDEX_t selected + * + */ +struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord { + struct __pyx_obj_7sklearn_5earth_7_record_Record __pyx_base; + __pyx_t_7sklearn_5earth_7_record_INDEX_t selected; +}; + + +/* "_record.pxd":34 + * cpdef roll_back(PruningPassRecord self, Basis basis) + * + * cdef class ForwardPassRecord(Record): # <<<<<<<<<<<<<< + * cdef int stopping_condition + * + */ +struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord { + struct __pyx_obj_7sklearn_5earth_7_record_Record __pyx_base; + int stopping_condition; + PyObject *xlabels; +}; + + /* "_basis.pxd":88 * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) * @@ -1104,58 +1153,46 @@ struct __pyx_obj_6_basis_BasisFunction { * cdef INDEX_t variable * cdef str label */ -struct __pyx_obj_6_basis_LinearBasisFunction { - struct __pyx_obj_6_basis_BasisFunction __pyx_base; - __pyx_t_6_basis_INDEX_t variable; +struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction { + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction __pyx_base; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t variable; PyObject *label; }; -/* "_record.pxd":47 +/* "_record.pxd":49 * cpdef INDEX_t get_size(Iteration self) * * cdef class PruningPassIteration(Iteration): # <<<<<<<<<<<<<< * cdef INDEX_t pruned * */ -struct __pyx_obj_7_record_PruningPassIteration { - struct __pyx_obj_7_record_Iteration __pyx_base; - __pyx_t_7_record_INDEX_t pruned; +struct __pyx_obj_7sklearn_5earth_7_record_PruningPassIteration { + struct __pyx_obj_7sklearn_5earth_7_record_Iteration __pyx_base; + __pyx_t_7sklearn_5earth_7_record_INDEX_t pruned; }; -/* "_record.pxd":52 +/* "_record.pxd":54 * cpdef INDEX_t get_pruned(PruningPassIteration self) * * cdef class FirstPruningPassIteration(PruningPassIteration): # <<<<<<<<<<<<<< * pass * */ -struct __pyx_obj_7_record_FirstPruningPassIteration { - struct __pyx_obj_7_record_PruningPassIteration __pyx_base; +struct __pyx_obj_7sklearn_5earth_7_record_FirstPruningPassIteration { + struct __pyx_obj_7sklearn_5earth_7_record_PruningPassIteration __pyx_base; }; -/* "_pruning.pxd":9 - * from _record cimport PruningPassRecord +/* "_record.pxd":68 + * cpdef no_further_candidates(ForwardPassIteration self) * - * cdef class PruningPasser: # <<<<<<<<<<<<<< - * cdef cnp.ndarray X - * cdef cnp.ndarray B + * cdef class FirstForwardPassIteration(ForwardPassIteration): # <<<<<<<<<<<<<< + * cpdef INDEX_t get_size(FirstForwardPassIteration self) */ -struct __pyx_obj_8_pruning_PruningPasser { - PyObject_HEAD - struct __pyx_vtabstruct_8_pruning_PruningPasser *__pyx_vtab; - PyArrayObject *X; - PyArrayObject *B; - PyArrayObject *y; - PyArrayObject *weights; - __pyx_t_8_pruning_INDEX_t m; - __pyx_t_8_pruning_INDEX_t n; - struct __pyx_obj_6_basis_Basis *basis; - __pyx_t_8_pruning_FLOAT_t penalty; - __pyx_t_8_pruning_FLOAT_t sst; - struct __pyx_obj_7_record_PruningPassRecord *record; +struct __pyx_obj_7sklearn_5earth_7_record_FirstForwardPassIteration { + struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration __pyx_base; }; @@ -1166,61 +1203,45 @@ struct __pyx_obj_8_pruning_PruningPasser { * cdef FLOAT_t knot * cdef INDEX_t knot_idx */ -struct __pyx_obj_6_basis_HingeBasisFunction { - struct __pyx_obj_6_basis_BasisFunction __pyx_base; - __pyx_t_6_basis_FLOAT_t knot; - __pyx_t_6_basis_INDEX_t knot_idx; - __pyx_t_6_basis_INDEX_t variable; +struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction { + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction __pyx_base; + __pyx_t_7sklearn_5earth_6_basis_FLOAT_t knot; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t knot_idx; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t variable; int reverse; PyObject *label; }; -/* "_record.pxd":34 - * cpdef roll_back(PruningPassRecord self, Basis basis) - * - * cdef class ForwardPassRecord(Record): # <<<<<<<<<<<<<< - * cdef int stopping_condition - * - */ -struct __pyx_obj_7_record_ForwardPassRecord { - struct __pyx_obj_7_record_Record __pyx_base; - int stopping_condition; -}; - -/* "_basis.pxd":50 - * - * - * cdef class ConstantBasisFunction(BasisFunction): # <<<<<<<<<<<<<< +/* "_record.pxd":41 + * cpdef set_stopping_condition(ForwardPassRecord self, int stopping_condition) * - * cpdef INDEX_t degree(ConstantBasisFunction self) + * cdef class Iteration: # <<<<<<<<<<<<<< + * cdef FLOAT_t mse + * cdef INDEX_t size */ -struct __pyx_obj_6_basis_ConstantBasisFunction { - struct __pyx_obj_6_basis_BasisFunction __pyx_base; -}; +struct __pyx_vtabstruct_7sklearn_5earth_7_record_Iteration { + __pyx_t_7sklearn_5earth_7_record_FLOAT_t (*get_mse)(struct __pyx_obj_7sklearn_5earth_7_record_Iteration *, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_7_record_INDEX_t (*get_size)(struct __pyx_obj_7sklearn_5earth_7_record_Iteration *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_7sklearn_5earth_7_record_Iteration *__pyx_vtabptr_7sklearn_5earth_7_record_Iteration; -/* "_basis.pxd":102 +/* "_record.pxd":49 + * cpdef INDEX_t get_size(Iteration self) * + * cdef class PruningPassIteration(Iteration): # <<<<<<<<<<<<<< + * cdef INDEX_t pruned * - * cdef class Basis: # <<<<<<<<<<<<<< - * '''A wrapper that provides functionality related to a set of BasisFunctions with a - * common ConstantBasisFunction ancestor. Retains the order in which BasisFunctions are */ -struct __pyx_vtabstruct_6_basis_Basis { - PyObject *(*translate)(struct __pyx_obj_6_basis_Basis *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); - PyObject *(*scale)(struct __pyx_obj_6_basis_Basis *, PyArrayObject *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); - struct __pyx_obj_6_basis_BasisFunction *(*get_root)(struct __pyx_obj_6_basis_Basis *, int __pyx_skip_dispatch); - PyObject *(*append)(struct __pyx_obj_6_basis_Basis *, struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - __pyx_t_6_basis_INDEX_t (*plen)(struct __pyx_obj_6_basis_Basis *, int __pyx_skip_dispatch); - struct __pyx_obj_6_basis_BasisFunction *(*get)(struct __pyx_obj_6_basis_Basis *, __pyx_t_6_basis_INDEX_t, int __pyx_skip_dispatch); - PyObject *(*transform)(struct __pyx_obj_6_basis_Basis *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); - PyObject *(*weighted_transform)(struct __pyx_obj_6_basis_Basis *, PyArrayObject *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); +struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassIteration { + struct __pyx_vtabstruct_7sklearn_5earth_7_record_Iteration __pyx_base; + __pyx_t_7sklearn_5earth_7_record_INDEX_t (*get_pruned)(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassIteration *, int __pyx_skip_dispatch); }; -static struct __pyx_vtabstruct_6_basis_Basis *__pyx_vtabptr_6_basis_Basis; +static struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassIteration *__pyx_vtabptr_7sklearn_5earth_7_record_PruningPassIteration; /* "_basis.pxd":7 @@ -1231,25 +1252,25 @@ static struct __pyx_vtabstruct_6_basis_Basis *__pyx_vtabptr_6_basis_Basis; * */ -struct __pyx_vtabstruct_6_basis_BasisFunction { - int (*has_knot)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - int (*is_prunable)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - int (*is_pruned)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - int (*is_splittable)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - int (*make_splittable)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - int (*make_unsplittable)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - PyObject *(*get_children)(struct __pyx_obj_6_basis_BasisFunction *); - PyObject *(*_set_parent)(struct __pyx_obj_6_basis_BasisFunction *, struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - PyObject *(*_add_child)(struct __pyx_obj_6_basis_BasisFunction *, struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - struct __pyx_obj_6_basis_BasisFunction *(*get_parent)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - PyObject *(*prune)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - PyObject *(*unprune)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - PyObject *(*knots)(struct __pyx_obj_6_basis_BasisFunction *, __pyx_t_6_basis_INDEX_t, int __pyx_skip_dispatch); - __pyx_t_6_basis_INDEX_t (*degree)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - PyObject *(*apply)(struct __pyx_obj_6_basis_BasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_6_basis_13BasisFunction_apply *__pyx_optional_args); - PyArrayObject *(*valid_knots)(struct __pyx_obj_6_basis_BasisFunction *, PyArrayObject *, PyArrayObject *, int, __pyx_t_6_basis_INDEX_t, int, int, __pyx_t_6_basis_FLOAT_t, __pyx_t_6_basis_INDEX_t, PyArrayObject *, int __pyx_skip_dispatch); +struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction { + int (*has_knot)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + int (*is_prunable)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + int (*is_pruned)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + int (*is_splittable)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + int (*make_splittable)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + int (*make_unsplittable)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*get_children)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *); + PyObject *(*_set_parent)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*_add_child)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *(*get_parent)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*prune)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*unprune)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*knots)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, __pyx_t_7sklearn_5earth_6_basis_INDEX_t, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_6_basis_INDEX_t (*degree)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*apply)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_7sklearn_5earth_6_basis_13BasisFunction_apply *__pyx_optional_args); + PyArrayObject *(*valid_knots)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, PyArrayObject *, PyArrayObject *, int, __pyx_t_7sklearn_5earth_6_basis_INDEX_t, int, int, __pyx_t_7sklearn_5earth_6_basis_FLOAT_t, __pyx_t_7sklearn_5earth_6_basis_INDEX_t, PyArrayObject *, int __pyx_skip_dispatch); }; -static struct __pyx_vtabstruct_6_basis_BasisFunction *__pyx_vtabptr_6_basis_BasisFunction; +static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *__pyx_vtabptr_7sklearn_5earth_6_basis_BasisFunction; /* "_basis.pxd":88 @@ -1260,72 +1281,66 @@ static struct __pyx_vtabstruct_6_basis_BasisFunction *__pyx_vtabptr_6_basis_Basi * cdef str label */ -struct __pyx_vtabstruct_6_basis_LinearBasisFunction { - struct __pyx_vtabstruct_6_basis_BasisFunction __pyx_base; - PyObject *(*translate)(struct __pyx_obj_6_basis_LinearBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch); - __pyx_t_6_basis_FLOAT_t (*scale)(struct __pyx_obj_6_basis_LinearBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); - __pyx_t_6_basis_INDEX_t (*get_variable)(struct __pyx_obj_6_basis_LinearBasisFunction *, int __pyx_skip_dispatch); +struct __pyx_vtabstruct_7sklearn_5earth_6_basis_LinearBasisFunction { + struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction __pyx_base; + PyObject *(*translate)(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_6_basis_FLOAT_t (*scale)(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_6_basis_INDEX_t (*get_variable)(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *, int __pyx_skip_dispatch); }; -static struct __pyx_vtabstruct_6_basis_LinearBasisFunction *__pyx_vtabptr_6_basis_LinearBasisFunction; +static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_LinearBasisFunction *__pyx_vtabptr_7sklearn_5earth_6_basis_LinearBasisFunction; -/* "_record.pxd":39 - * cpdef set_stopping_condition(ForwardPassRecord self, int stopping_condition) +/* "_record.pxd":8 + * from _basis cimport Basis * - * cdef class Iteration: # <<<<<<<<<<<<<< - * cdef FLOAT_t mse - * cdef INDEX_t size + * cdef class Record: # <<<<<<<<<<<<<< + * cdef list iterations + * cdef int num_samples */ -struct __pyx_vtabstruct_7_record_Iteration { - __pyx_t_7_record_FLOAT_t (*get_mse)(struct __pyx_obj_7_record_Iteration *, int __pyx_skip_dispatch); - __pyx_t_7_record_INDEX_t (*get_size)(struct __pyx_obj_7_record_Iteration *, int __pyx_skip_dispatch); +struct __pyx_vtabstruct_7sklearn_5earth_7_record_Record { + PyObject *(*append)(struct __pyx_obj_7sklearn_5earth_7_record_Record *, struct __pyx_obj_7sklearn_5earth_7_record_Iteration *, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_7_record_FLOAT_t (*mse)(struct __pyx_obj_7sklearn_5earth_7_record_Record *, __pyx_t_7sklearn_5earth_7_record_INDEX_t, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_7_record_FLOAT_t (*rsq)(struct __pyx_obj_7sklearn_5earth_7_record_Record *, __pyx_t_7sklearn_5earth_7_record_INDEX_t, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_7_record_FLOAT_t (*gcv)(struct __pyx_obj_7sklearn_5earth_7_record_Record *, __pyx_t_7sklearn_5earth_7_record_INDEX_t, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_7_record_FLOAT_t (*grsq)(struct __pyx_obj_7sklearn_5earth_7_record_Record *, __pyx_t_7sklearn_5earth_7_record_INDEX_t, int __pyx_skip_dispatch); }; -static struct __pyx_vtabstruct_7_record_Iteration *__pyx_vtabptr_7_record_Iteration; +static struct __pyx_vtabstruct_7sklearn_5earth_7_record_Record *__pyx_vtabptr_7sklearn_5earth_7_record_Record; -/* "_record.pxd":55 - * pass +/* "_record.pxd":34 + * cpdef roll_back(PruningPassRecord self, Basis basis) * - * cdef class ForwardPassIteration(Iteration): # <<<<<<<<<<<<<< - * cdef INDEX_t parent - * cdef INDEX_t variable - */ - -struct __pyx_vtabstruct_7_record_ForwardPassIteration { - struct __pyx_vtabstruct_7_record_Iteration __pyx_base; - PyObject *(*set_no_candidates)(struct __pyx_obj_7_record_ForwardPassIteration *, int, int __pyx_skip_dispatch); - PyObject *(*no_further_candidates)(struct __pyx_obj_7_record_ForwardPassIteration *, int __pyx_skip_dispatch); -}; -static struct __pyx_vtabstruct_7_record_ForwardPassIteration *__pyx_vtabptr_7_record_ForwardPassIteration; - - -/* "_record.pxd":66 - * cpdef no_further_candidates(ForwardPassIteration self) + * cdef class ForwardPassRecord(Record): # <<<<<<<<<<<<<< + * cdef int stopping_condition * - * cdef class FirstForwardPassIteration(ForwardPassIteration): # <<<<<<<<<<<<<< - * cpdef INDEX_t get_size(FirstForwardPassIteration self) */ -struct __pyx_vtabstruct_7_record_FirstForwardPassIteration { - struct __pyx_vtabstruct_7_record_ForwardPassIteration __pyx_base; +struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord { + struct __pyx_vtabstruct_7sklearn_5earth_7_record_Record __pyx_base; + PyObject *(*set_stopping_condition)(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *, int, int __pyx_skip_dispatch); }; -static struct __pyx_vtabstruct_7_record_FirstForwardPassIteration *__pyx_vtabptr_7_record_FirstForwardPassIteration; +static struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord *__pyx_vtabptr_7sklearn_5earth_7_record_ForwardPassRecord; -/* "_record.pxd":47 - * cpdef INDEX_t get_size(Iteration self) +/* "_basis.pxd":65 * - * cdef class PruningPassIteration(Iteration): # <<<<<<<<<<<<<< - * cdef INDEX_t pruned * + * cdef class HingeBasisFunction(BasisFunction): # <<<<<<<<<<<<<< + * cdef FLOAT_t knot + * cdef INDEX_t knot_idx */ -struct __pyx_vtabstruct_7_record_PruningPassIteration { - struct __pyx_vtabstruct_7_record_Iteration __pyx_base; - __pyx_t_7_record_INDEX_t (*get_pruned)(struct __pyx_obj_7_record_PruningPassIteration *, int __pyx_skip_dispatch); +struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction { + struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction __pyx_base; + PyObject *(*translate)(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_6_basis_FLOAT_t (*scale)(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_6_basis_INDEX_t (*get_variable)(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_6_basis_FLOAT_t (*get_knot)(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); + int (*get_reverse)(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_6_basis_INDEX_t (*get_knot_idx)(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); }; -static struct __pyx_vtabstruct_7_record_PruningPassIteration *__pyx_vtabptr_7_record_PruningPassIteration; +static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction *__pyx_vtabptr_7sklearn_5earth_6_basis_HingeBasisFunction; /* "_basis.pxd":50 @@ -1336,15 +1351,15 @@ static struct __pyx_vtabstruct_7_record_PruningPassIteration *__pyx_vtabptr_7_re * cpdef INDEX_t degree(ConstantBasisFunction self) */ -struct __pyx_vtabstruct_6_basis_ConstantBasisFunction { - struct __pyx_vtabstruct_6_basis_BasisFunction __pyx_base; - PyObject *(*translate)(struct __pyx_obj_6_basis_ConstantBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch); - __pyx_t_6_basis_FLOAT_t (*scale)(struct __pyx_obj_6_basis_ConstantBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); +struct __pyx_vtabstruct_7sklearn_5earth_6_basis_ConstantBasisFunction { + struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction __pyx_base; + PyObject *(*translate)(struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_6_basis_FLOAT_t (*scale)(struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); }; -static struct __pyx_vtabstruct_6_basis_ConstantBasisFunction *__pyx_vtabptr_6_basis_ConstantBasisFunction; +static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_ConstantBasisFunction *__pyx_vtabptr_7sklearn_5earth_6_basis_ConstantBasisFunction; -/* "_pruning.pyx":11 +/* "sklearn/earth/_pruning.pyx":11 * import numpy as np * * cdef class PruningPasser: # <<<<<<<<<<<<<< @@ -1352,84 +1367,81 @@ static struct __pyx_vtabstruct_6_basis_ConstantBasisFunction *__pyx_vtabptr_6_ba * def __init__(PruningPasser self, Basis basis, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] weights, **kwargs): */ -struct __pyx_vtabstruct_8_pruning_PruningPasser { - PyObject *(*run)(struct __pyx_obj_8_pruning_PruningPasser *, int __pyx_skip_dispatch); - struct __pyx_obj_7_record_PruningPassRecord *(*trace)(struct __pyx_obj_8_pruning_PruningPasser *, int __pyx_skip_dispatch); +struct __pyx_vtabstruct_7sklearn_5earth_8_pruning_PruningPasser { + PyObject *(*run)(struct __pyx_obj_7sklearn_5earth_8_pruning_PruningPasser *, int __pyx_skip_dispatch); + struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *(*trace)(struct __pyx_obj_7sklearn_5earth_8_pruning_PruningPasser *, int __pyx_skip_dispatch); }; -static struct __pyx_vtabstruct_8_pruning_PruningPasser *__pyx_vtabptr_8_pruning_PruningPasser; +static struct __pyx_vtabstruct_7sklearn_5earth_8_pruning_PruningPasser *__pyx_vtabptr_7sklearn_5earth_8_pruning_PruningPasser; -/* "_record.pxd":8 - * from _basis cimport Basis +/* "_record.pxd":25 + * cpdef FLOAT_t grsq(Record self, INDEX_t iteration) + * + * cdef class PruningPassRecord(Record): # <<<<<<<<<<<<<< + * cdef INDEX_t selected * - * cdef class Record: # <<<<<<<<<<<<<< - * cdef list iterations - * cdef int num_samples */ -struct __pyx_vtabstruct_7_record_Record { - PyObject *(*append)(struct __pyx_obj_7_record_Record *, struct __pyx_obj_7_record_Iteration *, int __pyx_skip_dispatch); - __pyx_t_7_record_FLOAT_t (*mse)(struct __pyx_obj_7_record_Record *, __pyx_t_7_record_INDEX_t, int __pyx_skip_dispatch); - __pyx_t_7_record_FLOAT_t (*rsq)(struct __pyx_obj_7_record_Record *, __pyx_t_7_record_INDEX_t, int __pyx_skip_dispatch); - __pyx_t_7_record_FLOAT_t (*gcv)(struct __pyx_obj_7_record_Record *, __pyx_t_7_record_INDEX_t, int __pyx_skip_dispatch); - __pyx_t_7_record_FLOAT_t (*grsq)(struct __pyx_obj_7_record_Record *, __pyx_t_7_record_INDEX_t, int __pyx_skip_dispatch); +struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord { + struct __pyx_vtabstruct_7sklearn_5earth_7_record_Record __pyx_base; + PyObject *(*set_selected)(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *, __pyx_t_7sklearn_5earth_7_record_INDEX_t, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_7_record_INDEX_t (*get_selected)(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *, int __pyx_skip_dispatch); + PyObject *(*roll_back)(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *, struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, int __pyx_skip_dispatch); }; -static struct __pyx_vtabstruct_7_record_Record *__pyx_vtabptr_7_record_Record; +static struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord *__pyx_vtabptr_7sklearn_5earth_7_record_PruningPassRecord; -/* "_record.pxd":25 - * cpdef FLOAT_t grsq(Record self, INDEX_t iteration) - * - * cdef class PruningPassRecord(Record): # <<<<<<<<<<<<<< - * cdef INDEX_t selected +/* "_record.pxd":57 + * pass * + * cdef class ForwardPassIteration(Iteration): # <<<<<<<<<<<<<< + * cdef INDEX_t parent + * cdef INDEX_t variable */ -struct __pyx_vtabstruct_7_record_PruningPassRecord { - struct __pyx_vtabstruct_7_record_Record __pyx_base; - PyObject *(*set_selected)(struct __pyx_obj_7_record_PruningPassRecord *, __pyx_t_7_record_INDEX_t, int __pyx_skip_dispatch); - __pyx_t_7_record_INDEX_t (*get_selected)(struct __pyx_obj_7_record_PruningPassRecord *, int __pyx_skip_dispatch); - PyObject *(*roll_back)(struct __pyx_obj_7_record_PruningPassRecord *, struct __pyx_obj_6_basis_Basis *, int __pyx_skip_dispatch); +struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassIteration { + struct __pyx_vtabstruct_7sklearn_5earth_7_record_Iteration __pyx_base; + PyObject *(*set_no_candidates)(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration *, int, int __pyx_skip_dispatch); + PyObject *(*no_further_candidates)(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration *, int __pyx_skip_dispatch); }; -static struct __pyx_vtabstruct_7_record_PruningPassRecord *__pyx_vtabptr_7_record_PruningPassRecord; +static struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassIteration *__pyx_vtabptr_7sklearn_5earth_7_record_ForwardPassIteration; -/* "_record.pxd":34 - * cpdef roll_back(PruningPassRecord self, Basis basis) +/* "_basis.pxd":102 * - * cdef class ForwardPassRecord(Record): # <<<<<<<<<<<<<< - * cdef int stopping_condition * + * cdef class Basis: # <<<<<<<<<<<<<< + * '''A wrapper that provides functionality related to a set of BasisFunctions with a + * common ConstantBasisFunction ancestor. Retains the order in which BasisFunctions are */ -struct __pyx_vtabstruct_7_record_ForwardPassRecord { - struct __pyx_vtabstruct_7_record_Record __pyx_base; - PyObject *(*set_stopping_condition)(struct __pyx_obj_7_record_ForwardPassRecord *, int, int __pyx_skip_dispatch); +struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis { + PyObject *(*translate)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); + PyObject *(*scale)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, PyArrayObject *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *(*get_root)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, int __pyx_skip_dispatch); + PyObject *(*append)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_6_basis_INDEX_t (*plen)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, int __pyx_skip_dispatch); + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *(*get)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, __pyx_t_7sklearn_5earth_6_basis_INDEX_t, int __pyx_skip_dispatch); + PyObject *(*transform)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); + PyObject *(*weighted_transform)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, PyArrayObject *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); }; -static struct __pyx_vtabstruct_7_record_ForwardPassRecord *__pyx_vtabptr_7_record_ForwardPassRecord; +static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *__pyx_vtabptr_7sklearn_5earth_6_basis_Basis; -/* "_basis.pxd":65 - * +/* "_record.pxd":68 + * cpdef no_further_candidates(ForwardPassIteration self) * - * cdef class HingeBasisFunction(BasisFunction): # <<<<<<<<<<<<<< - * cdef FLOAT_t knot - * cdef INDEX_t knot_idx + * cdef class FirstForwardPassIteration(ForwardPassIteration): # <<<<<<<<<<<<<< + * cpdef INDEX_t get_size(FirstForwardPassIteration self) */ -struct __pyx_vtabstruct_6_basis_HingeBasisFunction { - struct __pyx_vtabstruct_6_basis_BasisFunction __pyx_base; - PyObject *(*translate)(struct __pyx_obj_6_basis_HingeBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch); - __pyx_t_6_basis_FLOAT_t (*scale)(struct __pyx_obj_6_basis_HingeBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); - __pyx_t_6_basis_INDEX_t (*get_variable)(struct __pyx_obj_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); - __pyx_t_6_basis_FLOAT_t (*get_knot)(struct __pyx_obj_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); - int (*get_reverse)(struct __pyx_obj_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); - __pyx_t_6_basis_INDEX_t (*get_knot_idx)(struct __pyx_obj_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); +struct __pyx_vtabstruct_7sklearn_5earth_7_record_FirstForwardPassIteration { + struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassIteration __pyx_base; }; -static struct __pyx_vtabstruct_6_basis_HingeBasisFunction *__pyx_vtabptr_6_basis_HingeBasisFunction; +static struct __pyx_vtabstruct_7sklearn_5earth_7_record_FirstForwardPassIteration *__pyx_vtabptr_7sklearn_5earth_7_record_FirstForwardPassIteration; -/* "_record.pxd":52 +/* "_record.pxd":54 * cpdef INDEX_t get_pruned(PruningPassIteration self) * * cdef class FirstPruningPassIteration(PruningPassIteration): # <<<<<<<<<<<<<< @@ -1437,10 +1449,10 @@ static struct __pyx_vtabstruct_6_basis_HingeBasisFunction *__pyx_vtabptr_6_basis * */ -struct __pyx_vtabstruct_7_record_FirstPruningPassIteration { - struct __pyx_vtabstruct_7_record_PruningPassIteration __pyx_base; +struct __pyx_vtabstruct_7sklearn_5earth_7_record_FirstPruningPassIteration { + struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassIteration __pyx_base; }; -static struct __pyx_vtabstruct_7_record_FirstPruningPassIteration *__pyx_vtabptr_7_record_FirstPruningPassIteration; +static struct __pyx_vtabstruct_7sklearn_5earth_7_record_FirstPruningPassIteration *__pyx_vtabptr_7sklearn_5earth_7_record_FirstPruningPassIteration; #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif @@ -1597,6 +1609,10 @@ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); +static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ + +static void* __Pyx_GetVtable(PyObject *dict); /*proto*/ + typedef struct { Py_ssize_t shape, strides, suboffsets; } __Pyx_Buf_DimInfo; @@ -1760,8 +1776,6 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject * static int __Pyx_check_binary_version(void); -static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ - #if !defined(__Pyx_PyIdentifier_FromString) #if PY_MAJOR_VERSION < 3 #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) @@ -1774,8 +1788,6 @@ static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ -static void* __Pyx_GetVtable(PyObject *dict); /*proto*/ - static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig); /*proto*/ typedef struct { @@ -1825,43 +1837,43 @@ static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ -/* Module declarations from '_basis' */ -static PyTypeObject *__pyx_ptype_6_basis_BasisFunction = 0; -static PyTypeObject *__pyx_ptype_6_basis_ConstantBasisFunction = 0; -static PyTypeObject *__pyx_ptype_6_basis_HingeBasisFunction = 0; -static PyTypeObject *__pyx_ptype_6_basis_LinearBasisFunction = 0; -static PyTypeObject *__pyx_ptype_6_basis_Basis = 0; - -/* Module declarations from '_record' */ -static PyTypeObject *__pyx_ptype_7_record_Record = 0; -static PyTypeObject *__pyx_ptype_7_record_PruningPassRecord = 0; -static PyTypeObject *__pyx_ptype_7_record_ForwardPassRecord = 0; -static PyTypeObject *__pyx_ptype_7_record_Iteration = 0; -static PyTypeObject *__pyx_ptype_7_record_PruningPassIteration = 0; -static PyTypeObject *__pyx_ptype_7_record_FirstPruningPassIteration = 0; -static PyTypeObject *__pyx_ptype_7_record_ForwardPassIteration = 0; -static PyTypeObject *__pyx_ptype_7_record_FirstForwardPassIteration = 0; - -/* Module declarations from '_util' */ -static PyObject *(*__pyx_f_5_util_apply_weights_1d)(PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); /*proto*/ -static __pyx_t_5_util_FLOAT_t (*__pyx_f_5_util_gcv)(__pyx_t_5_util_FLOAT_t, __pyx_t_5_util_INDEX_t, __pyx_t_5_util_INDEX_t, __pyx_t_5_util_FLOAT_t, int __pyx_skip_dispatch); /*proto*/ - -/* Module declarations from '_pruning' */ -static PyTypeObject *__pyx_ptype_8_pruning_PruningPasser = 0; -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_8_pruning_FLOAT_t = { "FLOAT_t", NULL, sizeof(__pyx_t_8_pruning_FLOAT_t), { 0 }, 0, 'R', 0, 0 }; -#define __Pyx_MODULE_NAME "_pruning" -int __pyx_module_is_main__pruning = 0; - -/* Implementation of '_pruning' */ +/* Module declarations from 'sklearn.earth._basis' */ +static PyTypeObject *__pyx_ptype_7sklearn_5earth_6_basis_BasisFunction = 0; +static PyTypeObject *__pyx_ptype_7sklearn_5earth_6_basis_ConstantBasisFunction = 0; +static PyTypeObject *__pyx_ptype_7sklearn_5earth_6_basis_HingeBasisFunction = 0; +static PyTypeObject *__pyx_ptype_7sklearn_5earth_6_basis_LinearBasisFunction = 0; +static PyTypeObject *__pyx_ptype_7sklearn_5earth_6_basis_Basis = 0; + +/* Module declarations from 'sklearn.earth._record' */ +static PyTypeObject *__pyx_ptype_7sklearn_5earth_7_record_Record = 0; +static PyTypeObject *__pyx_ptype_7sklearn_5earth_7_record_PruningPassRecord = 0; +static PyTypeObject *__pyx_ptype_7sklearn_5earth_7_record_ForwardPassRecord = 0; +static PyTypeObject *__pyx_ptype_7sklearn_5earth_7_record_Iteration = 0; +static PyTypeObject *__pyx_ptype_7sklearn_5earth_7_record_PruningPassIteration = 0; +static PyTypeObject *__pyx_ptype_7sklearn_5earth_7_record_FirstPruningPassIteration = 0; +static PyTypeObject *__pyx_ptype_7sklearn_5earth_7_record_ForwardPassIteration = 0; +static PyTypeObject *__pyx_ptype_7sklearn_5earth_7_record_FirstForwardPassIteration = 0; + +/* Module declarations from 'sklearn.earth._util' */ +static PyObject *(*__pyx_f_7sklearn_5earth_5_util_apply_weights_1d)(PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); /*proto*/ +static __pyx_t_7sklearn_5earth_5_util_FLOAT_t (*__pyx_f_7sklearn_5earth_5_util_gcv)(__pyx_t_7sklearn_5earth_5_util_FLOAT_t, __pyx_t_7sklearn_5earth_5_util_INDEX_t, __pyx_t_7sklearn_5earth_5_util_INDEX_t, __pyx_t_7sklearn_5earth_5_util_FLOAT_t, int __pyx_skip_dispatch); /*proto*/ + +/* Module declarations from 'sklearn.earth._pruning' */ +static PyTypeObject *__pyx_ptype_7sklearn_5earth_8_pruning_PruningPasser = 0; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_pruning_FLOAT_t = { "FLOAT_t", NULL, sizeof(__pyx_t_7sklearn_5earth_8_pruning_FLOAT_t), { 0 }, 0, 'R', 0, 0 }; +#define __Pyx_MODULE_NAME "sklearn.earth._pruning" +int __pyx_module_is_main_sklearn__earth___pruning = 0; + +/* Implementation of 'sklearn.earth._pruning' */ static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_RuntimeError; -static int __pyx_pf_8_pruning_13PruningPasser___init__(struct __pyx_obj_8_pruning_PruningPasser *__pyx_v_self, struct __pyx_obj_6_basis_Basis *__pyx_v_basis, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_y, PyArrayObject *__pyx_v_weights, PyObject *__pyx_v_kwargs); /* proto */ -static PyObject *__pyx_pf_8_pruning_13PruningPasser_2run(struct __pyx_obj_8_pruning_PruningPasser *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_8_pruning_13PruningPasser_4trace(struct __pyx_obj_8_pruning_PruningPasser *__pyx_v_self); /* proto */ +static int __pyx_pf_7sklearn_5earth_8_pruning_13PruningPasser___init__(struct __pyx_obj_7sklearn_5earth_8_pruning_PruningPasser *__pyx_v_self, struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_basis, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_y, PyArrayObject *__pyx_v_weights, PyObject *__pyx_v_kwargs); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_8_pruning_13PruningPasser_2run(struct __pyx_obj_7sklearn_5earth_8_pruning_PruningPasser *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_8_pruning_13PruningPasser_4trace(struct __pyx_obj_7sklearn_5earth_8_pruning_PruningPasser *__pyx_v_self); /* proto */ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ -static PyObject *__pyx_tp_new_8_pruning_PruningPasser(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7sklearn_5earth_8_pruning_PruningPasser(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static char __pyx_k_7[] = "ndarray is not C contiguous"; static char __pyx_k_9[] = "ndarray is not Fortran contiguous"; static char __pyx_k_11[] = "Non-native byte order not supported"; @@ -1914,6 +1926,7 @@ static char __pyx_k__ValueError[] = "ValueError"; static char __pyx_k____import__[] = "__import__"; static char __pyx_k__is_prunable[] = "is_prunable"; static char __pyx_k__RuntimeError[] = "RuntimeError"; +static char __pyx_k____pyx_vtable__[] = "__pyx_vtable__"; static char __pyx_k____pyx_getbuffer[] = "__pyx_getbuffer"; static char __pyx_k____pyx_releasebuffer[] = "__pyx_releasebuffer"; static PyObject *__pyx_kp_u_11; @@ -1929,6 +1942,7 @@ static PyObject *__pyx_n_s____import__; static PyObject *__pyx_n_s____main__; static PyObject *__pyx_n_s____pyx_getbuffer; static PyObject *__pyx_n_s____pyx_releasebuffer; +static PyObject *__pyx_n_s____pyx_vtable__; static PyObject *__pyx_n_s____test__; static PyObject *__pyx_n_s__average; static PyObject *__pyx_n_s__basis; @@ -1970,9 +1984,9 @@ static PyObject *__pyx_k_tuple_16; static PyObject *__pyx_k_tuple_18; /* Python wrapper */ -static int __pyx_pw_8_pruning_13PruningPasser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_8_pruning_13PruningPasser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - struct __pyx_obj_6_basis_Basis *__pyx_v_basis = 0; +static int __pyx_pw_7sklearn_5earth_8_pruning_13PruningPasser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7sklearn_5earth_8_pruning_13PruningPasser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_basis = 0; PyArrayObject *__pyx_v_X = 0; PyArrayObject *__pyx_v_y = 0; PyArrayObject *__pyx_v_weights = 0; @@ -2031,7 +2045,7 @@ static int __pyx_pw_8_pruning_13PruningPasser_1__init__(PyObject *__pyx_v_self, values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); } - __pyx_v_basis = ((struct __pyx_obj_6_basis_Basis *)values[0]); + __pyx_v_basis = ((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)values[0]); __pyx_v_X = ((PyArrayObject *)values[1]); __pyx_v_y = ((PyArrayObject *)values[2]); __pyx_v_weights = ((PyArrayObject *)values[3]); @@ -2041,15 +2055,15 @@ static int __pyx_pw_8_pruning_13PruningPasser_1__init__(PyObject *__pyx_v_self, __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_DECREF(__pyx_v_kwargs); __pyx_v_kwargs = 0; - __Pyx_AddTraceback("_pruning.PruningPasser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._pruning.PruningPasser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_basis), __pyx_ptype_6_basis_Basis, 1, "basis", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_basis), __pyx_ptype_7sklearn_5earth_6_basis_Basis, 1, "basis", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weights), __pyx_ptype_5numpy_ndarray, 1, "weights", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_8_pruning_13PruningPasser___init__(((struct __pyx_obj_8_pruning_PruningPasser *)__pyx_v_self), __pyx_v_basis, __pyx_v_X, __pyx_v_y, __pyx_v_weights, __pyx_v_kwargs); + __pyx_r = __pyx_pf_7sklearn_5earth_8_pruning_13PruningPasser___init__(((struct __pyx_obj_7sklearn_5earth_8_pruning_PruningPasser *)__pyx_v_self), __pyx_v_basis, __pyx_v_X, __pyx_v_y, __pyx_v_weights, __pyx_v_kwargs); goto __pyx_L0; __pyx_L1_error:; __pyx_r = -1; @@ -2059,7 +2073,7 @@ static int __pyx_pw_8_pruning_13PruningPasser_1__init__(PyObject *__pyx_v_self, return __pyx_r; } -/* "_pruning.pyx":13 +/* "sklearn/earth/_pruning.pyx":13 * cdef class PruningPasser: * '''Implements the generic pruning pass as described by Friedman, 1991.''' * def __init__(PruningPasser self, Basis basis, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] weights, **kwargs): # <<<<<<<<<<<<<< @@ -2067,7 +2081,7 @@ static int __pyx_pw_8_pruning_13PruningPasser_1__init__(PyObject *__pyx_v_self, * self.m = self.X.shape[0] */ -static int __pyx_pf_8_pruning_13PruningPasser___init__(struct __pyx_obj_8_pruning_PruningPasser *__pyx_v_self, struct __pyx_obj_6_basis_Basis *__pyx_v_basis, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_y, PyArrayObject *__pyx_v_weights, PyObject *__pyx_v_kwargs) { +static int __pyx_pf_7sklearn_5earth_8_pruning_13PruningPasser___init__(struct __pyx_obj_7sklearn_5earth_8_pruning_PruningPasser *__pyx_v_self, struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_basis, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_y, PyArrayObject *__pyx_v_weights, PyObject *__pyx_v_kwargs) { __Pyx_LocalBuf_ND __pyx_pybuffernd_X; __Pyx_Buffer __pyx_pybuffer_X; __Pyx_LocalBuf_ND __pyx_pybuffernd_weights; @@ -2083,7 +2097,7 @@ static int __pyx_pf_8_pruning_13PruningPasser___init__(struct __pyx_obj_8_prunin Py_ssize_t __pyx_t_5; PyObject *__pyx_t_6 = NULL; int __pyx_t_7; - __pyx_t_8_pruning_FLOAT_t __pyx_t_8; + __pyx_t_7sklearn_5earth_8_pruning_FLOAT_t __pyx_t_8; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -2102,21 +2116,21 @@ static int __pyx_pf_8_pruning_13PruningPasser___init__(struct __pyx_obj_8_prunin __pyx_pybuffernd_weights.rcbuffer = &__pyx_pybuffer_weights; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_8_pruning_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_pruning_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_8_pruning_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_pruning_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_y.diminfo[0].strides = __pyx_pybuffernd_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y.diminfo[0].shape = __pyx_pybuffernd_y.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_8_pruning_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_pruning_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_weights.diminfo[0].strides = __pyx_pybuffernd_weights.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weights.diminfo[0].shape = __pyx_pybuffernd_weights.rcbuffer->pybuffer.shape[0]; - /* "_pruning.pyx":14 + /* "sklearn/earth/_pruning.pyx":14 * '''Implements the generic pruning pass as described by Friedman, 1991.''' * def __init__(PruningPasser self, Basis basis, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] weights, **kwargs): * self.X = X # <<<<<<<<<<<<<< @@ -2129,7 +2143,7 @@ static int __pyx_pf_8_pruning_13PruningPasser___init__(struct __pyx_obj_8_prunin __Pyx_DECREF(((PyObject *)__pyx_v_self->X)); __pyx_v_self->X = ((PyArrayObject *)__pyx_v_X); - /* "_pruning.pyx":15 + /* "sklearn/earth/_pruning.pyx":15 * def __init__(PruningPasser self, Basis basis, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] weights, **kwargs): * self.X = X * self.m = self.X.shape[0] # <<<<<<<<<<<<<< @@ -2138,7 +2152,7 @@ static int __pyx_pf_8_pruning_13PruningPasser___init__(struct __pyx_obj_8_prunin */ __pyx_v_self->m = (__pyx_v_self->X->dimensions[0]); - /* "_pruning.pyx":16 + /* "sklearn/earth/_pruning.pyx":16 * self.X = X * self.m = self.X.shape[0] * self.n = self.X.shape[1] # <<<<<<<<<<<<<< @@ -2147,7 +2161,7 @@ static int __pyx_pf_8_pruning_13PruningPasser___init__(struct __pyx_obj_8_prunin */ __pyx_v_self->n = (__pyx_v_self->X->dimensions[1]); - /* "_pruning.pyx":17 + /* "sklearn/earth/_pruning.pyx":17 * self.m = self.X.shape[0] * self.n = self.X.shape[1] * self.y = y # <<<<<<<<<<<<<< @@ -2160,7 +2174,7 @@ static int __pyx_pf_8_pruning_13PruningPasser___init__(struct __pyx_obj_8_prunin __Pyx_DECREF(((PyObject *)__pyx_v_self->y)); __pyx_v_self->y = ((PyArrayObject *)__pyx_v_y); - /* "_pruning.pyx":18 + /* "sklearn/earth/_pruning.pyx":18 * self.n = self.X.shape[1] * self.y = y * self.weights = weights # <<<<<<<<<<<<<< @@ -2173,7 +2187,7 @@ static int __pyx_pf_8_pruning_13PruningPasser___init__(struct __pyx_obj_8_prunin __Pyx_DECREF(((PyObject *)__pyx_v_self->weights)); __pyx_v_self->weights = ((PyArrayObject *)__pyx_v_weights); - /* "_pruning.pyx":19 + /* "sklearn/earth/_pruning.pyx":19 * self.y = y * self.weights = weights * self.basis = basis # <<<<<<<<<<<<<< @@ -2186,7 +2200,7 @@ static int __pyx_pf_8_pruning_13PruningPasser___init__(struct __pyx_obj_8_prunin __Pyx_DECREF(((PyObject *)__pyx_v_self->basis)); __pyx_v_self->basis = __pyx_v_basis; - /* "_pruning.pyx":20 + /* "sklearn/earth/_pruning.pyx":20 * self.weights = weights * self.basis = basis * self.B = np.empty(shape=(self.m,len(self.basis)+1),dtype=np.float) # <<<<<<<<<<<<<< @@ -2236,7 +2250,7 @@ static int __pyx_pf_8_pruning_13PruningPasser___init__(struct __pyx_obj_8_prunin __pyx_v_self->B = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "_pruning.pyx":21 + /* "sklearn/earth/_pruning.pyx":21 * self.basis = basis * self.B = np.empty(shape=(self.m,len(self.basis)+1),dtype=np.float) * self.penalty = kwargs['penalty'] if 'penalty' in kwargs else 3.0 # <<<<<<<<<<<<<< @@ -2244,7 +2258,7 @@ static int __pyx_pf_8_pruning_13PruningPasser___init__(struct __pyx_obj_8_prunin * */ __pyx_t_7 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__penalty), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_7) { + if ((__pyx_t_7 != 0)) { __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__penalty)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_4 = __pyx_t_1; @@ -2259,7 +2273,7 @@ static int __pyx_pf_8_pruning_13PruningPasser___init__(struct __pyx_obj_8_prunin __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_self->penalty = __pyx_t_8; - /* "_pruning.pyx":22 + /* "sklearn/earth/_pruning.pyx":22 * self.B = np.empty(shape=(self.m,len(self.basis)+1),dtype=np.float) * self.penalty = kwargs['penalty'] if 'penalty' in kwargs else 3.0 * self.sst = np.sum(self.weights*(self.y - np.average(self.y,weights=self.weights))**2) / self.m # <<<<<<<<<<<<<< @@ -2331,7 +2345,7 @@ static int __pyx_pf_8_pruning_13PruningPasser___init__(struct __pyx_obj_8_prunin __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("_pruning.PruningPasser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._pruning.PruningPasser.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; goto __pyx_L2; __pyx_L0:; @@ -2343,7 +2357,7 @@ static int __pyx_pf_8_pruning_13PruningPasser___init__(struct __pyx_obj_8_prunin return __pyx_r; } -/* "_pruning.pyx":24 +/* "sklearn/earth/_pruning.pyx":24 * self.sst = np.sum(self.weights*(self.y - np.average(self.y,weights=self.weights))**2) / self.m * * cpdef run(PruningPasser self): # <<<<<<<<<<<<<< @@ -2351,18 +2365,18 @@ static int __pyx_pf_8_pruning_13PruningPasser___init__(struct __pyx_obj_8_prunin * #through the use of updating algorithms. It is not clear that such */ -static PyObject *__pyx_pw_8_pruning_13PruningPasser_3run(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_pruning_PruningPasser *__pyx_v_self, int __pyx_skip_dispatch) { - __pyx_t_8_pruning_INDEX_t __pyx_v_i; - __pyx_t_8_pruning_INDEX_t __pyx_v_j; - __pyx_t_8_pruning_INDEX_t __pyx_v_basis_size; - __pyx_t_8_pruning_INDEX_t __pyx_v_pruned_basis_size; - __pyx_t_8_pruning_FLOAT_t __pyx_v_gcv_; - __pyx_t_8_pruning_INDEX_t __pyx_v_best_iteration; - __pyx_t_8_pruning_INDEX_t __pyx_v_best_bf_to_prune; - __pyx_t_8_pruning_FLOAT_t __pyx_v_best_gcv; - __pyx_t_8_pruning_FLOAT_t __pyx_v_best_iteration_gcv; - __pyx_t_8_pruning_FLOAT_t __pyx_v_best_iteration_mse; +static PyObject *__pyx_pw_7sklearn_5earth_8_pruning_13PruningPasser_3run(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __pyx_obj_7sklearn_5earth_8_pruning_PruningPasser *__pyx_v_self, int __pyx_skip_dispatch) { + __pyx_t_7sklearn_5earth_8_pruning_INDEX_t __pyx_v_i; + __pyx_t_7sklearn_5earth_8_pruning_INDEX_t __pyx_v_j; + __pyx_t_7sklearn_5earth_8_pruning_INDEX_t __pyx_v_basis_size; + __pyx_t_7sklearn_5earth_8_pruning_INDEX_t __pyx_v_pruned_basis_size; + __pyx_t_7sklearn_5earth_8_pruning_FLOAT_t __pyx_v_gcv_; + __pyx_t_7sklearn_5earth_8_pruning_INDEX_t __pyx_v_best_iteration; + __pyx_t_7sklearn_5earth_8_pruning_INDEX_t __pyx_v_best_bf_to_prune; + __pyx_t_7sklearn_5earth_8_pruning_FLOAT_t __pyx_v_best_gcv; + __pyx_t_7sklearn_5earth_8_pruning_FLOAT_t __pyx_v_best_iteration_gcv; + __pyx_t_7sklearn_5earth_8_pruning_FLOAT_t __pyx_v_best_iteration_mse; PyArrayObject *__pyx_v_B = 0; PyArrayObject *__pyx_v_X = 0; PyArrayObject *__pyx_v_y = 0; @@ -2398,13 +2412,13 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin int __pyx_t_12; PyObject *__pyx_t_13 = NULL; PyObject *__pyx_t_14 = NULL; - __pyx_t_8_pruning_INDEX_t __pyx_t_15; - __pyx_t_8_pruning_INDEX_t __pyx_t_16; - __pyx_t_8_pruning_INDEX_t __pyx_t_17; - __pyx_t_8_pruning_INDEX_t __pyx_t_18; + __pyx_t_7sklearn_5earth_8_pruning_INDEX_t __pyx_t_15; + __pyx_t_7sklearn_5earth_8_pruning_INDEX_t __pyx_t_16; + __pyx_t_7sklearn_5earth_8_pruning_INDEX_t __pyx_t_17; + __pyx_t_7sklearn_5earth_8_pruning_INDEX_t __pyx_t_18; int __pyx_t_19; - __pyx_t_5_util_FLOAT_t __pyx_t_20; - __pyx_t_8_pruning_FLOAT_t __pyx_t_21; + __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_t_20; + __pyx_t_7sklearn_5earth_8_pruning_FLOAT_t __pyx_t_21; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -2435,7 +2449,7 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__run); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8_pruning_13PruningPasser_3run)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_8_pruning_13PruningPasser_3run)) { __Pyx_XDECREF(__pyx_r); __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -2447,7 +2461,7 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_pruning.pyx":31 + /* "sklearn/earth/_pruning.pyx":31 * cdef INDEX_t i * cdef INDEX_t j * cdef INDEX_t basis_size = len(self.basis) # <<<<<<<<<<<<<< @@ -2460,16 +2474,16 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_basis_size = __pyx_t_3; - /* "_pruning.pyx":32 + /* "sklearn/earth/_pruning.pyx":32 * cdef INDEX_t j * cdef INDEX_t basis_size = len(self.basis) * cdef INDEX_t pruned_basis_size = self.basis.plen() # <<<<<<<<<<<<<< * cdef FLOAT_t gcv_ * cdef INDEX_t best_iteration */ - __pyx_v_pruned_basis_size = ((struct __pyx_vtabstruct_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->plen(__pyx_v_self->basis, 0); + __pyx_v_pruned_basis_size = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->plen(__pyx_v_self->basis, 0); - /* "_pruning.pyx":40 + /* "sklearn/earth/_pruning.pyx":40 * cdef FLOAT_t best_iteration_mse * * cdef cnp.ndarray[FLOAT_t, ndim=2] B = self.B # <<<<<<<<<<<<<< @@ -2479,7 +2493,7 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin __pyx_t_4 = ((PyArrayObject *)__pyx_v_self->B); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_8_pruning_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_pruning_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { __pyx_v_B = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_B.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_B.diminfo[0].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B.diminfo[0].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B.diminfo[1].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B.diminfo[1].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[1]; @@ -2489,7 +2503,7 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->B))); __pyx_v_B = ((PyArrayObject *)__pyx_v_self->B); - /* "_pruning.pyx":41 + /* "sklearn/earth/_pruning.pyx":41 * * cdef cnp.ndarray[FLOAT_t, ndim=2] B = self.B * cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X # <<<<<<<<<<<<<< @@ -2499,7 +2513,7 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin __pyx_t_5 = ((PyArrayObject *)__pyx_v_self->X); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_8_pruning_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_pruning_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { __pyx_v_X = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; @@ -2509,7 +2523,7 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->X))); __pyx_v_X = ((PyArrayObject *)__pyx_v_self->X); - /* "_pruning.pyx":42 + /* "sklearn/earth/_pruning.pyx":42 * cdef cnp.ndarray[FLOAT_t, ndim=2] B = self.B * cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X * cdef cnp.ndarray[FLOAT_t, ndim=1] y = self.y # <<<<<<<<<<<<<< @@ -2519,7 +2533,7 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin __pyx_t_6 = ((PyArrayObject *)__pyx_v_self->y); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_8_pruning_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_pruning_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_y = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_y.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_y.diminfo[0].strides = __pyx_pybuffernd_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y.diminfo[0].shape = __pyx_pybuffernd_y.rcbuffer->pybuffer.shape[0]; @@ -2529,7 +2543,7 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->y))); __pyx_v_y = ((PyArrayObject *)__pyx_v_self->y); - /* "_pruning.pyx":43 + /* "sklearn/earth/_pruning.pyx":43 * cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X * cdef cnp.ndarray[FLOAT_t, ndim=1] y = self.y * cdef cnp.ndarray[FLOAT_t, ndim=1] weights = self.weights # <<<<<<<<<<<<<< @@ -2539,7 +2553,7 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin __pyx_t_7 = ((PyArrayObject *)__pyx_v_self->weights); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_8_pruning_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_pruning_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_weights = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_weights.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_weights.diminfo[0].strides = __pyx_pybuffernd_weights.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weights.diminfo[0].shape = __pyx_pybuffernd_weights.rcbuffer->pybuffer.shape[0]; @@ -2549,7 +2563,7 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->weights))); __pyx_v_weights = ((PyArrayObject *)__pyx_v_self->weights); - /* "_pruning.pyx":44 + /* "sklearn/earth/_pruning.pyx":44 * cdef cnp.ndarray[FLOAT_t, ndim=1] y = self.y * cdef cnp.ndarray[FLOAT_t, ndim=1] weights = self.weights * cdef cnp.ndarray[FLOAT_t, ndim=1] weighted_y = y.copy() # <<<<<<<<<<<<<< @@ -2565,7 +2579,7 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin __pyx_t_8 = ((PyArrayObject *)__pyx_t_2); { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weighted_y.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_8_pruning_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weighted_y.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_pruning_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_weighted_y = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_weighted_y.rcbuffer->pybuffer.buf = NULL; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_weighted_y.diminfo[0].strides = __pyx_pybuffernd_weighted_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weighted_y.diminfo[0].shape = __pyx_pybuffernd_weighted_y.rcbuffer->pybuffer.shape[0]; @@ -2575,29 +2589,29 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin __pyx_v_weighted_y = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "_pruning.pyx":47 + /* "sklearn/earth/_pruning.pyx":47 * * #Initial solution * apply_weights_1d(weighted_y,weights) # <<<<<<<<<<<<<< * self.basis.weighted_transform(X,B,weights) * beta, mse = np.linalg.lstsq(B[:,0:(basis_size)],weighted_y)[0:2] */ - __pyx_t_2 = __pyx_f_5_util_apply_weights_1d(((PyArrayObject *)__pyx_v_weighted_y), ((PyArrayObject *)__pyx_v_weights), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_f_7sklearn_5earth_5_util_apply_weights_1d(((PyArrayObject *)__pyx_v_weighted_y), ((PyArrayObject *)__pyx_v_weights), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "_pruning.pyx":48 + /* "sklearn/earth/_pruning.pyx":48 * #Initial solution * apply_weights_1d(weighted_y,weights) * self.basis.weighted_transform(X,B,weights) # <<<<<<<<<<<<<< * beta, mse = np.linalg.lstsq(B[:,0:(basis_size)],weighted_y)[0:2] * if mse: */ - __pyx_t_2 = ((struct __pyx_vtabstruct_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->weighted_transform(__pyx_v_self->basis, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_B), ((PyArrayObject *)__pyx_v_weights), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->weighted_transform(__pyx_v_self->basis, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_B), ((PyArrayObject *)__pyx_v_weights), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "_pruning.pyx":49 + /* "sklearn/earth/_pruning.pyx":49 * apply_weights_1d(weighted_y,weights) * self.basis.weighted_transform(X,B,weights) * beta, mse = np.linalg.lstsq(B[:,0:(basis_size)],weighted_y)[0:2] # <<<<<<<<<<<<<< @@ -2699,7 +2713,7 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin __pyx_v_mse = __pyx_t_2; __pyx_t_2 = 0; - /* "_pruning.pyx":50 + /* "sklearn/earth/_pruning.pyx":50 * self.basis.weighted_transform(X,B,weights) * beta, mse = np.linalg.lstsq(B[:,0:(basis_size)],weighted_y)[0:2] * if mse: # <<<<<<<<<<<<<< @@ -2709,7 +2723,7 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_mse); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_12) { - /* "_pruning.pyx":51 + /* "sklearn/earth/_pruning.pyx":51 * beta, mse = np.linalg.lstsq(B[:,0:(basis_size)],weighted_y)[0:2] * if mse: * mse /= self.m # <<<<<<<<<<<<<< @@ -2728,7 +2742,7 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin } /*else*/ { - /* "_pruning.pyx":53 + /* "sklearn/earth/_pruning.pyx":53 * mse /= self.m * else: * mse = (1.0/self.m)*np.sum((np.dot(B[:,0:basis_size],beta) - weighted_y)**2) # <<<<<<<<<<<<<< @@ -2800,7 +2814,7 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin } __pyx_L5:; - /* "_pruning.pyx":56 + /* "sklearn/earth/_pruning.pyx":56 * * #Create the record object * self.record = PruningPassRecord(self.m,self.n,self.penalty,self.sst,pruned_basis_size,mse) # <<<<<<<<<<<<<< @@ -2837,25 +2851,25 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin __pyx_t_2 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; - __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7_record_PruningPassRecord)), ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_PruningPassRecord)), ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0; __Pyx_GIVEREF(__pyx_t_10); __Pyx_GOTREF(__pyx_v_self->record); __Pyx_DECREF(((PyObject *)__pyx_v_self->record)); - __pyx_v_self->record = ((struct __pyx_obj_7_record_PruningPassRecord *)__pyx_t_10); + __pyx_v_self->record = ((struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_t_10); __pyx_t_10 = 0; - /* "_pruning.pyx":57 + /* "sklearn/earth/_pruning.pyx":57 * #Create the record object * self.record = PruningPassRecord(self.m,self.n,self.penalty,self.sst,pruned_basis_size,mse) * gcv_ = self.record.gcv(0) # <<<<<<<<<<<<<< * best_gcv = gcv_ * best_iteration = 0 */ - __pyx_v_gcv_ = ((struct __pyx_vtabstruct_7_record_PruningPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->__pyx_base.gcv(((struct __pyx_obj_7_record_Record *)__pyx_v_self->record), 0, 0); + __pyx_v_gcv_ = ((struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->__pyx_base.gcv(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self->record), 0, 0); - /* "_pruning.pyx":58 + /* "sklearn/earth/_pruning.pyx":58 * self.record = PruningPassRecord(self.m,self.n,self.penalty,self.sst,pruned_basis_size,mse) * gcv_ = self.record.gcv(0) * best_gcv = gcv_ # <<<<<<<<<<<<<< @@ -2864,7 +2878,7 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin */ __pyx_v_best_gcv = __pyx_v_gcv_; - /* "_pruning.pyx":59 + /* "sklearn/earth/_pruning.pyx":59 * gcv_ = self.record.gcv(0) * best_gcv = gcv_ * best_iteration = 0 # <<<<<<<<<<<<<< @@ -2873,7 +2887,7 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin */ __pyx_v_best_iteration = 0; - /* "_pruning.pyx":62 + /* "sklearn/earth/_pruning.pyx":62 * * #Prune basis functions sequentially * for i in range(1,pruned_basis_size): # <<<<<<<<<<<<<< @@ -2884,7 +2898,7 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin for (__pyx_t_16 = 1; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { __pyx_v_i = __pyx_t_16; - /* "_pruning.pyx":63 + /* "sklearn/earth/_pruning.pyx":63 * #Prune basis functions sequentially * for i in range(1,pruned_basis_size): * first = True # <<<<<<<<<<<<<< @@ -2893,7 +2907,7 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin */ __pyx_v_first = 1; - /* "_pruning.pyx":64 + /* "sklearn/earth/_pruning.pyx":64 * for i in range(1,pruned_basis_size): * first = True * pruned_basis_size -= 1 # <<<<<<<<<<<<<< @@ -2902,7 +2916,7 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin */ __pyx_v_pruned_basis_size = (__pyx_v_pruned_basis_size - 1); - /* "_pruning.pyx":67 + /* "sklearn/earth/_pruning.pyx":67 * * #Find the best basis function to prune * for j in range(basis_size): # <<<<<<<<<<<<<< @@ -2913,20 +2927,20 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { __pyx_v_j = __pyx_t_18; - /* "_pruning.pyx":68 + /* "sklearn/earth/_pruning.pyx":68 * #Find the best basis function to prune * for j in range(basis_size): * bf = self.basis[j] # <<<<<<<<<<<<<< * if bf.is_pruned(): * continue */ - __pyx_t_10 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->basis), __pyx_v_j, sizeof(__pyx_t_8_pruning_INDEX_t)+1, __Pyx_PyInt_to_py_npy_ulonglong, 0, 0, 0); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->basis), __pyx_v_j, sizeof(__pyx_t_7sklearn_5earth_8_pruning_INDEX_t)+1, __Pyx_PyInt_to_py_npy_ulonglong, 0, 0, 0); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_XDECREF(__pyx_v_bf); __pyx_v_bf = __pyx_t_10; __pyx_t_10 = 0; - /* "_pruning.pyx":69 + /* "sklearn/earth/_pruning.pyx":69 * for j in range(basis_size): * bf = self.basis[j] * if bf.is_pruned(): # <<<<<<<<<<<<<< @@ -2942,7 +2956,7 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; if (__pyx_t_12) { - /* "_pruning.pyx":70 + /* "sklearn/earth/_pruning.pyx":70 * bf = self.basis[j] * if bf.is_pruned(): * continue # <<<<<<<<<<<<<< @@ -2954,7 +2968,7 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin } __pyx_L10:; - /* "_pruning.pyx":71 + /* "sklearn/earth/_pruning.pyx":71 * if bf.is_pruned(): * continue * if not bf.is_prunable(): # <<<<<<<<<<<<<< @@ -2968,10 +2982,10 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_19 = (!__pyx_t_12); + __pyx_t_19 = ((!__pyx_t_12) != 0); if (__pyx_t_19) { - /* "_pruning.pyx":72 + /* "sklearn/earth/_pruning.pyx":72 * continue * if not bf.is_prunable(): * continue # <<<<<<<<<<<<<< @@ -2983,7 +2997,7 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin } __pyx_L11:; - /* "_pruning.pyx":73 + /* "sklearn/earth/_pruning.pyx":73 * if not bf.is_prunable(): * continue * bf.prune() # <<<<<<<<<<<<<< @@ -2997,18 +3011,18 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - /* "_pruning.pyx":74 + /* "sklearn/earth/_pruning.pyx":74 * continue * bf.prune() * self.basis.weighted_transform(X, B, weights) # <<<<<<<<<<<<<< * beta, mse = np.linalg.lstsq(B[:,0:pruned_basis_size],weighted_y)[0:2] * if mse: */ - __pyx_t_14 = ((struct __pyx_vtabstruct_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->weighted_transform(__pyx_v_self->basis, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_B), ((PyArrayObject *)__pyx_v_weights), 0); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->weighted_transform(__pyx_v_self->basis, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_B), ((PyArrayObject *)__pyx_v_weights), 0); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - /* "_pruning.pyx":75 + /* "sklearn/earth/_pruning.pyx":75 * bf.prune() * self.basis.weighted_transform(X, B, weights) * beta, mse = np.linalg.lstsq(B[:,0:pruned_basis_size],weighted_y)[0:2] # <<<<<<<<<<<<<< @@ -3112,7 +3126,7 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin __pyx_v_mse = __pyx_t_14; __pyx_t_14 = 0; - /* "_pruning.pyx":76 + /* "sklearn/earth/_pruning.pyx":76 * self.basis.weighted_transform(X, B, weights) * beta, mse = np.linalg.lstsq(B[:,0:pruned_basis_size],weighted_y)[0:2] * if mse: # <<<<<<<<<<<<<< @@ -3122,7 +3136,7 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_v_mse); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_19) { - /* "_pruning.pyx":77 + /* "sklearn/earth/_pruning.pyx":77 * beta, mse = np.linalg.lstsq(B[:,0:pruned_basis_size],weighted_y)[0:2] * if mse: * mse /= self.m # <<<<<<<<<<<<<< @@ -3141,7 +3155,7 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin } /*else*/ { - /* "_pruning.pyx":79 + /* "sklearn/earth/_pruning.pyx":79 * mse /= self.m * else: * mse = (1/float(self.m))*np.sum((np.dot(B[:,0:pruned_basis_size],beta) - weighted_y)**2) # <<<<<<<<<<<<<< @@ -3213,7 +3227,7 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin } __pyx_L14:; - /* "_pruning.pyx":80 + /* "sklearn/earth/_pruning.pyx":80 * else: * mse = (1/float(self.m))*np.sum((np.dot(B[:,0:pruned_basis_size],beta) - weighted_y)**2) * gcv_ = gcv(mse,pruned_basis_size,self.m,self.penalty) # <<<<<<<<<<<<<< @@ -3221,24 +3235,24 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin * if gcv_ <= best_iteration_gcv or first: */ __pyx_t_20 = __pyx_PyFloat_AsDouble(__pyx_v_mse); if (unlikely((__pyx_t_20 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_gcv_ = __pyx_f_5_util_gcv(__pyx_t_20, __pyx_v_pruned_basis_size, __pyx_v_self->m, __pyx_v_self->penalty, 0); + __pyx_v_gcv_ = __pyx_f_7sklearn_5earth_5_util_gcv(__pyx_t_20, __pyx_v_pruned_basis_size, __pyx_v_self->m, __pyx_v_self->penalty, 0); - /* "_pruning.pyx":82 + /* "sklearn/earth/_pruning.pyx":82 * gcv_ = gcv(mse,pruned_basis_size,self.m,self.penalty) * * if gcv_ <= best_iteration_gcv or first: # <<<<<<<<<<<<<< * best_iteration_gcv = gcv_ * best_iteration_mse = mse */ - __pyx_t_19 = (__pyx_v_gcv_ <= __pyx_v_best_iteration_gcv); + __pyx_t_19 = ((__pyx_v_gcv_ <= __pyx_v_best_iteration_gcv) != 0); if (!__pyx_t_19) { - __pyx_t_12 = __pyx_v_first; + __pyx_t_12 = (__pyx_v_first != 0); } else { __pyx_t_12 = __pyx_t_19; } if (__pyx_t_12) { - /* "_pruning.pyx":83 + /* "sklearn/earth/_pruning.pyx":83 * * if gcv_ <= best_iteration_gcv or first: * best_iteration_gcv = gcv_ # <<<<<<<<<<<<<< @@ -3247,7 +3261,7 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin */ __pyx_v_best_iteration_gcv = __pyx_v_gcv_; - /* "_pruning.pyx":84 + /* "sklearn/earth/_pruning.pyx":84 * if gcv_ <= best_iteration_gcv or first: * best_iteration_gcv = gcv_ * best_iteration_mse = mse # <<<<<<<<<<<<<< @@ -3257,7 +3271,7 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin __pyx_t_21 = __pyx_PyFloat_AsDouble(__pyx_v_mse); if (unlikely((__pyx_t_21 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_best_iteration_mse = __pyx_t_21; - /* "_pruning.pyx":85 + /* "sklearn/earth/_pruning.pyx":85 * best_iteration_gcv = gcv_ * best_iteration_mse = mse * best_bf_to_prune = j # <<<<<<<<<<<<<< @@ -3266,7 +3280,7 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin */ __pyx_v_best_bf_to_prune = __pyx_v_j; - /* "_pruning.pyx":86 + /* "sklearn/earth/_pruning.pyx":86 * best_iteration_mse = mse * best_bf_to_prune = j * first = False # <<<<<<<<<<<<<< @@ -3278,7 +3292,7 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin } __pyx_L15:; - /* "_pruning.pyx":87 + /* "sklearn/earth/_pruning.pyx":87 * best_bf_to_prune = j * first = False * bf.unprune() # <<<<<<<<<<<<<< @@ -3294,17 +3308,17 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin __pyx_L8_continue:; } - /* "_pruning.pyx":91 + /* "sklearn/earth/_pruning.pyx":91 * #The inner loop found the best basis function to remove for this iteration. * #Now check whether this iteration is better than all the previous ones. * if best_iteration_gcv <= best_gcv: # <<<<<<<<<<<<<< * best_gcv = best_iteration_gcv * best_iteration = i */ - __pyx_t_12 = (__pyx_v_best_iteration_gcv <= __pyx_v_best_gcv); + __pyx_t_12 = ((__pyx_v_best_iteration_gcv <= __pyx_v_best_gcv) != 0); if (__pyx_t_12) { - /* "_pruning.pyx":92 + /* "sklearn/earth/_pruning.pyx":92 * #Now check whether this iteration is better than all the previous ones. * if best_iteration_gcv <= best_gcv: * best_gcv = best_iteration_gcv # <<<<<<<<<<<<<< @@ -3313,7 +3327,7 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin */ __pyx_v_best_gcv = __pyx_v_best_iteration_gcv; - /* "_pruning.pyx":93 + /* "sklearn/earth/_pruning.pyx":93 * if best_iteration_gcv <= best_gcv: * best_gcv = best_iteration_gcv * best_iteration = i # <<<<<<<<<<<<<< @@ -3325,7 +3339,7 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin } __pyx_L16:; - /* "_pruning.pyx":96 + /* "sklearn/earth/_pruning.pyx":96 * * #Update the record and prune the selected basis function * self.record.append(PruningPassIteration(best_bf_to_prune,pruned_basis_size,best_iteration_mse)) # <<<<<<<<<<<<<< @@ -3349,22 +3363,22 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin __pyx_t_13 = 0; __pyx_t_10 = 0; __pyx_t_14 = 0; - __pyx_t_14 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7_record_PruningPassIteration)), ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_PruningPassIteration)), ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - __pyx_t_9 = ((struct __pyx_vtabstruct_7_record_PruningPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->__pyx_base.append(((struct __pyx_obj_7_record_Record *)__pyx_v_self->record), ((struct __pyx_obj_7_record_Iteration *)__pyx_t_14), 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = ((struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->__pyx_base.append(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self->record), ((struct __pyx_obj_7sklearn_5earth_7_record_Iteration *)__pyx_t_14), 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "_pruning.pyx":97 + /* "sklearn/earth/_pruning.pyx":97 * #Update the record and prune the selected basis function * self.record.append(PruningPassIteration(best_bf_to_prune,pruned_basis_size,best_iteration_mse)) * self.basis[best_bf_to_prune].prune() # <<<<<<<<<<<<<< * * #Unprune the basis functions pruned after the best iteration */ - __pyx_t_9 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->basis), __pyx_v_best_bf_to_prune, sizeof(__pyx_t_8_pruning_INDEX_t)+1, __Pyx_PyInt_to_py_npy_ulonglong, 0, 0, 0); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->basis), __pyx_v_best_bf_to_prune, sizeof(__pyx_t_7sklearn_5earth_8_pruning_INDEX_t)+1, __Pyx_PyInt_to_py_npy_ulonglong, 0, 0, 0); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__prune); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); @@ -3375,18 +3389,18 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } - /* "_pruning.pyx":100 + /* "sklearn/earth/_pruning.pyx":100 * * #Unprune the basis functions pruned after the best iteration * self.record.set_selected(best_iteration) # <<<<<<<<<<<<<< * self.record.roll_back(self.basis) * */ - __pyx_t_9 = ((struct __pyx_vtabstruct_7_record_PruningPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->set_selected(__pyx_v_self->record, __pyx_v_best_iteration, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = ((struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->set_selected(__pyx_v_self->record, __pyx_v_best_iteration, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "_pruning.pyx":101 + /* "sklearn/earth/_pruning.pyx":101 * #Unprune the basis functions pruned after the best iteration * self.record.set_selected(best_iteration) * self.record.roll_back(self.basis) # <<<<<<<<<<<<<< @@ -3395,7 +3409,7 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin */ __pyx_t_9 = ((PyObject *)__pyx_v_self->basis); __Pyx_INCREF(__pyx_t_9); - __pyx_t_14 = ((struct __pyx_vtabstruct_7_record_PruningPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->roll_back(__pyx_v_self->record, ((struct __pyx_obj_6_basis_Basis *)__pyx_t_9), 0); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = ((struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->roll_back(__pyx_v_self->record, ((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)__pyx_t_9), 0); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; @@ -3417,7 +3431,7 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("_pruning.PruningPasser.run", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._pruning.PruningPasser.run", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; goto __pyx_L2; __pyx_L0:; @@ -3441,17 +3455,17 @@ static PyObject *__pyx_f_8_pruning_13PruningPasser_run(struct __pyx_obj_8_prunin } /* Python wrapper */ -static PyObject *__pyx_pw_8_pruning_13PruningPasser_3run(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_8_pruning_13PruningPasser_3run(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_8_pruning_13PruningPasser_3run(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_8_pruning_13PruningPasser_3run(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("run (wrapper)", 0); - __pyx_r = __pyx_pf_8_pruning_13PruningPasser_2run(((struct __pyx_obj_8_pruning_PruningPasser *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_8_pruning_13PruningPasser_2run(((struct __pyx_obj_7sklearn_5earth_8_pruning_PruningPasser *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_pruning.pyx":24 +/* "sklearn/earth/_pruning.pyx":24 * self.sst = np.sum(self.weights*(self.y - np.average(self.y,weights=self.weights))**2) / self.m * * cpdef run(PruningPasser self): # <<<<<<<<<<<<<< @@ -3459,7 +3473,7 @@ static PyObject *__pyx_pw_8_pruning_13PruningPasser_3run(PyObject *__pyx_v_self, * #through the use of updating algorithms. It is not clear that such */ -static PyObject *__pyx_pf_8_pruning_13PruningPasser_2run(struct __pyx_obj_8_pruning_PruningPasser *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_8_pruning_13PruningPasser_2run(struct __pyx_obj_7sklearn_5earth_8_pruning_PruningPasser *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3468,7 +3482,7 @@ static PyObject *__pyx_pf_8_pruning_13PruningPasser_2run(struct __pyx_obj_8_prun int __pyx_clineno = 0; __Pyx_RefNannySetupContext("run", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_8_pruning_PruningPasser *)__pyx_v_self->__pyx_vtab)->run(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_pruning_PruningPasser *)__pyx_v_self->__pyx_vtab)->run(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3478,7 +3492,7 @@ static PyObject *__pyx_pf_8_pruning_13PruningPasser_2run(struct __pyx_obj_8_prun goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_pruning.PruningPasser.run", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._pruning.PruningPasser.run", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3486,7 +3500,7 @@ static PyObject *__pyx_pf_8_pruning_13PruningPasser_2run(struct __pyx_obj_8_prun return __pyx_r; } -/* "_pruning.pyx":103 +/* "sklearn/earth/_pruning.pyx":103 * self.record.roll_back(self.basis) * * cpdef PruningPassRecord trace(PruningPasser self): # <<<<<<<<<<<<<< @@ -3494,9 +3508,9 @@ static PyObject *__pyx_pf_8_pruning_13PruningPasser_2run(struct __pyx_obj_8_prun * */ -static PyObject *__pyx_pw_8_pruning_13PruningPasser_5trace(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static struct __pyx_obj_7_record_PruningPassRecord *__pyx_f_8_pruning_13PruningPasser_trace(struct __pyx_obj_8_pruning_PruningPasser *__pyx_v_self, int __pyx_skip_dispatch) { - struct __pyx_obj_7_record_PruningPassRecord *__pyx_r = NULL; +static PyObject *__pyx_pw_7sklearn_5earth_8_pruning_13PruningPasser_5trace(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_trace(struct __pyx_obj_7sklearn_5earth_8_pruning_PruningPasser *__pyx_v_self, int __pyx_skip_dispatch) { + struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; @@ -3510,12 +3524,12 @@ static struct __pyx_obj_7_record_PruningPassRecord *__pyx_f_8_pruning_13PruningP else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__trace); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_8_pruning_13PruningPasser_5trace)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_8_pruning_13PruningPasser_5trace)) { __Pyx_XDECREF(((PyObject *)__pyx_r)); __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7_record_PruningPassRecord))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = ((struct __pyx_obj_7_record_PruningPassRecord *)__pyx_t_2); + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7sklearn_5earth_7_record_PruningPassRecord))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; @@ -3523,7 +3537,7 @@ static struct __pyx_obj_7_record_PruningPassRecord *__pyx_f_8_pruning_13PruningP __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_pruning.pyx":104 + /* "sklearn/earth/_pruning.pyx":104 * * cpdef PruningPassRecord trace(PruningPasser self): * return self.record # <<<<<<<<<<<<<< @@ -3535,12 +3549,12 @@ static struct __pyx_obj_7_record_PruningPassRecord *__pyx_f_8_pruning_13PruningP __pyx_r = __pyx_v_self->record; goto __pyx_L0; - __pyx_r = ((struct __pyx_obj_7_record_PruningPassRecord *)Py_None); __Pyx_INCREF(Py_None); + __pyx_r = ((struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *)Py_None); __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_pruning.PruningPasser.trace", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._pruning.PruningPasser.trace", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF((PyObject *)__pyx_r); @@ -3549,17 +3563,17 @@ static struct __pyx_obj_7_record_PruningPassRecord *__pyx_f_8_pruning_13PruningP } /* Python wrapper */ -static PyObject *__pyx_pw_8_pruning_13PruningPasser_5trace(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_8_pruning_13PruningPasser_5trace(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_8_pruning_13PruningPasser_5trace(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_8_pruning_13PruningPasser_5trace(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("trace (wrapper)", 0); - __pyx_r = __pyx_pf_8_pruning_13PruningPasser_4trace(((struct __pyx_obj_8_pruning_PruningPasser *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_8_pruning_13PruningPasser_4trace(((struct __pyx_obj_7sklearn_5earth_8_pruning_PruningPasser *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_pruning.pyx":103 +/* "sklearn/earth/_pruning.pyx":103 * self.record.roll_back(self.basis) * * cpdef PruningPassRecord trace(PruningPasser self): # <<<<<<<<<<<<<< @@ -3567,7 +3581,7 @@ static PyObject *__pyx_pw_8_pruning_13PruningPasser_5trace(PyObject *__pyx_v_sel * */ -static PyObject *__pyx_pf_8_pruning_13PruningPasser_4trace(struct __pyx_obj_8_pruning_PruningPasser *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_8_pruning_13PruningPasser_4trace(struct __pyx_obj_7sklearn_5earth_8_pruning_PruningPasser *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3576,7 +3590,7 @@ static PyObject *__pyx_pf_8_pruning_13PruningPasser_4trace(struct __pyx_obj_8_pr int __pyx_clineno = 0; __Pyx_RefNannySetupContext("trace", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_8_pruning_PruningPasser *)__pyx_v_self->__pyx_vtab)->trace(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_8_pruning_PruningPasser *)__pyx_v_self->__pyx_vtab)->trace(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3586,7 +3600,7 @@ static PyObject *__pyx_pf_8_pruning_13PruningPasser_4trace(struct __pyx_obj_8_pr goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_pruning.PruningPasser.trace", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._pruning.PruningPasser.trace", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3651,7 +3665,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * * cdef int copy_shape, i, ndim */ - __pyx_t_1 = (__pyx_v_info == NULL); + __pyx_t_1 = ((__pyx_v_info == NULL) != 0); if (__pyx_t_1) { __pyx_r = 0; goto __pyx_L0; @@ -3693,7 +3707,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * copy_shape = 1 * else: */ - __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); if (__pyx_t_1) { /* "numpy.pxd":209 @@ -3726,7 +3740,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); + __pyx_t_1 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0); if (__pyx_t_1) { /* "numpy.pxd":214 @@ -3736,7 +3750,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * raise ValueError(u"ndarray is not C contiguous") * */ - __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS)); + __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; @@ -3766,7 +3780,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") */ - __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); + __pyx_t_3 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0); if (__pyx_t_3) { /* "numpy.pxd":218 @@ -3776,7 +3790,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * raise ValueError(u"ndarray is not Fortran contiguous") * */ - __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS)); + __pyx_t_1 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; @@ -3824,7 +3838,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. */ - if (__pyx_v_copy_shape) { + __pyx_t_2 = (__pyx_v_copy_shape != 0); + if (__pyx_t_2) { /* "numpy.pxd":226 * # Allocate new buffer for strides and shape info. @@ -3922,7 +3937,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * * cdef int t */ - __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self)); + __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0)); /* "numpy.pxd":239 * @@ -3961,9 +3976,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * # do not call releasebuffer * info.obj = None */ - __pyx_t_2 = (!__pyx_v_hasfields); + __pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0); if (__pyx_t_2) { - __pyx_t_3 = (!__pyx_v_copy_shape); + __pyx_t_3 = ((!(__pyx_v_copy_shape != 0)) != 0); __pyx_t_1 = __pyx_t_3; } else { __pyx_t_1 = __pyx_t_2; @@ -4008,7 +4023,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or */ - __pyx_t_1 = (!__pyx_v_hasfields); + __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0); if (__pyx_t_1) { /* "numpy.pxd":254 @@ -4028,9 +4043,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ - __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); + __pyx_t_1 = ((__pyx_v_descr->byteorder == '>') != 0); if (__pyx_t_1) { - __pyx_t_2 = __pyx_v_little_endian; + __pyx_t_2 = (__pyx_v_little_endian != 0); } else { __pyx_t_2 = __pyx_t_1; } @@ -4043,9 +4058,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" */ - __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); + __pyx_t_1 = ((__pyx_v_descr->byteorder == '<') != 0); if (__pyx_t_1) { - __pyx_t_3 = (!__pyx_v_little_endian); + __pyx_t_3 = ((!(__pyx_v_little_endian != 0)) != 0); __pyx_t_7 = __pyx_t_3; } else { __pyx_t_7 = __pyx_t_1; @@ -4417,7 +4432,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self); + __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0); if (__pyx_t_1) { /* "numpy.pxd":290 @@ -4439,7 +4454,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s * stdlib.free(info.strides) * # info.shape was stored after info.strides in the same block */ - __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); if (__pyx_t_1) { /* "numpy.pxd":292 @@ -4870,9 +4885,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ - __pyx_t_7 = (__pyx_v_child->byteorder == '>'); + __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0); if (__pyx_t_7) { - __pyx_t_8 = __pyx_v_little_endian; + __pyx_t_8 = (__pyx_v_little_endian != 0); } else { __pyx_t_8 = __pyx_t_7; } @@ -4885,9 +4900,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ - __pyx_t_7 = (__pyx_v_child->byteorder == '<'); + __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0); if (__pyx_t_7) { - __pyx_t_9 = (!__pyx_v_little_endian); + __pyx_t_9 = ((!(__pyx_v_little_endian != 0)) != 0); __pyx_t_10 = __pyx_t_9; } else { __pyx_t_10 = __pyx_t_7; @@ -4976,7 +4991,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * t = child.type_num * if end - f < 5: */ - __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child)); + __pyx_t_7 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0); if (__pyx_t_7) { /* "numpy.pxd":821 @@ -4999,7 +5014,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * raise RuntimeError(u"Format string allocated too short.") * */ - __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5); + __pyx_t_7 = (((__pyx_v_end - __pyx_v_f) < 5) != 0); if (__pyx_t_7) { /* "numpy.pxd":823 @@ -5421,6 +5436,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a PyObject *__pyx_v_baseptr; __Pyx_RefNannyDeclarations int __pyx_t_1; + int __pyx_t_2; __Pyx_RefNannySetupContext("set_array_base", 0); /* "numpy.pxd":967 @@ -5431,7 +5447,8 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a * else: */ __pyx_t_1 = (__pyx_v_base == Py_None); - if (__pyx_t_1) { + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { /* "numpy.pxd":968 * cdef PyObject* baseptr @@ -5507,7 +5524,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py * return None * else: */ - __pyx_t_1 = (__pyx_v_arr->base == NULL); + __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0); if (__pyx_t_1) { /* "numpy.pxd":977 @@ -5543,26 +5560,26 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __Pyx_RefNannyFinishContext(); return __pyx_r; } -static struct __pyx_vtabstruct_8_pruning_PruningPasser __pyx_vtable_8_pruning_PruningPasser; +static struct __pyx_vtabstruct_7sklearn_5earth_8_pruning_PruningPasser __pyx_vtable_7sklearn_5earth_8_pruning_PruningPasser; -static PyObject *__pyx_tp_new_8_pruning_PruningPasser(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_8_pruning_PruningPasser *p; +static PyObject *__pyx_tp_new_7sklearn_5earth_8_pruning_PruningPasser(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_7sklearn_5earth_8_pruning_PruningPasser *p; PyObject *o; o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_8_pruning_PruningPasser *)o); - p->__pyx_vtab = __pyx_vtabptr_8_pruning_PruningPasser; + p = ((struct __pyx_obj_7sklearn_5earth_8_pruning_PruningPasser *)o); + p->__pyx_vtab = __pyx_vtabptr_7sklearn_5earth_8_pruning_PruningPasser; p->X = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); p->B = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); p->y = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); p->weights = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - p->basis = ((struct __pyx_obj_6_basis_Basis *)Py_None); Py_INCREF(Py_None); - p->record = ((struct __pyx_obj_7_record_PruningPassRecord *)Py_None); Py_INCREF(Py_None); + p->basis = ((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)Py_None); Py_INCREF(Py_None); + p->record = ((struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *)Py_None); Py_INCREF(Py_None); return o; } -static void __pyx_tp_dealloc_8_pruning_PruningPasser(PyObject *o) { - struct __pyx_obj_8_pruning_PruningPasser *p = (struct __pyx_obj_8_pruning_PruningPasser *)o; +static void __pyx_tp_dealloc_7sklearn_5earth_8_pruning_PruningPasser(PyObject *o) { + struct __pyx_obj_7sklearn_5earth_8_pruning_PruningPasser *p = (struct __pyx_obj_7sklearn_5earth_8_pruning_PruningPasser *)o; PyObject_GC_UnTrack(o); Py_CLEAR(p->X); Py_CLEAR(p->B); @@ -5573,9 +5590,9 @@ static void __pyx_tp_dealloc_8_pruning_PruningPasser(PyObject *o) { (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_8_pruning_PruningPasser(PyObject *o, visitproc v, void *a) { +static int __pyx_tp_traverse_7sklearn_5earth_8_pruning_PruningPasser(PyObject *o, visitproc v, void *a) { int e; - struct __pyx_obj_8_pruning_PruningPasser *p = (struct __pyx_obj_8_pruning_PruningPasser *)o; + struct __pyx_obj_7sklearn_5earth_8_pruning_PruningPasser *p = (struct __pyx_obj_7sklearn_5earth_8_pruning_PruningPasser *)o; if (p->X) { e = (*v)(((PyObject*)p->X), a); if (e) return e; } @@ -5597,8 +5614,8 @@ static int __pyx_tp_traverse_8_pruning_PruningPasser(PyObject *o, visitproc v, v return 0; } -static int __pyx_tp_clear_8_pruning_PruningPasser(PyObject *o) { - struct __pyx_obj_8_pruning_PruningPasser *p = (struct __pyx_obj_8_pruning_PruningPasser *)o; +static int __pyx_tp_clear_7sklearn_5earth_8_pruning_PruningPasser(PyObject *o) { + struct __pyx_obj_7sklearn_5earth_8_pruning_PruningPasser *p = (struct __pyx_obj_7sklearn_5earth_8_pruning_PruningPasser *)o; PyObject* tmp; tmp = ((PyObject*)p->X); p->X = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); @@ -5613,124 +5630,26 @@ static int __pyx_tp_clear_8_pruning_PruningPasser(PyObject *o) { p->weights = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->basis); - p->basis = ((struct __pyx_obj_6_basis_Basis *)Py_None); Py_INCREF(Py_None); + p->basis = ((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); tmp = ((PyObject*)p->record); - p->record = ((struct __pyx_obj_7_record_PruningPassRecord *)Py_None); Py_INCREF(Py_None); + p->record = ((struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); return 0; } -static PyMethodDef __pyx_methods_8_pruning_PruningPasser[] = { - {__Pyx_NAMESTR("run"), (PyCFunction)__pyx_pw_8_pruning_13PruningPasser_3run, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("trace"), (PyCFunction)__pyx_pw_8_pruning_13PruningPasser_5trace, METH_NOARGS, __Pyx_DOCSTR(0)}, +static PyMethodDef __pyx_methods_7sklearn_5earth_8_pruning_PruningPasser[] = { + {__Pyx_NAMESTR("run"), (PyCFunction)__pyx_pw_7sklearn_5earth_8_pruning_13PruningPasser_3run, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("trace"), (PyCFunction)__pyx_pw_7sklearn_5earth_8_pruning_13PruningPasser_5trace, METH_NOARGS, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; -static PyNumberMethods __pyx_tp_as_number_PruningPasser = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_long*/ - #else - 0, /*reserved*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if PY_VERSION_HEX >= 0x02050000 - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_PruningPasser = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_PruningPasser = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_PruningPasser = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -static PyTypeObject __pyx_type_8_pruning_PruningPasser = { +static PyTypeObject __pyx_type_7sklearn_5earth_8_pruning_PruningPasser = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_pruning.PruningPasser"), /*tp_name*/ - sizeof(struct __pyx_obj_8_pruning_PruningPasser), /*tp_basicsize*/ + __Pyx_NAMESTR("sklearn.earth._pruning.PruningPasser"), /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_5earth_8_pruning_PruningPasser), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_8_pruning_PruningPasser, /*tp_dealloc*/ + __pyx_tp_dealloc_7sklearn_5earth_8_pruning_PruningPasser, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -5740,24 +5659,24 @@ static PyTypeObject __pyx_type_8_pruning_PruningPasser = { 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number_PruningPasser, /*tp_as_number*/ - &__pyx_tp_as_sequence_PruningPasser, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_PruningPasser, /*tp_as_mapping*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_PruningPasser, /*tp_as_buffer*/ + 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ __Pyx_DOCSTR("Implements the generic pruning pass as described by Friedman, 1991."), /*tp_doc*/ - __pyx_tp_traverse_8_pruning_PruningPasser, /*tp_traverse*/ - __pyx_tp_clear_8_pruning_PruningPasser, /*tp_clear*/ + __pyx_tp_traverse_7sklearn_5earth_8_pruning_PruningPasser, /*tp_traverse*/ + __pyx_tp_clear_7sklearn_5earth_8_pruning_PruningPasser, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_8_pruning_PruningPasser, /*tp_methods*/ + __pyx_methods_7sklearn_5earth_8_pruning_PruningPasser, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -5765,9 +5684,9 @@ static PyTypeObject __pyx_type_8_pruning_PruningPasser = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pw_8_pruning_13PruningPasser_1__init__, /*tp_init*/ + __pyx_pw_7sklearn_5earth_8_pruning_13PruningPasser_1__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_8_pruning_PruningPasser, /*tp_new*/ + __pyx_tp_new_7sklearn_5earth_8_pruning_PruningPasser, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -5817,6 +5736,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, {&__pyx_n_s____pyx_getbuffer, __pyx_k____pyx_getbuffer, sizeof(__pyx_k____pyx_getbuffer), 0, 0, 1, 1}, {&__pyx_n_s____pyx_releasebuffer, __pyx_k____pyx_releasebuffer, sizeof(__pyx_k____pyx_releasebuffer), 0, 0, 1, 1}, + {&__pyx_n_s____pyx_vtable__, __pyx_k____pyx_vtable__, sizeof(__pyx_k____pyx_vtable__), 0, 0, 1, 1}, {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, {&__pyx_n_s__average, __pyx_k__average, sizeof(__pyx_k__average), 0, 0, 1, 1}, {&__pyx_n_s__basis, __pyx_k__basis, sizeof(__pyx_k__basis), 0, 0, 1, 1}, @@ -5856,7 +5776,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "_pruning.pyx":49 + /* "sklearn/earth/_pruning.pyx":49 * apply_weights_1d(weighted_y,weights) * self.basis.weighted_transform(X,B,weights) * beta, mse = np.linalg.lstsq(B[:,0:(basis_size)],weighted_y)[0:2] # <<<<<<<<<<<<<< @@ -5870,7 +5790,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_slice_2); __Pyx_GIVEREF(__pyx_k_slice_2); - /* "_pruning.pyx":53 + /* "sklearn/earth/_pruning.pyx":53 * mse /= self.m * else: * mse = (1.0/self.m)*np.sum((np.dot(B[:,0:basis_size],beta) - weighted_y)**2) # <<<<<<<<<<<<<< @@ -5881,7 +5801,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_slice_3); __Pyx_GIVEREF(__pyx_k_slice_3); - /* "_pruning.pyx":75 + /* "sklearn/earth/_pruning.pyx":75 * bf.prune() * self.basis.weighted_transform(X, B, weights) * beta, mse = np.linalg.lstsq(B[:,0:pruned_basis_size],weighted_y)[0:2] # <<<<<<<<<<<<<< @@ -5895,7 +5815,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_slice_5); __Pyx_GIVEREF(__pyx_k_slice_5); - /* "_pruning.pyx":79 + /* "sklearn/earth/_pruning.pyx":79 * mse /= self.m * else: * mse = (1/float(self.m))*np.sum((np.dot(B[:,0:pruned_basis_size],beta) - weighted_y)**2) # <<<<<<<<<<<<<< @@ -6043,8 +5963,8 @@ PyMODINIT_FUNC PyInit__pruning(void) #if PY_MAJOR_VERSION >= 3 { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (!PyDict_GetItemString(modules, "_pruning")) { - if (unlikely(PyDict_SetItemString(modules, "_pruning", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyDict_GetItemString(modules, "sklearn.earth._pruning")) { + if (unlikely(PyDict_SetItemString(modules, "sklearn.earth._pruning", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif @@ -6058,7 +5978,7 @@ PyMODINIT_FUNC PyInit__pruning(void) #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif - if (__pyx_module_is_main__pruning) { + if (__pyx_module_is_main_sklearn__earth___pruning) { if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; } /*--- Builtin init code ---*/ @@ -6069,13 +5989,13 @@ PyMODINIT_FUNC PyInit__pruning(void) /*--- Variable export code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ - __pyx_vtabptr_8_pruning_PruningPasser = &__pyx_vtable_8_pruning_PruningPasser; - __pyx_vtable_8_pruning_PruningPasser.run = (PyObject *(*)(struct __pyx_obj_8_pruning_PruningPasser *, int __pyx_skip_dispatch))__pyx_f_8_pruning_13PruningPasser_run; - __pyx_vtable_8_pruning_PruningPasser.trace = (struct __pyx_obj_7_record_PruningPassRecord *(*)(struct __pyx_obj_8_pruning_PruningPasser *, int __pyx_skip_dispatch))__pyx_f_8_pruning_13PruningPasser_trace; - if (PyType_Ready(&__pyx_type_8_pruning_PruningPasser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_8_pruning_PruningPasser.tp_dict, __pyx_vtabptr_8_pruning_PruningPasser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "PruningPasser", (PyObject *)&__pyx_type_8_pruning_PruningPasser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_8_pruning_PruningPasser = &__pyx_type_8_pruning_PruningPasser; + __pyx_vtabptr_7sklearn_5earth_8_pruning_PruningPasser = &__pyx_vtable_7sklearn_5earth_8_pruning_PruningPasser; + __pyx_vtable_7sklearn_5earth_8_pruning_PruningPasser.run = (PyObject *(*)(struct __pyx_obj_7sklearn_5earth_8_pruning_PruningPasser *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run; + __pyx_vtable_7sklearn_5earth_8_pruning_PruningPasser.trace = (struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *(*)(struct __pyx_obj_7sklearn_5earth_8_pruning_PruningPasser *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_trace; + if (PyType_Ready(&__pyx_type_7sklearn_5earth_8_pruning_PruningPasser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_5earth_8_pruning_PruningPasser.tp_dict, __pyx_vtabptr_7sklearn_5earth_8_pruning_PruningPasser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "PruningPasser", (PyObject *)&__pyx_type_7sklearn_5earth_8_pruning_PruningPasser) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_8_pruning_PruningPasser = &__pyx_type_7sklearn_5earth_8_pruning_PruningPasser; /*--- Type import code ---*/ __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", #if CYTHON_COMPILING_IN_PYPY @@ -6089,41 +6009,41 @@ PyMODINIT_FUNC PyInit__pruning(void) __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_6_basis_BasisFunction = __Pyx_ImportType("_basis", "BasisFunction", sizeof(struct __pyx_obj_6_basis_BasisFunction), 1); if (unlikely(!__pyx_ptype_6_basis_BasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_vtabptr_6_basis_BasisFunction = (struct __pyx_vtabstruct_6_basis_BasisFunction*)__Pyx_GetVtable(__pyx_ptype_6_basis_BasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_6_basis_BasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_6_basis_ConstantBasisFunction = __Pyx_ImportType("_basis", "ConstantBasisFunction", sizeof(struct __pyx_obj_6_basis_ConstantBasisFunction), 1); if (unlikely(!__pyx_ptype_6_basis_ConstantBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_vtabptr_6_basis_ConstantBasisFunction = (struct __pyx_vtabstruct_6_basis_ConstantBasisFunction*)__Pyx_GetVtable(__pyx_ptype_6_basis_ConstantBasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_6_basis_ConstantBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_6_basis_HingeBasisFunction = __Pyx_ImportType("_basis", "HingeBasisFunction", sizeof(struct __pyx_obj_6_basis_HingeBasisFunction), 1); if (unlikely(!__pyx_ptype_6_basis_HingeBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_vtabptr_6_basis_HingeBasisFunction = (struct __pyx_vtabstruct_6_basis_HingeBasisFunction*)__Pyx_GetVtable(__pyx_ptype_6_basis_HingeBasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_6_basis_HingeBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_6_basis_LinearBasisFunction = __Pyx_ImportType("_basis", "LinearBasisFunction", sizeof(struct __pyx_obj_6_basis_LinearBasisFunction), 1); if (unlikely(!__pyx_ptype_6_basis_LinearBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_vtabptr_6_basis_LinearBasisFunction = (struct __pyx_vtabstruct_6_basis_LinearBasisFunction*)__Pyx_GetVtable(__pyx_ptype_6_basis_LinearBasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_6_basis_LinearBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_6_basis_Basis = __Pyx_ImportType("_basis", "Basis", sizeof(struct __pyx_obj_6_basis_Basis), 1); if (unlikely(!__pyx_ptype_6_basis_Basis)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_vtabptr_6_basis_Basis = (struct __pyx_vtabstruct_6_basis_Basis*)__Pyx_GetVtable(__pyx_ptype_6_basis_Basis->tp_dict); if (unlikely(!__pyx_vtabptr_6_basis_Basis)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7_record_Record = __Pyx_ImportType("_record", "Record", sizeof(struct __pyx_obj_7_record_Record), 1); if (unlikely(!__pyx_ptype_7_record_Record)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_vtabptr_7_record_Record = (struct __pyx_vtabstruct_7_record_Record*)__Pyx_GetVtable(__pyx_ptype_7_record_Record->tp_dict); if (unlikely(!__pyx_vtabptr_7_record_Record)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7_record_PruningPassRecord = __Pyx_ImportType("_record", "PruningPassRecord", sizeof(struct __pyx_obj_7_record_PruningPassRecord), 1); if (unlikely(!__pyx_ptype_7_record_PruningPassRecord)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_vtabptr_7_record_PruningPassRecord = (struct __pyx_vtabstruct_7_record_PruningPassRecord*)__Pyx_GetVtable(__pyx_ptype_7_record_PruningPassRecord->tp_dict); if (unlikely(!__pyx_vtabptr_7_record_PruningPassRecord)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7_record_ForwardPassRecord = __Pyx_ImportType("_record", "ForwardPassRecord", sizeof(struct __pyx_obj_7_record_ForwardPassRecord), 1); if (unlikely(!__pyx_ptype_7_record_ForwardPassRecord)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_vtabptr_7_record_ForwardPassRecord = (struct __pyx_vtabstruct_7_record_ForwardPassRecord*)__Pyx_GetVtable(__pyx_ptype_7_record_ForwardPassRecord->tp_dict); if (unlikely(!__pyx_vtabptr_7_record_ForwardPassRecord)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7_record_Iteration = __Pyx_ImportType("_record", "Iteration", sizeof(struct __pyx_obj_7_record_Iteration), 1); if (unlikely(!__pyx_ptype_7_record_Iteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_vtabptr_7_record_Iteration = (struct __pyx_vtabstruct_7_record_Iteration*)__Pyx_GetVtable(__pyx_ptype_7_record_Iteration->tp_dict); if (unlikely(!__pyx_vtabptr_7_record_Iteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7_record_PruningPassIteration = __Pyx_ImportType("_record", "PruningPassIteration", sizeof(struct __pyx_obj_7_record_PruningPassIteration), 1); if (unlikely(!__pyx_ptype_7_record_PruningPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_vtabptr_7_record_PruningPassIteration = (struct __pyx_vtabstruct_7_record_PruningPassIteration*)__Pyx_GetVtable(__pyx_ptype_7_record_PruningPassIteration->tp_dict); if (unlikely(!__pyx_vtabptr_7_record_PruningPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7_record_FirstPruningPassIteration = __Pyx_ImportType("_record", "FirstPruningPassIteration", sizeof(struct __pyx_obj_7_record_FirstPruningPassIteration), 1); if (unlikely(!__pyx_ptype_7_record_FirstPruningPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_vtabptr_7_record_FirstPruningPassIteration = (struct __pyx_vtabstruct_7_record_FirstPruningPassIteration*)__Pyx_GetVtable(__pyx_ptype_7_record_FirstPruningPassIteration->tp_dict); if (unlikely(!__pyx_vtabptr_7_record_FirstPruningPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7_record_ForwardPassIteration = __Pyx_ImportType("_record", "ForwardPassIteration", sizeof(struct __pyx_obj_7_record_ForwardPassIteration), 1); if (unlikely(!__pyx_ptype_7_record_ForwardPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_vtabptr_7_record_ForwardPassIteration = (struct __pyx_vtabstruct_7_record_ForwardPassIteration*)__Pyx_GetVtable(__pyx_ptype_7_record_ForwardPassIteration->tp_dict); if (unlikely(!__pyx_vtabptr_7_record_ForwardPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7_record_FirstForwardPassIteration = __Pyx_ImportType("_record", "FirstForwardPassIteration", sizeof(struct __pyx_obj_7_record_FirstForwardPassIteration), 1); if (unlikely(!__pyx_ptype_7_record_FirstForwardPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_vtabptr_7_record_FirstForwardPassIteration = (struct __pyx_vtabstruct_7_record_FirstForwardPassIteration*)__Pyx_GetVtable(__pyx_ptype_7_record_FirstForwardPassIteration->tp_dict); if (unlikely(!__pyx_vtabptr_7_record_FirstForwardPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction = __Pyx_ImportType("sklearn.earth._basis", "BasisFunction", sizeof(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_6_basis_BasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5earth_6_basis_BasisFunction = (struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_6_basis_BasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_6_basis_BasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_6_basis_ConstantBasisFunction = __Pyx_ImportType("sklearn.earth._basis", "ConstantBasisFunction", sizeof(struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_6_basis_ConstantBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5earth_6_basis_ConstantBasisFunction = (struct __pyx_vtabstruct_7sklearn_5earth_6_basis_ConstantBasisFunction*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_6_basis_ConstantBasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_6_basis_ConstantBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_6_basis_HingeBasisFunction = __Pyx_ImportType("sklearn.earth._basis", "HingeBasisFunction", sizeof(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_6_basis_HingeBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5earth_6_basis_HingeBasisFunction = (struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_6_basis_HingeBasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_6_basis_HingeBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_6_basis_LinearBasisFunction = __Pyx_ImportType("sklearn.earth._basis", "LinearBasisFunction", sizeof(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_6_basis_LinearBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5earth_6_basis_LinearBasisFunction = (struct __pyx_vtabstruct_7sklearn_5earth_6_basis_LinearBasisFunction*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_6_basis_LinearBasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_6_basis_LinearBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_6_basis_Basis = __Pyx_ImportType("sklearn.earth._basis", "Basis", sizeof(struct __pyx_obj_7sklearn_5earth_6_basis_Basis), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_6_basis_Basis)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5earth_6_basis_Basis = (struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_6_basis_Basis->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_6_basis_Basis)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_7_record_Record = __Pyx_ImportType("sklearn.earth._record", "Record", sizeof(struct __pyx_obj_7sklearn_5earth_7_record_Record), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_7_record_Record)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5earth_7_record_Record = (struct __pyx_vtabstruct_7sklearn_5earth_7_record_Record*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_7_record_Record->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_7_record_Record)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_7_record_PruningPassRecord = __Pyx_ImportType("sklearn.earth._record", "PruningPassRecord", sizeof(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_7_record_PruningPassRecord)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5earth_7_record_PruningPassRecord = (struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_7_record_PruningPassRecord->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_7_record_PruningPassRecord)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_7_record_ForwardPassRecord = __Pyx_ImportType("sklearn.earth._record", "ForwardPassRecord", sizeof(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_7_record_ForwardPassRecord)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5earth_7_record_ForwardPassRecord = (struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_7_record_ForwardPassRecord->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_7_record_ForwardPassRecord)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_7_record_Iteration = __Pyx_ImportType("sklearn.earth._record", "Iteration", sizeof(struct __pyx_obj_7sklearn_5earth_7_record_Iteration), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_7_record_Iteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5earth_7_record_Iteration = (struct __pyx_vtabstruct_7sklearn_5earth_7_record_Iteration*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_7_record_Iteration->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_7_record_Iteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_7_record_PruningPassIteration = __Pyx_ImportType("sklearn.earth._record", "PruningPassIteration", sizeof(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassIteration), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_7_record_PruningPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5earth_7_record_PruningPassIteration = (struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassIteration*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_7_record_PruningPassIteration->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_7_record_PruningPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_7_record_FirstPruningPassIteration = __Pyx_ImportType("sklearn.earth._record", "FirstPruningPassIteration", sizeof(struct __pyx_obj_7sklearn_5earth_7_record_FirstPruningPassIteration), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_7_record_FirstPruningPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5earth_7_record_FirstPruningPassIteration = (struct __pyx_vtabstruct_7sklearn_5earth_7_record_FirstPruningPassIteration*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_7_record_FirstPruningPassIteration->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_7_record_FirstPruningPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_7_record_ForwardPassIteration = __Pyx_ImportType("sklearn.earth._record", "ForwardPassIteration", sizeof(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_7_record_ForwardPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5earth_7_record_ForwardPassIteration = (struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassIteration*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_7_record_ForwardPassIteration->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_7_record_ForwardPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_7_record_FirstForwardPassIteration = __Pyx_ImportType("sklearn.earth._record", "FirstForwardPassIteration", sizeof(struct __pyx_obj_7sklearn_5earth_7_record_FirstForwardPassIteration), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_7_record_FirstForwardPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5earth_7_record_FirstForwardPassIteration = (struct __pyx_vtabstruct_7sklearn_5earth_7_record_FirstForwardPassIteration*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_7_record_FirstForwardPassIteration->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_7_record_FirstForwardPassIteration)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Variable import code ---*/ /*--- Function import code ---*/ - __pyx_t_1 = __Pyx_ImportModule("_util"); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_ImportFunction(__pyx_t_1, "apply_weights_1d", (void (**)(void))&__pyx_f_5_util_apply_weights_1d, "PyObject *(PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_ImportFunction(__pyx_t_1, "gcv", (void (**)(void))&__pyx_f_5_util_gcv, "__pyx_t_5_util_FLOAT_t (__pyx_t_5_util_FLOAT_t, __pyx_t_5_util_INDEX_t, __pyx_t_5_util_INDEX_t, __pyx_t_5_util_FLOAT_t, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_ImportModule("sklearn.earth._util"); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_t_1, "apply_weights_1d", (void (**)(void))&__pyx_f_7sklearn_5earth_5_util_apply_weights_1d, "PyObject *(PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_t_1, "gcv", (void (**)(void))&__pyx_f_7sklearn_5earth_5_util_gcv, "__pyx_t_7sklearn_5earth_5_util_FLOAT_t (__pyx_t_7sklearn_5earth_5_util_FLOAT_t, __pyx_t_7sklearn_5earth_5_util_INDEX_t, __pyx_t_7sklearn_5earth_5_util_INDEX_t, __pyx_t_7sklearn_5earth_5_util_FLOAT_t, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_t_1); __pyx_t_1 = 0; /*--- Execution code ---*/ - /* "_pruning.pyx":9 + /* "sklearn/earth/_pruning.pyx":9 * from _record cimport PruningPassIteration * from _util cimport gcv, apply_weights_1d * import numpy as np # <<<<<<<<<<<<<< @@ -6135,7 +6055,7 @@ PyMODINIT_FUNC PyInit__pruning(void) if (PyDict_SetItem(__pyx_d, __pyx_n_s__np, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "_pruning.pyx":1 + /* "sklearn/earth/_pruning.pyx":1 * # distutils: language = c # <<<<<<<<<<<<<< * # cython: cdivision = True * # cython: boundscheck = False @@ -6157,10 +6077,10 @@ PyMODINIT_FUNC PyInit__pruning(void) __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); if (__pyx_m) { - __Pyx_AddTraceback("init _pruning", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("init sklearn.earth._pruning", __pyx_clineno, __pyx_lineno, __pyx_filename); Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init _pruning"); + PyErr_SetString(PyExc_ImportError, "init sklearn.earth._pruning"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -7350,6 +7270,42 @@ static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } +static int __Pyx_SetVtable(PyObject *dict, void *vtable) { +#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) + PyObject *ob = PyCapsule_New(vtable, 0, 0); +#else + PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); +#endif + if (!ob) + goto bad; + if (PyDict_SetItem(dict, __pyx_n_s____pyx_vtable__, ob) < 0) + goto bad; + Py_DECREF(ob); + return 0; +bad: + Py_XDECREF(ob); + return -1; +} + +static void* __Pyx_GetVtable(PyObject *dict) { + void* ptr; + PyObject *ob = PyObject_GetItem(dict, __pyx_n_s____pyx_vtable__); + if (!ob) + goto bad; +#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) + ptr = PyCapsule_GetPointer(ob, 0); +#else + ptr = PyCObject_AsVoidPtr(ob); +#endif + if (!ptr && !PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); + Py_DECREF(ob); + return ptr; +bad: + Py_XDECREF(ob); + return NULL; +} + #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { #if PY_VERSION_HEX >= 0x02060000 @@ -8394,23 +8350,6 @@ static int __Pyx_check_binary_version(void) { return 0; } -static int __Pyx_SetVtable(PyObject *dict, void *vtable) { -#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) - PyObject *ob = PyCapsule_New(vtable, 0, 0); -#else - PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); -#endif - if (!ob) - goto bad; - if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0) - goto bad; - Py_DECREF(ob); - return 0; -bad: - Py_XDECREF(ob); - return -1; -} - #ifndef __PYX_HAVE_RT_ImportModule #define __PYX_HAVE_RT_ImportModule static PyObject *__Pyx_ImportModule(const char *name) { @@ -8496,25 +8435,6 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class } #endif -static void* __Pyx_GetVtable(PyObject *dict) { - void* ptr; - PyObject *ob = PyMapping_GetItemString(dict, (char *)"__pyx_vtable__"); - if (!ob) - goto bad; -#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) - ptr = PyCapsule_GetPointer(ob, 0); -#else - ptr = PyCObject_AsVoidPtr(ob); -#endif - if (!ptr && !PyErr_Occurred()) - PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); - Py_DECREF(ob); - return ptr; -bad: - Py_XDECREF(ob); - return NULL; -} - #ifndef __PYX_HAVE_RT_ImportFunction #define __PYX_HAVE_RT_ImportFunction static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { diff --git a/sklearn/earth/_record.c b/sklearn/earth/_record.c index f7c06c7420be7..7a2e437456dc6 100644 --- a/sklearn/earth/_record.c +++ b/sklearn/earth/_record.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19 on Sat Jul 20 23:46:45 2013 */ +/* Generated by Cython 0.19.1 on Thu Jul 25 22:12:25 2013 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS @@ -261,6 +261,17 @@ #define CYTHON_INLINE #endif #endif +#ifndef CYTHON_RESTRICT + #if defined(__GNUC__) + #define CYTHON_RESTRICT __restrict__ + #elif defined(_MSC_VER) + #define CYTHON_RESTRICT __restrict + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_RESTRICT restrict + #else + #define CYTHON_RESTRICT + #endif +#endif #ifdef NAN #define __PYX_NAN() ((float) NAN) #else @@ -295,8 +306,8 @@ static CYTHON_INLINE float __PYX_NAN() { #define _USE_MATH_DEFINES #endif #include -#define __PYX_HAVE___record -#define __PYX_HAVE_API___record +#define __PYX_HAVE__sklearn__earth___record +#define __PYX_HAVE_API__sklearn__earth___record #include "string.h" #include "stdio.h" #include "stdlib.h" @@ -696,7 +707,7 @@ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; * ctypedef cnp.intp_t INT_t * ctypedef cnp.ulong_t INDEX_t */ -typedef __pyx_t_5numpy_float64_t __pyx_t_6_basis_FLOAT_t; +typedef __pyx_t_5numpy_float64_t __pyx_t_7sklearn_5earth_6_basis_FLOAT_t; /* "_basis.pxd":3 * cimport numpy as cnp @@ -705,7 +716,7 @@ typedef __pyx_t_5numpy_float64_t __pyx_t_6_basis_FLOAT_t; * ctypedef cnp.ulong_t INDEX_t * ctypedef cnp.uint8_t BOOL_t */ -typedef __pyx_t_5numpy_intp_t __pyx_t_6_basis_INT_t; +typedef __pyx_t_5numpy_intp_t __pyx_t_7sklearn_5earth_6_basis_INT_t; /* "_basis.pxd":4 * ctypedef cnp.float64_t FLOAT_t @@ -714,7 +725,7 @@ typedef __pyx_t_5numpy_intp_t __pyx_t_6_basis_INT_t; * ctypedef cnp.uint8_t BOOL_t * */ -typedef __pyx_t_5numpy_ulong_t __pyx_t_6_basis_INDEX_t; +typedef __pyx_t_5numpy_ulong_t __pyx_t_7sklearn_5earth_6_basis_INDEX_t; /* "_basis.pxd":5 * ctypedef cnp.intp_t INT_t @@ -723,7 +734,7 @@ typedef __pyx_t_5numpy_ulong_t __pyx_t_6_basis_INDEX_t; * * cdef class BasisFunction: */ -typedef __pyx_t_5numpy_uint8_t __pyx_t_6_basis_BOOL_t; +typedef __pyx_t_5numpy_uint8_t __pyx_t_7sklearn_5earth_6_basis_BOOL_t; /* "_util.pxd":2 * cimport numpy as cnp @@ -731,7 +742,7 @@ typedef __pyx_t_5numpy_uint8_t __pyx_t_6_basis_BOOL_t; * ctypedef cnp.intp_t INT_t * ctypedef cnp.ulong_t INDEX_t */ -typedef __pyx_t_5numpy_float64_t __pyx_t_5_util_FLOAT_t; +typedef __pyx_t_5numpy_float64_t __pyx_t_7sklearn_5earth_5_util_FLOAT_t; /* "_util.pxd":3 * cimport numpy as cnp @@ -740,7 +751,7 @@ typedef __pyx_t_5numpy_float64_t __pyx_t_5_util_FLOAT_t; * ctypedef cnp.ulong_t INDEX_t * ctypedef cnp.uint8_t BOOL_t */ -typedef __pyx_t_5numpy_intp_t __pyx_t_5_util_INT_t; +typedef __pyx_t_5numpy_intp_t __pyx_t_7sklearn_5earth_5_util_INT_t; /* "_util.pxd":4 * ctypedef cnp.float64_t FLOAT_t @@ -749,7 +760,7 @@ typedef __pyx_t_5numpy_intp_t __pyx_t_5_util_INT_t; * ctypedef cnp.uint8_t BOOL_t * */ -typedef __pyx_t_5numpy_ulong_t __pyx_t_5_util_INDEX_t; +typedef __pyx_t_5numpy_ulong_t __pyx_t_7sklearn_5earth_5_util_INDEX_t; /* "_util.pxd":5 * ctypedef cnp.intp_t INT_t @@ -758,42 +769,42 @@ typedef __pyx_t_5numpy_ulong_t __pyx_t_5_util_INDEX_t; * * cdef FLOAT_t log2(FLOAT_t x) */ -typedef __pyx_t_5numpy_uint8_t __pyx_t_5_util_BOOL_t; +typedef __pyx_t_5numpy_uint8_t __pyx_t_7sklearn_5earth_5_util_BOOL_t; -/* "_record.pxd":2 +/* "sklearn/earth/_record.pxd":2 * cimport numpy as cnp * ctypedef cnp.float64_t FLOAT_t # <<<<<<<<<<<<<< * ctypedef cnp.intp_t INT_t * ctypedef cnp.ulong_t INDEX_t */ -typedef __pyx_t_5numpy_float64_t __pyx_t_7_record_FLOAT_t; +typedef __pyx_t_5numpy_float64_t __pyx_t_7sklearn_5earth_7_record_FLOAT_t; -/* "_record.pxd":3 +/* "sklearn/earth/_record.pxd":3 * cimport numpy as cnp * ctypedef cnp.float64_t FLOAT_t * ctypedef cnp.intp_t INT_t # <<<<<<<<<<<<<< * ctypedef cnp.ulong_t INDEX_t * ctypedef cnp.uint8_t BOOL_t */ -typedef __pyx_t_5numpy_intp_t __pyx_t_7_record_INT_t; +typedef __pyx_t_5numpy_intp_t __pyx_t_7sklearn_5earth_7_record_INT_t; -/* "_record.pxd":4 +/* "sklearn/earth/_record.pxd":4 * ctypedef cnp.float64_t FLOAT_t * ctypedef cnp.intp_t INT_t * ctypedef cnp.ulong_t INDEX_t # <<<<<<<<<<<<<< * ctypedef cnp.uint8_t BOOL_t * from _basis cimport Basis */ -typedef __pyx_t_5numpy_ulong_t __pyx_t_7_record_INDEX_t; +typedef __pyx_t_5numpy_ulong_t __pyx_t_7sklearn_5earth_7_record_INDEX_t; -/* "_record.pxd":5 +/* "sklearn/earth/_record.pxd":5 * ctypedef cnp.intp_t INT_t * ctypedef cnp.ulong_t INDEX_t * ctypedef cnp.uint8_t BOOL_t # <<<<<<<<<<<<<< * from _basis cimport Basis * */ -typedef __pyx_t_5numpy_uint8_t __pyx_t_7_record_BOOL_t; +typedef __pyx_t_5numpy_uint8_t __pyx_t_7sklearn_5earth_7_record_BOOL_t; #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; @@ -816,19 +827,19 @@ typedef __pyx_t_5numpy_uint8_t __pyx_t_7_record_BOOL_t; /*--- Type declarations ---*/ -struct __pyx_obj_7_record_Record; -struct __pyx_obj_7_record_PruningPassRecord; -struct __pyx_obj_7_record_Iteration; -struct __pyx_obj_7_record_ForwardPassIteration; -struct __pyx_obj_7_record_FirstForwardPassIteration; -struct __pyx_obj_6_basis_Basis; -struct __pyx_obj_6_basis_BasisFunction; -struct __pyx_obj_6_basis_LinearBasisFunction; -struct __pyx_obj_7_record_PruningPassIteration; -struct __pyx_obj_7_record_FirstPruningPassIteration; -struct __pyx_obj_6_basis_HingeBasisFunction; -struct __pyx_obj_7_record_ForwardPassRecord; -struct __pyx_obj_6_basis_ConstantBasisFunction; +struct __pyx_obj_7sklearn_5earth_6_basis_Basis; +struct __pyx_obj_7sklearn_5earth_7_record_Iteration; +struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration; +struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction; +struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction; +struct __pyx_obj_7sklearn_5earth_7_record_Record; +struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord; +struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord; +struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction; +struct __pyx_obj_7sklearn_5earth_7_record_PruningPassIteration; +struct __pyx_obj_7sklearn_5earth_7_record_FirstPruningPassIteration; +struct __pyx_obj_7sklearn_5earth_7_record_FirstForwardPassIteration; +struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction; /* "numpy.pxd":762 * ctypedef npy_longdouble longdouble_t @@ -865,10 +876,10 @@ typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; * cdef inline object PyArray_MultiIterNew1(a): */ typedef npy_cdouble __pyx_t_5numpy_complex_t; -struct __pyx_opt_args_6_basis_13BasisFunction_apply; -struct __pyx_opt_args_6_basis_21ConstantBasisFunction_apply; -struct __pyx_opt_args_6_basis_18HingeBasisFunction_apply; -struct __pyx_opt_args_6_basis_19LinearBasisFunction_apply; +struct __pyx_opt_args_7sklearn_5earth_6_basis_13BasisFunction_apply; +struct __pyx_opt_args_7sklearn_5earth_6_basis_21ConstantBasisFunction_apply; +struct __pyx_opt_args_7sklearn_5earth_6_basis_18HingeBasisFunction_apply; +struct __pyx_opt_args_7sklearn_5earth_6_basis_19LinearBasisFunction_apply; /* "_basis.pxd":45 * cpdef INDEX_t degree(BasisFunction self) @@ -877,7 +888,7 @@ struct __pyx_opt_args_6_basis_19LinearBasisFunction_apply; * * cpdef cnp.ndarray[INT_t, ndim=1] valid_knots(BasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] values, cnp.ndarray[FLOAT_t,ndim=1] variable, int variable_idx, INDEX_t check_every, int endspan, int minspan, FLOAT_t minspan_alpha, INDEX_t n, cnp.ndarray[INT_t,ndim=1] workspace) */ -struct __pyx_opt_args_6_basis_13BasisFunction_apply { +struct __pyx_opt_args_7sklearn_5earth_6_basis_13BasisFunction_apply { int __pyx_n; int recurse; }; @@ -889,7 +900,7 @@ struct __pyx_opt_args_6_basis_13BasisFunction_apply { * * */ -struct __pyx_opt_args_6_basis_21ConstantBasisFunction_apply { +struct __pyx_opt_args_7sklearn_5earth_6_basis_21ConstantBasisFunction_apply { int __pyx_n; int recurse; }; @@ -901,7 +912,7 @@ struct __pyx_opt_args_6_basis_21ConstantBasisFunction_apply { * * cdef class LinearBasisFunction(BasisFunction): */ -struct __pyx_opt_args_6_basis_18HingeBasisFunction_apply { +struct __pyx_opt_args_7sklearn_5earth_6_basis_18HingeBasisFunction_apply { int __pyx_n; int recurse; }; @@ -913,115 +924,130 @@ struct __pyx_opt_args_6_basis_18HingeBasisFunction_apply { * * */ -struct __pyx_opt_args_6_basis_19LinearBasisFunction_apply { +struct __pyx_opt_args_7sklearn_5earth_6_basis_19LinearBasisFunction_apply { int __pyx_n; int recurse; }; -/* "_record.pxd":8 - * from _basis cimport Basis - * - * cdef class Record: # <<<<<<<<<<<<<< - * cdef list iterations - * cdef int num_samples - */ -struct __pyx_obj_7_record_Record { - PyObject_HEAD - struct __pyx_vtabstruct_7_record_Record *__pyx_vtab; - PyObject *iterations; - int num_samples; - int num_variables; - __pyx_t_7_record_FLOAT_t penalty; - __pyx_t_7_record_FLOAT_t sst; -}; - - -/* "_record.pxd":25 - * cpdef FLOAT_t grsq(Record self, INDEX_t iteration) +/* "_basis.pxd":102 * - * cdef class PruningPassRecord(Record): # <<<<<<<<<<<<<< - * cdef INDEX_t selected * + * cdef class Basis: # <<<<<<<<<<<<<< + * '''A wrapper that provides functionality related to a set of BasisFunctions with a + * common ConstantBasisFunction ancestor. Retains the order in which BasisFunctions are */ -struct __pyx_obj_7_record_PruningPassRecord { - struct __pyx_obj_7_record_Record __pyx_base; - __pyx_t_7_record_INDEX_t selected; +struct __pyx_obj_7sklearn_5earth_6_basis_Basis { + PyObject_HEAD + struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *__pyx_vtab; + PyObject *order; }; -/* "_record.pxd":39 +/* "sklearn/earth/_record.pxd":41 * cpdef set_stopping_condition(ForwardPassRecord self, int stopping_condition) * * cdef class Iteration: # <<<<<<<<<<<<<< * cdef FLOAT_t mse * cdef INDEX_t size */ -struct __pyx_obj_7_record_Iteration { +struct __pyx_obj_7sklearn_5earth_7_record_Iteration { PyObject_HEAD - struct __pyx_vtabstruct_7_record_Iteration *__pyx_vtab; - __pyx_t_7_record_FLOAT_t mse; - __pyx_t_7_record_INDEX_t size; + struct __pyx_vtabstruct_7sklearn_5earth_7_record_Iteration *__pyx_vtab; + __pyx_t_7sklearn_5earth_7_record_FLOAT_t mse; + __pyx_t_7sklearn_5earth_7_record_INDEX_t size; }; -/* "_record.pxd":55 +/* "sklearn/earth/_record.pxd":57 * pass * * cdef class ForwardPassIteration(Iteration): # <<<<<<<<<<<<<< * cdef INDEX_t parent * cdef INDEX_t variable */ -struct __pyx_obj_7_record_ForwardPassIteration { - struct __pyx_obj_7_record_Iteration __pyx_base; - __pyx_t_7_record_INDEX_t parent; - __pyx_t_7_record_INDEX_t variable; - __pyx_t_7_record_FLOAT_t knot; +struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration { + struct __pyx_obj_7sklearn_5earth_7_record_Iteration __pyx_base; + __pyx_t_7sklearn_5earth_7_record_INDEX_t parent; + __pyx_t_7sklearn_5earth_7_record_INDEX_t variable; + __pyx_t_7sklearn_5earth_7_record_FLOAT_t knot; int code; int no_candidates; }; -/* "_record.pxd":66 - * cpdef no_further_candidates(ForwardPassIteration self) +/* "_basis.pxd":7 + * ctypedef cnp.uint8_t BOOL_t + * + * cdef class BasisFunction: # <<<<<<<<<<<<<< + * '''Abstract. Subclasses must implement the apply, translate, scale, and __init__ methods.''' * - * cdef class FirstForwardPassIteration(ForwardPassIteration): # <<<<<<<<<<<<<< - * cpdef INDEX_t get_size(FirstForwardPassIteration self) */ -struct __pyx_obj_7_record_FirstForwardPassIteration { - struct __pyx_obj_7_record_ForwardPassIteration __pyx_base; +struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction { + PyObject_HEAD + struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *__pyx_vtab; + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *parent; + PyObject *child_map; + PyObject *children; + int pruned; + int prunable; + int splittable; }; -/* "_basis.pxd":102 +/* "_basis.pxd":50 * * - * cdef class Basis: # <<<<<<<<<<<<<< - * '''A wrapper that provides functionality related to a set of BasisFunctions with a - * common ConstantBasisFunction ancestor. Retains the order in which BasisFunctions are + * cdef class ConstantBasisFunction(BasisFunction): # <<<<<<<<<<<<<< + * + * cpdef INDEX_t degree(ConstantBasisFunction self) + */ +struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction { + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction __pyx_base; +}; + + +/* "sklearn/earth/_record.pxd":8 + * from _basis cimport Basis + * + * cdef class Record: # <<<<<<<<<<<<<< + * cdef list iterations + * cdef int num_samples */ -struct __pyx_obj_6_basis_Basis { +struct __pyx_obj_7sklearn_5earth_7_record_Record { PyObject_HEAD - struct __pyx_vtabstruct_6_basis_Basis *__pyx_vtab; - PyObject *order; + struct __pyx_vtabstruct_7sklearn_5earth_7_record_Record *__pyx_vtab; + PyObject *iterations; + int num_samples; + int num_variables; + __pyx_t_7sklearn_5earth_7_record_FLOAT_t penalty; + __pyx_t_7sklearn_5earth_7_record_FLOAT_t sst; }; -/* "_basis.pxd":7 - * ctypedef cnp.uint8_t BOOL_t +/* "sklearn/earth/_record.pxd":25 + * cpdef FLOAT_t grsq(Record self, INDEX_t iteration) * - * cdef class BasisFunction: # <<<<<<<<<<<<<< - * '''Abstract. Subclasses must implement the apply, translate, scale, and __init__ methods.''' + * cdef class PruningPassRecord(Record): # <<<<<<<<<<<<<< + * cdef INDEX_t selected * */ -struct __pyx_obj_6_basis_BasisFunction { - PyObject_HEAD - struct __pyx_vtabstruct_6_basis_BasisFunction *__pyx_vtab; - struct __pyx_obj_6_basis_BasisFunction *parent; - PyObject *child_map; - PyObject *children; - int pruned; - int prunable; - int splittable; +struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord { + struct __pyx_obj_7sklearn_5earth_7_record_Record __pyx_base; + __pyx_t_7sklearn_5earth_7_record_INDEX_t selected; +}; + + +/* "sklearn/earth/_record.pxd":34 + * cpdef roll_back(PruningPassRecord self, Basis basis) + * + * cdef class ForwardPassRecord(Record): # <<<<<<<<<<<<<< + * cdef int stopping_condition + * + */ +struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord { + struct __pyx_obj_7sklearn_5earth_7_record_Record __pyx_base; + int stopping_condition; + PyObject *xlabels; }; @@ -1032,35 +1058,46 @@ struct __pyx_obj_6_basis_BasisFunction { * cdef INDEX_t variable * cdef str label */ -struct __pyx_obj_6_basis_LinearBasisFunction { - struct __pyx_obj_6_basis_BasisFunction __pyx_base; - __pyx_t_6_basis_INDEX_t variable; +struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction { + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction __pyx_base; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t variable; PyObject *label; }; -/* "_record.pxd":47 +/* "sklearn/earth/_record.pxd":49 * cpdef INDEX_t get_size(Iteration self) * * cdef class PruningPassIteration(Iteration): # <<<<<<<<<<<<<< * cdef INDEX_t pruned * */ -struct __pyx_obj_7_record_PruningPassIteration { - struct __pyx_obj_7_record_Iteration __pyx_base; - __pyx_t_7_record_INDEX_t pruned; +struct __pyx_obj_7sklearn_5earth_7_record_PruningPassIteration { + struct __pyx_obj_7sklearn_5earth_7_record_Iteration __pyx_base; + __pyx_t_7sklearn_5earth_7_record_INDEX_t pruned; }; -/* "_record.pxd":52 +/* "sklearn/earth/_record.pxd":54 * cpdef INDEX_t get_pruned(PruningPassIteration self) * * cdef class FirstPruningPassIteration(PruningPassIteration): # <<<<<<<<<<<<<< * pass * */ -struct __pyx_obj_7_record_FirstPruningPassIteration { - struct __pyx_obj_7_record_PruningPassIteration __pyx_base; +struct __pyx_obj_7sklearn_5earth_7_record_FirstPruningPassIteration { + struct __pyx_obj_7sklearn_5earth_7_record_PruningPassIteration __pyx_base; +}; + + +/* "sklearn/earth/_record.pxd":68 + * cpdef no_further_candidates(ForwardPassIteration self) + * + * cdef class FirstForwardPassIteration(ForwardPassIteration): # <<<<<<<<<<<<<< + * cpdef INDEX_t get_size(FirstForwardPassIteration self) + */ +struct __pyx_obj_7sklearn_5earth_7_record_FirstForwardPassIteration { + struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration __pyx_base; }; @@ -1071,61 +1108,45 @@ struct __pyx_obj_7_record_FirstPruningPassIteration { * cdef FLOAT_t knot * cdef INDEX_t knot_idx */ -struct __pyx_obj_6_basis_HingeBasisFunction { - struct __pyx_obj_6_basis_BasisFunction __pyx_base; - __pyx_t_6_basis_FLOAT_t knot; - __pyx_t_6_basis_INDEX_t knot_idx; - __pyx_t_6_basis_INDEX_t variable; +struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction { + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction __pyx_base; + __pyx_t_7sklearn_5earth_6_basis_FLOAT_t knot; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t knot_idx; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t variable; int reverse; PyObject *label; }; -/* "_record.pxd":34 - * cpdef roll_back(PruningPassRecord self, Basis basis) - * - * cdef class ForwardPassRecord(Record): # <<<<<<<<<<<<<< - * cdef int stopping_condition - * - */ -struct __pyx_obj_7_record_ForwardPassRecord { - struct __pyx_obj_7_record_Record __pyx_base; - int stopping_condition; -}; - -/* "_basis.pxd":50 - * +/* "sklearn/earth/_record.pyx":144 + * return result * - * cdef class ConstantBasisFunction(BasisFunction): # <<<<<<<<<<<<<< + * cdef class Iteration: # <<<<<<<<<<<<<< * - * cpdef INDEX_t degree(ConstantBasisFunction self) + * def __richcmp__(self, other, method): */ -struct __pyx_obj_6_basis_ConstantBasisFunction { - struct __pyx_obj_6_basis_BasisFunction __pyx_base; -}; +struct __pyx_vtabstruct_7sklearn_5earth_7_record_Iteration { + __pyx_t_7sklearn_5earth_7_record_FLOAT_t (*get_mse)(struct __pyx_obj_7sklearn_5earth_7_record_Iteration *, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_7_record_INDEX_t (*get_size)(struct __pyx_obj_7sklearn_5earth_7_record_Iteration *, int __pyx_skip_dispatch); +}; +static struct __pyx_vtabstruct_7sklearn_5earth_7_record_Iteration *__pyx_vtabptr_7sklearn_5earth_7_record_Iteration; -/* "_basis.pxd":102 - * +/* "sklearn/earth/_record.pyx":163 + * return self.size * - * cdef class Basis: # <<<<<<<<<<<<<< - * '''A wrapper that provides functionality related to a set of BasisFunctions with a - * common ConstantBasisFunction ancestor. Retains the order in which BasisFunctions are + * cdef class PruningPassIteration(Iteration): # <<<<<<<<<<<<<< + * def __init__(PruningPassIteration self, INDEX_t pruned, INDEX_t size, FLOAT_t mse): + * self.pruned = pruned */ -struct __pyx_vtabstruct_6_basis_Basis { - PyObject *(*translate)(struct __pyx_obj_6_basis_Basis *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); - PyObject *(*scale)(struct __pyx_obj_6_basis_Basis *, PyArrayObject *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); - struct __pyx_obj_6_basis_BasisFunction *(*get_root)(struct __pyx_obj_6_basis_Basis *, int __pyx_skip_dispatch); - PyObject *(*append)(struct __pyx_obj_6_basis_Basis *, struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - __pyx_t_6_basis_INDEX_t (*plen)(struct __pyx_obj_6_basis_Basis *, int __pyx_skip_dispatch); - struct __pyx_obj_6_basis_BasisFunction *(*get)(struct __pyx_obj_6_basis_Basis *, __pyx_t_6_basis_INDEX_t, int __pyx_skip_dispatch); - PyObject *(*transform)(struct __pyx_obj_6_basis_Basis *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); - PyObject *(*weighted_transform)(struct __pyx_obj_6_basis_Basis *, PyArrayObject *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); +struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassIteration { + struct __pyx_vtabstruct_7sklearn_5earth_7_record_Iteration __pyx_base; + __pyx_t_7sklearn_5earth_7_record_INDEX_t (*get_pruned)(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassIteration *, int __pyx_skip_dispatch); }; -static struct __pyx_vtabstruct_6_basis_Basis *__pyx_vtabptr_6_basis_Basis; +static struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassIteration *__pyx_vtabptr_7sklearn_5earth_7_record_PruningPassIteration; /* "_basis.pxd":7 @@ -1136,25 +1157,25 @@ static struct __pyx_vtabstruct_6_basis_Basis *__pyx_vtabptr_6_basis_Basis; * */ -struct __pyx_vtabstruct_6_basis_BasisFunction { - int (*has_knot)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - int (*is_prunable)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - int (*is_pruned)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - int (*is_splittable)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - int (*make_splittable)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - int (*make_unsplittable)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - PyObject *(*get_children)(struct __pyx_obj_6_basis_BasisFunction *); - PyObject *(*_set_parent)(struct __pyx_obj_6_basis_BasisFunction *, struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - PyObject *(*_add_child)(struct __pyx_obj_6_basis_BasisFunction *, struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - struct __pyx_obj_6_basis_BasisFunction *(*get_parent)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - PyObject *(*prune)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - PyObject *(*unprune)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - PyObject *(*knots)(struct __pyx_obj_6_basis_BasisFunction *, __pyx_t_6_basis_INDEX_t, int __pyx_skip_dispatch); - __pyx_t_6_basis_INDEX_t (*degree)(struct __pyx_obj_6_basis_BasisFunction *, int __pyx_skip_dispatch); - PyObject *(*apply)(struct __pyx_obj_6_basis_BasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_6_basis_13BasisFunction_apply *__pyx_optional_args); - PyArrayObject *(*valid_knots)(struct __pyx_obj_6_basis_BasisFunction *, PyArrayObject *, PyArrayObject *, int, __pyx_t_6_basis_INDEX_t, int, int, __pyx_t_6_basis_FLOAT_t, __pyx_t_6_basis_INDEX_t, PyArrayObject *, int __pyx_skip_dispatch); +struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction { + int (*has_knot)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + int (*is_prunable)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + int (*is_pruned)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + int (*is_splittable)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + int (*make_splittable)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + int (*make_unsplittable)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*get_children)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *); + PyObject *(*_set_parent)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*_add_child)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *(*get_parent)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*prune)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*unprune)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*knots)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, __pyx_t_7sklearn_5earth_6_basis_INDEX_t, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_6_basis_INDEX_t (*degree)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + PyObject *(*apply)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch, struct __pyx_opt_args_7sklearn_5earth_6_basis_13BasisFunction_apply *__pyx_optional_args); + PyArrayObject *(*valid_knots)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, PyArrayObject *, PyArrayObject *, int, __pyx_t_7sklearn_5earth_6_basis_INDEX_t, int, int, __pyx_t_7sklearn_5earth_6_basis_FLOAT_t, __pyx_t_7sklearn_5earth_6_basis_INDEX_t, PyArrayObject *, int __pyx_skip_dispatch); }; -static struct __pyx_vtabstruct_6_basis_BasisFunction *__pyx_vtabptr_6_basis_BasisFunction; +static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *__pyx_vtabptr_7sklearn_5earth_6_basis_BasisFunction; /* "_basis.pxd":88 @@ -1165,73 +1186,66 @@ static struct __pyx_vtabstruct_6_basis_BasisFunction *__pyx_vtabptr_6_basis_Basi * cdef str label */ -struct __pyx_vtabstruct_6_basis_LinearBasisFunction { - struct __pyx_vtabstruct_6_basis_BasisFunction __pyx_base; - PyObject *(*translate)(struct __pyx_obj_6_basis_LinearBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch); - __pyx_t_6_basis_FLOAT_t (*scale)(struct __pyx_obj_6_basis_LinearBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); - __pyx_t_6_basis_INDEX_t (*get_variable)(struct __pyx_obj_6_basis_LinearBasisFunction *, int __pyx_skip_dispatch); +struct __pyx_vtabstruct_7sklearn_5earth_6_basis_LinearBasisFunction { + struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction __pyx_base; + PyObject *(*translate)(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_6_basis_FLOAT_t (*scale)(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_6_basis_INDEX_t (*get_variable)(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *, int __pyx_skip_dispatch); }; -static struct __pyx_vtabstruct_6_basis_LinearBasisFunction *__pyx_vtabptr_6_basis_LinearBasisFunction; +static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_LinearBasisFunction *__pyx_vtabptr_7sklearn_5earth_6_basis_LinearBasisFunction; -/* "_record.pyx":141 - * return result +/* "sklearn/earth/_record.pyx":10 + * import _forward * - * cdef class Iteration: # <<<<<<<<<<<<<< + * cdef class Record: # <<<<<<<<<<<<<< * * def __richcmp__(self, other, method): */ -struct __pyx_vtabstruct_7_record_Iteration { - __pyx_t_7_record_FLOAT_t (*get_mse)(struct __pyx_obj_7_record_Iteration *, int __pyx_skip_dispatch); - __pyx_t_7_record_INDEX_t (*get_size)(struct __pyx_obj_7_record_Iteration *, int __pyx_skip_dispatch); +struct __pyx_vtabstruct_7sklearn_5earth_7_record_Record { + PyObject *(*append)(struct __pyx_obj_7sklearn_5earth_7_record_Record *, struct __pyx_obj_7sklearn_5earth_7_record_Iteration *, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_7_record_FLOAT_t (*mse)(struct __pyx_obj_7sklearn_5earth_7_record_Record *, __pyx_t_7sklearn_5earth_7_record_INDEX_t, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_7_record_FLOAT_t (*rsq)(struct __pyx_obj_7sklearn_5earth_7_record_Record *, __pyx_t_7sklearn_5earth_7_record_INDEX_t, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_7_record_FLOAT_t (*gcv)(struct __pyx_obj_7sklearn_5earth_7_record_Record *, __pyx_t_7sklearn_5earth_7_record_INDEX_t, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_7_record_FLOAT_t (*grsq)(struct __pyx_obj_7sklearn_5earth_7_record_Record *, __pyx_t_7sklearn_5earth_7_record_INDEX_t, int __pyx_skip_dispatch); }; -static struct __pyx_vtabstruct_7_record_Iteration *__pyx_vtabptr_7_record_Iteration; +static struct __pyx_vtabstruct_7sklearn_5earth_7_record_Record *__pyx_vtabptr_7sklearn_5earth_7_record_Record; -/* "_record.pyx":206 +/* "sklearn/earth/_record.pyx":102 * return result * - * cdef class ForwardPassIteration(Iteration): # <<<<<<<<<<<<<< - * def __init__(ForwardPassIteration self, INDEX_t parent, INDEX_t variable, int knot, FLOAT_t mse, INDEX_t size): - * self.parent = parent + * cdef class ForwardPassRecord(Record): # <<<<<<<<<<<<<< + * def __init__(ForwardPassRecord self, INDEX_t num_samples, INDEX_t num_variables, FLOAT_t penalty, FLOAT_t sst, list xlabels): + * self.num_samples = num_samples */ -struct __pyx_vtabstruct_7_record_ForwardPassIteration { - struct __pyx_vtabstruct_7_record_Iteration __pyx_base; - PyObject *(*set_no_candidates)(struct __pyx_obj_7_record_ForwardPassIteration *, int, int __pyx_skip_dispatch); - PyObject *(*no_further_candidates)(struct __pyx_obj_7_record_ForwardPassIteration *, int __pyx_skip_dispatch); +struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord { + struct __pyx_vtabstruct_7sklearn_5earth_7_record_Record __pyx_base; + PyObject *(*set_stopping_condition)(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *, int, int __pyx_skip_dispatch); }; -static struct __pyx_vtabstruct_7_record_ForwardPassIteration *__pyx_vtabptr_7_record_ForwardPassIteration; +static struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord *__pyx_vtabptr_7sklearn_5earth_7_record_ForwardPassRecord; -/* "_record.pyx":241 - * return self.no_candidates +/* "_basis.pxd":65 * - * cdef class FirstForwardPassIteration(ForwardPassIteration): # <<<<<<<<<<<<<< - * def __init__(FirstForwardPassIteration self, FLOAT_t mse): - * self.mse = mse - */ - -struct __pyx_vtabstruct_7_record_FirstForwardPassIteration { - struct __pyx_vtabstruct_7_record_ForwardPassIteration __pyx_base; -}; -static struct __pyx_vtabstruct_7_record_FirstForwardPassIteration *__pyx_vtabptr_7_record_FirstForwardPassIteration; - - -/* "_record.pyx":160 - * return self.size * - * cdef class PruningPassIteration(Iteration): # <<<<<<<<<<<<<< - * def __init__(PruningPassIteration self, INDEX_t pruned, INDEX_t size, FLOAT_t mse): - * self.pruned = pruned + * cdef class HingeBasisFunction(BasisFunction): # <<<<<<<<<<<<<< + * cdef FLOAT_t knot + * cdef INDEX_t knot_idx */ -struct __pyx_vtabstruct_7_record_PruningPassIteration { - struct __pyx_vtabstruct_7_record_Iteration __pyx_base; - __pyx_t_7_record_INDEX_t (*get_pruned)(struct __pyx_obj_7_record_PruningPassIteration *, int __pyx_skip_dispatch); +struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction { + struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction __pyx_base; + PyObject *(*translate)(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_6_basis_FLOAT_t (*scale)(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_6_basis_INDEX_t (*get_variable)(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_6_basis_FLOAT_t (*get_knot)(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); + int (*get_reverse)(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_6_basis_INDEX_t (*get_knot_idx)(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); }; -static struct __pyx_vtabstruct_7_record_PruningPassIteration *__pyx_vtabptr_7_record_PruningPassIteration; +static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction *__pyx_vtabptr_7sklearn_5earth_6_basis_HingeBasisFunction; /* "_basis.pxd":50 @@ -1242,85 +1256,75 @@ static struct __pyx_vtabstruct_7_record_PruningPassIteration *__pyx_vtabptr_7_re * cpdef INDEX_t degree(ConstantBasisFunction self) */ -struct __pyx_vtabstruct_6_basis_ConstantBasisFunction { - struct __pyx_vtabstruct_6_basis_BasisFunction __pyx_base; - PyObject *(*translate)(struct __pyx_obj_6_basis_ConstantBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch); - __pyx_t_6_basis_FLOAT_t (*scale)(struct __pyx_obj_6_basis_ConstantBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); +struct __pyx_vtabstruct_7sklearn_5earth_6_basis_ConstantBasisFunction { + struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction __pyx_base; + PyObject *(*translate)(struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_6_basis_FLOAT_t (*scale)(struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); }; -static struct __pyx_vtabstruct_6_basis_ConstantBasisFunction *__pyx_vtabptr_6_basis_ConstantBasisFunction; - +static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_ConstantBasisFunction *__pyx_vtabptr_7sklearn_5earth_6_basis_ConstantBasisFunction; -/* "_record.pyx":10 - * import _forward - * - * cdef class Record: # <<<<<<<<<<<<<< - * - * def __richcmp__(self, other, method): - */ -struct __pyx_vtabstruct_7_record_Record { - PyObject *(*append)(struct __pyx_obj_7_record_Record *, struct __pyx_obj_7_record_Iteration *, int __pyx_skip_dispatch); - __pyx_t_7_record_FLOAT_t (*mse)(struct __pyx_obj_7_record_Record *, __pyx_t_7_record_INDEX_t, int __pyx_skip_dispatch); - __pyx_t_7_record_FLOAT_t (*rsq)(struct __pyx_obj_7_record_Record *, __pyx_t_7_record_INDEX_t, int __pyx_skip_dispatch); - __pyx_t_7_record_FLOAT_t (*gcv)(struct __pyx_obj_7_record_Record *, __pyx_t_7_record_INDEX_t, int __pyx_skip_dispatch); - __pyx_t_7_record_FLOAT_t (*grsq)(struct __pyx_obj_7_record_Record *, __pyx_t_7_record_INDEX_t, int __pyx_skip_dispatch); +struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord { + struct __pyx_vtabstruct_7sklearn_5earth_7_record_Record __pyx_base; + PyObject *(*set_selected)(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *, __pyx_t_7sklearn_5earth_7_record_INDEX_t, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_7_record_INDEX_t (*get_selected)(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *, int __pyx_skip_dispatch); + PyObject *(*roll_back)(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *, struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, int __pyx_skip_dispatch); }; -static struct __pyx_vtabstruct_7_record_Record *__pyx_vtabptr_7_record_Record; +static struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord *__pyx_vtabptr_7sklearn_5earth_7_record_PruningPassRecord; -/* "_record.pyx":50 - * return 1 - (gcv_/gcv0) +/* "sklearn/earth/_record.pyx":209 + * return result * - * cdef class PruningPassRecord(Record): # <<<<<<<<<<<<<< - * def __init__(PruningPassRecord self, INDEX_t num_samples, INDEX_t num_variables, FLOAT_t penalty, FLOAT_t sst, INDEX_t size, FLOAT_t mse): - * self.num_samples = num_samples + * cdef class ForwardPassIteration(Iteration): # <<<<<<<<<<<<<< + * def __init__(ForwardPassIteration self, INDEX_t parent, INDEX_t variable, int knot, FLOAT_t mse, INDEX_t size): + * self.parent = parent */ -struct __pyx_vtabstruct_7_record_PruningPassRecord { - struct __pyx_vtabstruct_7_record_Record __pyx_base; - PyObject *(*set_selected)(struct __pyx_obj_7_record_PruningPassRecord *, __pyx_t_7_record_INDEX_t, int __pyx_skip_dispatch); - __pyx_t_7_record_INDEX_t (*get_selected)(struct __pyx_obj_7_record_PruningPassRecord *, int __pyx_skip_dispatch); - PyObject *(*roll_back)(struct __pyx_obj_7_record_PruningPassRecord *, struct __pyx_obj_6_basis_Basis *, int __pyx_skip_dispatch); +struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassIteration { + struct __pyx_vtabstruct_7sklearn_5earth_7_record_Iteration __pyx_base; + PyObject *(*set_no_candidates)(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration *, int, int __pyx_skip_dispatch); + PyObject *(*no_further_candidates)(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration *, int __pyx_skip_dispatch); }; -static struct __pyx_vtabstruct_7_record_PruningPassRecord *__pyx_vtabptr_7_record_PruningPassRecord; +static struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassIteration *__pyx_vtabptr_7sklearn_5earth_7_record_ForwardPassIteration; -/* "_record.pyx":102 - * return result +/* "_basis.pxd":102 * - * cdef class ForwardPassRecord(Record): # <<<<<<<<<<<<<< - * def __init__(ForwardPassRecord self, INDEX_t num_samples, INDEX_t num_variables, FLOAT_t penalty, FLOAT_t sst): - * self.num_samples = num_samples + * + * cdef class Basis: # <<<<<<<<<<<<<< + * '''A wrapper that provides functionality related to a set of BasisFunctions with a + * common ConstantBasisFunction ancestor. Retains the order in which BasisFunctions are */ -struct __pyx_vtabstruct_7_record_ForwardPassRecord { - struct __pyx_vtabstruct_7_record_Record __pyx_base; - PyObject *(*set_stopping_condition)(struct __pyx_obj_7_record_ForwardPassRecord *, int, int __pyx_skip_dispatch); +struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis { + PyObject *(*translate)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); + PyObject *(*scale)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, PyArrayObject *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *(*get_root)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, int __pyx_skip_dispatch); + PyObject *(*append)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_6_basis_INDEX_t (*plen)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, int __pyx_skip_dispatch); + struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *(*get)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, __pyx_t_7sklearn_5earth_6_basis_INDEX_t, int __pyx_skip_dispatch); + PyObject *(*transform)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); + PyObject *(*weighted_transform)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, PyArrayObject *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); }; -static struct __pyx_vtabstruct_7_record_ForwardPassRecord *__pyx_vtabptr_7_record_ForwardPassRecord; +static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *__pyx_vtabptr_7sklearn_5earth_6_basis_Basis; -/* "_basis.pxd":65 - * +/* "sklearn/earth/_record.pyx":244 + * return self.no_candidates * - * cdef class HingeBasisFunction(BasisFunction): # <<<<<<<<<<<<<< - * cdef FLOAT_t knot - * cdef INDEX_t knot_idx + * cdef class FirstForwardPassIteration(ForwardPassIteration): # <<<<<<<<<<<<<< + * def __init__(FirstForwardPassIteration self, FLOAT_t mse): + * self.mse = mse */ -struct __pyx_vtabstruct_6_basis_HingeBasisFunction { - struct __pyx_vtabstruct_6_basis_BasisFunction __pyx_base; - PyObject *(*translate)(struct __pyx_obj_6_basis_HingeBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch); - __pyx_t_6_basis_FLOAT_t (*scale)(struct __pyx_obj_6_basis_HingeBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); - __pyx_t_6_basis_INDEX_t (*get_variable)(struct __pyx_obj_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); - __pyx_t_6_basis_FLOAT_t (*get_knot)(struct __pyx_obj_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); - int (*get_reverse)(struct __pyx_obj_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); - __pyx_t_6_basis_INDEX_t (*get_knot_idx)(struct __pyx_obj_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch); +struct __pyx_vtabstruct_7sklearn_5earth_7_record_FirstForwardPassIteration { + struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassIteration __pyx_base; }; -static struct __pyx_vtabstruct_6_basis_HingeBasisFunction *__pyx_vtabptr_6_basis_HingeBasisFunction; +static struct __pyx_vtabstruct_7sklearn_5earth_7_record_FirstForwardPassIteration *__pyx_vtabptr_7sklearn_5earth_7_record_FirstForwardPassIteration; -/* "_record.pyx":186 +/* "sklearn/earth/_record.pyx":189 * return result * * cdef class FirstPruningPassIteration(PruningPassIteration): # <<<<<<<<<<<<<< @@ -1328,10 +1332,10 @@ static struct __pyx_vtabstruct_6_basis_HingeBasisFunction *__pyx_vtabptr_6_basis * self.size = size */ -struct __pyx_vtabstruct_7_record_FirstPruningPassIteration { - struct __pyx_vtabstruct_7_record_PruningPassIteration __pyx_base; +struct __pyx_vtabstruct_7sklearn_5earth_7_record_FirstPruningPassIteration { + struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassIteration __pyx_base; }; -static struct __pyx_vtabstruct_7_record_FirstPruningPassIteration *__pyx_vtabptr_7_record_FirstPruningPassIteration; +static struct __pyx_vtabstruct_7sklearn_5earth_7_record_FirstPruningPassIteration *__pyx_vtabptr_7sklearn_5earth_7_record_FirstPruningPassIteration; #ifndef CYTHON_REFNANNY #define CYTHON_REFNANNY 0 #endif @@ -1422,6 +1426,12 @@ static CYTHON_INLINE int __Pyx_PyList_Append(PyObject* list, PyObject* x) { static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static void __Pyx_WriteUnraisable(const char *name, int clineno, + int lineno, const char *filename); /*proto*/ + static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, @@ -1475,9 +1485,6 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int is_list, int wraparound, int boundscheck); -static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ - static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, PyObject *cause); /*proto*/ static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(Py_ssize_t expected); @@ -1490,6 +1497,10 @@ static CYTHON_INLINE int __Pyx_IterFinish(void); /*proto*/ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); /*proto*/ +static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ + +static void* __Pyx_GetVtable(PyObject *dict); /*proto*/ + static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/ static CYTHON_INLINE npy_ulonglong __Pyx_PyInt_from_py_npy_ulonglong(PyObject *); @@ -1626,13 +1637,8 @@ static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); -static void __Pyx_WriteUnraisable(const char *name, int clineno, - int lineno, const char *filename); /*proto*/ - static int __Pyx_check_binary_version(void); -static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ - #if !defined(__Pyx_PyIdentifier_FromString) #if PY_MAJOR_VERSION < 3 #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) @@ -1645,8 +1651,6 @@ static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ -static void* __Pyx_GetVtable(PyObject *dict); /*proto*/ - static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig); /*proto*/ typedef struct { @@ -1696,96 +1700,96 @@ static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ -/* Module declarations from '_basis' */ -static PyTypeObject *__pyx_ptype_6_basis_BasisFunction = 0; -static PyTypeObject *__pyx_ptype_6_basis_ConstantBasisFunction = 0; -static PyTypeObject *__pyx_ptype_6_basis_HingeBasisFunction = 0; -static PyTypeObject *__pyx_ptype_6_basis_LinearBasisFunction = 0; -static PyTypeObject *__pyx_ptype_6_basis_Basis = 0; - -/* Module declarations from '_util' */ -static __pyx_t_5_util_FLOAT_t (*__pyx_f_5_util_gcv)(__pyx_t_5_util_FLOAT_t, __pyx_t_5_util_INDEX_t, __pyx_t_5_util_INDEX_t, __pyx_t_5_util_FLOAT_t, int __pyx_skip_dispatch); /*proto*/ -static PyObject *(*__pyx_f_5_util_ascii_table)(PyObject *, PyObject *, int __pyx_skip_dispatch); /*proto*/ - -/* Module declarations from '_record' */ -static PyTypeObject *__pyx_ptype_7_record_Record = 0; -static PyTypeObject *__pyx_ptype_7_record_PruningPassRecord = 0; -static PyTypeObject *__pyx_ptype_7_record_ForwardPassRecord = 0; -static PyTypeObject *__pyx_ptype_7_record_Iteration = 0; -static PyTypeObject *__pyx_ptype_7_record_PruningPassIteration = 0; -static PyTypeObject *__pyx_ptype_7_record_FirstPruningPassIteration = 0; -static PyTypeObject *__pyx_ptype_7_record_ForwardPassIteration = 0; -static PyTypeObject *__pyx_ptype_7_record_FirstForwardPassIteration = 0; -#define __Pyx_MODULE_NAME "_record" -int __pyx_module_is_main__record = 0; - -/* Implementation of '_record' */ +/* Module declarations from 'sklearn.earth._basis' */ +static PyTypeObject *__pyx_ptype_7sklearn_5earth_6_basis_BasisFunction = 0; +static PyTypeObject *__pyx_ptype_7sklearn_5earth_6_basis_ConstantBasisFunction = 0; +static PyTypeObject *__pyx_ptype_7sklearn_5earth_6_basis_HingeBasisFunction = 0; +static PyTypeObject *__pyx_ptype_7sklearn_5earth_6_basis_LinearBasisFunction = 0; +static PyTypeObject *__pyx_ptype_7sklearn_5earth_6_basis_Basis = 0; + +/* Module declarations from 'sklearn.earth._util' */ +static __pyx_t_7sklearn_5earth_5_util_FLOAT_t (*__pyx_f_7sklearn_5earth_5_util_gcv)(__pyx_t_7sklearn_5earth_5_util_FLOAT_t, __pyx_t_7sklearn_5earth_5_util_INDEX_t, __pyx_t_7sklearn_5earth_5_util_INDEX_t, __pyx_t_7sklearn_5earth_5_util_FLOAT_t, int __pyx_skip_dispatch); /*proto*/ +static PyObject *(*__pyx_f_7sklearn_5earth_5_util_ascii_table)(PyObject *, PyObject *, int __pyx_skip_dispatch); /*proto*/ + +/* Module declarations from 'sklearn.earth._record' */ +static PyTypeObject *__pyx_ptype_7sklearn_5earth_7_record_Iteration = 0; +static PyTypeObject *__pyx_ptype_7sklearn_5earth_7_record_ForwardPassIteration = 0; +static PyTypeObject *__pyx_ptype_7sklearn_5earth_7_record_Record = 0; +static PyTypeObject *__pyx_ptype_7sklearn_5earth_7_record_ForwardPassRecord = 0; +static PyTypeObject *__pyx_ptype_7sklearn_5earth_7_record_PruningPassIteration = 0; +static PyTypeObject *__pyx_ptype_7sklearn_5earth_7_record_FirstPruningPassIteration = 0; +static PyTypeObject *__pyx_ptype_7sklearn_5earth_7_record_FirstForwardPassIteration = 0; +static PyTypeObject *__pyx_ptype_7sklearn_5earth_7_record_PruningPassRecord = 0; +#define __Pyx_MODULE_NAME "sklearn.earth._record" +int __pyx_module_is_main_sklearn__earth___record = 0; + +/* Implementation of 'sklearn.earth._record' */ static PyObject *__pyx_builtin_NotImplemented; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_enumerate; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_RuntimeError; -static PyObject *__pyx_pf_7_record_6Record___richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_method); /* proto */ -static PyObject *__pyx_pf_7_record_6Record_2_eq(struct __pyx_obj_7_record_Record *__pyx_v_self, PyObject *__pyx_v_other); /* proto */ -static PyObject *__pyx_pf_7_record_6Record_4__getitem__(struct __pyx_obj_7_record_Record *__pyx_v_self, int __pyx_v_idx); /* proto */ -static Py_ssize_t __pyx_pf_7_record_6Record_6__len__(struct __pyx_obj_7_record_Record *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7_record_6Record_8append(struct __pyx_obj_7_record_Record *__pyx_v_self, struct __pyx_obj_7_record_Iteration *__pyx_v_iteration); /* proto */ -static PyObject *__pyx_pf_7_record_6Record_10mse(struct __pyx_obj_7_record_Record *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_iteration); /* proto */ -static PyObject *__pyx_pf_7_record_6Record_12gcv(struct __pyx_obj_7_record_Record *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_iteration); /* proto */ -static PyObject *__pyx_pf_7_record_6Record_14rsq(struct __pyx_obj_7_record_Record *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_iteration); /* proto */ -static PyObject *__pyx_pf_7_record_6Record_16grsq(struct __pyx_obj_7_record_Record *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_iteration); /* proto */ -static int __pyx_pf_7_record_17PruningPassRecord___init__(struct __pyx_obj_7_record_PruningPassRecord *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_num_samples, __pyx_t_7_record_INDEX_t __pyx_v_num_variables, __pyx_t_7_record_FLOAT_t __pyx_v_penalty, __pyx_t_7_record_FLOAT_t __pyx_v_sst, __pyx_t_7_record_INDEX_t __pyx_v_size, __pyx_t_7_record_FLOAT_t __pyx_v_mse); /* proto */ -static PyObject *__pyx_pf_7_record_17PruningPassRecord_2__reduce__(struct __pyx_obj_7_record_PruningPassRecord *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7_record_17PruningPassRecord_4_getstate(struct __pyx_obj_7_record_PruningPassRecord *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7_record_17PruningPassRecord_6__setstate__(struct __pyx_obj_7_record_PruningPassRecord *__pyx_v_self, PyObject *__pyx_v_state); /* proto */ -static PyObject *__pyx_pf_7_record_17PruningPassRecord_8set_selected(struct __pyx_obj_7_record_PruningPassRecord *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_selected); /* proto */ -static PyObject *__pyx_pf_7_record_17PruningPassRecord_10get_selected(struct __pyx_obj_7_record_PruningPassRecord *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7_record_17PruningPassRecord_12roll_back(struct __pyx_obj_7_record_PruningPassRecord *__pyx_v_self, struct __pyx_obj_6_basis_Basis *__pyx_v_basis); /* proto */ -static PyObject *__pyx_pf_7_record_17PruningPassRecord_14__str__(struct __pyx_obj_7_record_PruningPassRecord *__pyx_v_self); /* proto */ -static int __pyx_pf_7_record_17ForwardPassRecord___init__(struct __pyx_obj_7_record_ForwardPassRecord *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_num_samples, __pyx_t_7_record_INDEX_t __pyx_v_num_variables, __pyx_t_7_record_FLOAT_t __pyx_v_penalty, __pyx_t_7_record_FLOAT_t __pyx_v_sst); /* proto */ -static PyObject *__pyx_pf_7_record_17ForwardPassRecord_2__reduce__(struct __pyx_obj_7_record_ForwardPassRecord *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7_record_17ForwardPassRecord_4_getstate(struct __pyx_obj_7_record_ForwardPassRecord *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7_record_17ForwardPassRecord_6__setstate__(struct __pyx_obj_7_record_ForwardPassRecord *__pyx_v_self, PyObject *__pyx_v_state); /* proto */ -static PyObject *__pyx_pf_7_record_17ForwardPassRecord_8set_stopping_condition(struct __pyx_obj_7_record_ForwardPassRecord *__pyx_v_self, int __pyx_v_stopping_condition); /* proto */ -static PyObject *__pyx_pf_7_record_17ForwardPassRecord_10__str__(struct __pyx_obj_7_record_ForwardPassRecord *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7_record_9Iteration___richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_method); /* proto */ -static PyObject *__pyx_pf_7_record_9Iteration_2_eq(struct __pyx_obj_7_record_Iteration *__pyx_v_self, PyObject *__pyx_v_other); /* proto */ -static PyObject *__pyx_pf_7_record_9Iteration_4get_mse(struct __pyx_obj_7_record_Iteration *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7_record_9Iteration_6get_size(struct __pyx_obj_7_record_Iteration *__pyx_v_self); /* proto */ -static int __pyx_pf_7_record_20PruningPassIteration___init__(struct __pyx_obj_7_record_PruningPassIteration *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_pruned, __pyx_t_7_record_INDEX_t __pyx_v_size, __pyx_t_7_record_FLOAT_t __pyx_v_mse); /* proto */ -static PyObject *__pyx_pf_7_record_20PruningPassIteration_2__reduce__(struct __pyx_obj_7_record_PruningPassIteration *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7_record_20PruningPassIteration_4_getstate(struct __pyx_obj_7_record_PruningPassIteration *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7_record_20PruningPassIteration_6__setstate__(struct __pyx_obj_7_record_PruningPassIteration *__pyx_v_self, PyObject *__pyx_v_state); /* proto */ -static PyObject *__pyx_pf_7_record_20PruningPassIteration_8get_pruned(struct __pyx_obj_7_record_PruningPassIteration *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7_record_20PruningPassIteration_10__str__(struct __pyx_obj_7_record_PruningPassIteration *__pyx_v_self); /* proto */ -static int __pyx_pf_7_record_25FirstPruningPassIteration___init__(struct __pyx_obj_7_record_FirstPruningPassIteration *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_size, __pyx_t_7_record_FLOAT_t __pyx_v_mse); /* proto */ -static PyObject *__pyx_pf_7_record_25FirstPruningPassIteration_2__reduce__(struct __pyx_obj_7_record_FirstPruningPassIteration *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7_record_25FirstPruningPassIteration_4_getstate(struct __pyx_obj_7_record_FirstPruningPassIteration *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7_record_25FirstPruningPassIteration_6__setstate__(struct __pyx_obj_7_record_FirstPruningPassIteration *__pyx_v_self, PyObject *__pyx_v_state); /* proto */ -static PyObject *__pyx_pf_7_record_25FirstPruningPassIteration_8__str__(struct __pyx_obj_7_record_FirstPruningPassIteration *__pyx_v_self); /* proto */ -static int __pyx_pf_7_record_20ForwardPassIteration___init__(struct __pyx_obj_7_record_ForwardPassIteration *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_parent, __pyx_t_7_record_INDEX_t __pyx_v_variable, int __pyx_v_knot, __pyx_t_7_record_FLOAT_t __pyx_v_mse, __pyx_t_7_record_INDEX_t __pyx_v_size); /* proto */ -static PyObject *__pyx_pf_7_record_20ForwardPassIteration_2__reduce__(struct __pyx_obj_7_record_ForwardPassIteration *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7_record_20ForwardPassIteration_4_getstate(struct __pyx_obj_7_record_ForwardPassIteration *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7_record_20ForwardPassIteration_6__setstate__(struct __pyx_obj_7_record_ForwardPassIteration *__pyx_v_self, PyObject *__pyx_v_state); /* proto */ -static PyObject *__pyx_pf_7_record_20ForwardPassIteration_8__str__(struct __pyx_obj_7_record_ForwardPassIteration *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7_record_20ForwardPassIteration_10set_no_candidates(struct __pyx_obj_7_record_ForwardPassIteration *__pyx_v_self, int __pyx_v_value); /* proto */ -static PyObject *__pyx_pf_7_record_20ForwardPassIteration_12no_further_candidates(struct __pyx_obj_7_record_ForwardPassIteration *__pyx_v_self); /* proto */ -static int __pyx_pf_7_record_25FirstForwardPassIteration___init__(struct __pyx_obj_7_record_FirstForwardPassIteration *__pyx_v_self, __pyx_t_7_record_FLOAT_t __pyx_v_mse); /* proto */ -static PyObject *__pyx_pf_7_record_25FirstForwardPassIteration_2__reduce__(struct __pyx_obj_7_record_FirstForwardPassIteration *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7_record_25FirstForwardPassIteration_4_getstate(struct __pyx_obj_7_record_FirstForwardPassIteration *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7_record_25FirstForwardPassIteration_6__setstate__(struct __pyx_obj_7_record_FirstForwardPassIteration *__pyx_v_self, PyObject *__pyx_v_state); /* proto */ -static PyObject *__pyx_pf_7_record_25FirstForwardPassIteration_8get_size(struct __pyx_obj_7_record_FirstForwardPassIteration *__pyx_v_self); /* proto */ -static PyObject *__pyx_pf_7_record_25FirstForwardPassIteration_10__str__(struct __pyx_obj_7_record_FirstForwardPassIteration *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_6Record___richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_method); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_6Record_2_eq(struct __pyx_obj_7sklearn_5earth_7_record_Record *__pyx_v_self, PyObject *__pyx_v_other); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_6Record_4__getitem__(struct __pyx_obj_7sklearn_5earth_7_record_Record *__pyx_v_self, int __pyx_v_idx); /* proto */ +static Py_ssize_t __pyx_pf_7sklearn_5earth_7_record_6Record_6__len__(struct __pyx_obj_7sklearn_5earth_7_record_Record *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_6Record_8append(struct __pyx_obj_7sklearn_5earth_7_record_Record *__pyx_v_self, struct __pyx_obj_7sklearn_5earth_7_record_Iteration *__pyx_v_iteration); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_6Record_10mse(struct __pyx_obj_7sklearn_5earth_7_record_Record *__pyx_v_self, __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_iteration); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_6Record_12gcv(struct __pyx_obj_7sklearn_5earth_7_record_Record *__pyx_v_self, __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_iteration); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_6Record_14rsq(struct __pyx_obj_7sklearn_5earth_7_record_Record *__pyx_v_self, __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_iteration); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_6Record_16grsq(struct __pyx_obj_7sklearn_5earth_7_record_Record *__pyx_v_self, __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_iteration); /* proto */ +static int __pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord___init__(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *__pyx_v_self, __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_num_samples, __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_num_variables, __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_v_penalty, __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_v_sst, __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_size, __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_v_mse); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_2__reduce__(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_4_getstate(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_6__setstate__(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *__pyx_v_self, PyObject *__pyx_v_state); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_8set_selected(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *__pyx_v_self, __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_selected); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_10get_selected(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_12roll_back(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *__pyx_v_self, struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_basis); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_14__str__(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *__pyx_v_self); /* proto */ +static int __pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord___init__(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *__pyx_v_self, __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_num_samples, __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_num_variables, __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_v_penalty, __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_v_sst, PyObject *__pyx_v_xlabels); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_2__reduce__(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_4_getstate(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_6__setstate__(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *__pyx_v_self, PyObject *__pyx_v_state); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_8set_stopping_condition(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *__pyx_v_self, int __pyx_v_stopping_condition); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_10__str__(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_9Iteration___richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_method); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_9Iteration_2_eq(struct __pyx_obj_7sklearn_5earth_7_record_Iteration *__pyx_v_self, PyObject *__pyx_v_other); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_9Iteration_4get_mse(struct __pyx_obj_7sklearn_5earth_7_record_Iteration *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_9Iteration_6get_size(struct __pyx_obj_7sklearn_5earth_7_record_Iteration *__pyx_v_self); /* proto */ +static int __pyx_pf_7sklearn_5earth_7_record_20PruningPassIteration___init__(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassIteration *__pyx_v_self, __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_pruned, __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_size, __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_v_mse); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_20PruningPassIteration_2__reduce__(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassIteration *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_20PruningPassIteration_4_getstate(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassIteration *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_20PruningPassIteration_6__setstate__(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassIteration *__pyx_v_self, PyObject *__pyx_v_state); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_20PruningPassIteration_8get_pruned(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassIteration *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_20PruningPassIteration_10__str__(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassIteration *__pyx_v_self); /* proto */ +static int __pyx_pf_7sklearn_5earth_7_record_25FirstPruningPassIteration___init__(struct __pyx_obj_7sklearn_5earth_7_record_FirstPruningPassIteration *__pyx_v_self, __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_size, __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_v_mse); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_25FirstPruningPassIteration_2__reduce__(struct __pyx_obj_7sklearn_5earth_7_record_FirstPruningPassIteration *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_25FirstPruningPassIteration_4_getstate(struct __pyx_obj_7sklearn_5earth_7_record_FirstPruningPassIteration *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_25FirstPruningPassIteration_6__setstate__(struct __pyx_obj_7sklearn_5earth_7_record_FirstPruningPassIteration *__pyx_v_self, PyObject *__pyx_v_state); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_25FirstPruningPassIteration_8__str__(struct __pyx_obj_7sklearn_5earth_7_record_FirstPruningPassIteration *__pyx_v_self); /* proto */ +static int __pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration___init__(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration *__pyx_v_self, __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_parent, __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_variable, int __pyx_v_knot, __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_v_mse, __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_size); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration_2__reduce__(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration_4_getstate(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration_6__setstate__(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration *__pyx_v_self, PyObject *__pyx_v_state); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration_8__str__(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration_10set_no_candidates(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration *__pyx_v_self, int __pyx_v_value); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration_12no_further_candidates(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration *__pyx_v_self); /* proto */ +static int __pyx_pf_7sklearn_5earth_7_record_25FirstForwardPassIteration___init__(struct __pyx_obj_7sklearn_5earth_7_record_FirstForwardPassIteration *__pyx_v_self, __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_v_mse); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_25FirstForwardPassIteration_2__reduce__(struct __pyx_obj_7sklearn_5earth_7_record_FirstForwardPassIteration *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_25FirstForwardPassIteration_4_getstate(struct __pyx_obj_7sklearn_5earth_7_record_FirstForwardPassIteration *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_25FirstForwardPassIteration_6__setstate__(struct __pyx_obj_7sklearn_5earth_7_record_FirstForwardPassIteration *__pyx_v_self, PyObject *__pyx_v_state); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_25FirstForwardPassIteration_8get_size(struct __pyx_obj_7sklearn_5earth_7_record_FirstForwardPassIteration *__pyx_v_self); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_7_record_25FirstForwardPassIteration_10__str__(struct __pyx_obj_7sklearn_5earth_7_record_FirstForwardPassIteration *__pyx_v_self); /* proto */ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ -static PyObject *__pyx_tp_new_7_record_Record(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7_record_PruningPassRecord(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7_record_ForwardPassRecord(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7_record_Iteration(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7_record_PruningPassIteration(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7_record_FirstPruningPassIteration(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7_record_ForwardPassIteration(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static PyObject *__pyx_tp_new_7_record_FirstForwardPassIteration(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7sklearn_5earth_7_record_Iteration(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7sklearn_5earth_7_record_ForwardPassIteration(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7sklearn_5earth_7_record_Record(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7sklearn_5earth_7_record_ForwardPassRecord(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7sklearn_5earth_7_record_PruningPassIteration(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7sklearn_5earth_7_record_FirstPruningPassIteration(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7sklearn_5earth_7_record_FirstForwardPassIteration(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ +static PyObject *__pyx_tp_new_7sklearn_5earth_7_record_PruningPassRecord(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ static char __pyx_k_1[] = ""; static char __pyx_k_2[] = "Pruning Pass\n"; static char __pyx_k_3[] = "iter\tbf\tterms\tmse\tgcv\trsq\tgrsq"; @@ -1845,6 +1849,7 @@ static char __pyx_k__pruned[] = "pruned"; static char __pyx_k__get_mse[] = "get_mse"; static char __pyx_k__penalty[] = "penalty"; static char __pyx_k__unprune[] = "unprune"; +static char __pyx_k__xlabels[] = "xlabels"; static char __pyx_k____main__[] = "__main__"; static char __pyx_k____test__[] = "__test__"; static char __pyx_k___forward[] = "_forward"; @@ -1865,6 +1870,7 @@ static char __pyx_k__get_selected[] = "get_selected"; static char __pyx_k__set_selected[] = "set_selected"; static char __pyx_k__num_variables[] = "num_variables"; static char __pyx_k__NotImplemented[] = "NotImplemented"; +static char __pyx_k____pyx_vtable__[] = "__pyx_vtable__"; static char __pyx_k__set_no_candidates[] = "set_no_candidates"; static char __pyx_k__stopping_conditions[] = "stopping_conditions"; static PyObject *__pyx_kp_s_1; @@ -1896,6 +1902,7 @@ static PyObject *__pyx_n_s__ValueError; static PyObject *__pyx_n_s____class__; static PyObject *__pyx_n_s____import__; static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____pyx_vtable__; static PyObject *__pyx_n_s____test__; static PyObject *__pyx_n_s___eq; static PyObject *__pyx_n_s___forward; @@ -1931,6 +1938,7 @@ static PyObject *__pyx_n_s__terms; static PyObject *__pyx_n_s__unprune; static PyObject *__pyx_n_s__var; static PyObject *__pyx_n_s__variable; +static PyObject *__pyx_n_s__xlabels; static PyObject *__pyx_int_0; static PyObject *__pyx_int_1; static PyObject *__pyx_int_2; @@ -1948,8 +1956,8 @@ static PyObject *__pyx_k_tuple_31; static PyObject *__pyx_k_tuple_33; /* Python wrapper */ -static PyObject *__pyx_pw_7_record_6Record_1__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_arg_method); /*proto*/ -static PyObject *__pyx_pw_7_record_6Record_1__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_arg_method) { +static PyObject *__pyx_pw_7sklearn_5earth_7_record_6Record_1__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_arg_method); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_6Record_1__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_arg_method) { PyObject *__pyx_v_method = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -1961,17 +1969,17 @@ static PyObject *__pyx_pw_7_record_6Record_1__richcmp__(PyObject *__pyx_v_self, __Pyx_GOTREF(__pyx_v_method); goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_record.Record.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.Record.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_7_record_6Record___richcmp__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other), ((PyObject *)__pyx_v_method)); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_6Record___richcmp__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other), ((PyObject *)__pyx_v_method)); __Pyx_XDECREF(__pyx_v_method); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":12 +/* "sklearn/earth/_record.pyx":12 * cdef class Record: * * def __richcmp__(self, other, method): # <<<<<<<<<<<<<< @@ -1979,7 +1987,7 @@ static PyObject *__pyx_pw_7_record_6Record_1__richcmp__(PyObject *__pyx_v_self, * return self._eq(other) */ -static PyObject *__pyx_pf_7_record_6Record___richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_method) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_6Record___richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_method) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -1991,7 +1999,7 @@ static PyObject *__pyx_pf_7_record_6Record___richcmp__(PyObject *__pyx_v_self, P int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__richcmp__", 0); - /* "_record.pyx":13 + /* "sklearn/earth/_record.pyx":13 * * def __richcmp__(self, other, method): * if method == 2: # <<<<<<<<<<<<<< @@ -2003,7 +2011,7 @@ static PyObject *__pyx_pf_7_record_6Record___richcmp__(PyObject *__pyx_v_self, P __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "_record.pyx":14 + /* "sklearn/earth/_record.pyx":14 * def __richcmp__(self, other, method): * if method == 2: * return self._eq(other) # <<<<<<<<<<<<<< @@ -2028,7 +2036,7 @@ static PyObject *__pyx_pf_7_record_6Record___richcmp__(PyObject *__pyx_v_self, P goto __pyx_L3; } - /* "_record.pyx":15 + /* "sklearn/earth/_record.pyx":15 * if method == 2: * return self._eq(other) * elif method == 3: # <<<<<<<<<<<<<< @@ -2040,7 +2048,7 @@ static PyObject *__pyx_pf_7_record_6Record___richcmp__(PyObject *__pyx_v_self, P __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_2) { - /* "_record.pyx":16 + /* "sklearn/earth/_record.pyx":16 * return self._eq(other) * elif method == 3: * return not self._eq(other) # <<<<<<<<<<<<<< @@ -2070,7 +2078,7 @@ static PyObject *__pyx_pf_7_record_6Record___richcmp__(PyObject *__pyx_v_self, P } /*else*/ { - /* "_record.pyx":18 + /* "sklearn/earth/_record.pyx":18 * return not self._eq(other) * else: * return NotImplemented # <<<<<<<<<<<<<< @@ -2090,7 +2098,7 @@ static PyObject *__pyx_pf_7_record_6Record___richcmp__(PyObject *__pyx_v_self, P __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_record.Record.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.Record.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2099,17 +2107,17 @@ static PyObject *__pyx_pf_7_record_6Record___richcmp__(PyObject *__pyx_v_self, P } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_6Record_3_eq(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ -static PyObject *__pyx_pw_7_record_6Record_3_eq(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { +static PyObject *__pyx_pw_7sklearn_5earth_7_record_6Record_3_eq(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_6Record_3_eq(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_eq (wrapper)", 0); - __pyx_r = __pyx_pf_7_record_6Record_2_eq(((struct __pyx_obj_7_record_Record *)__pyx_v_self), ((PyObject *)__pyx_v_other)); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_6Record_2_eq(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self), ((PyObject *)__pyx_v_other)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":20 +/* "sklearn/earth/_record.pyx":20 * return NotImplemented * * def _eq(self, other): # <<<<<<<<<<<<<< @@ -2117,7 +2125,7 @@ static PyObject *__pyx_pw_7_record_6Record_3_eq(PyObject *__pyx_v_self, PyObject * */ -static PyObject *__pyx_pf_7_record_6Record_2_eq(struct __pyx_obj_7_record_Record *__pyx_v_self, PyObject *__pyx_v_other) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_6Record_2_eq(struct __pyx_obj_7sklearn_5earth_7_record_Record *__pyx_v_self, PyObject *__pyx_v_other) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -2130,7 +2138,7 @@ static PyObject *__pyx_pf_7_record_6Record_2_eq(struct __pyx_obj_7_record_Record int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_eq", 0); - /* "_record.pyx":21 + /* "sklearn/earth/_record.pyx":21 * * def _eq(self, other): * return self.__class__ is other.__class__ and self._getstate() == other._getstate() # <<<<<<<<<<<<<< @@ -2180,7 +2188,7 @@ static PyObject *__pyx_pf_7_record_6Record_2_eq(struct __pyx_obj_7_record_Record __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("_record.Record._eq", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.Record._eq", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2189,8 +2197,8 @@ static PyObject *__pyx_pf_7_record_6Record_2_eq(struct __pyx_obj_7_record_Record } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_6Record_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_idx); /*proto*/ -static PyObject *__pyx_pw_7_record_6Record_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_idx) { +static PyObject *__pyx_pw_7sklearn_5earth_7_record_6Record_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_idx); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_6Record_5__getitem__(PyObject *__pyx_v_self, PyObject *__pyx_arg_idx) { int __pyx_v_idx; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -2203,16 +2211,16 @@ static PyObject *__pyx_pw_7_record_6Record_5__getitem__(PyObject *__pyx_v_self, } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_record.Record.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.Record.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_7_record_6Record_4__getitem__(((struct __pyx_obj_7_record_Record *)__pyx_v_self), ((int)__pyx_v_idx)); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_6Record_4__getitem__(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self), ((int)__pyx_v_idx)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":23 +/* "sklearn/earth/_record.pyx":23 * return self.__class__ is other.__class__ and self._getstate() == other._getstate() * * def __getitem__(Record self, int idx): # <<<<<<<<<<<<<< @@ -2220,7 +2228,7 @@ static PyObject *__pyx_pw_7_record_6Record_5__getitem__(PyObject *__pyx_v_self, * */ -static PyObject *__pyx_pf_7_record_6Record_4__getitem__(struct __pyx_obj_7_record_Record *__pyx_v_self, int __pyx_v_idx) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_6Record_4__getitem__(struct __pyx_obj_7sklearn_5earth_7_record_Record *__pyx_v_self, int __pyx_v_idx) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations int __pyx_lineno = 0; @@ -2228,7 +2236,7 @@ static PyObject *__pyx_pf_7_record_6Record_4__getitem__(struct __pyx_obj_7_recor int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getitem__", 0); - /* "_record.pyx":24 + /* "sklearn/earth/_record.pyx":24 * * def __getitem__(Record self, int idx): * return self.iterations[idx] # <<<<<<<<<<<<<< @@ -2247,7 +2255,7 @@ static PyObject *__pyx_pf_7_record_6Record_4__getitem__(struct __pyx_obj_7_recor __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_AddTraceback("_record.Record.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.Record.__getitem__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2256,17 +2264,17 @@ static PyObject *__pyx_pf_7_record_6Record_4__getitem__(struct __pyx_obj_7_recor } /* Python wrapper */ -static Py_ssize_t __pyx_pw_7_record_6Record_7__len__(PyObject *__pyx_v_self); /*proto*/ -static Py_ssize_t __pyx_pw_7_record_6Record_7__len__(PyObject *__pyx_v_self) { +static Py_ssize_t __pyx_pw_7sklearn_5earth_7_record_6Record_7__len__(PyObject *__pyx_v_self); /*proto*/ +static Py_ssize_t __pyx_pw_7sklearn_5earth_7_record_6Record_7__len__(PyObject *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__len__ (wrapper)", 0); - __pyx_r = __pyx_pf_7_record_6Record_6__len__(((struct __pyx_obj_7_record_Record *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_6Record_6__len__(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":26 +/* "sklearn/earth/_record.pyx":26 * return self.iterations[idx] * * def __len__(Record self): # <<<<<<<<<<<<<< @@ -2274,7 +2282,7 @@ static Py_ssize_t __pyx_pw_7_record_6Record_7__len__(PyObject *__pyx_v_self) { * */ -static Py_ssize_t __pyx_pf_7_record_6Record_6__len__(struct __pyx_obj_7_record_Record *__pyx_v_self) { +static Py_ssize_t __pyx_pf_7sklearn_5earth_7_record_6Record_6__len__(struct __pyx_obj_7sklearn_5earth_7_record_Record *__pyx_v_self) { Py_ssize_t __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -2284,7 +2292,7 @@ static Py_ssize_t __pyx_pf_7_record_6Record_6__len__(struct __pyx_obj_7_record_R int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__len__", 0); - /* "_record.pyx":27 + /* "sklearn/earth/_record.pyx":27 * * def __len__(Record self): * return len(self.iterations) # <<<<<<<<<<<<<< @@ -2306,14 +2314,14 @@ static Py_ssize_t __pyx_pf_7_record_6Record_6__len__(struct __pyx_obj_7_record_R goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_record.Record.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.Record.__len__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":29 +/* "sklearn/earth/_record.pyx":29 * return len(self.iterations) * * cpdef append(Record self, Iteration iteration): # <<<<<<<<<<<<<< @@ -2321,8 +2329,8 @@ static Py_ssize_t __pyx_pf_7_record_6Record_6__len__(struct __pyx_obj_7_record_R * */ -static PyObject *__pyx_pw_7_record_6Record_9append(PyObject *__pyx_v_self, PyObject *__pyx_v_iteration); /*proto*/ -static PyObject *__pyx_f_7_record_6Record_append(struct __pyx_obj_7_record_Record *__pyx_v_self, struct __pyx_obj_7_record_Iteration *__pyx_v_iteration, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_7sklearn_5earth_7_record_6Record_9append(PyObject *__pyx_v_self, PyObject *__pyx_v_iteration); /*proto*/ +static PyObject *__pyx_f_7sklearn_5earth_7_record_6Record_append(struct __pyx_obj_7sklearn_5earth_7_record_Record *__pyx_v_self, struct __pyx_obj_7sklearn_5earth_7_record_Iteration *__pyx_v_iteration, int __pyx_skip_dispatch) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -2339,7 +2347,7 @@ static PyObject *__pyx_f_7_record_6Record_append(struct __pyx_obj_7_record_Recor else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__append); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7_record_6Record_9append)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_6Record_9append)) { __Pyx_XDECREF(__pyx_r); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -2357,7 +2365,7 @@ static PyObject *__pyx_f_7_record_6Record_append(struct __pyx_obj_7_record_Recor __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_record.pyx":30 + /* "sklearn/earth/_record.pyx":30 * * cpdef append(Record self, Iteration iteration): * self.iterations.append(iteration) # <<<<<<<<<<<<<< @@ -2376,7 +2384,7 @@ static PyObject *__pyx_f_7_record_6Record_append(struct __pyx_obj_7_record_Recor __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_record.Record.append", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.Record.append", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2385,16 +2393,16 @@ static PyObject *__pyx_f_7_record_6Record_append(struct __pyx_obj_7_record_Recor } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_6Record_9append(PyObject *__pyx_v_self, PyObject *__pyx_v_iteration); /*proto*/ -static PyObject *__pyx_pw_7_record_6Record_9append(PyObject *__pyx_v_self, PyObject *__pyx_v_iteration) { - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; +static PyObject *__pyx_pw_7sklearn_5earth_7_record_6Record_9append(PyObject *__pyx_v_self, PyObject *__pyx_v_iteration); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_6Record_9append(PyObject *__pyx_v_self, PyObject *__pyx_v_iteration) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("append (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_iteration), __pyx_ptype_7_record_Iteration, 1, "iteration", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7_record_6Record_8append(((struct __pyx_obj_7_record_Record *)__pyx_v_self), ((struct __pyx_obj_7_record_Iteration *)__pyx_v_iteration)); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_iteration), __pyx_ptype_7sklearn_5earth_7_record_Iteration, 1, "iteration", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_6Record_8append(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self), ((struct __pyx_obj_7sklearn_5earth_7_record_Iteration *)__pyx_v_iteration)); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -2403,7 +2411,7 @@ static PyObject *__pyx_pw_7_record_6Record_9append(PyObject *__pyx_v_self, PyObj return __pyx_r; } -/* "_record.pyx":29 +/* "sklearn/earth/_record.pyx":29 * return len(self.iterations) * * cpdef append(Record self, Iteration iteration): # <<<<<<<<<<<<<< @@ -2411,7 +2419,7 @@ static PyObject *__pyx_pw_7_record_6Record_9append(PyObject *__pyx_v_self, PyObj * */ -static PyObject *__pyx_pf_7_record_6Record_8append(struct __pyx_obj_7_record_Record *__pyx_v_self, struct __pyx_obj_7_record_Iteration *__pyx_v_iteration) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_6Record_8append(struct __pyx_obj_7sklearn_5earth_7_record_Record *__pyx_v_self, struct __pyx_obj_7sklearn_5earth_7_record_Iteration *__pyx_v_iteration) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -2420,7 +2428,7 @@ static PyObject *__pyx_pf_7_record_6Record_8append(struct __pyx_obj_7_record_Rec int __pyx_clineno = 0; __Pyx_RefNannySetupContext("append", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_7_record_Record *)__pyx_v_self->__pyx_vtab)->append(__pyx_v_self, __pyx_v_iteration, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_7_record_Record *)__pyx_v_self->__pyx_vtab)->append(__pyx_v_self, __pyx_v_iteration, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2430,7 +2438,7 @@ static PyObject *__pyx_pf_7_record_6Record_8append(struct __pyx_obj_7_record_Rec goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_record.Record.append", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.Record.append", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2438,7 +2446,7 @@ static PyObject *__pyx_pf_7_record_6Record_8append(struct __pyx_obj_7_record_Rec return __pyx_r; } -/* "_record.pyx":32 +/* "sklearn/earth/_record.pyx":32 * self.iterations.append(iteration) * * cpdef FLOAT_t mse(Record self, INDEX_t iteration): # <<<<<<<<<<<<<< @@ -2446,14 +2454,14 @@ static PyObject *__pyx_pf_7_record_6Record_8append(struct __pyx_obj_7_record_Rec * */ -static PyObject *__pyx_pw_7_record_6Record_11mse(PyObject *__pyx_v_self, PyObject *__pyx_arg_iteration); /*proto*/ -static __pyx_t_7_record_FLOAT_t __pyx_f_7_record_6Record_mse(struct __pyx_obj_7_record_Record *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_iteration, int __pyx_skip_dispatch) { - __pyx_t_7_record_FLOAT_t __pyx_r; +static PyObject *__pyx_pw_7sklearn_5earth_7_record_6Record_11mse(PyObject *__pyx_v_self, PyObject *__pyx_arg_iteration); /*proto*/ +static __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_f_7sklearn_5earth_7_record_6Record_mse(struct __pyx_obj_7sklearn_5earth_7_record_Record *__pyx_v_self, __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_iteration, int __pyx_skip_dispatch) { + __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - __pyx_t_7_record_FLOAT_t __pyx_t_4; + __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -2464,7 +2472,7 @@ static __pyx_t_7_record_FLOAT_t __pyx_f_7_record_6Record_mse(struct __pyx_obj_7_ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__mse); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7_record_6Record_11mse)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_6Record_11mse)) { __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_iteration); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -2484,7 +2492,7 @@ static __pyx_t_7_record_FLOAT_t __pyx_f_7_record_6Record_mse(struct __pyx_obj_7_ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_record.pyx":33 + /* "sklearn/earth/_record.pyx":33 * * cpdef FLOAT_t mse(Record self, INDEX_t iteration): * return self.iterations[iteration].get_mse() # <<<<<<<<<<<<<< @@ -2511,7 +2519,7 @@ static __pyx_t_7_record_FLOAT_t __pyx_f_7_record_6Record_mse(struct __pyx_obj_7_ __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_WriteUnraisable("_record.Record.mse", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("sklearn.earth._record.Record.mse", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -2519,9 +2527,9 @@ static __pyx_t_7_record_FLOAT_t __pyx_f_7_record_6Record_mse(struct __pyx_obj_7_ } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_6Record_11mse(PyObject *__pyx_v_self, PyObject *__pyx_arg_iteration); /*proto*/ -static PyObject *__pyx_pw_7_record_6Record_11mse(PyObject *__pyx_v_self, PyObject *__pyx_arg_iteration) { - __pyx_t_7_record_INDEX_t __pyx_v_iteration; +static PyObject *__pyx_pw_7sklearn_5earth_7_record_6Record_11mse(PyObject *__pyx_v_self, PyObject *__pyx_arg_iteration); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_6Record_11mse(PyObject *__pyx_v_self, PyObject *__pyx_arg_iteration) { + __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_iteration; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -2533,16 +2541,16 @@ static PyObject *__pyx_pw_7_record_6Record_11mse(PyObject *__pyx_v_self, PyObjec } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_record.Record.mse", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.Record.mse", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_7_record_6Record_10mse(((struct __pyx_obj_7_record_Record *)__pyx_v_self), ((__pyx_t_7_record_INDEX_t)__pyx_v_iteration)); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_6Record_10mse(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self), ((__pyx_t_7sklearn_5earth_7_record_INDEX_t)__pyx_v_iteration)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":32 +/* "sklearn/earth/_record.pyx":32 * self.iterations.append(iteration) * * cpdef FLOAT_t mse(Record self, INDEX_t iteration): # <<<<<<<<<<<<<< @@ -2550,7 +2558,7 @@ static PyObject *__pyx_pw_7_record_6Record_11mse(PyObject *__pyx_v_self, PyObjec * */ -static PyObject *__pyx_pf_7_record_6Record_10mse(struct __pyx_obj_7_record_Record *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_iteration) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_6Record_10mse(struct __pyx_obj_7sklearn_5earth_7_record_Record *__pyx_v_self, __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_iteration) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -2559,7 +2567,7 @@ static PyObject *__pyx_pf_7_record_6Record_10mse(struct __pyx_obj_7_record_Recor int __pyx_clineno = 0; __Pyx_RefNannySetupContext("mse", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7_record_Record *)__pyx_v_self->__pyx_vtab)->mse(__pyx_v_self, __pyx_v_iteration, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_Record *)__pyx_v_self->__pyx_vtab)->mse(__pyx_v_self, __pyx_v_iteration, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2569,7 +2577,7 @@ static PyObject *__pyx_pf_7_record_6Record_10mse(struct __pyx_obj_7_record_Recor goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_record.Record.mse", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.Record.mse", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2577,7 +2585,7 @@ static PyObject *__pyx_pf_7_record_6Record_10mse(struct __pyx_obj_7_record_Recor return __pyx_r; } -/* "_record.pyx":35 +/* "sklearn/earth/_record.pyx":35 * return self.iterations[iteration].get_mse() * * cpdef FLOAT_t gcv(Record self, INDEX_t iteration): # <<<<<<<<<<<<<< @@ -2585,16 +2593,16 @@ static PyObject *__pyx_pf_7_record_6Record_10mse(struct __pyx_obj_7_record_Recor * cdef FLOAT_t mse = it.mse */ -static PyObject *__pyx_pw_7_record_6Record_13gcv(PyObject *__pyx_v_self, PyObject *__pyx_arg_iteration); /*proto*/ -static __pyx_t_7_record_FLOAT_t __pyx_f_7_record_6Record_gcv(struct __pyx_obj_7_record_Record *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_iteration, int __pyx_skip_dispatch) { - struct __pyx_obj_7_record_Iteration *__pyx_v_it = 0; - __pyx_t_7_record_FLOAT_t __pyx_v_mse; - __pyx_t_7_record_FLOAT_t __pyx_r; +static PyObject *__pyx_pw_7sklearn_5earth_7_record_6Record_13gcv(PyObject *__pyx_v_self, PyObject *__pyx_arg_iteration); /*proto*/ +static __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_f_7sklearn_5earth_7_record_6Record_gcv(struct __pyx_obj_7sklearn_5earth_7_record_Record *__pyx_v_self, __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_iteration, int __pyx_skip_dispatch) { + struct __pyx_obj_7sklearn_5earth_7_record_Iteration *__pyx_v_it = 0; + __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_v_mse; + __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - __pyx_t_7_record_FLOAT_t __pyx_t_4; + __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -2605,7 +2613,7 @@ static __pyx_t_7_record_FLOAT_t __pyx_f_7_record_6Record_gcv(struct __pyx_obj_7_ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__gcv); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7_record_6Record_13gcv)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_6Record_13gcv)) { __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_iteration); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -2625,7 +2633,7 @@ static __pyx_t_7_record_FLOAT_t __pyx_f_7_record_6Record_gcv(struct __pyx_obj_7_ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_record.pyx":36 + /* "sklearn/earth/_record.pyx":36 * * cpdef FLOAT_t gcv(Record self, INDEX_t iteration): * cdef Iteration it = self.iterations[iteration] # <<<<<<<<<<<<<< @@ -2636,13 +2644,13 @@ static __pyx_t_7_record_FLOAT_t __pyx_f_7_record_6Record_gcv(struct __pyx_obj_7_ PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - if (!(likely(((PyList_GET_ITEM(__pyx_v_self->iterations, __pyx_v_iteration)) == Py_None) || likely(__Pyx_TypeTest(PyList_GET_ITEM(__pyx_v_self->iterations, __pyx_v_iteration), __pyx_ptype_7_record_Iteration))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((PyList_GET_ITEM(__pyx_v_self->iterations, __pyx_v_iteration)) == Py_None) || likely(__Pyx_TypeTest(PyList_GET_ITEM(__pyx_v_self->iterations, __pyx_v_iteration), __pyx_ptype_7sklearn_5earth_7_record_Iteration))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_1 = PyList_GET_ITEM(__pyx_v_self->iterations, __pyx_v_iteration); __Pyx_INCREF(__pyx_t_1); - __pyx_v_it = ((struct __pyx_obj_7_record_Iteration *)__pyx_t_1); + __pyx_v_it = ((struct __pyx_obj_7sklearn_5earth_7_record_Iteration *)__pyx_t_1); __pyx_t_1 = 0; - /* "_record.pyx":37 + /* "sklearn/earth/_record.pyx":37 * cpdef FLOAT_t gcv(Record self, INDEX_t iteration): * cdef Iteration it = self.iterations[iteration] * cdef FLOAT_t mse = it.mse # <<<<<<<<<<<<<< @@ -2652,14 +2660,14 @@ static __pyx_t_7_record_FLOAT_t __pyx_f_7_record_6Record_gcv(struct __pyx_obj_7_ __pyx_t_4 = __pyx_v_it->mse; __pyx_v_mse = __pyx_t_4; - /* "_record.pyx":38 + /* "sklearn/earth/_record.pyx":38 * cdef Iteration it = self.iterations[iteration] * cdef FLOAT_t mse = it.mse * return gcv(mse,it.get_size(),self.num_samples,self.penalty) # <<<<<<<<<<<<<< * * cpdef FLOAT_t rsq(Record self, INDEX_t iteration): */ - __pyx_r = __pyx_f_5_util_gcv(__pyx_v_mse, ((struct __pyx_vtabstruct_7_record_Iteration *)__pyx_v_it->__pyx_vtab)->get_size(__pyx_v_it, 0), __pyx_v_self->num_samples, __pyx_v_self->penalty, 0); + __pyx_r = __pyx_f_7sklearn_5earth_5_util_gcv(__pyx_v_mse, ((struct __pyx_vtabstruct_7sklearn_5earth_7_record_Iteration *)__pyx_v_it->__pyx_vtab)->get_size(__pyx_v_it, 0), __pyx_v_self->num_samples, __pyx_v_self->penalty, 0); goto __pyx_L0; __pyx_r = 0; @@ -2668,7 +2676,7 @@ static __pyx_t_7_record_FLOAT_t __pyx_f_7_record_6Record_gcv(struct __pyx_obj_7_ __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_WriteUnraisable("_record.Record.gcv", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("sklearn.earth._record.Record.gcv", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF((PyObject *)__pyx_v_it); @@ -2677,9 +2685,9 @@ static __pyx_t_7_record_FLOAT_t __pyx_f_7_record_6Record_gcv(struct __pyx_obj_7_ } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_6Record_13gcv(PyObject *__pyx_v_self, PyObject *__pyx_arg_iteration); /*proto*/ -static PyObject *__pyx_pw_7_record_6Record_13gcv(PyObject *__pyx_v_self, PyObject *__pyx_arg_iteration) { - __pyx_t_7_record_INDEX_t __pyx_v_iteration; +static PyObject *__pyx_pw_7sklearn_5earth_7_record_6Record_13gcv(PyObject *__pyx_v_self, PyObject *__pyx_arg_iteration); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_6Record_13gcv(PyObject *__pyx_v_self, PyObject *__pyx_arg_iteration) { + __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_iteration; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -2691,16 +2699,16 @@ static PyObject *__pyx_pw_7_record_6Record_13gcv(PyObject *__pyx_v_self, PyObjec } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_record.Record.gcv", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.Record.gcv", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_7_record_6Record_12gcv(((struct __pyx_obj_7_record_Record *)__pyx_v_self), ((__pyx_t_7_record_INDEX_t)__pyx_v_iteration)); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_6Record_12gcv(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self), ((__pyx_t_7sklearn_5earth_7_record_INDEX_t)__pyx_v_iteration)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":35 +/* "sklearn/earth/_record.pyx":35 * return self.iterations[iteration].get_mse() * * cpdef FLOAT_t gcv(Record self, INDEX_t iteration): # <<<<<<<<<<<<<< @@ -2708,7 +2716,7 @@ static PyObject *__pyx_pw_7_record_6Record_13gcv(PyObject *__pyx_v_self, PyObjec * cdef FLOAT_t mse = it.mse */ -static PyObject *__pyx_pf_7_record_6Record_12gcv(struct __pyx_obj_7_record_Record *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_iteration) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_6Record_12gcv(struct __pyx_obj_7sklearn_5earth_7_record_Record *__pyx_v_self, __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_iteration) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -2717,7 +2725,7 @@ static PyObject *__pyx_pf_7_record_6Record_12gcv(struct __pyx_obj_7_record_Recor int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gcv", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7_record_Record *)__pyx_v_self->__pyx_vtab)->gcv(__pyx_v_self, __pyx_v_iteration, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_Record *)__pyx_v_self->__pyx_vtab)->gcv(__pyx_v_self, __pyx_v_iteration, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2727,7 +2735,7 @@ static PyObject *__pyx_pf_7_record_6Record_12gcv(struct __pyx_obj_7_record_Recor goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_record.Record.gcv", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.Record.gcv", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2735,7 +2743,7 @@ static PyObject *__pyx_pf_7_record_6Record_12gcv(struct __pyx_obj_7_record_Recor return __pyx_r; } -/* "_record.pyx":40 +/* "sklearn/earth/_record.pyx":40 * return gcv(mse,it.get_size(),self.num_samples,self.penalty) * * cpdef FLOAT_t rsq(Record self, INDEX_t iteration): # <<<<<<<<<<<<<< @@ -2743,16 +2751,16 @@ static PyObject *__pyx_pf_7_record_6Record_12gcv(struct __pyx_obj_7_record_Recor * cdef FLOAT_t mse = self.mse(iteration)#gcv(self.mse(iteration):,self.iterations[iteration].get_size(),self.num_samples,self.penalty)#self.gcv(iteration) */ -static PyObject *__pyx_pw_7_record_6Record_15rsq(PyObject *__pyx_v_self, PyObject *__pyx_arg_iteration); /*proto*/ -static __pyx_t_7_record_FLOAT_t __pyx_f_7_record_6Record_rsq(struct __pyx_obj_7_record_Record *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_iteration, int __pyx_skip_dispatch) { - __pyx_t_7_record_FLOAT_t __pyx_v_mse0; - __pyx_t_7_record_FLOAT_t __pyx_v_mse; - __pyx_t_7_record_FLOAT_t __pyx_r; +static PyObject *__pyx_pw_7sklearn_5earth_7_record_6Record_15rsq(PyObject *__pyx_v_self, PyObject *__pyx_arg_iteration); /*proto*/ +static __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_f_7sklearn_5earth_7_record_6Record_rsq(struct __pyx_obj_7sklearn_5earth_7_record_Record *__pyx_v_self, __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_iteration, int __pyx_skip_dispatch) { + __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_v_mse0; + __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_v_mse; + __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - __pyx_t_7_record_FLOAT_t __pyx_t_4; + __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -2763,7 +2771,7 @@ static __pyx_t_7_record_FLOAT_t __pyx_f_7_record_6Record_rsq(struct __pyx_obj_7_ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__rsq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7_record_6Record_15rsq)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_6Record_15rsq)) { __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_iteration); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -2783,7 +2791,7 @@ static __pyx_t_7_record_FLOAT_t __pyx_f_7_record_6Record_rsq(struct __pyx_obj_7_ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_record.pyx":41 + /* "sklearn/earth/_record.pyx":41 * * cpdef FLOAT_t rsq(Record self, INDEX_t iteration): * cdef FLOAT_t mse0 = self.sst#gcv(self.sst,1,self.num_samples,self.penalty) # <<<<<<<<<<<<<< @@ -2793,16 +2801,16 @@ static __pyx_t_7_record_FLOAT_t __pyx_f_7_record_6Record_rsq(struct __pyx_obj_7_ __pyx_t_4 = __pyx_v_self->sst; __pyx_v_mse0 = __pyx_t_4; - /* "_record.pyx":42 + /* "sklearn/earth/_record.pyx":42 * cpdef FLOAT_t rsq(Record self, INDEX_t iteration): * cdef FLOAT_t mse0 = self.sst#gcv(self.sst,1,self.num_samples,self.penalty) * cdef FLOAT_t mse = self.mse(iteration)#gcv(self.mse(iteration):,self.iterations[iteration].get_size(),self.num_samples,self.penalty)#self.gcv(iteration) # <<<<<<<<<<<<<< * return 1 - (mse / mse0) * */ - __pyx_v_mse = ((struct __pyx_vtabstruct_7_record_Record *)__pyx_v_self->__pyx_vtab)->mse(__pyx_v_self, __pyx_v_iteration, 0); + __pyx_v_mse = ((struct __pyx_vtabstruct_7sklearn_5earth_7_record_Record *)__pyx_v_self->__pyx_vtab)->mse(__pyx_v_self, __pyx_v_iteration, 0); - /* "_record.pyx":43 + /* "sklearn/earth/_record.pyx":43 * cdef FLOAT_t mse0 = self.sst#gcv(self.sst,1,self.num_samples,self.penalty) * cdef FLOAT_t mse = self.mse(iteration)#gcv(self.mse(iteration):,self.iterations[iteration].get_size(),self.num_samples,self.penalty)#self.gcv(iteration) * return 1 - (mse / mse0) # <<<<<<<<<<<<<< @@ -2818,7 +2826,7 @@ static __pyx_t_7_record_FLOAT_t __pyx_f_7_record_6Record_rsq(struct __pyx_obj_7_ __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_WriteUnraisable("_record.Record.rsq", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("sklearn.earth._record.Record.rsq", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -2826,9 +2834,9 @@ static __pyx_t_7_record_FLOAT_t __pyx_f_7_record_6Record_rsq(struct __pyx_obj_7_ } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_6Record_15rsq(PyObject *__pyx_v_self, PyObject *__pyx_arg_iteration); /*proto*/ -static PyObject *__pyx_pw_7_record_6Record_15rsq(PyObject *__pyx_v_self, PyObject *__pyx_arg_iteration) { - __pyx_t_7_record_INDEX_t __pyx_v_iteration; +static PyObject *__pyx_pw_7sklearn_5earth_7_record_6Record_15rsq(PyObject *__pyx_v_self, PyObject *__pyx_arg_iteration); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_6Record_15rsq(PyObject *__pyx_v_self, PyObject *__pyx_arg_iteration) { + __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_iteration; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -2840,16 +2848,16 @@ static PyObject *__pyx_pw_7_record_6Record_15rsq(PyObject *__pyx_v_self, PyObjec } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_record.Record.rsq", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.Record.rsq", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_7_record_6Record_14rsq(((struct __pyx_obj_7_record_Record *)__pyx_v_self), ((__pyx_t_7_record_INDEX_t)__pyx_v_iteration)); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_6Record_14rsq(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self), ((__pyx_t_7sklearn_5earth_7_record_INDEX_t)__pyx_v_iteration)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":40 +/* "sklearn/earth/_record.pyx":40 * return gcv(mse,it.get_size(),self.num_samples,self.penalty) * * cpdef FLOAT_t rsq(Record self, INDEX_t iteration): # <<<<<<<<<<<<<< @@ -2857,7 +2865,7 @@ static PyObject *__pyx_pw_7_record_6Record_15rsq(PyObject *__pyx_v_self, PyObjec * cdef FLOAT_t mse = self.mse(iteration)#gcv(self.mse(iteration):,self.iterations[iteration].get_size(),self.num_samples,self.penalty)#self.gcv(iteration) */ -static PyObject *__pyx_pf_7_record_6Record_14rsq(struct __pyx_obj_7_record_Record *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_iteration) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_6Record_14rsq(struct __pyx_obj_7sklearn_5earth_7_record_Record *__pyx_v_self, __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_iteration) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -2866,7 +2874,7 @@ static PyObject *__pyx_pf_7_record_6Record_14rsq(struct __pyx_obj_7_record_Recor int __pyx_clineno = 0; __Pyx_RefNannySetupContext("rsq", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7_record_Record *)__pyx_v_self->__pyx_vtab)->rsq(__pyx_v_self, __pyx_v_iteration, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_Record *)__pyx_v_self->__pyx_vtab)->rsq(__pyx_v_self, __pyx_v_iteration, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2876,7 +2884,7 @@ static PyObject *__pyx_pf_7_record_6Record_14rsq(struct __pyx_obj_7_record_Recor goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_record.Record.rsq", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.Record.rsq", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2884,7 +2892,7 @@ static PyObject *__pyx_pf_7_record_6Record_14rsq(struct __pyx_obj_7_record_Recor return __pyx_r; } -/* "_record.pyx":45 +/* "sklearn/earth/_record.pyx":45 * return 1 - (mse / mse0) * * cpdef FLOAT_t grsq(Record self, INDEX_t iteration): # <<<<<<<<<<<<<< @@ -2892,16 +2900,16 @@ static PyObject *__pyx_pf_7_record_6Record_14rsq(struct __pyx_obj_7_record_Recor * cdef FLOAT_t gcv_ = self.gcv(iteration) */ -static PyObject *__pyx_pw_7_record_6Record_17grsq(PyObject *__pyx_v_self, PyObject *__pyx_arg_iteration); /*proto*/ -static __pyx_t_7_record_FLOAT_t __pyx_f_7_record_6Record_grsq(struct __pyx_obj_7_record_Record *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_iteration, int __pyx_skip_dispatch) { - __pyx_t_7_record_FLOAT_t __pyx_v_gcv0; - __pyx_t_7_record_FLOAT_t __pyx_v_gcv_; - __pyx_t_7_record_FLOAT_t __pyx_r; +static PyObject *__pyx_pw_7sklearn_5earth_7_record_6Record_17grsq(PyObject *__pyx_v_self, PyObject *__pyx_arg_iteration); /*proto*/ +static __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_f_7sklearn_5earth_7_record_6Record_grsq(struct __pyx_obj_7sklearn_5earth_7_record_Record *__pyx_v_self, __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_iteration, int __pyx_skip_dispatch) { + __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_v_gcv0; + __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_v_gcv_; + __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - __pyx_t_7_record_FLOAT_t __pyx_t_4; + __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -2912,7 +2920,7 @@ static __pyx_t_7_record_FLOAT_t __pyx_f_7_record_6Record_grsq(struct __pyx_obj_7 else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__grsq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7_record_6Record_17grsq)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_6Record_17grsq)) { __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_iteration); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -2932,25 +2940,25 @@ static __pyx_t_7_record_FLOAT_t __pyx_f_7_record_6Record_grsq(struct __pyx_obj_7 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_record.pyx":46 + /* "sklearn/earth/_record.pyx":46 * * cpdef FLOAT_t grsq(Record self, INDEX_t iteration): * cdef FLOAT_t gcv0 = gcv(self.sst,1,self.num_samples,self.penalty) # <<<<<<<<<<<<<< * cdef FLOAT_t gcv_ = self.gcv(iteration) * return 1 - (gcv_/gcv0) */ - __pyx_v_gcv0 = __pyx_f_5_util_gcv(__pyx_v_self->sst, 1, __pyx_v_self->num_samples, __pyx_v_self->penalty, 0); + __pyx_v_gcv0 = __pyx_f_7sklearn_5earth_5_util_gcv(__pyx_v_self->sst, 1, __pyx_v_self->num_samples, __pyx_v_self->penalty, 0); - /* "_record.pyx":47 + /* "sklearn/earth/_record.pyx":47 * cpdef FLOAT_t grsq(Record self, INDEX_t iteration): * cdef FLOAT_t gcv0 = gcv(self.sst,1,self.num_samples,self.penalty) * cdef FLOAT_t gcv_ = self.gcv(iteration) # <<<<<<<<<<<<<< * return 1 - (gcv_/gcv0) * */ - __pyx_v_gcv_ = ((struct __pyx_vtabstruct_7_record_Record *)__pyx_v_self->__pyx_vtab)->gcv(__pyx_v_self, __pyx_v_iteration, 0); + __pyx_v_gcv_ = ((struct __pyx_vtabstruct_7sklearn_5earth_7_record_Record *)__pyx_v_self->__pyx_vtab)->gcv(__pyx_v_self, __pyx_v_iteration, 0); - /* "_record.pyx":48 + /* "sklearn/earth/_record.pyx":48 * cdef FLOAT_t gcv0 = gcv(self.sst,1,self.num_samples,self.penalty) * cdef FLOAT_t gcv_ = self.gcv(iteration) * return 1 - (gcv_/gcv0) # <<<<<<<<<<<<<< @@ -2966,7 +2974,7 @@ static __pyx_t_7_record_FLOAT_t __pyx_f_7_record_6Record_grsq(struct __pyx_obj_7 __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_WriteUnraisable("_record.Record.grsq", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("sklearn.earth._record.Record.grsq", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -2974,9 +2982,9 @@ static __pyx_t_7_record_FLOAT_t __pyx_f_7_record_6Record_grsq(struct __pyx_obj_7 } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_6Record_17grsq(PyObject *__pyx_v_self, PyObject *__pyx_arg_iteration); /*proto*/ -static PyObject *__pyx_pw_7_record_6Record_17grsq(PyObject *__pyx_v_self, PyObject *__pyx_arg_iteration) { - __pyx_t_7_record_INDEX_t __pyx_v_iteration; +static PyObject *__pyx_pw_7sklearn_5earth_7_record_6Record_17grsq(PyObject *__pyx_v_self, PyObject *__pyx_arg_iteration); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_6Record_17grsq(PyObject *__pyx_v_self, PyObject *__pyx_arg_iteration) { + __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_iteration; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -2988,16 +2996,16 @@ static PyObject *__pyx_pw_7_record_6Record_17grsq(PyObject *__pyx_v_self, PyObje } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_record.Record.grsq", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.Record.grsq", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_7_record_6Record_16grsq(((struct __pyx_obj_7_record_Record *)__pyx_v_self), ((__pyx_t_7_record_INDEX_t)__pyx_v_iteration)); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_6Record_16grsq(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self), ((__pyx_t_7sklearn_5earth_7_record_INDEX_t)__pyx_v_iteration)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":45 +/* "sklearn/earth/_record.pyx":45 * return 1 - (mse / mse0) * * cpdef FLOAT_t grsq(Record self, INDEX_t iteration): # <<<<<<<<<<<<<< @@ -3005,7 +3013,7 @@ static PyObject *__pyx_pw_7_record_6Record_17grsq(PyObject *__pyx_v_self, PyObje * cdef FLOAT_t gcv_ = self.gcv(iteration) */ -static PyObject *__pyx_pf_7_record_6Record_16grsq(struct __pyx_obj_7_record_Record *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_iteration) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_6Record_16grsq(struct __pyx_obj_7sklearn_5earth_7_record_Record *__pyx_v_self, __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_iteration) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3014,7 +3022,7 @@ static PyObject *__pyx_pf_7_record_6Record_16grsq(struct __pyx_obj_7_record_Reco int __pyx_clineno = 0; __Pyx_RefNannySetupContext("grsq", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7_record_Record *)__pyx_v_self->__pyx_vtab)->grsq(__pyx_v_self, __pyx_v_iteration, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_Record *)__pyx_v_self->__pyx_vtab)->grsq(__pyx_v_self, __pyx_v_iteration, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3024,7 +3032,7 @@ static PyObject *__pyx_pf_7_record_6Record_16grsq(struct __pyx_obj_7_record_Reco goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_record.Record.grsq", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.Record.grsq", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3033,14 +3041,14 @@ static PyObject *__pyx_pf_7_record_6Record_16grsq(struct __pyx_obj_7_record_Reco } /* Python wrapper */ -static int __pyx_pw_7_record_17PruningPassRecord_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_7_record_17PruningPassRecord_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __pyx_t_7_record_INDEX_t __pyx_v_num_samples; - __pyx_t_7_record_INDEX_t __pyx_v_num_variables; - __pyx_t_7_record_FLOAT_t __pyx_v_penalty; - __pyx_t_7_record_FLOAT_t __pyx_v_sst; - __pyx_t_7_record_INDEX_t __pyx_v_size; - __pyx_t_7_record_FLOAT_t __pyx_v_mse; +static int __pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_num_samples; + __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_num_variables; + __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_v_penalty; + __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_v_sst; + __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_size; + __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_v_mse; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -3118,16 +3126,16 @@ static int __pyx_pw_7_record_17PruningPassRecord_1__init__(PyObject *__pyx_v_sel __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_record.PruningPassRecord.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.PruningPassRecord.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_7_record_17PruningPassRecord___init__(((struct __pyx_obj_7_record_PruningPassRecord *)__pyx_v_self), __pyx_v_num_samples, __pyx_v_num_variables, __pyx_v_penalty, __pyx_v_sst, __pyx_v_size, __pyx_v_mse); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord___init__(((struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_v_self), __pyx_v_num_samples, __pyx_v_num_variables, __pyx_v_penalty, __pyx_v_sst, __pyx_v_size, __pyx_v_mse); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":51 +/* "sklearn/earth/_record.pyx":51 * * cdef class PruningPassRecord(Record): * def __init__(PruningPassRecord self, INDEX_t num_samples, INDEX_t num_variables, FLOAT_t penalty, FLOAT_t sst, INDEX_t size, FLOAT_t mse): # <<<<<<<<<<<<<< @@ -3135,7 +3143,7 @@ static int __pyx_pw_7_record_17PruningPassRecord_1__init__(PyObject *__pyx_v_sel * self.num_variables = num_variables */ -static int __pyx_pf_7_record_17PruningPassRecord___init__(struct __pyx_obj_7_record_PruningPassRecord *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_num_samples, __pyx_t_7_record_INDEX_t __pyx_v_num_variables, __pyx_t_7_record_FLOAT_t __pyx_v_penalty, __pyx_t_7_record_FLOAT_t __pyx_v_sst, __pyx_t_7_record_INDEX_t __pyx_v_size, __pyx_t_7_record_FLOAT_t __pyx_v_mse) { +static int __pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord___init__(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *__pyx_v_self, __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_num_samples, __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_num_variables, __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_v_penalty, __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_v_sst, __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_size, __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_v_mse) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3146,7 +3154,7 @@ static int __pyx_pf_7_record_17PruningPassRecord___init__(struct __pyx_obj_7_rec int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "_record.pyx":52 + /* "sklearn/earth/_record.pyx":52 * cdef class PruningPassRecord(Record): * def __init__(PruningPassRecord self, INDEX_t num_samples, INDEX_t num_variables, FLOAT_t penalty, FLOAT_t sst, INDEX_t size, FLOAT_t mse): * self.num_samples = num_samples # <<<<<<<<<<<<<< @@ -3155,7 +3163,7 @@ static int __pyx_pf_7_record_17PruningPassRecord___init__(struct __pyx_obj_7_rec */ __pyx_v_self->__pyx_base.num_samples = __pyx_v_num_samples; - /* "_record.pyx":53 + /* "sklearn/earth/_record.pyx":53 * def __init__(PruningPassRecord self, INDEX_t num_samples, INDEX_t num_variables, FLOAT_t penalty, FLOAT_t sst, INDEX_t size, FLOAT_t mse): * self.num_samples = num_samples * self.num_variables = num_variables # <<<<<<<<<<<<<< @@ -3164,7 +3172,7 @@ static int __pyx_pf_7_record_17PruningPassRecord___init__(struct __pyx_obj_7_rec */ __pyx_v_self->__pyx_base.num_variables = __pyx_v_num_variables; - /* "_record.pyx":54 + /* "sklearn/earth/_record.pyx":54 * self.num_samples = num_samples * self.num_variables = num_variables * self.penalty = penalty # <<<<<<<<<<<<<< @@ -3173,7 +3181,7 @@ static int __pyx_pf_7_record_17PruningPassRecord___init__(struct __pyx_obj_7_rec */ __pyx_v_self->__pyx_base.penalty = __pyx_v_penalty; - /* "_record.pyx":55 + /* "sklearn/earth/_record.pyx":55 * self.num_variables = num_variables * self.penalty = penalty * self.sst = sst # <<<<<<<<<<<<<< @@ -3182,7 +3190,7 @@ static int __pyx_pf_7_record_17PruningPassRecord___init__(struct __pyx_obj_7_rec */ __pyx_v_self->__pyx_base.sst = __pyx_v_sst; - /* "_record.pyx":56 + /* "sklearn/earth/_record.pyx":56 * self.penalty = penalty * self.sst = sst * self.iterations = [FirstPruningPassIteration(size, mse)] # <<<<<<<<<<<<<< @@ -3201,7 +3209,7 @@ static int __pyx_pf_7_record_17PruningPassRecord___init__(struct __pyx_obj_7_rec __Pyx_GIVEREF(__pyx_t_2); __pyx_t_1 = 0; __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7_record_FirstPruningPassIteration)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_FirstPruningPassIteration)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -3221,7 +3229,7 @@ static int __pyx_pf_7_record_17PruningPassRecord___init__(struct __pyx_obj_7_rec __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_record.PruningPassRecord.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.PruningPassRecord.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -3229,17 +3237,17 @@ static int __pyx_pf_7_record_17PruningPassRecord___init__(struct __pyx_obj_7_rec } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_17PruningPassRecord_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7_record_17PruningPassRecord_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); - __pyx_r = __pyx_pf_7_record_17PruningPassRecord_2__reduce__(((struct __pyx_obj_7_record_PruningPassRecord *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_2__reduce__(((struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":58 +/* "sklearn/earth/_record.pyx":58 * self.iterations = [FirstPruningPassIteration(size, mse)] * * def __reduce__(PruningPassRecord self): # <<<<<<<<<<<<<< @@ -3247,7 +3255,7 @@ static PyObject *__pyx_pw_7_record_17PruningPassRecord_3__reduce__(PyObject *__p * */ -static PyObject *__pyx_pf_7_record_17PruningPassRecord_2__reduce__(struct __pyx_obj_7_record_PruningPassRecord *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_2__reduce__(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3259,7 +3267,7 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_2__reduce__(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce__", 0); - /* "_record.pyx":59 + /* "sklearn/earth/_record.pyx":59 * * def __reduce__(PruningPassRecord self): * return (PruningPassRecord, (1,1,1.0,1.0,1,1.0), self._getstate()) # <<<<<<<<<<<<<< @@ -3300,9 +3308,9 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_2__reduce__(struct __pyx_ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7_record_PruningPassRecord))); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((PyObject*)__pyx_ptype_7_record_PruningPassRecord))); - __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7_record_PruningPassRecord))); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_PruningPassRecord))); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_PruningPassRecord))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_PruningPassRecord))); PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_t_4)); __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); @@ -3320,7 +3328,7 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_2__reduce__(struct __pyx_ __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_record.PruningPassRecord.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.PruningPassRecord.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3329,17 +3337,17 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_2__reduce__(struct __pyx_ } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_17PruningPassRecord_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7_record_17PruningPassRecord_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_getstate (wrapper)", 0); - __pyx_r = __pyx_pf_7_record_17PruningPassRecord_4_getstate(((struct __pyx_obj_7_record_PruningPassRecord *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_4_getstate(((struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":61 +/* "sklearn/earth/_record.pyx":61 * return (PruningPassRecord, (1,1,1.0,1.0,1,1.0), self._getstate()) * * def _getstate(PruningPassRecord self): # <<<<<<<<<<<<<< @@ -3347,7 +3355,7 @@ static PyObject *__pyx_pw_7_record_17PruningPassRecord_5_getstate(PyObject *__py * 'num_variables': self.num_variables, */ -static PyObject *__pyx_pf_7_record_17PruningPassRecord_4_getstate(struct __pyx_obj_7_record_PruningPassRecord *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_4_getstate(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *__pyx_v_self) { PyObject *__pyx_v_result = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -3358,7 +3366,7 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_4_getstate(struct __pyx_o int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_getstate", 0); - /* "_record.pyx":62 + /* "sklearn/earth/_record.pyx":62 * * def _getstate(PruningPassRecord self): * result = {'num_samples': self.num_samples, # <<<<<<<<<<<<<< @@ -3372,7 +3380,7 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_4_getstate(struct __pyx_o if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__num_samples), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "_record.pyx":63 + /* "sklearn/earth/_record.pyx":63 * def _getstate(PruningPassRecord self): * result = {'num_samples': self.num_samples, * 'num_variables': self.num_variables, # <<<<<<<<<<<<<< @@ -3384,7 +3392,7 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_4_getstate(struct __pyx_o if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__num_variables), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "_record.pyx":64 + /* "sklearn/earth/_record.pyx":64 * result = {'num_samples': self.num_samples, * 'num_variables': self.num_variables, * 'penalty': self.penalty, # <<<<<<<<<<<<<< @@ -3396,7 +3404,7 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_4_getstate(struct __pyx_o if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__penalty), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "_record.pyx":65 + /* "sklearn/earth/_record.pyx":65 * 'num_variables': self.num_variables, * 'penalty': self.penalty, * 'sst': self.sst, # <<<<<<<<<<<<<< @@ -3408,7 +3416,7 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_4_getstate(struct __pyx_o if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__sst), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "_record.pyx":66 + /* "sklearn/earth/_record.pyx":66 * 'penalty': self.penalty, * 'sst': self.sst, * 'iterations': self.iterations, # <<<<<<<<<<<<<< @@ -3417,7 +3425,7 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_4_getstate(struct __pyx_o */ if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__iterations), ((PyObject *)__pyx_v_self->__pyx_base.iterations)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "_record.pyx":67 + /* "sklearn/earth/_record.pyx":67 * 'sst': self.sst, * 'iterations': self.iterations, * 'selected': self.selected} # <<<<<<<<<<<<<< @@ -3431,7 +3439,7 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_4_getstate(struct __pyx_o __pyx_v_result = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "_record.pyx":68 + /* "sklearn/earth/_record.pyx":68 * 'iterations': self.iterations, * 'selected': self.selected} * return result # <<<<<<<<<<<<<< @@ -3448,7 +3456,7 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_4_getstate(struct __pyx_o __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_record.PruningPassRecord._getstate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.PruningPassRecord._getstate", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_result); @@ -3458,16 +3466,16 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_4_getstate(struct __pyx_o } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_17PruningPassRecord_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ -static PyObject *__pyx_pw_7_record_17PruningPassRecord_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; +static PyObject *__pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), (&PyDict_Type), 1, "state", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7_record_17PruningPassRecord_6__setstate__(((struct __pyx_obj_7_record_PruningPassRecord *)__pyx_v_self), ((PyObject*)__pyx_v_state)); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_6__setstate__(((struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_v_self), ((PyObject*)__pyx_v_state)); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -3476,7 +3484,7 @@ static PyObject *__pyx_pw_7_record_17PruningPassRecord_7__setstate__(PyObject *_ return __pyx_r; } -/* "_record.pyx":70 +/* "sklearn/earth/_record.pyx":70 * return result * * def __setstate__(PruningPassRecord self, dict state): # <<<<<<<<<<<<<< @@ -3484,19 +3492,19 @@ static PyObject *__pyx_pw_7_record_17PruningPassRecord_7__setstate__(PyObject *_ * self.num_variables = state['num_variables'] */ -static PyObject *__pyx_pf_7_record_17PruningPassRecord_6__setstate__(struct __pyx_obj_7_record_PruningPassRecord *__pyx_v_self, PyObject *__pyx_v_state) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_6__setstate__(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *__pyx_v_self, PyObject *__pyx_v_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; - __pyx_t_7_record_FLOAT_t __pyx_t_3; - __pyx_t_7_record_INDEX_t __pyx_t_4; + __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_t_3; + __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate__", 0); - /* "_record.pyx":71 + /* "sklearn/earth/_record.pyx":71 * * def __setstate__(PruningPassRecord self, dict state): * self.num_samples = state['num_samples'] # <<<<<<<<<<<<<< @@ -3513,7 +3521,7 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_6__setstate__(struct __py __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->__pyx_base.num_samples = __pyx_t_2; - /* "_record.pyx":72 + /* "sklearn/earth/_record.pyx":72 * def __setstate__(PruningPassRecord self, dict state): * self.num_samples = state['num_samples'] * self.num_variables = state['num_variables'] # <<<<<<<<<<<<<< @@ -3530,7 +3538,7 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_6__setstate__(struct __py __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->__pyx_base.num_variables = __pyx_t_2; - /* "_record.pyx":73 + /* "sklearn/earth/_record.pyx":73 * self.num_samples = state['num_samples'] * self.num_variables = state['num_variables'] * self.penalty = state['penalty'] # <<<<<<<<<<<<<< @@ -3547,7 +3555,7 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_6__setstate__(struct __py __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->__pyx_base.penalty = __pyx_t_3; - /* "_record.pyx":74 + /* "sklearn/earth/_record.pyx":74 * self.num_variables = state['num_variables'] * self.penalty = state['penalty'] * self.sst = state['sst'] # <<<<<<<<<<<<<< @@ -3564,7 +3572,7 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_6__setstate__(struct __py __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->__pyx_base.sst = __pyx_t_3; - /* "_record.pyx":75 + /* "sklearn/earth/_record.pyx":75 * self.penalty = state['penalty'] * self.sst = state['sst'] * self.iterations = state['iterations'] # <<<<<<<<<<<<<< @@ -3584,7 +3592,7 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_6__setstate__(struct __py __pyx_v_self->__pyx_base.iterations = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "_record.pyx":76 + /* "sklearn/earth/_record.pyx":76 * self.sst = state['sst'] * self.iterations = state['iterations'] * self.selected = state['selected'] # <<<<<<<<<<<<<< @@ -3605,7 +3613,7 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_6__setstate__(struct __py goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_record.PruningPassRecord.__setstate__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.PruningPassRecord.__setstate__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3613,7 +3621,7 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_6__setstate__(struct __py return __pyx_r; } -/* "_record.pyx":78 +/* "sklearn/earth/_record.pyx":78 * self.selected = state['selected'] * * cpdef set_selected(PruningPassRecord self, INDEX_t selected): # <<<<<<<<<<<<<< @@ -3621,8 +3629,8 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_6__setstate__(struct __py * */ -static PyObject *__pyx_pw_7_record_17PruningPassRecord_9set_selected(PyObject *__pyx_v_self, PyObject *__pyx_arg_selected); /*proto*/ -static PyObject *__pyx_f_7_record_17PruningPassRecord_set_selected(struct __pyx_obj_7_record_PruningPassRecord *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_selected, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_9set_selected(PyObject *__pyx_v_self, PyObject *__pyx_arg_selected); /*proto*/ +static PyObject *__pyx_f_7sklearn_5earth_7_record_17PruningPassRecord_set_selected(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *__pyx_v_self, __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_selected, int __pyx_skip_dispatch) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3638,7 +3646,7 @@ static PyObject *__pyx_f_7_record_17PruningPassRecord_set_selected(struct __pyx_ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__set_selected); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7_record_17PruningPassRecord_9set_selected)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_9set_selected)) { __Pyx_XDECREF(__pyx_r); __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_selected); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -3658,7 +3666,7 @@ static PyObject *__pyx_f_7_record_17PruningPassRecord_set_selected(struct __pyx_ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_record.pyx":79 + /* "sklearn/earth/_record.pyx":79 * * cpdef set_selected(PruningPassRecord self, INDEX_t selected): * self.selected = selected # <<<<<<<<<<<<<< @@ -3673,7 +3681,7 @@ static PyObject *__pyx_f_7_record_17PruningPassRecord_set_selected(struct __pyx_ __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_record.PruningPassRecord.set_selected", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.PruningPassRecord.set_selected", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3682,9 +3690,9 @@ static PyObject *__pyx_f_7_record_17PruningPassRecord_set_selected(struct __pyx_ } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_17PruningPassRecord_9set_selected(PyObject *__pyx_v_self, PyObject *__pyx_arg_selected); /*proto*/ -static PyObject *__pyx_pw_7_record_17PruningPassRecord_9set_selected(PyObject *__pyx_v_self, PyObject *__pyx_arg_selected) { - __pyx_t_7_record_INDEX_t __pyx_v_selected; +static PyObject *__pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_9set_selected(PyObject *__pyx_v_self, PyObject *__pyx_arg_selected); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_9set_selected(PyObject *__pyx_v_self, PyObject *__pyx_arg_selected) { + __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_selected; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -3696,16 +3704,16 @@ static PyObject *__pyx_pw_7_record_17PruningPassRecord_9set_selected(PyObject *_ } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_record.PruningPassRecord.set_selected", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.PruningPassRecord.set_selected", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_7_record_17PruningPassRecord_8set_selected(((struct __pyx_obj_7_record_PruningPassRecord *)__pyx_v_self), ((__pyx_t_7_record_INDEX_t)__pyx_v_selected)); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_8set_selected(((struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_v_self), ((__pyx_t_7sklearn_5earth_7_record_INDEX_t)__pyx_v_selected)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":78 +/* "sklearn/earth/_record.pyx":78 * self.selected = state['selected'] * * cpdef set_selected(PruningPassRecord self, INDEX_t selected): # <<<<<<<<<<<<<< @@ -3713,7 +3721,7 @@ static PyObject *__pyx_pw_7_record_17PruningPassRecord_9set_selected(PyObject *_ * */ -static PyObject *__pyx_pf_7_record_17PruningPassRecord_8set_selected(struct __pyx_obj_7_record_PruningPassRecord *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_selected) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_8set_selected(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *__pyx_v_self, __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_selected) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3722,7 +3730,7 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_8set_selected(struct __py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("set_selected", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_7_record_PruningPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->set_selected(__pyx_v_self, __pyx_v_selected, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->set_selected(__pyx_v_self, __pyx_v_selected, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3732,7 +3740,7 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_8set_selected(struct __py goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_record.PruningPassRecord.set_selected", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.PruningPassRecord.set_selected", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3740,7 +3748,7 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_8set_selected(struct __py return __pyx_r; } -/* "_record.pyx":81 +/* "sklearn/earth/_record.pyx":81 * self.selected = selected * * cpdef INDEX_t get_selected(PruningPassRecord self): # <<<<<<<<<<<<<< @@ -3748,13 +3756,13 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_8set_selected(struct __py * */ -static PyObject *__pyx_pw_7_record_17PruningPassRecord_11get_selected(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static __pyx_t_7_record_INDEX_t __pyx_f_7_record_17PruningPassRecord_get_selected(struct __pyx_obj_7_record_PruningPassRecord *__pyx_v_self, int __pyx_skip_dispatch) { - __pyx_t_7_record_INDEX_t __pyx_r; +static PyObject *__pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_11get_selected(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_f_7sklearn_5earth_7_record_17PruningPassRecord_get_selected(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *__pyx_v_self, int __pyx_skip_dispatch) { + __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - __pyx_t_7_record_INDEX_t __pyx_t_3; + __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -3765,7 +3773,7 @@ static __pyx_t_7_record_INDEX_t __pyx_f_7_record_17PruningPassRecord_get_selecte else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_selected); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7_record_17PruningPassRecord_11get_selected)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_11get_selected)) { __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -3777,7 +3785,7 @@ static __pyx_t_7_record_INDEX_t __pyx_f_7_record_17PruningPassRecord_get_selecte __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_record.pyx":82 + /* "sklearn/earth/_record.pyx":82 * * cpdef INDEX_t get_selected(PruningPassRecord self): * return self.selected # <<<<<<<<<<<<<< @@ -3792,7 +3800,7 @@ static __pyx_t_7_record_INDEX_t __pyx_f_7_record_17PruningPassRecord_get_selecte __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_WriteUnraisable("_record.PruningPassRecord.get_selected", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("sklearn.earth._record.PruningPassRecord.get_selected", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -3800,17 +3808,17 @@ static __pyx_t_7_record_INDEX_t __pyx_f_7_record_17PruningPassRecord_get_selecte } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_17PruningPassRecord_11get_selected(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7_record_17PruningPassRecord_11get_selected(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_11get_selected(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_11get_selected(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_selected (wrapper)", 0); - __pyx_r = __pyx_pf_7_record_17PruningPassRecord_10get_selected(((struct __pyx_obj_7_record_PruningPassRecord *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_10get_selected(((struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":81 +/* "sklearn/earth/_record.pyx":81 * self.selected = selected * * cpdef INDEX_t get_selected(PruningPassRecord self): # <<<<<<<<<<<<<< @@ -3818,7 +3826,7 @@ static PyObject *__pyx_pw_7_record_17PruningPassRecord_11get_selected(PyObject * * */ -static PyObject *__pyx_pf_7_record_17PruningPassRecord_10get_selected(struct __pyx_obj_7_record_PruningPassRecord *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_10get_selected(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3827,7 +3835,7 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_10get_selected(struct __p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_selected", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_7_record_PruningPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_selected(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_selected(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3837,7 +3845,7 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_10get_selected(struct __p goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_record.PruningPassRecord.get_selected", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.PruningPassRecord.get_selected", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3845,7 +3853,7 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_10get_selected(struct __p return __pyx_r; } -/* "_record.pyx":84 +/* "sklearn/earth/_record.pyx":84 * return self.selected * * cpdef roll_back(PruningPassRecord self, Basis basis): # <<<<<<<<<<<<<< @@ -3853,19 +3861,19 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_10get_selected(struct __p * cdef INDEX_t i */ -static PyObject *__pyx_pw_7_record_17PruningPassRecord_13roll_back(PyObject *__pyx_v_self, PyObject *__pyx_v_basis); /*proto*/ -static PyObject *__pyx_f_7_record_17PruningPassRecord_roll_back(struct __pyx_obj_7_record_PruningPassRecord *__pyx_v_self, struct __pyx_obj_6_basis_Basis *__pyx_v_basis, int __pyx_skip_dispatch) { - __pyx_t_7_record_INDEX_t __pyx_v_n; - __pyx_t_7_record_INDEX_t __pyx_v_i; +static PyObject *__pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_13roll_back(PyObject *__pyx_v_self, PyObject *__pyx_v_basis); /*proto*/ +static PyObject *__pyx_f_7sklearn_5earth_7_record_17PruningPassRecord_roll_back(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *__pyx_v_self, struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_basis, int __pyx_skip_dispatch) { + __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_n; + __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_i; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; Py_ssize_t __pyx_t_4; - __pyx_t_7_record_INDEX_t __pyx_t_5; - __pyx_t_7_record_INDEX_t __pyx_t_6; - __pyx_t_7_record_INDEX_t __pyx_t_7; + __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_t_5; + __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_t_6; + __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -3876,7 +3884,7 @@ static PyObject *__pyx_f_7_record_17PruningPassRecord_roll_back(struct __pyx_obj else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__roll_back); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7_record_17PruningPassRecord_13roll_back)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_13roll_back)) { __Pyx_XDECREF(__pyx_r); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -3894,7 +3902,7 @@ static PyObject *__pyx_f_7_record_17PruningPassRecord_roll_back(struct __pyx_obj __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_record.pyx":85 + /* "sklearn/earth/_record.pyx":85 * * cpdef roll_back(PruningPassRecord self, Basis basis): * cdef INDEX_t n = len(self.iterations) # <<<<<<<<<<<<<< @@ -3911,7 +3919,7 @@ static PyObject *__pyx_f_7_record_17PruningPassRecord_roll_back(struct __pyx_obj __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_n = __pyx_t_4; - /* "_record.pyx":87 + /* "sklearn/earth/_record.pyx":87 * cdef INDEX_t n = len(self.iterations) * cdef INDEX_t i * for i in range(n - self.selected - 1): # <<<<<<<<<<<<<< @@ -3922,7 +3930,7 @@ static PyObject *__pyx_f_7_record_17PruningPassRecord_roll_back(struct __pyx_obj for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "_record.pyx":88 + /* "sklearn/earth/_record.pyx":88 * cdef INDEX_t i * for i in range(n - self.selected - 1): * basis[self.iterations[n - i - 1].get_pruned()].unprune() # <<<<<<<<<<<<<< @@ -3957,7 +3965,7 @@ static PyObject *__pyx_f_7_record_17PruningPassRecord_roll_back(struct __pyx_obj __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_record.PruningPassRecord.roll_back", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.PruningPassRecord.roll_back", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3966,16 +3974,16 @@ static PyObject *__pyx_f_7_record_17PruningPassRecord_roll_back(struct __pyx_obj } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_17PruningPassRecord_13roll_back(PyObject *__pyx_v_self, PyObject *__pyx_v_basis); /*proto*/ -static PyObject *__pyx_pw_7_record_17PruningPassRecord_13roll_back(PyObject *__pyx_v_self, PyObject *__pyx_v_basis) { - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; +static PyObject *__pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_13roll_back(PyObject *__pyx_v_self, PyObject *__pyx_v_basis); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_13roll_back(PyObject *__pyx_v_self, PyObject *__pyx_v_basis) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("roll_back (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_basis), __pyx_ptype_6_basis_Basis, 1, "basis", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7_record_17PruningPassRecord_12roll_back(((struct __pyx_obj_7_record_PruningPassRecord *)__pyx_v_self), ((struct __pyx_obj_6_basis_Basis *)__pyx_v_basis)); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_basis), __pyx_ptype_7sklearn_5earth_6_basis_Basis, 1, "basis", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_12roll_back(((struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_v_self), ((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)__pyx_v_basis)); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -3984,7 +3992,7 @@ static PyObject *__pyx_pw_7_record_17PruningPassRecord_13roll_back(PyObject *__p return __pyx_r; } -/* "_record.pyx":84 +/* "sklearn/earth/_record.pyx":84 * return self.selected * * cpdef roll_back(PruningPassRecord self, Basis basis): # <<<<<<<<<<<<<< @@ -3992,7 +4000,7 @@ static PyObject *__pyx_pw_7_record_17PruningPassRecord_13roll_back(PyObject *__p * cdef INDEX_t i */ -static PyObject *__pyx_pf_7_record_17PruningPassRecord_12roll_back(struct __pyx_obj_7_record_PruningPassRecord *__pyx_v_self, struct __pyx_obj_6_basis_Basis *__pyx_v_basis) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_12roll_back(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *__pyx_v_self, struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_basis) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -4001,7 +4009,7 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_12roll_back(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("roll_back", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_7_record_PruningPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->roll_back(__pyx_v_self, __pyx_v_basis, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->roll_back(__pyx_v_self, __pyx_v_basis, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4011,7 +4019,7 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_12roll_back(struct __pyx_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_record.PruningPassRecord.roll_back", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.PruningPassRecord.roll_back", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -4020,17 +4028,17 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_12roll_back(struct __pyx_ } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_17PruningPassRecord_15__str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_7_record_17PruningPassRecord_15__str__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_15__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_15__str__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_pf_7_record_17PruningPassRecord_14__str__(((struct __pyx_obj_7_record_PruningPassRecord *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_14__str__(((struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":90 +/* "sklearn/earth/_record.pyx":90 * basis[self.iterations[n - i - 1].get_pruned()].unprune() * * def __str__(PruningPassRecord self): # <<<<<<<<<<<<<< @@ -4038,7 +4046,7 @@ static PyObject *__pyx_pw_7_record_17PruningPassRecord_15__str__(PyObject *__pyx * result += 'Pruning Pass\n' */ -static PyObject *__pyx_pf_7_record_17PruningPassRecord_14__str__(struct __pyx_obj_7_record_PruningPassRecord *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_14__str__(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *__pyx_v_self) { PyObject *__pyx_v_result = NULL; PyObject *__pyx_v_header = NULL; PyObject *__pyx_v_data = NULL; @@ -4053,7 +4061,7 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_14__str__(struct __pyx_ob PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; - __pyx_t_7_record_INDEX_t __pyx_t_7; + __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_t_7; PyObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9 = NULL; int __pyx_t_10; @@ -4062,7 +4070,7 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_14__str__(struct __pyx_ob int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - /* "_record.pyx":91 + /* "sklearn/earth/_record.pyx":91 * * def __str__(PruningPassRecord self): * result = '' # <<<<<<<<<<<<<< @@ -4072,7 +4080,7 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_14__str__(struct __pyx_ob __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); __pyx_v_result = ((PyObject *)__pyx_kp_s_1); - /* "_record.pyx":92 + /* "sklearn/earth/_record.pyx":92 * def __str__(PruningPassRecord self): * result = '' * result += 'Pruning Pass\n' # <<<<<<<<<<<<<< @@ -4085,7 +4093,7 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_14__str__(struct __pyx_ob __pyx_v_result = __pyx_t_1; __pyx_t_1 = 0; - /* "_record.pyx":93 + /* "sklearn/earth/_record.pyx":93 * result = '' * result += 'Pruning Pass\n' * header = 'iter\tbf\tterms\tmse\tgcv\trsq\tgrsq'.split('\t') # <<<<<<<<<<<<<< @@ -4100,7 +4108,7 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_14__str__(struct __pyx_ob __pyx_v_header = __pyx_t_2; __pyx_t_2 = 0; - /* "_record.pyx":94 + /* "sklearn/earth/_record.pyx":94 * result += 'Pruning Pass\n' * header = 'iter\tbf\tterms\tmse\tgcv\trsq\tgrsq'.split('\t') * data = [] # <<<<<<<<<<<<<< @@ -4112,7 +4120,7 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_14__str__(struct __pyx_ob __pyx_v_data = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "_record.pyx":95 + /* "sklearn/earth/_record.pyx":95 * header = 'iter\tbf\tterms\tmse\tgcv\trsq\tgrsq'.split('\t') * data = [] * for i, iteration in enumerate(self.iterations): # <<<<<<<<<<<<<< @@ -4141,7 +4149,7 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_14__str__(struct __pyx_ob __pyx_t_2 = __pyx_t_4; __pyx_t_4 = 0; - /* "_record.pyx":96 + /* "sklearn/earth/_record.pyx":96 * data = [] * for i, iteration in enumerate(self.iterations): * row = str(i) + '\t' + str(iteration) + '\t%.3f\t%.3f\t%.3f' % (self.gcv(i),self.rsq(i),self.grsq(i)) # <<<<<<<<<<<<<< @@ -4172,13 +4180,13 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_14__str__(struct __pyx_ob __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_t_7 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_i); if (unlikely((__pyx_t_7 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7_record_PruningPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.gcv(((struct __pyx_obj_7_record_Record *)__pyx_v_self), __pyx_t_7, 0)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.gcv(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self), __pyx_t_7, 0)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __pyx_t_7 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_i); if (unlikely((__pyx_t_7 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7_record_PruningPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.rsq(((struct __pyx_obj_7_record_Record *)__pyx_v_self), __pyx_t_7, 0)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.rsq(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self), __pyx_t_7, 0)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_7 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_i); if (unlikely((__pyx_t_7 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_8 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7_record_PruningPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.grsq(((struct __pyx_obj_7_record_Record *)__pyx_v_self), __pyx_t_7, 0)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.grsq(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self), __pyx_t_7, 0)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); @@ -4202,7 +4210,7 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_14__str__(struct __pyx_ob __pyx_v_row = __pyx_t_9; __pyx_t_9 = 0; - /* "_record.pyx":97 + /* "sklearn/earth/_record.pyx":97 * for i, iteration in enumerate(self.iterations): * row = str(i) + '\t' + str(iteration) + '\t%.3f\t%.3f\t%.3f' % (self.gcv(i),self.rsq(i),self.grsq(i)) * data.append(row.split('\t')) # <<<<<<<<<<<<<< @@ -4220,14 +4228,14 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_14__str__(struct __pyx_ob __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "_record.pyx":98 + /* "sklearn/earth/_record.pyx":98 * row = str(i) + '\t' + str(iteration) + '\t%.3f\t%.3f\t%.3f' % (self.gcv(i),self.rsq(i),self.grsq(i)) * data.append(row.split('\t')) * result += ascii_table(header,data) # <<<<<<<<<<<<<< * result += '\nSelected iteration: ' + str(self.selected) + '\n' * return result */ - __pyx_t_2 = __pyx_f_5_util_ascii_table(__pyx_v_header, ((PyObject *)__pyx_v_data), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_f_7sklearn_5earth_5_util_ascii_table(__pyx_v_header, ((PyObject *)__pyx_v_data), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_result, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); @@ -4236,7 +4244,7 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_14__str__(struct __pyx_ob __pyx_v_result = __pyx_t_1; __pyx_t_1 = 0; - /* "_record.pyx":99 + /* "sklearn/earth/_record.pyx":99 * data.append(row.split('\t')) * result += ascii_table(header,data) * result += '\nSelected iteration: ' + str(self.selected) + '\n' # <<<<<<<<<<<<<< @@ -4266,7 +4274,7 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_14__str__(struct __pyx_ob __pyx_v_result = __pyx_t_2; __pyx_t_2 = 0; - /* "_record.pyx":100 + /* "sklearn/earth/_record.pyx":100 * result += ascii_table(header,data) * result += '\nSelected iteration: ' + str(self.selected) + '\n' * return result # <<<<<<<<<<<<<< @@ -4288,7 +4296,7 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_14__str__(struct __pyx_ob __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("_record.PruningPassRecord.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.PruningPassRecord.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_result); @@ -4303,12 +4311,13 @@ static PyObject *__pyx_pf_7_record_17PruningPassRecord_14__str__(struct __pyx_ob } /* Python wrapper */ -static int __pyx_pw_7_record_17ForwardPassRecord_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_7_record_17ForwardPassRecord_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __pyx_t_7_record_INDEX_t __pyx_v_num_samples; - __pyx_t_7_record_INDEX_t __pyx_v_num_variables; - __pyx_t_7_record_FLOAT_t __pyx_v_penalty; - __pyx_t_7_record_FLOAT_t __pyx_v_sst; +static int __pyx_pw_7sklearn_5earth_7_record_17ForwardPassRecord_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7sklearn_5earth_7_record_17ForwardPassRecord_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_num_samples; + __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_num_variables; + __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_v_penalty; + __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_v_sst; + PyObject *__pyx_v_xlabels = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -4316,12 +4325,13 @@ static int __pyx_pw_7_record_17ForwardPassRecord_1__init__(PyObject *__pyx_v_sel __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); { - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__num_samples,&__pyx_n_s__num_variables,&__pyx_n_s__penalty,&__pyx_n_s__sst,0}; - PyObject* values[4] = {0,0,0,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__num_samples,&__pyx_n_s__num_variables,&__pyx_n_s__penalty,&__pyx_n_s__sst,&__pyx_n_s__xlabels,0}; + PyObject* values[5] = {0,0,0,0,0}; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args; const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); switch (pos_args) { + case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); @@ -4337,57 +4347,69 @@ static int __pyx_pw_7_record_17ForwardPassRecord_1__init__(PyObject *__pyx_v_sel case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__num_variables)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__penalty)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sst)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 4: + if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xlabels)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } - } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { + } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); + values[4] = PyTuple_GET_ITEM(__pyx_args, 4); } __pyx_v_num_samples = __Pyx_PyInt_from_py_npy_ulonglong(values[0]); if (unlikely((__pyx_v_num_samples == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_num_variables = __Pyx_PyInt_from_py_npy_ulonglong(values[1]); if (unlikely((__pyx_v_num_variables == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_penalty = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_penalty == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_sst = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_sst == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_xlabels = ((PyObject*)values[4]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_record.ForwardPassRecord.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.ForwardPassRecord.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_7_record_17ForwardPassRecord___init__(((struct __pyx_obj_7_record_ForwardPassRecord *)__pyx_v_self), __pyx_v_num_samples, __pyx_v_num_variables, __pyx_v_penalty, __pyx_v_sst); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xlabels), (&PyList_Type), 1, "xlabels", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord___init__(((struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *)__pyx_v_self), __pyx_v_num_samples, __pyx_v_num_variables, __pyx_v_penalty, __pyx_v_sst, __pyx_v_xlabels); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = -1; + __pyx_L0:; __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":103 +/* "sklearn/earth/_record.pyx":103 * * cdef class ForwardPassRecord(Record): - * def __init__(ForwardPassRecord self, INDEX_t num_samples, INDEX_t num_variables, FLOAT_t penalty, FLOAT_t sst): # <<<<<<<<<<<<<< + * def __init__(ForwardPassRecord self, INDEX_t num_samples, INDEX_t num_variables, FLOAT_t penalty, FLOAT_t sst, list xlabels): # <<<<<<<<<<<<<< * self.num_samples = num_samples * self.num_variables = num_variables */ -static int __pyx_pf_7_record_17ForwardPassRecord___init__(struct __pyx_obj_7_record_ForwardPassRecord *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_num_samples, __pyx_t_7_record_INDEX_t __pyx_v_num_variables, __pyx_t_7_record_FLOAT_t __pyx_v_penalty, __pyx_t_7_record_FLOAT_t __pyx_v_sst) { +static int __pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord___init__(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *__pyx_v_self, __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_num_samples, __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_num_variables, __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_v_penalty, __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_v_sst, PyObject *__pyx_v_xlabels) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -4397,17 +4419,17 @@ static int __pyx_pf_7_record_17ForwardPassRecord___init__(struct __pyx_obj_7_rec int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "_record.pyx":104 + /* "sklearn/earth/_record.pyx":104 * cdef class ForwardPassRecord(Record): - * def __init__(ForwardPassRecord self, INDEX_t num_samples, INDEX_t num_variables, FLOAT_t penalty, FLOAT_t sst): + * def __init__(ForwardPassRecord self, INDEX_t num_samples, INDEX_t num_variables, FLOAT_t penalty, FLOAT_t sst, list xlabels): * self.num_samples = num_samples # <<<<<<<<<<<<<< * self.num_variables = num_variables * self.penalty = penalty */ __pyx_v_self->__pyx_base.num_samples = __pyx_v_num_samples; - /* "_record.pyx":105 - * def __init__(ForwardPassRecord self, INDEX_t num_samples, INDEX_t num_variables, FLOAT_t penalty, FLOAT_t sst): + /* "sklearn/earth/_record.pyx":105 + * def __init__(ForwardPassRecord self, INDEX_t num_samples, INDEX_t num_variables, FLOAT_t penalty, FLOAT_t sst, list xlabels): * self.num_samples = num_samples * self.num_variables = num_variables # <<<<<<<<<<<<<< * self.penalty = penalty @@ -4415,7 +4437,7 @@ static int __pyx_pf_7_record_17ForwardPassRecord___init__(struct __pyx_obj_7_rec */ __pyx_v_self->__pyx_base.num_variables = __pyx_v_num_variables; - /* "_record.pyx":106 + /* "sklearn/earth/_record.pyx":106 * self.num_samples = num_samples * self.num_variables = num_variables * self.penalty = penalty # <<<<<<<<<<<<<< @@ -4424,21 +4446,21 @@ static int __pyx_pf_7_record_17ForwardPassRecord___init__(struct __pyx_obj_7_rec */ __pyx_v_self->__pyx_base.penalty = __pyx_v_penalty; - /* "_record.pyx":107 + /* "sklearn/earth/_record.pyx":107 * self.num_variables = num_variables * self.penalty = penalty * self.sst = sst # <<<<<<<<<<<<<< * self.iterations = [FirstForwardPassIteration(self.sst)] - * + * self.xlabels = xlabels */ __pyx_v_self->__pyx_base.sst = __pyx_v_sst; - /* "_record.pyx":108 + /* "sklearn/earth/_record.pyx":108 * self.penalty = penalty * self.sst = sst * self.iterations = [FirstForwardPassIteration(self.sst)] # <<<<<<<<<<<<<< + * self.xlabels = xlabels * - * def __reduce__(ForwardPassRecord self): */ __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.sst); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); @@ -4447,7 +4469,7 @@ static int __pyx_pf_7_record_17ForwardPassRecord___init__(struct __pyx_obj_7_rec PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7_record_FirstForwardPassIteration)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_FirstForwardPassIteration)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -4461,12 +4483,25 @@ static int __pyx_pf_7_record_17ForwardPassRecord___init__(struct __pyx_obj_7_rec __pyx_v_self->__pyx_base.iterations = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; + /* "sklearn/earth/_record.pyx":109 + * self.sst = sst + * self.iterations = [FirstForwardPassIteration(self.sst)] + * self.xlabels = xlabels # <<<<<<<<<<<<<< + * + * def __reduce__(ForwardPassRecord self): + */ + __Pyx_INCREF(((PyObject *)__pyx_v_xlabels)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_xlabels)); + __Pyx_GOTREF(__pyx_v_self->xlabels); + __Pyx_DECREF(((PyObject *)__pyx_v_self->xlabels)); + __pyx_v_self->xlabels = __pyx_v_xlabels; + __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_record.ForwardPassRecord.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.ForwardPassRecord.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = -1; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -4474,79 +4509,88 @@ static int __pyx_pf_7_record_17ForwardPassRecord___init__(struct __pyx_obj_7_rec } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_17ForwardPassRecord_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7_record_17ForwardPassRecord_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_7_record_17ForwardPassRecord_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_17ForwardPassRecord_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); - __pyx_r = __pyx_pf_7_record_17ForwardPassRecord_2__reduce__(((struct __pyx_obj_7_record_ForwardPassRecord *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_2__reduce__(((struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":110 - * self.iterations = [FirstForwardPassIteration(self.sst)] +/* "sklearn/earth/_record.pyx":111 + * self.xlabels = xlabels * * def __reduce__(ForwardPassRecord self): # <<<<<<<<<<<<<< - * return (ForwardPassRecord, (1,1,1.0,1.0), self._getstate()) + * return (ForwardPassRecord, (self.num_samples,self.num_variables,self.penalty,self.sst,self.xlabels), self._getstate()) * */ -static PyObject *__pyx_pf_7_record_17ForwardPassRecord_2__reduce__(struct __pyx_obj_7_record_ForwardPassRecord *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_2__reduce__(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce__", 0); - /* "_record.pyx":111 + /* "sklearn/earth/_record.pyx":112 * * def __reduce__(ForwardPassRecord self): - * return (ForwardPassRecord, (1,1,1.0,1.0), self._getstate()) # <<<<<<<<<<<<<< + * return (ForwardPassRecord, (self.num_samples,self.num_variables,self.penalty,self.sst,self.xlabels), self._getstate()) # <<<<<<<<<<<<<< * * def _getstate(ForwardPassRecord self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->__pyx_base.num_samples); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_v_self->__pyx_base.num_variables); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.penalty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_int_1); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_int_1); - __Pyx_GIVEREF(__pyx_int_1); - __Pyx_INCREF(__pyx_int_1); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_1); - __Pyx_GIVEREF(__pyx_int_1); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_1); + __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.sst); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_v_self->xlabels)); + PyTuple_SET_ITEM(__pyx_t_5, 4, ((PyObject *)__pyx_v_self->xlabels)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_self->xlabels)); __pyx_t_1 = 0; __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7_record_ForwardPassRecord))); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)((PyObject*)__pyx_ptype_7_record_ForwardPassRecord))); - __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7_record_ForwardPassRecord))); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); __pyx_t_3 = 0; - __pyx_t_1 = 0; - __pyx_r = ((PyObject *)__pyx_t_2); - __pyx_t_2 = 0; + __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_ForwardPassRecord))); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_ForwardPassRecord))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_ForwardPassRecord))); + PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_t_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); + PyTuple_SET_ITEM(__pyx_t_4, 2, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_5 = 0; + __pyx_t_3 = 0; + __pyx_r = ((PyObject *)__pyx_t_4); + __pyx_t_4 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -4555,7 +4599,9 @@ static PyObject *__pyx_pf_7_record_17ForwardPassRecord_2__reduce__(struct __pyx_ __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_record.ForwardPassRecord.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("sklearn.earth._record.ForwardPassRecord.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -4564,25 +4610,25 @@ static PyObject *__pyx_pf_7_record_17ForwardPassRecord_2__reduce__(struct __pyx_ } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_17ForwardPassRecord_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7_record_17ForwardPassRecord_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_7_record_17ForwardPassRecord_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_17ForwardPassRecord_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_getstate (wrapper)", 0); - __pyx_r = __pyx_pf_7_record_17ForwardPassRecord_4_getstate(((struct __pyx_obj_7_record_ForwardPassRecord *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_4_getstate(((struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":113 - * return (ForwardPassRecord, (1,1,1.0,1.0), self._getstate()) +/* "sklearn/earth/_record.pyx":114 + * return (ForwardPassRecord, (self.num_samples,self.num_variables,self.penalty,self.sst,self.xlabels), self._getstate()) * * def _getstate(ForwardPassRecord self): # <<<<<<<<<<<<<< * return {'num_samples': self.num_samples, * 'num_variables': self.num_variables, */ -static PyObject *__pyx_pf_7_record_17ForwardPassRecord_4_getstate(struct __pyx_obj_7_record_ForwardPassRecord *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_4_getstate(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -4592,7 +4638,7 @@ static PyObject *__pyx_pf_7_record_17ForwardPassRecord_4_getstate(struct __pyx_o int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_getstate", 0); - /* "_record.pyx":114 + /* "sklearn/earth/_record.pyx":115 * * def _getstate(ForwardPassRecord self): * return {'num_samples': self.num_samples, # <<<<<<<<<<<<<< @@ -4600,57 +4646,66 @@ static PyObject *__pyx_pf_7_record_17ForwardPassRecord_4_getstate(struct __pyx_o * 'penalty': self.penalty, */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = PyInt_FromLong(__pyx_v_self->__pyx_base.num_samples); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_v_self->__pyx_base.num_samples); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__num_samples), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__num_samples), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "_record.pyx":115 + /* "sklearn/earth/_record.pyx":116 * def _getstate(ForwardPassRecord self): * return {'num_samples': self.num_samples, * 'num_variables': self.num_variables, # <<<<<<<<<<<<<< * 'penalty': self.penalty, * 'sst': self.sst, */ - __pyx_t_2 = PyInt_FromLong(__pyx_v_self->__pyx_base.num_variables); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_v_self->__pyx_base.num_variables); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__num_variables), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__num_variables), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "_record.pyx":116 + /* "sklearn/earth/_record.pyx":117 * return {'num_samples': self.num_samples, * 'num_variables': self.num_variables, * 'penalty': self.penalty, # <<<<<<<<<<<<<< * 'sst': self.sst, - * 'iterations': self.iterations} + * 'iterations': self.iterations, */ - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.penalty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.penalty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__penalty), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__penalty), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "_record.pyx":117 + /* "sklearn/earth/_record.pyx":118 * 'num_variables': self.num_variables, * 'penalty': self.penalty, * 'sst': self.sst, # <<<<<<<<<<<<<< - * 'iterations': self.iterations} - * + * 'iterations': self.iterations, + * 'xlabels': self.xlabels} */ - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.sst); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.sst); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__sst), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__sst), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "_record.pyx":118 + /* "sklearn/earth/_record.pyx":119 * 'penalty': self.penalty, * 'sst': self.sst, - * 'iterations': self.iterations} # <<<<<<<<<<<<<< + * 'iterations': self.iterations, # <<<<<<<<<<<<<< + * 'xlabels': self.xlabels} + * + */ + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__iterations), ((PyObject *)__pyx_v_self->__pyx_base.iterations)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/earth/_record.pyx":120 + * 'sst': self.sst, + * 'iterations': self.iterations, + * 'xlabels': self.xlabels} # <<<<<<<<<<<<<< * * def __setstate__(ForwardPassRecord self, dict state): */ - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__iterations), ((PyObject *)__pyx_v_self->__pyx_base.iterations)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__xlabels), ((PyObject *)__pyx_v_self->xlabels)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; @@ -4660,7 +4715,7 @@ static PyObject *__pyx_pf_7_record_17ForwardPassRecord_4_getstate(struct __pyx_o __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_record.ForwardPassRecord._getstate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.ForwardPassRecord._getstate", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -4669,16 +4724,16 @@ static PyObject *__pyx_pf_7_record_17ForwardPassRecord_4_getstate(struct __pyx_o } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_17ForwardPassRecord_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ -static PyObject *__pyx_pw_7_record_17ForwardPassRecord_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; +static PyObject *__pyx_pw_7sklearn_5earth_7_record_17ForwardPassRecord_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_17ForwardPassRecord_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), (&PyDict_Type), 1, "state", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7_record_17ForwardPassRecord_6__setstate__(((struct __pyx_obj_7_record_ForwardPassRecord *)__pyx_v_self), ((PyObject*)__pyx_v_state)); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), (&PyDict_Type), 1, "state", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_6__setstate__(((struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *)__pyx_v_self), ((PyObject*)__pyx_v_state)); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -4687,26 +4742,26 @@ static PyObject *__pyx_pw_7_record_17ForwardPassRecord_7__setstate__(PyObject *_ return __pyx_r; } -/* "_record.pyx":120 - * 'iterations': self.iterations} +/* "sklearn/earth/_record.pyx":122 + * 'xlabels': self.xlabels} * * def __setstate__(ForwardPassRecord self, dict state): # <<<<<<<<<<<<<< * self.num_samples = state['num_samples'] * self.num_variables = state['num_variables'] */ -static PyObject *__pyx_pf_7_record_17ForwardPassRecord_6__setstate__(struct __pyx_obj_7_record_ForwardPassRecord *__pyx_v_self, PyObject *__pyx_v_state) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_6__setstate__(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *__pyx_v_self, PyObject *__pyx_v_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; int __pyx_t_2; - __pyx_t_7_record_FLOAT_t __pyx_t_3; + __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate__", 0); - /* "_record.pyx":121 + /* "sklearn/earth/_record.pyx":123 * * def __setstate__(ForwardPassRecord self, dict state): * self.num_samples = state['num_samples'] # <<<<<<<<<<<<<< @@ -4715,15 +4770,15 @@ static PyObject *__pyx_pf_7_record_17ForwardPassRecord_6__setstate__(struct __py */ if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__num_samples)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__num_samples)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->__pyx_base.num_samples = __pyx_t_2; - /* "_record.pyx":122 + /* "sklearn/earth/_record.pyx":124 * def __setstate__(ForwardPassRecord self, dict state): * self.num_samples = state['num_samples'] * self.num_variables = state['num_variables'] # <<<<<<<<<<<<<< @@ -4732,15 +4787,15 @@ static PyObject *__pyx_pf_7_record_17ForwardPassRecord_6__setstate__(struct __py */ if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__num_variables)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__num_variables)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->__pyx_base.num_variables = __pyx_t_2; - /* "_record.pyx":123 + /* "sklearn/earth/_record.pyx":125 * self.num_samples = state['num_samples'] * self.num_variables = state['num_variables'] * self.penalty = state['penalty'] # <<<<<<<<<<<<<< @@ -4749,56 +4804,76 @@ static PyObject *__pyx_pf_7_record_17ForwardPassRecord_6__setstate__(struct __py */ if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__penalty)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__penalty)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->__pyx_base.penalty = __pyx_t_3; - /* "_record.pyx":124 + /* "sklearn/earth/_record.pyx":126 * self.num_variables = state['num_variables'] * self.penalty = state['penalty'] * self.sst = state['sst'] # <<<<<<<<<<<<<< * self.iterations = state['iterations'] - * + * self.xlabels = state['xlabels'] */ if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__sst)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__sst)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->__pyx_base.sst = __pyx_t_3; - /* "_record.pyx":125 + /* "sklearn/earth/_record.pyx":127 * self.penalty = state['penalty'] * self.sst = state['sst'] * self.iterations = state['iterations'] # <<<<<<<<<<<<<< + * self.xlabels = state['xlabels'] * - * cpdef set_stopping_condition(ForwardPassRecord self, int stopping_condition): */ if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__iterations)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__iterations)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->__pyx_base.iterations); __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.iterations)); __pyx_v_self->__pyx_base.iterations = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; + /* "sklearn/earth/_record.pyx":128 + * self.sst = state['sst'] + * self.iterations = state['iterations'] + * self.xlabels = state['xlabels'] # <<<<<<<<<<<<<< + * + * cpdef set_stopping_condition(ForwardPassRecord self, int stopping_condition): + */ + if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__xlabels)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_v_self->xlabels); + __Pyx_DECREF(((PyObject *)__pyx_v_self->xlabels)); + __pyx_v_self->xlabels = ((PyObject*)__pyx_t_1); + __pyx_t_1 = 0; + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_record.ForwardPassRecord.__setstate__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.ForwardPassRecord.__setstate__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -4806,16 +4881,16 @@ static PyObject *__pyx_pf_7_record_17ForwardPassRecord_6__setstate__(struct __py return __pyx_r; } -/* "_record.pyx":127 - * self.iterations = state['iterations'] +/* "sklearn/earth/_record.pyx":130 + * self.xlabels = state['xlabels'] * * cpdef set_stopping_condition(ForwardPassRecord self, int stopping_condition): # <<<<<<<<<<<<<< * self.stopping_condition = stopping_condition * */ -static PyObject *__pyx_pw_7_record_17ForwardPassRecord_9set_stopping_condition(PyObject *__pyx_v_self, PyObject *__pyx_arg_stopping_condition); /*proto*/ -static PyObject *__pyx_f_7_record_17ForwardPassRecord_set_stopping_condition(struct __pyx_obj_7_record_ForwardPassRecord *__pyx_v_self, int __pyx_v_stopping_condition, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_7sklearn_5earth_7_record_17ForwardPassRecord_9set_stopping_condition(PyObject *__pyx_v_self, PyObject *__pyx_arg_stopping_condition); /*proto*/ +static PyObject *__pyx_f_7sklearn_5earth_7_record_17ForwardPassRecord_set_stopping_condition(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *__pyx_v_self, int __pyx_v_stopping_condition, int __pyx_skip_dispatch) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -4829,18 +4904,18 @@ static PyObject *__pyx_f_7_record_17ForwardPassRecord_set_stopping_condition(str if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_10); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_10); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7_record_17ForwardPassRecord_9set_stopping_condition)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_17ForwardPassRecord_9set_stopping_condition)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyInt_FromLong(__pyx_v_stopping_condition); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_v_stopping_condition); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; @@ -4851,7 +4926,7 @@ static PyObject *__pyx_f_7_record_17ForwardPassRecord_set_stopping_condition(str __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_record.pyx":128 + /* "sklearn/earth/_record.pyx":131 * * cpdef set_stopping_condition(ForwardPassRecord self, int stopping_condition): * self.stopping_condition = stopping_condition # <<<<<<<<<<<<<< @@ -4866,7 +4941,7 @@ static PyObject *__pyx_f_7_record_17ForwardPassRecord_set_stopping_condition(str __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_record.ForwardPassRecord.set_stopping_condition", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.ForwardPassRecord.set_stopping_condition", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -4875,8 +4950,8 @@ static PyObject *__pyx_f_7_record_17ForwardPassRecord_set_stopping_condition(str } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_17ForwardPassRecord_9set_stopping_condition(PyObject *__pyx_v_self, PyObject *__pyx_arg_stopping_condition); /*proto*/ -static PyObject *__pyx_pw_7_record_17ForwardPassRecord_9set_stopping_condition(PyObject *__pyx_v_self, PyObject *__pyx_arg_stopping_condition) { +static PyObject *__pyx_pw_7sklearn_5earth_7_record_17ForwardPassRecord_9set_stopping_condition(PyObject *__pyx_v_self, PyObject *__pyx_arg_stopping_condition); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_17ForwardPassRecord_9set_stopping_condition(PyObject *__pyx_v_self, PyObject *__pyx_arg_stopping_condition) { int __pyx_v_stopping_condition; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -4885,28 +4960,28 @@ static PyObject *__pyx_pw_7_record_17ForwardPassRecord_9set_stopping_condition(P __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_stopping_condition (wrapper)", 0); assert(__pyx_arg_stopping_condition); { - __pyx_v_stopping_condition = __Pyx_PyInt_AsInt(__pyx_arg_stopping_condition); if (unlikely((__pyx_v_stopping_condition == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_stopping_condition = __Pyx_PyInt_AsInt(__pyx_arg_stopping_condition); if (unlikely((__pyx_v_stopping_condition == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_record.ForwardPassRecord.set_stopping_condition", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.ForwardPassRecord.set_stopping_condition", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_7_record_17ForwardPassRecord_8set_stopping_condition(((struct __pyx_obj_7_record_ForwardPassRecord *)__pyx_v_self), ((int)__pyx_v_stopping_condition)); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_8set_stopping_condition(((struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *)__pyx_v_self), ((int)__pyx_v_stopping_condition)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":127 - * self.iterations = state['iterations'] +/* "sklearn/earth/_record.pyx":130 + * self.xlabels = state['xlabels'] * * cpdef set_stopping_condition(ForwardPassRecord self, int stopping_condition): # <<<<<<<<<<<<<< * self.stopping_condition = stopping_condition * */ -static PyObject *__pyx_pf_7_record_17ForwardPassRecord_8set_stopping_condition(struct __pyx_obj_7_record_ForwardPassRecord *__pyx_v_self, int __pyx_v_stopping_condition) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_8set_stopping_condition(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *__pyx_v_self, int __pyx_v_stopping_condition) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -4915,7 +4990,7 @@ static PyObject *__pyx_pf_7_record_17ForwardPassRecord_8set_stopping_condition(s int __pyx_clineno = 0; __Pyx_RefNannySetupContext("set_stopping_condition", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_7_record_ForwardPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->set_stopping_condition(__pyx_v_self, __pyx_v_stopping_condition, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->set_stopping_condition(__pyx_v_self, __pyx_v_stopping_condition, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4925,7 +5000,7 @@ static PyObject *__pyx_pf_7_record_17ForwardPassRecord_8set_stopping_condition(s goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_record.ForwardPassRecord.set_stopping_condition", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.ForwardPassRecord.set_stopping_condition", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -4934,17 +5009,17 @@ static PyObject *__pyx_pf_7_record_17ForwardPassRecord_8set_stopping_condition(s } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_17ForwardPassRecord_11__str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_7_record_17ForwardPassRecord_11__str__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_7sklearn_5earth_7_record_17ForwardPassRecord_11__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_17ForwardPassRecord_11__str__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_pf_7_record_17ForwardPassRecord_10__str__(((struct __pyx_obj_7_record_ForwardPassRecord *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_10__str__(((struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":130 +/* "sklearn/earth/_record.pyx":133 * self.stopping_condition = stopping_condition * * def __str__(ForwardPassRecord self): # <<<<<<<<<<<<<< @@ -4952,7 +5027,7 @@ static PyObject *__pyx_pw_7_record_17ForwardPassRecord_11__str__(PyObject *__pyx * data = [] */ -static PyObject *__pyx_pf_7_record_17ForwardPassRecord_10__str__(struct __pyx_obj_7_record_ForwardPassRecord *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_10__str__(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *__pyx_v_self) { PyObject *__pyx_v_header = NULL; PyObject *__pyx_v_data = NULL; PyObject *__pyx_v_i = NULL; @@ -4966,7 +5041,7 @@ static PyObject *__pyx_pf_7_record_17ForwardPassRecord_10__str__(struct __pyx_ob PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; - __pyx_t_7_record_INDEX_t __pyx_t_7; + __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_t_7; PyObject *__pyx_t_8 = NULL; PyObject *__pyx_t_9 = NULL; int __pyx_t_10; @@ -4975,14 +5050,14 @@ static PyObject *__pyx_pf_7_record_17ForwardPassRecord_10__str__(struct __pyx_ob int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - /* "_record.pyx":131 + /* "sklearn/earth/_record.pyx":134 * * def __str__(ForwardPassRecord self): * header = ['iter','parent','var','knot','mse','terms','gcv','rsq','grsq'] # <<<<<<<<<<<<<< * data = [] * for i, iteration in enumerate(self.iterations): */ - __pyx_t_1 = PyList_New(9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyList_New(9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_n_s__iter)); PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__iter)); @@ -5014,19 +5089,19 @@ static PyObject *__pyx_pf_7_record_17ForwardPassRecord_10__str__(struct __pyx_ob __pyx_v_header = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "_record.pyx":132 + /* "sklearn/earth/_record.pyx":135 * def __str__(ForwardPassRecord self): * header = ['iter','parent','var','knot','mse','terms','gcv','rsq','grsq'] * data = [] # <<<<<<<<<<<<<< * for i, iteration in enumerate(self.iterations): * data.append([str(i)] + str(iteration).split('\t') + ('%.3f\t%.3f\t%.3f' % (self.gcv(i),self.rsq(i),self.grsq(i))).split('\t')) */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_data = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "_record.pyx":133 + /* "sklearn/earth/_record.pyx":136 * header = ['iter','parent','var','knot','mse','terms','gcv','rsq','grsq'] * data = [] * for i, iteration in enumerate(self.iterations): # <<<<<<<<<<<<<< @@ -5039,9 +5114,9 @@ static PyObject *__pyx_pf_7_record_17ForwardPassRecord_10__str__(struct __pyx_ob for (;;) { if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif __Pyx_XDECREF(__pyx_v_iteration); __pyx_v_iteration = __pyx_t_4; @@ -5049,60 +5124,60 @@ static PyObject *__pyx_pf_7_record_17ForwardPassRecord_10__str__(struct __pyx_ob __Pyx_INCREF(__pyx_t_1); __Pyx_XDECREF(__pyx_v_i); __pyx_v_i = __pyx_t_1; - __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = __pyx_t_4; __pyx_t_4 = 0; - /* "_record.pyx":134 + /* "sklearn/earth/_record.pyx":137 * data = [] * for i, iteration in enumerate(self.iterations): * data.append([str(i)] + str(iteration).split('\t') + ('%.3f\t%.3f\t%.3f' % (self.gcv(i),self.rsq(i),self.grsq(i))).split('\t')) # <<<<<<<<<<<<<< * result = '' * result += 'Forward Pass\n' */ - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_i); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_i); __Pyx_GIVEREF(__pyx_v_i); - __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_iteration); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_iteration); __Pyx_GIVEREF(__pyx_v_iteration); - __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__split); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__split); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_t_4), __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_t_4), __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_7 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_i); if (unlikely((__pyx_t_7 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7_record_ForwardPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.gcv(((struct __pyx_obj_7_record_Record *)__pyx_v_self), __pyx_t_7, 0)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_i); if (unlikely((__pyx_t_7 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.gcv(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self), __pyx_t_7, 0)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_i); if (unlikely((__pyx_t_7 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7_record_ForwardPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.rsq(((struct __pyx_obj_7_record_Record *)__pyx_v_self), __pyx_t_7, 0)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_i); if (unlikely((__pyx_t_7 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.rsq(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self), __pyx_t_7, 0)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_i); if (unlikely((__pyx_t_7 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_8 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7_record_ForwardPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.grsq(((struct __pyx_obj_7_record_Record *)__pyx_v_self), __pyx_t_7, 0)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_i); if (unlikely((__pyx_t_7 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.grsq(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self), __pyx_t_7, 0)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); @@ -5113,26 +5188,26 @@ static PyObject *__pyx_pf_7_record_17ForwardPassRecord_10__str__(struct __pyx_ob __pyx_t_6 = 0; __pyx_t_4 = 0; __pyx_t_8 = 0; - __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_12), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_12), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_t_8), __pyx_n_s__split); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_t_8), __pyx_n_s__split); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyNumber_Add(__pyx_t_5, __pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyNumber_Add(__pyx_t_5, __pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_data, __pyx_t_9); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_data, __pyx_t_9); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "_record.pyx":135 + /* "sklearn/earth/_record.pyx":138 * for i, iteration in enumerate(self.iterations): * data.append([str(i)] + str(iteration).split('\t') + ('%.3f\t%.3f\t%.3f' % (self.gcv(i),self.rsq(i),self.grsq(i))).split('\t')) * result = '' # <<<<<<<<<<<<<< @@ -5142,53 +5217,53 @@ static PyObject *__pyx_pf_7_record_17ForwardPassRecord_10__str__(struct __pyx_ob __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); __pyx_v_result = ((PyObject *)__pyx_kp_s_1); - /* "_record.pyx":136 + /* "sklearn/earth/_record.pyx":139 * data.append([str(i)] + str(iteration).split('\t') + ('%.3f\t%.3f\t%.3f' % (self.gcv(i),self.rsq(i),self.grsq(i))).split('\t')) * result = '' * result += 'Forward Pass\n' # <<<<<<<<<<<<<< * result += ascii_table(header, data) * result += '\nStopping Condition %d: %s\n' % (self.stopping_condition, _forward.stopping_conditions[self.stopping_condition]) */ - __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_14)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_14)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_v_result); __pyx_v_result = __pyx_t_1; __pyx_t_1 = 0; - /* "_record.pyx":137 + /* "sklearn/earth/_record.pyx":140 * result = '' * result += 'Forward Pass\n' * result += ascii_table(header, data) # <<<<<<<<<<<<<< * result += '\nStopping Condition %d: %s\n' % (self.stopping_condition, _forward.stopping_conditions[self.stopping_condition]) * return result */ - __pyx_t_1 = __pyx_f_5_util_ascii_table(((PyObject *)__pyx_v_header), ((PyObject *)__pyx_v_data), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_f_7sklearn_5earth_5_util_ascii_table(((PyObject *)__pyx_v_header), ((PyObject *)__pyx_v_data), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_result, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_result, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_v_result); __pyx_v_result = __pyx_t_2; __pyx_t_2 = 0; - /* "_record.pyx":138 + /* "sklearn/earth/_record.pyx":141 * result += 'Forward Pass\n' * result += ascii_table(header, data) * result += '\nStopping Condition %d: %s\n' % (self.stopping_condition, _forward.stopping_conditions[self.stopping_condition]) # <<<<<<<<<<<<<< * return result * */ - __pyx_t_2 = PyInt_FromLong(__pyx_v_self->stopping_condition); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_v_self->stopping_condition); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s___forward); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s___forward); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__stopping_conditions); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__stopping_conditions); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_9, __pyx_v_self->stopping_condition, sizeof(int), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_9, __pyx_v_self->stopping_condition, sizeof(int), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); @@ -5196,17 +5271,17 @@ static PyObject *__pyx_pf_7_record_17ForwardPassRecord_10__str__(struct __pyx_ob __Pyx_GIVEREF(__pyx_t_1); __pyx_t_2 = 0; __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_15), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_15), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - __pyx_t_9 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_v_result); __pyx_v_result = __pyx_t_9; __pyx_t_9 = 0; - /* "_record.pyx":139 + /* "sklearn/earth/_record.pyx":142 * result += ascii_table(header, data) * result += '\nStopping Condition %d: %s\n' % (self.stopping_condition, _forward.stopping_conditions[self.stopping_condition]) * return result # <<<<<<<<<<<<<< @@ -5228,7 +5303,7 @@ static PyObject *__pyx_pf_7_record_17ForwardPassRecord_10__str__(struct __pyx_ob __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_8); __Pyx_XDECREF(__pyx_t_9); - __Pyx_AddTraceback("_record.ForwardPassRecord.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.ForwardPassRecord.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_header); @@ -5242,8 +5317,8 @@ static PyObject *__pyx_pf_7_record_17ForwardPassRecord_10__str__(struct __pyx_ob } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_9Iteration_1__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_arg_method); /*proto*/ -static PyObject *__pyx_pw_7_record_9Iteration_1__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_arg_method) { +static PyObject *__pyx_pw_7sklearn_5earth_7_record_9Iteration_1__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_arg_method); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_9Iteration_1__richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, int __pyx_arg_method) { PyObject *__pyx_v_method = 0; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -5251,21 +5326,21 @@ static PyObject *__pyx_pw_7_record_9Iteration_1__richcmp__(PyObject *__pyx_v_sel PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0); - __pyx_v_method = PyInt_FromLong(__pyx_arg_method); if (unlikely(!__pyx_v_method)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_method = PyInt_FromLong(__pyx_arg_method); if (unlikely(!__pyx_v_method)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __Pyx_GOTREF(__pyx_v_method); goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_record.Iteration.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.Iteration.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_7_record_9Iteration___richcmp__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other), ((PyObject *)__pyx_v_method)); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_9Iteration___richcmp__(((PyObject *)__pyx_v_self), ((PyObject *)__pyx_v_other), ((PyObject *)__pyx_v_method)); __Pyx_XDECREF(__pyx_v_method); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":143 +/* "sklearn/earth/_record.pyx":146 * cdef class Iteration: * * def __richcmp__(self, other, method): # <<<<<<<<<<<<<< @@ -5273,7 +5348,7 @@ static PyObject *__pyx_pw_7_record_9Iteration_1__richcmp__(PyObject *__pyx_v_sel * return self._eq(other) */ -static PyObject *__pyx_pf_7_record_9Iteration___richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_method) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_9Iteration___richcmp__(PyObject *__pyx_v_self, PyObject *__pyx_v_other, PyObject *__pyx_v_method) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -5285,19 +5360,19 @@ static PyObject *__pyx_pf_7_record_9Iteration___richcmp__(PyObject *__pyx_v_self int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__richcmp__", 0); - /* "_record.pyx":144 + /* "sklearn/earth/_record.pyx":147 * * def __richcmp__(self, other, method): * if method == 2: # <<<<<<<<<<<<<< * return self._eq(other) * elif method == 3: */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_method, __pyx_int_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_v_method, __pyx_int_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "_record.pyx":145 + /* "sklearn/earth/_record.pyx":148 * def __richcmp__(self, other, method): * if method == 2: * return self._eq(other) # <<<<<<<<<<<<<< @@ -5305,14 +5380,14 @@ static PyObject *__pyx_pf_7_record_9Iteration___richcmp__(PyObject *__pyx_v_self * return not self._eq(other) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s___eq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s___eq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_other); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_other); __Pyx_GIVEREF(__pyx_v_other); - __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; @@ -5322,19 +5397,19 @@ static PyObject *__pyx_pf_7_record_9Iteration___richcmp__(PyObject *__pyx_v_self goto __pyx_L3; } - /* "_record.pyx":146 + /* "sklearn/earth/_record.pyx":149 * if method == 2: * return self._eq(other) * elif method == 3: # <<<<<<<<<<<<<< * return not self._eq(other) * else: */ - __pyx_t_4 = PyObject_RichCompare(__pyx_v_method, __pyx_int_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_RichCompare(__pyx_v_method, __pyx_int_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_2) { - /* "_record.pyx":147 + /* "sklearn/earth/_record.pyx":150 * return self._eq(other) * elif method == 3: * return not self._eq(other) # <<<<<<<<<<<<<< @@ -5342,20 +5417,20 @@ static PyObject *__pyx_pf_7_record_9Iteration___richcmp__(PyObject *__pyx_v_self * return NotImplemented */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s___eq); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s___eq); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_other); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_other); __Pyx_GIVEREF(__pyx_v_other); - __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyBool_FromLong((!__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong((!__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -5364,7 +5439,7 @@ static PyObject *__pyx_pf_7_record_9Iteration___richcmp__(PyObject *__pyx_v_self } /*else*/ { - /* "_record.pyx":149 + /* "sklearn/earth/_record.pyx":152 * return not self._eq(other) * else: * return NotImplemented # <<<<<<<<<<<<<< @@ -5384,7 +5459,7 @@ static PyObject *__pyx_pf_7_record_9Iteration___richcmp__(PyObject *__pyx_v_self __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); - __Pyx_AddTraceback("_record.Iteration.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.Iteration.__richcmp__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -5393,17 +5468,17 @@ static PyObject *__pyx_pf_7_record_9Iteration___richcmp__(PyObject *__pyx_v_self } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_9Iteration_3_eq(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ -static PyObject *__pyx_pw_7_record_9Iteration_3_eq(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { +static PyObject *__pyx_pw_7sklearn_5earth_7_record_9Iteration_3_eq(PyObject *__pyx_v_self, PyObject *__pyx_v_other); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_9Iteration_3_eq(PyObject *__pyx_v_self, PyObject *__pyx_v_other) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_eq (wrapper)", 0); - __pyx_r = __pyx_pf_7_record_9Iteration_2_eq(((struct __pyx_obj_7_record_Iteration *)__pyx_v_self), ((PyObject *)__pyx_v_other)); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_9Iteration_2_eq(((struct __pyx_obj_7sklearn_5earth_7_record_Iteration *)__pyx_v_self), ((PyObject *)__pyx_v_other)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":151 +/* "sklearn/earth/_record.pyx":154 * return NotImplemented * * def _eq(self, other): # <<<<<<<<<<<<<< @@ -5411,7 +5486,7 @@ static PyObject *__pyx_pw_7_record_9Iteration_3_eq(PyObject *__pyx_v_self, PyObj * */ -static PyObject *__pyx_pf_7_record_9Iteration_2_eq(struct __pyx_obj_7_record_Iteration *__pyx_v_self, PyObject *__pyx_v_other) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_9Iteration_2_eq(struct __pyx_obj_7sklearn_5earth_7_record_Iteration *__pyx_v_self, PyObject *__pyx_v_other) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -5424,7 +5499,7 @@ static PyObject *__pyx_pf_7_record_9Iteration_2_eq(struct __pyx_obj_7_record_Ite int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_eq", 0); - /* "_record.pyx":152 + /* "sklearn/earth/_record.pyx":155 * * def _eq(self, other): * return self.__class__ is other.__class__ and self._getstate() == other._getstate() # <<<<<<<<<<<<<< @@ -5432,29 +5507,29 @@ static PyObject *__pyx_pf_7_record_9Iteration_2_eq(struct __pyx_obj_7_record_Ite * cpdef FLOAT_t get_mse(Iteration self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = (__pyx_t_1 == __pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_3) { __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __pyx_t_1; @@ -5474,7 +5549,7 @@ static PyObject *__pyx_pf_7_record_9Iteration_2_eq(struct __pyx_obj_7_record_Ite __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("_record.Iteration._eq", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.Iteration._eq", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -5482,7 +5557,7 @@ static PyObject *__pyx_pf_7_record_9Iteration_2_eq(struct __pyx_obj_7_record_Ite return __pyx_r; } -/* "_record.pyx":154 +/* "sklearn/earth/_record.pyx":157 * return self.__class__ is other.__class__ and self._getstate() == other._getstate() * * cpdef FLOAT_t get_mse(Iteration self): # <<<<<<<<<<<<<< @@ -5490,13 +5565,13 @@ static PyObject *__pyx_pf_7_record_9Iteration_2_eq(struct __pyx_obj_7_record_Ite * */ -static PyObject *__pyx_pw_7_record_9Iteration_5get_mse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static __pyx_t_7_record_FLOAT_t __pyx_f_7_record_9Iteration_get_mse(struct __pyx_obj_7_record_Iteration *__pyx_v_self, int __pyx_skip_dispatch) { - __pyx_t_7_record_FLOAT_t __pyx_r; +static PyObject *__pyx_pw_7sklearn_5earth_7_record_9Iteration_5get_mse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_f_7sklearn_5earth_7_record_9Iteration_get_mse(struct __pyx_obj_7sklearn_5earth_7_record_Iteration *__pyx_v_self, int __pyx_skip_dispatch) { + __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - __pyx_t_7_record_FLOAT_t __pyx_t_3; + __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -5505,12 +5580,12 @@ static __pyx_t_7_record_FLOAT_t __pyx_f_7_record_9Iteration_get_mse(struct __pyx if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_mse); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_mse); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7_record_9Iteration_5get_mse)) { - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_9Iteration_5get_mse)) { + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -5519,7 +5594,7 @@ static __pyx_t_7_record_FLOAT_t __pyx_f_7_record_9Iteration_get_mse(struct __pyx __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_record.pyx":155 + /* "sklearn/earth/_record.pyx":158 * * cpdef FLOAT_t get_mse(Iteration self): * return self.mse # <<<<<<<<<<<<<< @@ -5534,7 +5609,7 @@ static __pyx_t_7_record_FLOAT_t __pyx_f_7_record_9Iteration_get_mse(struct __pyx __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_WriteUnraisable("_record.Iteration.get_mse", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("sklearn.earth._record.Iteration.get_mse", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -5542,17 +5617,17 @@ static __pyx_t_7_record_FLOAT_t __pyx_f_7_record_9Iteration_get_mse(struct __pyx } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_9Iteration_5get_mse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7_record_9Iteration_5get_mse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_7_record_9Iteration_5get_mse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_9Iteration_5get_mse(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_mse (wrapper)", 0); - __pyx_r = __pyx_pf_7_record_9Iteration_4get_mse(((struct __pyx_obj_7_record_Iteration *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_9Iteration_4get_mse(((struct __pyx_obj_7sklearn_5earth_7_record_Iteration *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":154 +/* "sklearn/earth/_record.pyx":157 * return self.__class__ is other.__class__ and self._getstate() == other._getstate() * * cpdef FLOAT_t get_mse(Iteration self): # <<<<<<<<<<<<<< @@ -5560,7 +5635,7 @@ static PyObject *__pyx_pw_7_record_9Iteration_5get_mse(PyObject *__pyx_v_self, C * */ -static PyObject *__pyx_pf_7_record_9Iteration_4get_mse(struct __pyx_obj_7_record_Iteration *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_9Iteration_4get_mse(struct __pyx_obj_7sklearn_5earth_7_record_Iteration *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -5569,7 +5644,7 @@ static PyObject *__pyx_pf_7_record_9Iteration_4get_mse(struct __pyx_obj_7_record int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_mse", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7_record_Iteration *)__pyx_v_self->__pyx_vtab)->get_mse(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_Iteration *)__pyx_v_self->__pyx_vtab)->get_mse(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -5579,7 +5654,7 @@ static PyObject *__pyx_pf_7_record_9Iteration_4get_mse(struct __pyx_obj_7_record goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_record.Iteration.get_mse", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.Iteration.get_mse", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -5587,7 +5662,7 @@ static PyObject *__pyx_pf_7_record_9Iteration_4get_mse(struct __pyx_obj_7_record return __pyx_r; } -/* "_record.pyx":157 +/* "sklearn/earth/_record.pyx":160 * return self.mse * * cpdef INDEX_t get_size(Iteration self): # <<<<<<<<<<<<<< @@ -5595,13 +5670,13 @@ static PyObject *__pyx_pf_7_record_9Iteration_4get_mse(struct __pyx_obj_7_record * */ -static PyObject *__pyx_pw_7_record_9Iteration_7get_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static __pyx_t_7_record_INDEX_t __pyx_f_7_record_9Iteration_get_size(struct __pyx_obj_7_record_Iteration *__pyx_v_self, int __pyx_skip_dispatch) { - __pyx_t_7_record_INDEX_t __pyx_r; +static PyObject *__pyx_pw_7sklearn_5earth_7_record_9Iteration_7get_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_f_7sklearn_5earth_7_record_9Iteration_get_size(struct __pyx_obj_7sklearn_5earth_7_record_Iteration *__pyx_v_self, int __pyx_skip_dispatch) { + __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - __pyx_t_7_record_INDEX_t __pyx_t_3; + __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -5610,12 +5685,12 @@ static __pyx_t_7_record_INDEX_t __pyx_f_7_record_9Iteration_get_size(struct __py if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7_record_9Iteration_7get_size)) { - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_9Iteration_7get_size)) { + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -5624,7 +5699,7 @@ static __pyx_t_7_record_INDEX_t __pyx_f_7_record_9Iteration_get_size(struct __py __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_record.pyx":158 + /* "sklearn/earth/_record.pyx":161 * * cpdef INDEX_t get_size(Iteration self): * return self.size # <<<<<<<<<<<<<< @@ -5639,7 +5714,7 @@ static __pyx_t_7_record_INDEX_t __pyx_f_7_record_9Iteration_get_size(struct __py __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_WriteUnraisable("_record.Iteration.get_size", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("sklearn.earth._record.Iteration.get_size", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -5647,17 +5722,17 @@ static __pyx_t_7_record_INDEX_t __pyx_f_7_record_9Iteration_get_size(struct __py } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_9Iteration_7get_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7_record_9Iteration_7get_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_7_record_9Iteration_7get_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_9Iteration_7get_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_size (wrapper)", 0); - __pyx_r = __pyx_pf_7_record_9Iteration_6get_size(((struct __pyx_obj_7_record_Iteration *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_9Iteration_6get_size(((struct __pyx_obj_7sklearn_5earth_7_record_Iteration *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":157 +/* "sklearn/earth/_record.pyx":160 * return self.mse * * cpdef INDEX_t get_size(Iteration self): # <<<<<<<<<<<<<< @@ -5665,7 +5740,7 @@ static PyObject *__pyx_pw_7_record_9Iteration_7get_size(PyObject *__pyx_v_self, * */ -static PyObject *__pyx_pf_7_record_9Iteration_6get_size(struct __pyx_obj_7_record_Iteration *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_9Iteration_6get_size(struct __pyx_obj_7sklearn_5earth_7_record_Iteration *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -5674,7 +5749,7 @@ static PyObject *__pyx_pf_7_record_9Iteration_6get_size(struct __pyx_obj_7_recor int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_size", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_7_record_Iteration *)__pyx_v_self->__pyx_vtab)->get_size(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_Iteration *)__pyx_v_self->__pyx_vtab)->get_size(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -5684,7 +5759,7 @@ static PyObject *__pyx_pf_7_record_9Iteration_6get_size(struct __pyx_obj_7_recor goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_record.Iteration.get_size", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.Iteration.get_size", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -5693,11 +5768,11 @@ static PyObject *__pyx_pf_7_record_9Iteration_6get_size(struct __pyx_obj_7_recor } /* Python wrapper */ -static int __pyx_pw_7_record_20PruningPassIteration_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_7_record_20PruningPassIteration_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __pyx_t_7_record_INDEX_t __pyx_v_pruned; - __pyx_t_7_record_INDEX_t __pyx_v_size; - __pyx_t_7_record_FLOAT_t __pyx_v_mse; +static int __pyx_pw_7sklearn_5earth_7_record_20PruningPassIteration_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7sklearn_5earth_7_record_20PruningPassIteration_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_pruned; + __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_size; + __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_v_mse; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -5725,16 +5800,16 @@ static int __pyx_pw_7_record_20PruningPassIteration_1__init__(PyObject *__pyx_v_ case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mse)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -5743,24 +5818,24 @@ static int __pyx_pw_7_record_20PruningPassIteration_1__init__(PyObject *__pyx_v_ values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } - __pyx_v_pruned = __Pyx_PyInt_from_py_npy_ulonglong(values[0]); if (unlikely((__pyx_v_pruned == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_size = __Pyx_PyInt_from_py_npy_ulonglong(values[1]); if (unlikely((__pyx_v_size == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_mse = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_mse == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_pruned = __Pyx_PyInt_from_py_npy_ulonglong(values[0]); if (unlikely((__pyx_v_pruned == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_size = __Pyx_PyInt_from_py_npy_ulonglong(values[1]); if (unlikely((__pyx_v_size == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_mse = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_mse == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_record.PruningPassIteration.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.PruningPassIteration.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_7_record_20PruningPassIteration___init__(((struct __pyx_obj_7_record_PruningPassIteration *)__pyx_v_self), __pyx_v_pruned, __pyx_v_size, __pyx_v_mse); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_20PruningPassIteration___init__(((struct __pyx_obj_7sklearn_5earth_7_record_PruningPassIteration *)__pyx_v_self), __pyx_v_pruned, __pyx_v_size, __pyx_v_mse); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":161 +/* "sklearn/earth/_record.pyx":164 * * cdef class PruningPassIteration(Iteration): * def __init__(PruningPassIteration self, INDEX_t pruned, INDEX_t size, FLOAT_t mse): # <<<<<<<<<<<<<< @@ -5768,12 +5843,12 @@ static int __pyx_pw_7_record_20PruningPassIteration_1__init__(PyObject *__pyx_v_ * self.size = size */ -static int __pyx_pf_7_record_20PruningPassIteration___init__(struct __pyx_obj_7_record_PruningPassIteration *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_pruned, __pyx_t_7_record_INDEX_t __pyx_v_size, __pyx_t_7_record_FLOAT_t __pyx_v_mse) { +static int __pyx_pf_7sklearn_5earth_7_record_20PruningPassIteration___init__(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassIteration *__pyx_v_self, __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_pruned, __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_size, __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_v_mse) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); - /* "_record.pyx":162 + /* "sklearn/earth/_record.pyx":165 * cdef class PruningPassIteration(Iteration): * def __init__(PruningPassIteration self, INDEX_t pruned, INDEX_t size, FLOAT_t mse): * self.pruned = pruned # <<<<<<<<<<<<<< @@ -5782,7 +5857,7 @@ static int __pyx_pf_7_record_20PruningPassIteration___init__(struct __pyx_obj_7_ */ __pyx_v_self->pruned = __pyx_v_pruned; - /* "_record.pyx":163 + /* "sklearn/earth/_record.pyx":166 * def __init__(PruningPassIteration self, INDEX_t pruned, INDEX_t size, FLOAT_t mse): * self.pruned = pruned * self.size = size # <<<<<<<<<<<<<< @@ -5791,7 +5866,7 @@ static int __pyx_pf_7_record_20PruningPassIteration___init__(struct __pyx_obj_7_ */ __pyx_v_self->__pyx_base.size = __pyx_v_size; - /* "_record.pyx":164 + /* "sklearn/earth/_record.pyx":167 * self.pruned = pruned * self.size = size * self.mse = mse # <<<<<<<<<<<<<< @@ -5806,17 +5881,17 @@ static int __pyx_pf_7_record_20PruningPassIteration___init__(struct __pyx_obj_7_ } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_20PruningPassIteration_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7_record_20PruningPassIteration_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_7_record_20PruningPassIteration_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_20PruningPassIteration_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); - __pyx_r = __pyx_pf_7_record_20PruningPassIteration_2__reduce__(((struct __pyx_obj_7_record_PruningPassIteration *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_20PruningPassIteration_2__reduce__(((struct __pyx_obj_7sklearn_5earth_7_record_PruningPassIteration *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":166 +/* "sklearn/earth/_record.pyx":169 * self.mse = mse * * def __reduce__(PruningPassIteration self): # <<<<<<<<<<<<<< @@ -5824,7 +5899,7 @@ static PyObject *__pyx_pw_7_record_20PruningPassIteration_3__reduce__(PyObject * * */ -static PyObject *__pyx_pf_7_record_20PruningPassIteration_2__reduce__(struct __pyx_obj_7_record_PruningPassIteration *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_20PruningPassIteration_2__reduce__(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassIteration *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -5835,7 +5910,7 @@ static PyObject *__pyx_pf_7_record_20PruningPassIteration_2__reduce__(struct __p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce__", 0); - /* "_record.pyx":167 + /* "sklearn/earth/_record.pyx":170 * * def __reduce__(PruningPassIteration self): * return (PruningPassIteration, (1,1,1.0), self._getstate()) # <<<<<<<<<<<<<< @@ -5843,9 +5918,9 @@ static PyObject *__pyx_pf_7_record_20PruningPassIteration_2__reduce__(struct __p * def _getstate(PruningPassIteration self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_1); @@ -5856,16 +5931,16 @@ static PyObject *__pyx_pf_7_record_20PruningPassIteration_2__reduce__(struct __p PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7_record_PruningPassIteration))); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7_record_PruningPassIteration))); - __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7_record_PruningPassIteration))); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_PruningPassIteration))); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_PruningPassIteration))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_PruningPassIteration))); PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_t_2)); __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_3); @@ -5882,7 +5957,7 @@ static PyObject *__pyx_pf_7_record_20PruningPassIteration_2__reduce__(struct __p __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_record.PruningPassIteration.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.PruningPassIteration.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -5891,17 +5966,17 @@ static PyObject *__pyx_pf_7_record_20PruningPassIteration_2__reduce__(struct __p } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_20PruningPassIteration_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7_record_20PruningPassIteration_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_7_record_20PruningPassIteration_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_20PruningPassIteration_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_getstate (wrapper)", 0); - __pyx_r = __pyx_pf_7_record_20PruningPassIteration_4_getstate(((struct __pyx_obj_7_record_PruningPassIteration *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_20PruningPassIteration_4_getstate(((struct __pyx_obj_7sklearn_5earth_7_record_PruningPassIteration *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":169 +/* "sklearn/earth/_record.pyx":172 * return (PruningPassIteration, (1,1,1.0), self._getstate()) * * def _getstate(PruningPassIteration self): # <<<<<<<<<<<<<< @@ -5909,7 +5984,7 @@ static PyObject *__pyx_pw_7_record_20PruningPassIteration_5_getstate(PyObject *_ * 'size': self.size, */ -static PyObject *__pyx_pf_7_record_20PruningPassIteration_4_getstate(struct __pyx_obj_7_record_PruningPassIteration *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_20PruningPassIteration_4_getstate(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassIteration *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -5919,7 +5994,7 @@ static PyObject *__pyx_pf_7_record_20PruningPassIteration_4_getstate(struct __py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_getstate", 0); - /* "_record.pyx":170 + /* "sklearn/earth/_record.pyx":173 * * def _getstate(PruningPassIteration self): * return {'pruned': self.pruned, # <<<<<<<<<<<<<< @@ -5927,35 +6002,35 @@ static PyObject *__pyx_pf_7_record_20PruningPassIteration_4_getstate(struct __py * 'mse': self.mse} */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->pruned); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->pruned); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__pruned), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__pruned), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "_record.pyx":171 + /* "sklearn/earth/_record.pyx":174 * def _getstate(PruningPassIteration self): * return {'pruned': self.pruned, * 'size': self.size, # <<<<<<<<<<<<<< * 'mse': self.mse} * */ - __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->__pyx_base.size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->__pyx_base.size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__size), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__size), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "_record.pyx":172 + /* "sklearn/earth/_record.pyx":175 * return {'pruned': self.pruned, * 'size': self.size, * 'mse': self.mse} # <<<<<<<<<<<<<< * * def __setstate__(PruningPassIteration self, dict state): */ - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.mse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.mse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__mse), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__mse), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; @@ -5966,7 +6041,7 @@ static PyObject *__pyx_pf_7_record_20PruningPassIteration_4_getstate(struct __py __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_record.PruningPassIteration._getstate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.PruningPassIteration._getstate", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -5975,16 +6050,16 @@ static PyObject *__pyx_pf_7_record_20PruningPassIteration_4_getstate(struct __py } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_20PruningPassIteration_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ -static PyObject *__pyx_pw_7_record_20PruningPassIteration_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; +static PyObject *__pyx_pw_7sklearn_5earth_7_record_20PruningPassIteration_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_20PruningPassIteration_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), (&PyDict_Type), 1, "state", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7_record_20PruningPassIteration_6__setstate__(((struct __pyx_obj_7_record_PruningPassIteration *)__pyx_v_self), ((PyObject*)__pyx_v_state)); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), (&PyDict_Type), 1, "state", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_20PruningPassIteration_6__setstate__(((struct __pyx_obj_7sklearn_5earth_7_record_PruningPassIteration *)__pyx_v_self), ((PyObject*)__pyx_v_state)); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -5993,7 +6068,7 @@ static PyObject *__pyx_pw_7_record_20PruningPassIteration_7__setstate__(PyObject return __pyx_r; } -/* "_record.pyx":174 +/* "sklearn/earth/_record.pyx":177 * 'mse': self.mse} * * def __setstate__(PruningPassIteration self, dict state): # <<<<<<<<<<<<<< @@ -6001,18 +6076,18 @@ static PyObject *__pyx_pw_7_record_20PruningPassIteration_7__setstate__(PyObject * self.size = state['size'] */ -static PyObject *__pyx_pf_7_record_20PruningPassIteration_6__setstate__(struct __pyx_obj_7_record_PruningPassIteration *__pyx_v_self, PyObject *__pyx_v_state) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_20PruningPassIteration_6__setstate__(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassIteration *__pyx_v_self, PyObject *__pyx_v_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __pyx_t_7_record_INDEX_t __pyx_t_2; - __pyx_t_7_record_FLOAT_t __pyx_t_3; + __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_t_2; + __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate__", 0); - /* "_record.pyx":175 + /* "sklearn/earth/_record.pyx":178 * * def __setstate__(PruningPassIteration self, dict state): * self.pruned = state['pruned'] # <<<<<<<<<<<<<< @@ -6021,15 +6096,15 @@ static PyObject *__pyx_pf_7_record_20PruningPassIteration_6__setstate__(struct _ */ if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__pruned)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__pruned)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->pruned = __pyx_t_2; - /* "_record.pyx":176 + /* "sklearn/earth/_record.pyx":179 * def __setstate__(PruningPassIteration self, dict state): * self.pruned = state['pruned'] * self.size = state['size'] # <<<<<<<<<<<<<< @@ -6038,15 +6113,15 @@ static PyObject *__pyx_pf_7_record_20PruningPassIteration_6__setstate__(struct _ */ if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__size)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__size)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->__pyx_base.size = __pyx_t_2; - /* "_record.pyx":177 + /* "sklearn/earth/_record.pyx":180 * self.pruned = state['pruned'] * self.size = state['size'] * self.mse = state['mse'] # <<<<<<<<<<<<<< @@ -6055,11 +6130,11 @@ static PyObject *__pyx_pf_7_record_20PruningPassIteration_6__setstate__(struct _ */ if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__mse)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__mse)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->__pyx_base.mse = __pyx_t_3; @@ -6067,7 +6142,7 @@ static PyObject *__pyx_pf_7_record_20PruningPassIteration_6__setstate__(struct _ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_record.PruningPassIteration.__setstate__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.PruningPassIteration.__setstate__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -6075,7 +6150,7 @@ static PyObject *__pyx_pf_7_record_20PruningPassIteration_6__setstate__(struct _ return __pyx_r; } -/* "_record.pyx":179 +/* "sklearn/earth/_record.pyx":182 * self.mse = state['mse'] * * cpdef INDEX_t get_pruned(PruningPassIteration self): # <<<<<<<<<<<<<< @@ -6083,13 +6158,13 @@ static PyObject *__pyx_pf_7_record_20PruningPassIteration_6__setstate__(struct _ * */ -static PyObject *__pyx_pw_7_record_20PruningPassIteration_9get_pruned(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static __pyx_t_7_record_INDEX_t __pyx_f_7_record_20PruningPassIteration_get_pruned(struct __pyx_obj_7_record_PruningPassIteration *__pyx_v_self, int __pyx_skip_dispatch) { - __pyx_t_7_record_INDEX_t __pyx_r; +static PyObject *__pyx_pw_7sklearn_5earth_7_record_20PruningPassIteration_9get_pruned(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_f_7sklearn_5earth_7_record_20PruningPassIteration_get_pruned(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassIteration *__pyx_v_self, int __pyx_skip_dispatch) { + __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - __pyx_t_7_record_INDEX_t __pyx_t_3; + __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -6098,12 +6173,12 @@ static __pyx_t_7_record_INDEX_t __pyx_f_7_record_20PruningPassIteration_get_prun if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_pruned); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_pruned); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7_record_20PruningPassIteration_9get_pruned)) { - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_20PruningPassIteration_9get_pruned)) { + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -6112,7 +6187,7 @@ static __pyx_t_7_record_INDEX_t __pyx_f_7_record_20PruningPassIteration_get_prun __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_record.pyx":180 + /* "sklearn/earth/_record.pyx":183 * * cpdef INDEX_t get_pruned(PruningPassIteration self): * return self.pruned # <<<<<<<<<<<<<< @@ -6127,7 +6202,7 @@ static __pyx_t_7_record_INDEX_t __pyx_f_7_record_20PruningPassIteration_get_prun __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_WriteUnraisable("_record.PruningPassIteration.get_pruned", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("sklearn.earth._record.PruningPassIteration.get_pruned", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -6135,17 +6210,17 @@ static __pyx_t_7_record_INDEX_t __pyx_f_7_record_20PruningPassIteration_get_prun } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_20PruningPassIteration_9get_pruned(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7_record_20PruningPassIteration_9get_pruned(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_7_record_20PruningPassIteration_9get_pruned(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_20PruningPassIteration_9get_pruned(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_pruned (wrapper)", 0); - __pyx_r = __pyx_pf_7_record_20PruningPassIteration_8get_pruned(((struct __pyx_obj_7_record_PruningPassIteration *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_20PruningPassIteration_8get_pruned(((struct __pyx_obj_7sklearn_5earth_7_record_PruningPassIteration *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":179 +/* "sklearn/earth/_record.pyx":182 * self.mse = state['mse'] * * cpdef INDEX_t get_pruned(PruningPassIteration self): # <<<<<<<<<<<<<< @@ -6153,7 +6228,7 @@ static PyObject *__pyx_pw_7_record_20PruningPassIteration_9get_pruned(PyObject * * */ -static PyObject *__pyx_pf_7_record_20PruningPassIteration_8get_pruned(struct __pyx_obj_7_record_PruningPassIteration *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_20PruningPassIteration_8get_pruned(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassIteration *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -6162,7 +6237,7 @@ static PyObject *__pyx_pf_7_record_20PruningPassIteration_8get_pruned(struct __p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_pruned", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_7_record_PruningPassIteration *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_pruned(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassIteration *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_pruned(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -6172,7 +6247,7 @@ static PyObject *__pyx_pf_7_record_20PruningPassIteration_8get_pruned(struct __p goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_record.PruningPassIteration.get_pruned", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.PruningPassIteration.get_pruned", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -6181,17 +6256,17 @@ static PyObject *__pyx_pf_7_record_20PruningPassIteration_8get_pruned(struct __p } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_20PruningPassIteration_11__str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_7_record_20PruningPassIteration_11__str__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_7sklearn_5earth_7_record_20PruningPassIteration_11__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_20PruningPassIteration_11__str__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_pf_7_record_20PruningPassIteration_10__str__(((struct __pyx_obj_7_record_PruningPassIteration *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_20PruningPassIteration_10__str__(((struct __pyx_obj_7sklearn_5earth_7_record_PruningPassIteration *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":182 +/* "sklearn/earth/_record.pyx":185 * return self.pruned * * def __str__(PruningPassIteration self): # <<<<<<<<<<<<<< @@ -6199,7 +6274,7 @@ static PyObject *__pyx_pw_7_record_20PruningPassIteration_11__str__(PyObject *__ * return result */ -static PyObject *__pyx_pf_7_record_20PruningPassIteration_10__str__(struct __pyx_obj_7_record_PruningPassIteration *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_20PruningPassIteration_10__str__(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassIteration *__pyx_v_self) { PyObject *__pyx_v_result = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -6214,33 +6289,33 @@ static PyObject *__pyx_pf_7_record_20PruningPassIteration_10__str__(struct __pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - /* "_record.pyx":183 + /* "sklearn/earth/_record.pyx":186 * * def __str__(PruningPassIteration self): * result = '%s\t%s\t%s' % (str(self.pruned),self.size,'%.2f' % self.mse if self.mse is not None else None) # <<<<<<<<<<<<<< * return result * */ - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->pruned); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->pruned); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->__pyx_base.size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->__pyx_base.size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.mse); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.mse); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = (__pyx_t_4 != Py_None); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (__pyx_t_5) { - __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.mse); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if ((__pyx_t_5 != 0)) { + __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.mse); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_17), __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_17), __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_3 = ((PyObject *)__pyx_t_6); @@ -6249,7 +6324,7 @@ static PyObject *__pyx_pf_7_record_20PruningPassIteration_10__str__(struct __pyx __Pyx_INCREF(Py_None); __pyx_t_3 = Py_None; } - __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); @@ -6260,13 +6335,13 @@ static PyObject *__pyx_pf_7_record_20PruningPassIteration_10__str__(struct __pyx __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_16), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_16), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; __pyx_v_result = ((PyObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "_record.pyx":184 + /* "sklearn/earth/_record.pyx":187 * def __str__(PruningPassIteration self): * result = '%s\t%s\t%s' % (str(self.pruned),self.size,'%.2f' % self.mse if self.mse is not None else None) * return result # <<<<<<<<<<<<<< @@ -6286,7 +6361,7 @@ static PyObject *__pyx_pf_7_record_20PruningPassIteration_10__str__(struct __pyx __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("_record.PruningPassIteration.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.PruningPassIteration.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_result); @@ -6296,10 +6371,10 @@ static PyObject *__pyx_pf_7_record_20PruningPassIteration_10__str__(struct __pyx } /* Python wrapper */ -static int __pyx_pw_7_record_25FirstPruningPassIteration_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_7_record_25FirstPruningPassIteration_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __pyx_t_7_record_INDEX_t __pyx_v_size; - __pyx_t_7_record_FLOAT_t __pyx_v_mse; +static int __pyx_pw_7sklearn_5earth_7_record_25FirstPruningPassIteration_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7sklearn_5earth_7_record_25FirstPruningPassIteration_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_size; + __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_v_mse; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -6326,11 +6401,11 @@ static int __pyx_pw_7_record_25FirstPruningPassIteration_1__init__(PyObject *__p case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mse)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -6338,23 +6413,23 @@ static int __pyx_pw_7_record_25FirstPruningPassIteration_1__init__(PyObject *__p values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_size = __Pyx_PyInt_from_py_npy_ulonglong(values[0]); if (unlikely((__pyx_v_size == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_mse = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_mse == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_size = __Pyx_PyInt_from_py_npy_ulonglong(values[0]); if (unlikely((__pyx_v_size == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_mse = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_mse == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_record.FirstPruningPassIteration.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.FirstPruningPassIteration.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_7_record_25FirstPruningPassIteration___init__(((struct __pyx_obj_7_record_FirstPruningPassIteration *)__pyx_v_self), __pyx_v_size, __pyx_v_mse); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_25FirstPruningPassIteration___init__(((struct __pyx_obj_7sklearn_5earth_7_record_FirstPruningPassIteration *)__pyx_v_self), __pyx_v_size, __pyx_v_mse); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":187 +/* "sklearn/earth/_record.pyx":190 * * cdef class FirstPruningPassIteration(PruningPassIteration): * def __init__(PruningPassIteration self, INDEX_t size, FLOAT_t mse): # <<<<<<<<<<<<<< @@ -6362,12 +6437,12 @@ static int __pyx_pw_7_record_25FirstPruningPassIteration_1__init__(PyObject *__p * self.mse = mse */ -static int __pyx_pf_7_record_25FirstPruningPassIteration___init__(struct __pyx_obj_7_record_FirstPruningPassIteration *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_size, __pyx_t_7_record_FLOAT_t __pyx_v_mse) { +static int __pyx_pf_7sklearn_5earth_7_record_25FirstPruningPassIteration___init__(struct __pyx_obj_7sklearn_5earth_7_record_FirstPruningPassIteration *__pyx_v_self, __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_size, __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_v_mse) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); - /* "_record.pyx":188 + /* "sklearn/earth/_record.pyx":191 * cdef class FirstPruningPassIteration(PruningPassIteration): * def __init__(PruningPassIteration self, INDEX_t size, FLOAT_t mse): * self.size = size # <<<<<<<<<<<<<< @@ -6376,7 +6451,7 @@ static int __pyx_pf_7_record_25FirstPruningPassIteration___init__(struct __pyx_o */ __pyx_v_self->__pyx_base.__pyx_base.size = __pyx_v_size; - /* "_record.pyx":189 + /* "sklearn/earth/_record.pyx":192 * def __init__(PruningPassIteration self, INDEX_t size, FLOAT_t mse): * self.size = size * self.mse = mse # <<<<<<<<<<<<<< @@ -6391,17 +6466,17 @@ static int __pyx_pf_7_record_25FirstPruningPassIteration___init__(struct __pyx_o } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_25FirstPruningPassIteration_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7_record_25FirstPruningPassIteration_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_7_record_25FirstPruningPassIteration_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_25FirstPruningPassIteration_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); - __pyx_r = __pyx_pf_7_record_25FirstPruningPassIteration_2__reduce__(((struct __pyx_obj_7_record_FirstPruningPassIteration *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_25FirstPruningPassIteration_2__reduce__(((struct __pyx_obj_7sklearn_5earth_7_record_FirstPruningPassIteration *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":191 +/* "sklearn/earth/_record.pyx":194 * self.mse = mse * * def __reduce__(FirstPruningPassIteration self): # <<<<<<<<<<<<<< @@ -6409,7 +6484,7 @@ static PyObject *__pyx_pw_7_record_25FirstPruningPassIteration_3__reduce__(PyObj * */ -static PyObject *__pyx_pf_7_record_25FirstPruningPassIteration_2__reduce__(struct __pyx_obj_7_record_FirstPruningPassIteration *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_25FirstPruningPassIteration_2__reduce__(struct __pyx_obj_7sklearn_5earth_7_record_FirstPruningPassIteration *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -6420,7 +6495,7 @@ static PyObject *__pyx_pf_7_record_25FirstPruningPassIteration_2__reduce__(struc int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce__", 0); - /* "_record.pyx":192 + /* "sklearn/earth/_record.pyx":195 * * def __reduce__(FirstPruningPassIteration self): * return (FirstPruningPassIteration, (1,1.0), self._getstate()) # <<<<<<<<<<<<<< @@ -6428,9 +6503,9 @@ static PyObject *__pyx_pf_7_record_25FirstPruningPassIteration_2__reduce__(struc * def _getstate(FirstPruningPassIteration self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_1); @@ -6438,16 +6513,16 @@ static PyObject *__pyx_pf_7_record_25FirstPruningPassIteration_2__reduce__(struc PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7_record_FirstPruningPassIteration))); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7_record_FirstPruningPassIteration))); - __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7_record_FirstPruningPassIteration))); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_FirstPruningPassIteration))); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_FirstPruningPassIteration))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_FirstPruningPassIteration))); PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_t_2)); __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_3); @@ -6464,7 +6539,7 @@ static PyObject *__pyx_pf_7_record_25FirstPruningPassIteration_2__reduce__(struc __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_record.FirstPruningPassIteration.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.FirstPruningPassIteration.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -6473,17 +6548,17 @@ static PyObject *__pyx_pf_7_record_25FirstPruningPassIteration_2__reduce__(struc } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_25FirstPruningPassIteration_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7_record_25FirstPruningPassIteration_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_7_record_25FirstPruningPassIteration_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_25FirstPruningPassIteration_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_getstate (wrapper)", 0); - __pyx_r = __pyx_pf_7_record_25FirstPruningPassIteration_4_getstate(((struct __pyx_obj_7_record_FirstPruningPassIteration *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_25FirstPruningPassIteration_4_getstate(((struct __pyx_obj_7sklearn_5earth_7_record_FirstPruningPassIteration *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":194 +/* "sklearn/earth/_record.pyx":197 * return (FirstPruningPassIteration, (1,1.0), self._getstate()) * * def _getstate(FirstPruningPassIteration self): # <<<<<<<<<<<<<< @@ -6491,7 +6566,7 @@ static PyObject *__pyx_pw_7_record_25FirstPruningPassIteration_5_getstate(PyObje * 'mse': self.mse} */ -static PyObject *__pyx_pf_7_record_25FirstPruningPassIteration_4_getstate(struct __pyx_obj_7_record_FirstPruningPassIteration *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_25FirstPruningPassIteration_4_getstate(struct __pyx_obj_7sklearn_5earth_7_record_FirstPruningPassIteration *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -6501,7 +6576,7 @@ static PyObject *__pyx_pf_7_record_25FirstPruningPassIteration_4_getstate(struct int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_getstate", 0); - /* "_record.pyx":195 + /* "sklearn/earth/_record.pyx":198 * * def _getstate(FirstPruningPassIteration self): * return {'size': self.size, # <<<<<<<<<<<<<< @@ -6509,23 +6584,23 @@ static PyObject *__pyx_pf_7_record_25FirstPruningPassIteration_4_getstate(struct * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->__pyx_base.__pyx_base.size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->__pyx_base.__pyx_base.size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__size), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__size), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "_record.pyx":196 + /* "sklearn/earth/_record.pyx":199 * def _getstate(FirstPruningPassIteration self): * return {'size': self.size, * 'mse': self.mse} # <<<<<<<<<<<<<< * * def __setstate__(FirstPruningPassIteration self, dict state): */ - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.__pyx_base.mse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.__pyx_base.mse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__mse), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__mse), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; @@ -6536,7 +6611,7 @@ static PyObject *__pyx_pf_7_record_25FirstPruningPassIteration_4_getstate(struct __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_record.FirstPruningPassIteration._getstate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.FirstPruningPassIteration._getstate", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -6545,16 +6620,16 @@ static PyObject *__pyx_pf_7_record_25FirstPruningPassIteration_4_getstate(struct } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_25FirstPruningPassIteration_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ -static PyObject *__pyx_pw_7_record_25FirstPruningPassIteration_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; +static PyObject *__pyx_pw_7sklearn_5earth_7_record_25FirstPruningPassIteration_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_25FirstPruningPassIteration_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), (&PyDict_Type), 1, "state", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7_record_25FirstPruningPassIteration_6__setstate__(((struct __pyx_obj_7_record_FirstPruningPassIteration *)__pyx_v_self), ((PyObject*)__pyx_v_state)); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), (&PyDict_Type), 1, "state", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_25FirstPruningPassIteration_6__setstate__(((struct __pyx_obj_7sklearn_5earth_7_record_FirstPruningPassIteration *)__pyx_v_self), ((PyObject*)__pyx_v_state)); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -6563,7 +6638,7 @@ static PyObject *__pyx_pw_7_record_25FirstPruningPassIteration_7__setstate__(PyO return __pyx_r; } -/* "_record.pyx":198 +/* "sklearn/earth/_record.pyx":201 * 'mse': self.mse} * * def __setstate__(FirstPruningPassIteration self, dict state): # <<<<<<<<<<<<<< @@ -6571,18 +6646,18 @@ static PyObject *__pyx_pw_7_record_25FirstPruningPassIteration_7__setstate__(PyO * self.mse = state['mse'] */ -static PyObject *__pyx_pf_7_record_25FirstPruningPassIteration_6__setstate__(struct __pyx_obj_7_record_FirstPruningPassIteration *__pyx_v_self, PyObject *__pyx_v_state) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_25FirstPruningPassIteration_6__setstate__(struct __pyx_obj_7sklearn_5earth_7_record_FirstPruningPassIteration *__pyx_v_self, PyObject *__pyx_v_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __pyx_t_7_record_INDEX_t __pyx_t_2; - __pyx_t_7_record_FLOAT_t __pyx_t_3; + __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_t_2; + __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate__", 0); - /* "_record.pyx":199 + /* "sklearn/earth/_record.pyx":202 * * def __setstate__(FirstPruningPassIteration self, dict state): * self.size = state['size'] # <<<<<<<<<<<<<< @@ -6591,15 +6666,15 @@ static PyObject *__pyx_pf_7_record_25FirstPruningPassIteration_6__setstate__(str */ if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__size)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__size)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->__pyx_base.__pyx_base.size = __pyx_t_2; - /* "_record.pyx":200 + /* "sklearn/earth/_record.pyx":203 * def __setstate__(FirstPruningPassIteration self, dict state): * self.size = state['size'] * self.mse = state['mse'] # <<<<<<<<<<<<<< @@ -6608,11 +6683,11 @@ static PyObject *__pyx_pf_7_record_25FirstPruningPassIteration_6__setstate__(str */ if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__mse)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__mse)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->__pyx_base.__pyx_base.mse = __pyx_t_3; @@ -6620,7 +6695,7 @@ static PyObject *__pyx_pf_7_record_25FirstPruningPassIteration_6__setstate__(str goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_record.FirstPruningPassIteration.__setstate__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.FirstPruningPassIteration.__setstate__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -6629,17 +6704,17 @@ static PyObject *__pyx_pf_7_record_25FirstPruningPassIteration_6__setstate__(str } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_25FirstPruningPassIteration_9__str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_7_record_25FirstPruningPassIteration_9__str__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_7sklearn_5earth_7_record_25FirstPruningPassIteration_9__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_25FirstPruningPassIteration_9__str__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_pf_7_record_25FirstPruningPassIteration_8__str__(((struct __pyx_obj_7_record_FirstPruningPassIteration *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_25FirstPruningPassIteration_8__str__(((struct __pyx_obj_7sklearn_5earth_7_record_FirstPruningPassIteration *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":202 +/* "sklearn/earth/_record.pyx":205 * self.mse = state['mse'] * * def __str__(PruningPassIteration self): # <<<<<<<<<<<<<< @@ -6647,7 +6722,7 @@ static PyObject *__pyx_pw_7_record_25FirstPruningPassIteration_9__str__(PyObject * return result */ -static PyObject *__pyx_pf_7_record_25FirstPruningPassIteration_8__str__(struct __pyx_obj_7_record_FirstPruningPassIteration *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_25FirstPruningPassIteration_8__str__(struct __pyx_obj_7sklearn_5earth_7_record_FirstPruningPassIteration *__pyx_v_self) { PyObject *__pyx_v_result = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -6661,23 +6736,23 @@ static PyObject *__pyx_pf_7_record_25FirstPruningPassIteration_8__str__(struct _ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - /* "_record.pyx":203 + /* "sklearn/earth/_record.pyx":206 * * def __str__(PruningPassIteration self): * result = '%s\t%s\t%s' % ('-',self.size,'%.2f' % self.mse if self.mse is not None else None) # <<<<<<<<<<<<<< * return result * */ - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->__pyx_base.__pyx_base.size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->__pyx_base.__pyx_base.size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.__pyx_base.mse); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.__pyx_base.mse); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = (__pyx_t_3 != Py_None); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_4) { - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.__pyx_base.mse); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if ((__pyx_t_4 != 0)) { + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.__pyx_base.mse); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_17), __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_17), __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_2 = ((PyObject *)__pyx_t_5); @@ -6686,7 +6761,7 @@ static PyObject *__pyx_pf_7_record_25FirstPruningPassIteration_8__str__(struct _ __Pyx_INCREF(Py_None); __pyx_t_2 = Py_None; } - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(((PyObject *)__pyx_kp_s_18)); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_18)); @@ -6697,13 +6772,13 @@ static PyObject *__pyx_pf_7_record_25FirstPruningPassIteration_8__str__(struct _ __Pyx_GIVEREF(__pyx_t_2); __pyx_t_1 = 0; __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_16), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_16), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_v_result = ((PyObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "_record.pyx":204 + /* "sklearn/earth/_record.pyx":207 * def __str__(PruningPassIteration self): * result = '%s\t%s\t%s' % ('-',self.size,'%.2f' % self.mse if self.mse is not None else None) * return result # <<<<<<<<<<<<<< @@ -6722,7 +6797,7 @@ static PyObject *__pyx_pf_7_record_25FirstPruningPassIteration_8__str__(struct _ __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); __Pyx_XDECREF(__pyx_t_5); - __Pyx_AddTraceback("_record.FirstPruningPassIteration.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.FirstPruningPassIteration.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_result); @@ -6732,13 +6807,13 @@ static PyObject *__pyx_pf_7_record_25FirstPruningPassIteration_8__str__(struct _ } /* Python wrapper */ -static int __pyx_pw_7_record_20ForwardPassIteration_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_7_record_20ForwardPassIteration_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __pyx_t_7_record_INDEX_t __pyx_v_parent; - __pyx_t_7_record_INDEX_t __pyx_v_variable; +static int __pyx_pw_7sklearn_5earth_7_record_20ForwardPassIteration_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7sklearn_5earth_7_record_20ForwardPassIteration_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_parent; + __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_variable; int __pyx_v_knot; - __pyx_t_7_record_FLOAT_t __pyx_v_mse; - __pyx_t_7_record_INDEX_t __pyx_v_size; + __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_v_mse; + __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_size; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -6768,26 +6843,26 @@ static int __pyx_pw_7_record_20ForwardPassIteration_1__init__(PyObject *__pyx_v_ case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__variable)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__knot)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mse)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { goto __pyx_L5_argtuple_error; @@ -6798,26 +6873,26 @@ static int __pyx_pw_7_record_20ForwardPassIteration_1__init__(PyObject *__pyx_v_ values[3] = PyTuple_GET_ITEM(__pyx_args, 3); values[4] = PyTuple_GET_ITEM(__pyx_args, 4); } - __pyx_v_parent = __Pyx_PyInt_from_py_npy_ulonglong(values[0]); if (unlikely((__pyx_v_parent == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_variable = __Pyx_PyInt_from_py_npy_ulonglong(values[1]); if (unlikely((__pyx_v_variable == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_knot = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_knot == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_mse = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_mse == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_size = __Pyx_PyInt_from_py_npy_ulonglong(values[4]); if (unlikely((__pyx_v_size == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_parent = __Pyx_PyInt_from_py_npy_ulonglong(values[0]); if (unlikely((__pyx_v_parent == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_variable = __Pyx_PyInt_from_py_npy_ulonglong(values[1]); if (unlikely((__pyx_v_variable == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_knot = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_knot == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_mse = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_mse == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_size = __Pyx_PyInt_from_py_npy_ulonglong(values[4]); if (unlikely((__pyx_v_size == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_record.ForwardPassIteration.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.ForwardPassIteration.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_7_record_20ForwardPassIteration___init__(((struct __pyx_obj_7_record_ForwardPassIteration *)__pyx_v_self), __pyx_v_parent, __pyx_v_variable, __pyx_v_knot, __pyx_v_mse, __pyx_v_size); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration___init__(((struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration *)__pyx_v_self), __pyx_v_parent, __pyx_v_variable, __pyx_v_knot, __pyx_v_mse, __pyx_v_size); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":207 +/* "sklearn/earth/_record.pyx":210 * * cdef class ForwardPassIteration(Iteration): * def __init__(ForwardPassIteration self, INDEX_t parent, INDEX_t variable, int knot, FLOAT_t mse, INDEX_t size): # <<<<<<<<<<<<<< @@ -6825,12 +6900,12 @@ static int __pyx_pw_7_record_20ForwardPassIteration_1__init__(PyObject *__pyx_v_ * self.variable = variable */ -static int __pyx_pf_7_record_20ForwardPassIteration___init__(struct __pyx_obj_7_record_ForwardPassIteration *__pyx_v_self, __pyx_t_7_record_INDEX_t __pyx_v_parent, __pyx_t_7_record_INDEX_t __pyx_v_variable, int __pyx_v_knot, __pyx_t_7_record_FLOAT_t __pyx_v_mse, __pyx_t_7_record_INDEX_t __pyx_v_size) { +static int __pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration___init__(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration *__pyx_v_self, __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_parent, __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_variable, int __pyx_v_knot, __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_v_mse, __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_size) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); - /* "_record.pyx":208 + /* "sklearn/earth/_record.pyx":211 * cdef class ForwardPassIteration(Iteration): * def __init__(ForwardPassIteration self, INDEX_t parent, INDEX_t variable, int knot, FLOAT_t mse, INDEX_t size): * self.parent = parent # <<<<<<<<<<<<<< @@ -6839,7 +6914,7 @@ static int __pyx_pf_7_record_20ForwardPassIteration___init__(struct __pyx_obj_7_ */ __pyx_v_self->parent = __pyx_v_parent; - /* "_record.pyx":209 + /* "sklearn/earth/_record.pyx":212 * def __init__(ForwardPassIteration self, INDEX_t parent, INDEX_t variable, int knot, FLOAT_t mse, INDEX_t size): * self.parent = parent * self.variable = variable # <<<<<<<<<<<<<< @@ -6848,7 +6923,7 @@ static int __pyx_pf_7_record_20ForwardPassIteration___init__(struct __pyx_obj_7_ */ __pyx_v_self->variable = __pyx_v_variable; - /* "_record.pyx":210 + /* "sklearn/earth/_record.pyx":213 * self.parent = parent * self.variable = variable * self.knot = knot # <<<<<<<<<<<<<< @@ -6857,7 +6932,7 @@ static int __pyx_pf_7_record_20ForwardPassIteration___init__(struct __pyx_obj_7_ */ __pyx_v_self->knot = __pyx_v_knot; - /* "_record.pyx":211 + /* "sklearn/earth/_record.pyx":214 * self.variable = variable * self.knot = knot * self.mse = mse # <<<<<<<<<<<<<< @@ -6866,7 +6941,7 @@ static int __pyx_pf_7_record_20ForwardPassIteration___init__(struct __pyx_obj_7_ */ __pyx_v_self->__pyx_base.mse = __pyx_v_mse; - /* "_record.pyx":212 + /* "sklearn/earth/_record.pyx":215 * self.knot = knot * self.mse = mse * self.size = size # <<<<<<<<<<<<<< @@ -6881,17 +6956,17 @@ static int __pyx_pf_7_record_20ForwardPassIteration___init__(struct __pyx_obj_7_ } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_20ForwardPassIteration_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7_record_20ForwardPassIteration_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_7_record_20ForwardPassIteration_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_20ForwardPassIteration_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); - __pyx_r = __pyx_pf_7_record_20ForwardPassIteration_2__reduce__(((struct __pyx_obj_7_record_ForwardPassIteration *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration_2__reduce__(((struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":214 +/* "sklearn/earth/_record.pyx":217 * self.size = size * * def __reduce__(ForwardPassIteration self): # <<<<<<<<<<<<<< @@ -6899,7 +6974,7 @@ static PyObject *__pyx_pw_7_record_20ForwardPassIteration_3__reduce__(PyObject * * */ -static PyObject *__pyx_pf_7_record_20ForwardPassIteration_2__reduce__(struct __pyx_obj_7_record_ForwardPassIteration *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration_2__reduce__(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -6910,7 +6985,7 @@ static PyObject *__pyx_pf_7_record_20ForwardPassIteration_2__reduce__(struct __p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce__", 0); - /* "_record.pyx":215 + /* "sklearn/earth/_record.pyx":218 * * def __reduce__(ForwardPassIteration self): * return (ForwardPassIteration, (1,1,1,1.0,1), self._getstate()) # <<<<<<<<<<<<<< @@ -6918,9 +6993,9 @@ static PyObject *__pyx_pf_7_record_20ForwardPassIteration_2__reduce__(struct __p * def _getstate(ForwardPassIteration self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_1); @@ -6937,16 +7012,16 @@ static PyObject *__pyx_pf_7_record_20ForwardPassIteration_2__reduce__(struct __p PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7_record_ForwardPassIteration))); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7_record_ForwardPassIteration))); - __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7_record_ForwardPassIteration))); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_ForwardPassIteration))); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_ForwardPassIteration))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_ForwardPassIteration))); PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_t_2)); __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_3); @@ -6963,7 +7038,7 @@ static PyObject *__pyx_pf_7_record_20ForwardPassIteration_2__reduce__(struct __p __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_record.ForwardPassIteration.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.ForwardPassIteration.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -6972,17 +7047,17 @@ static PyObject *__pyx_pf_7_record_20ForwardPassIteration_2__reduce__(struct __p } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_20ForwardPassIteration_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7_record_20ForwardPassIteration_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_7_record_20ForwardPassIteration_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_20ForwardPassIteration_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_getstate (wrapper)", 0); - __pyx_r = __pyx_pf_7_record_20ForwardPassIteration_4_getstate(((struct __pyx_obj_7_record_ForwardPassIteration *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration_4_getstate(((struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":217 +/* "sklearn/earth/_record.pyx":220 * return (ForwardPassIteration, (1,1,1,1.0,1), self._getstate()) * * def _getstate(ForwardPassIteration self): # <<<<<<<<<<<<<< @@ -6990,7 +7065,7 @@ static PyObject *__pyx_pw_7_record_20ForwardPassIteration_5_getstate(PyObject *_ * 'variable': self.variable, */ -static PyObject *__pyx_pf_7_record_20ForwardPassIteration_4_getstate(struct __pyx_obj_7_record_ForwardPassIteration *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration_4_getstate(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -7000,7 +7075,7 @@ static PyObject *__pyx_pf_7_record_20ForwardPassIteration_4_getstate(struct __py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_getstate", 0); - /* "_record.pyx":218 + /* "sklearn/earth/_record.pyx":221 * * def _getstate(ForwardPassIteration self): * return {'parent': self.parent, # <<<<<<<<<<<<<< @@ -7008,59 +7083,59 @@ static PyObject *__pyx_pf_7_record_20ForwardPassIteration_4_getstate(struct __py * 'knot': self.knot, */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->parent); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->parent); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__parent), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__parent), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "_record.pyx":219 + /* "sklearn/earth/_record.pyx":222 * def _getstate(ForwardPassIteration self): * return {'parent': self.parent, * 'variable': self.variable, # <<<<<<<<<<<<<< * 'knot': self.knot, * 'mse': self.mse, */ - __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->variable); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->variable); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__variable), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__variable), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "_record.pyx":220 + /* "sklearn/earth/_record.pyx":223 * return {'parent': self.parent, * 'variable': self.variable, * 'knot': self.knot, # <<<<<<<<<<<<<< * 'mse': self.mse, * 'size': self.size} */ - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->knot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->knot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__knot), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__knot), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "_record.pyx":221 + /* "sklearn/earth/_record.pyx":224 * 'variable': self.variable, * 'knot': self.knot, * 'mse': self.mse, # <<<<<<<<<<<<<< * 'size': self.size} * */ - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.mse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.mse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__mse), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__mse), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "_record.pyx":222 + /* "sklearn/earth/_record.pyx":225 * 'knot': self.knot, * 'mse': self.mse, * 'size': self.size} # <<<<<<<<<<<<<< * * def __setstate__(ForwardPassIteration self, dict state): */ - __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->__pyx_base.size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->__pyx_base.size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__size), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__size), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; @@ -7071,7 +7146,7 @@ static PyObject *__pyx_pf_7_record_20ForwardPassIteration_4_getstate(struct __py __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_record.ForwardPassIteration._getstate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.ForwardPassIteration._getstate", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -7080,16 +7155,16 @@ static PyObject *__pyx_pf_7_record_20ForwardPassIteration_4_getstate(struct __py } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_20ForwardPassIteration_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ -static PyObject *__pyx_pw_7_record_20ForwardPassIteration_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; +static PyObject *__pyx_pw_7sklearn_5earth_7_record_20ForwardPassIteration_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_20ForwardPassIteration_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), (&PyDict_Type), 1, "state", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7_record_20ForwardPassIteration_6__setstate__(((struct __pyx_obj_7_record_ForwardPassIteration *)__pyx_v_self), ((PyObject*)__pyx_v_state)); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), (&PyDict_Type), 1, "state", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration_6__setstate__(((struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration *)__pyx_v_self), ((PyObject*)__pyx_v_state)); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -7098,7 +7173,7 @@ static PyObject *__pyx_pw_7_record_20ForwardPassIteration_7__setstate__(PyObject return __pyx_r; } -/* "_record.pyx":224 +/* "sklearn/earth/_record.pyx":227 * 'size': self.size} * * def __setstate__(ForwardPassIteration self, dict state): # <<<<<<<<<<<<<< @@ -7106,18 +7181,18 @@ static PyObject *__pyx_pw_7_record_20ForwardPassIteration_7__setstate__(PyObject * self.variable = state['variable'] */ -static PyObject *__pyx_pf_7_record_20ForwardPassIteration_6__setstate__(struct __pyx_obj_7_record_ForwardPassIteration *__pyx_v_self, PyObject *__pyx_v_state) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration_6__setstate__(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration *__pyx_v_self, PyObject *__pyx_v_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __pyx_t_7_record_INDEX_t __pyx_t_2; - __pyx_t_7_record_FLOAT_t __pyx_t_3; + __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_t_2; + __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate__", 0); - /* "_record.pyx":225 + /* "sklearn/earth/_record.pyx":228 * * def __setstate__(ForwardPassIteration self, dict state): * self.parent = state['parent'] # <<<<<<<<<<<<<< @@ -7126,15 +7201,15 @@ static PyObject *__pyx_pf_7_record_20ForwardPassIteration_6__setstate__(struct _ */ if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__parent)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__parent)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->parent = __pyx_t_2; - /* "_record.pyx":226 + /* "sklearn/earth/_record.pyx":229 * def __setstate__(ForwardPassIteration self, dict state): * self.parent = state['parent'] * self.variable = state['variable'] # <<<<<<<<<<<<<< @@ -7143,15 +7218,15 @@ static PyObject *__pyx_pf_7_record_20ForwardPassIteration_6__setstate__(struct _ */ if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__variable)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__variable)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->variable = __pyx_t_2; - /* "_record.pyx":227 + /* "sklearn/earth/_record.pyx":230 * self.parent = state['parent'] * self.variable = state['variable'] * self.knot = state['knot'] # <<<<<<<<<<<<<< @@ -7160,15 +7235,15 @@ static PyObject *__pyx_pf_7_record_20ForwardPassIteration_6__setstate__(struct _ */ if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__knot)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__knot)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->knot = __pyx_t_3; - /* "_record.pyx":228 + /* "sklearn/earth/_record.pyx":231 * self.variable = state['variable'] * self.knot = state['knot'] * self.mse = state['mse'] # <<<<<<<<<<<<<< @@ -7177,15 +7252,15 @@ static PyObject *__pyx_pf_7_record_20ForwardPassIteration_6__setstate__(struct _ */ if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__mse)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__mse)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->__pyx_base.mse = __pyx_t_3; - /* "_record.pyx":229 + /* "sklearn/earth/_record.pyx":232 * self.knot = state['knot'] * self.mse = state['mse'] * self.size = state['size'] # <<<<<<<<<<<<<< @@ -7194,11 +7269,11 @@ static PyObject *__pyx_pf_7_record_20ForwardPassIteration_6__setstate__(struct _ */ if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__size)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__size)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->__pyx_base.size = __pyx_t_2; @@ -7206,7 +7281,7 @@ static PyObject *__pyx_pf_7_record_20ForwardPassIteration_6__setstate__(struct _ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_record.ForwardPassIteration.__setstate__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.ForwardPassIteration.__setstate__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -7215,17 +7290,17 @@ static PyObject *__pyx_pf_7_record_20ForwardPassIteration_6__setstate__(struct _ } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_20ForwardPassIteration_9__str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_7_record_20ForwardPassIteration_9__str__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_7sklearn_5earth_7_record_20ForwardPassIteration_9__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_20ForwardPassIteration_9__str__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_pf_7_record_20ForwardPassIteration_8__str__(((struct __pyx_obj_7_record_ForwardPassIteration *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration_8__str__(((struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":231 +/* "sklearn/earth/_record.pyx":234 * self.size = state['size'] * * def __str__(self): # <<<<<<<<<<<<<< @@ -7233,7 +7308,7 @@ static PyObject *__pyx_pw_7_record_20ForwardPassIteration_9__str__(PyObject *__p * return result */ -static PyObject *__pyx_pf_7_record_20ForwardPassIteration_8__str__(struct __pyx_obj_7_record_ForwardPassIteration *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration_8__str__(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration *__pyx_v_self) { PyObject *__pyx_v_result = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -7248,24 +7323,24 @@ static PyObject *__pyx_pf_7_record_20ForwardPassIteration_8__str__(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - /* "_record.pyx":232 + /* "sklearn/earth/_record.pyx":235 * * def __str__(self): * result = '%d\t%d\t%d\t%4f\t%d' % (self.parent,self.variable,self.knot,self.mse,self.size) # <<<<<<<<<<<<<< * return result * */ - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->parent); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->parent); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->variable); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->variable); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->knot); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->knot); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.mse); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.mse); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->__pyx_base.size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->__pyx_base.size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyTuple_New(5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyTuple_New(5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); @@ -7282,13 +7357,13 @@ static PyObject *__pyx_pf_7_record_20ForwardPassIteration_8__str__(struct __pyx_ __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_19), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_19), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; __pyx_v_result = ((PyObject *)__pyx_t_5); __pyx_t_5 = 0; - /* "_record.pyx":233 + /* "sklearn/earth/_record.pyx":236 * def __str__(self): * result = '%d\t%d\t%d\t%4f\t%d' % (self.parent,self.variable,self.knot,self.mse,self.size) * return result # <<<<<<<<<<<<<< @@ -7309,7 +7384,7 @@ static PyObject *__pyx_pf_7_record_20ForwardPassIteration_8__str__(struct __pyx_ __Pyx_XDECREF(__pyx_t_4); __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); - __Pyx_AddTraceback("_record.ForwardPassIteration.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.ForwardPassIteration.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_result); @@ -7318,7 +7393,7 @@ static PyObject *__pyx_pf_7_record_20ForwardPassIteration_8__str__(struct __pyx_ return __pyx_r; } -/* "_record.pyx":235 +/* "sklearn/earth/_record.pyx":238 * return result * * cpdef set_no_candidates(ForwardPassIteration self, bint value): # <<<<<<<<<<<<<< @@ -7326,8 +7401,8 @@ static PyObject *__pyx_pf_7_record_20ForwardPassIteration_8__str__(struct __pyx_ * */ -static PyObject *__pyx_pw_7_record_20ForwardPassIteration_11set_no_candidates(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/ -static PyObject *__pyx_f_7_record_20ForwardPassIteration_set_no_candidates(struct __pyx_obj_7_record_ForwardPassIteration *__pyx_v_self, int __pyx_v_value, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_7sklearn_5earth_7_record_20ForwardPassIteration_11set_no_candidates(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/ +static PyObject *__pyx_f_7sklearn_5earth_7_record_20ForwardPassIteration_set_no_candidates(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration *__pyx_v_self, int __pyx_v_value, int __pyx_skip_dispatch) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -7341,18 +7416,18 @@ static PyObject *__pyx_f_7_record_20ForwardPassIteration_set_no_candidates(struc if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__set_no_candidates); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__set_no_candidates); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7_record_20ForwardPassIteration_11set_no_candidates)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_20ForwardPassIteration_11set_no_candidates)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; @@ -7363,7 +7438,7 @@ static PyObject *__pyx_f_7_record_20ForwardPassIteration_set_no_candidates(struc __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_record.pyx":236 + /* "sklearn/earth/_record.pyx":239 * * cpdef set_no_candidates(ForwardPassIteration self, bint value): * self.no_candidates = value # <<<<<<<<<<<<<< @@ -7378,7 +7453,7 @@ static PyObject *__pyx_f_7_record_20ForwardPassIteration_set_no_candidates(struc __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_record.ForwardPassIteration.set_no_candidates", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.ForwardPassIteration.set_no_candidates", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -7387,8 +7462,8 @@ static PyObject *__pyx_f_7_record_20ForwardPassIteration_set_no_candidates(struc } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_20ForwardPassIteration_11set_no_candidates(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/ -static PyObject *__pyx_pw_7_record_20ForwardPassIteration_11set_no_candidates(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) { +static PyObject *__pyx_pw_7sklearn_5earth_7_record_20ForwardPassIteration_11set_no_candidates(PyObject *__pyx_v_self, PyObject *__pyx_arg_value); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_20ForwardPassIteration_11set_no_candidates(PyObject *__pyx_v_self, PyObject *__pyx_arg_value) { int __pyx_v_value; int __pyx_lineno = 0; const char *__pyx_filename = NULL; @@ -7397,20 +7472,20 @@ static PyObject *__pyx_pw_7_record_20ForwardPassIteration_11set_no_candidates(Py __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_no_candidates (wrapper)", 0); assert(__pyx_arg_value); { - __pyx_v_value = __Pyx_PyObject_IsTrue(__pyx_arg_value); if (unlikely((__pyx_v_value == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_value = __Pyx_PyObject_IsTrue(__pyx_arg_value); if (unlikely((__pyx_v_value == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; - __Pyx_AddTraceback("_record.ForwardPassIteration.set_no_candidates", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.ForwardPassIteration.set_no_candidates", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_7_record_20ForwardPassIteration_10set_no_candidates(((struct __pyx_obj_7_record_ForwardPassIteration *)__pyx_v_self), ((int)__pyx_v_value)); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration_10set_no_candidates(((struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration *)__pyx_v_self), ((int)__pyx_v_value)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":235 +/* "sklearn/earth/_record.pyx":238 * return result * * cpdef set_no_candidates(ForwardPassIteration self, bint value): # <<<<<<<<<<<<<< @@ -7418,7 +7493,7 @@ static PyObject *__pyx_pw_7_record_20ForwardPassIteration_11set_no_candidates(Py * */ -static PyObject *__pyx_pf_7_record_20ForwardPassIteration_10set_no_candidates(struct __pyx_obj_7_record_ForwardPassIteration *__pyx_v_self, int __pyx_v_value) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration_10set_no_candidates(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration *__pyx_v_self, int __pyx_v_value) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -7427,7 +7502,7 @@ static PyObject *__pyx_pf_7_record_20ForwardPassIteration_10set_no_candidates(st int __pyx_clineno = 0; __Pyx_RefNannySetupContext("set_no_candidates", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_7_record_ForwardPassIteration *)__pyx_v_self->__pyx_base.__pyx_vtab)->set_no_candidates(__pyx_v_self, __pyx_v_value, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassIteration *)__pyx_v_self->__pyx_base.__pyx_vtab)->set_no_candidates(__pyx_v_self, __pyx_v_value, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -7437,7 +7512,7 @@ static PyObject *__pyx_pf_7_record_20ForwardPassIteration_10set_no_candidates(st goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_record.ForwardPassIteration.set_no_candidates", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.ForwardPassIteration.set_no_candidates", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -7445,7 +7520,7 @@ static PyObject *__pyx_pf_7_record_20ForwardPassIteration_10set_no_candidates(st return __pyx_r; } -/* "_record.pyx":238 +/* "sklearn/earth/_record.pyx":241 * self.no_candidates = value * * cpdef no_further_candidates(ForwardPassIteration self): # <<<<<<<<<<<<<< @@ -7453,8 +7528,8 @@ static PyObject *__pyx_pf_7_record_20ForwardPassIteration_10set_no_candidates(st * */ -static PyObject *__pyx_pw_7_record_20ForwardPassIteration_13no_further_candidates(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_f_7_record_20ForwardPassIteration_no_further_candidates(struct __pyx_obj_7_record_ForwardPassIteration *__pyx_v_self, int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_7sklearn_5earth_7_record_20ForwardPassIteration_13no_further_candidates(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_f_7sklearn_5earth_7_record_20ForwardPassIteration_no_further_candidates(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration *__pyx_v_self, int __pyx_skip_dispatch) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -7467,11 +7542,11 @@ static PyObject *__pyx_f_7_record_20ForwardPassIteration_no_further_candidates(s if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_20); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_20); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7_record_20ForwardPassIteration_13no_further_candidates)) { + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_20ForwardPassIteration_13no_further_candidates)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -7481,7 +7556,7 @@ static PyObject *__pyx_f_7_record_20ForwardPassIteration_no_further_candidates(s __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_record.pyx":239 + /* "sklearn/earth/_record.pyx":242 * * cpdef no_further_candidates(ForwardPassIteration self): * return self.no_candidates # <<<<<<<<<<<<<< @@ -7489,7 +7564,7 @@ static PyObject *__pyx_f_7_record_20ForwardPassIteration_no_further_candidates(s * cdef class FirstForwardPassIteration(ForwardPassIteration): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->no_candidates); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->no_candidates); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -7500,7 +7575,7 @@ static PyObject *__pyx_f_7_record_20ForwardPassIteration_no_further_candidates(s __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_record.ForwardPassIteration.no_further_candidates", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.ForwardPassIteration.no_further_candidates", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -7509,17 +7584,17 @@ static PyObject *__pyx_f_7_record_20ForwardPassIteration_no_further_candidates(s } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_20ForwardPassIteration_13no_further_candidates(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7_record_20ForwardPassIteration_13no_further_candidates(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_7_record_20ForwardPassIteration_13no_further_candidates(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_20ForwardPassIteration_13no_further_candidates(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("no_further_candidates (wrapper)", 0); - __pyx_r = __pyx_pf_7_record_20ForwardPassIteration_12no_further_candidates(((struct __pyx_obj_7_record_ForwardPassIteration *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration_12no_further_candidates(((struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":238 +/* "sklearn/earth/_record.pyx":241 * self.no_candidates = value * * cpdef no_further_candidates(ForwardPassIteration self): # <<<<<<<<<<<<<< @@ -7527,7 +7602,7 @@ static PyObject *__pyx_pw_7_record_20ForwardPassIteration_13no_further_candidate * */ -static PyObject *__pyx_pf_7_record_20ForwardPassIteration_12no_further_candidates(struct __pyx_obj_7_record_ForwardPassIteration *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration_12no_further_candidates(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -7536,7 +7611,7 @@ static PyObject *__pyx_pf_7_record_20ForwardPassIteration_12no_further_candidate int __pyx_clineno = 0; __Pyx_RefNannySetupContext("no_further_candidates", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_7_record_ForwardPassIteration *)__pyx_v_self->__pyx_base.__pyx_vtab)->no_further_candidates(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassIteration *)__pyx_v_self->__pyx_base.__pyx_vtab)->no_further_candidates(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -7546,7 +7621,7 @@ static PyObject *__pyx_pf_7_record_20ForwardPassIteration_12no_further_candidate goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_record.ForwardPassIteration.no_further_candidates", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.ForwardPassIteration.no_further_candidates", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -7555,9 +7630,9 @@ static PyObject *__pyx_pf_7_record_20ForwardPassIteration_12no_further_candidate } /* Python wrapper */ -static int __pyx_pw_7_record_25FirstForwardPassIteration_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static int __pyx_pw_7_record_25FirstForwardPassIteration_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __pyx_t_7_record_FLOAT_t __pyx_v_mse; +static int __pyx_pw_7sklearn_5earth_7_record_25FirstForwardPassIteration_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static int __pyx_pw_7sklearn_5earth_7_record_25FirstForwardPassIteration_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_v_mse; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -7582,29 +7657,29 @@ static int __pyx_pw_7_record_25FirstForwardPassIteration_1__init__(PyObject *__p else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); } - __pyx_v_mse = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_mse == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_mse = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_mse == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_record.FirstForwardPassIteration.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.FirstForwardPassIteration.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_7_record_25FirstForwardPassIteration___init__(((struct __pyx_obj_7_record_FirstForwardPassIteration *)__pyx_v_self), __pyx_v_mse); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_25FirstForwardPassIteration___init__(((struct __pyx_obj_7sklearn_5earth_7_record_FirstForwardPassIteration *)__pyx_v_self), __pyx_v_mse); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":242 +/* "sklearn/earth/_record.pyx":245 * * cdef class FirstForwardPassIteration(ForwardPassIteration): * def __init__(FirstForwardPassIteration self, FLOAT_t mse): # <<<<<<<<<<<<<< @@ -7612,12 +7687,12 @@ static int __pyx_pw_7_record_25FirstForwardPassIteration_1__init__(PyObject *__p * */ -static int __pyx_pf_7_record_25FirstForwardPassIteration___init__(struct __pyx_obj_7_record_FirstForwardPassIteration *__pyx_v_self, __pyx_t_7_record_FLOAT_t __pyx_v_mse) { +static int __pyx_pf_7sklearn_5earth_7_record_25FirstForwardPassIteration___init__(struct __pyx_obj_7sklearn_5earth_7_record_FirstForwardPassIteration *__pyx_v_self, __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_v_mse) { int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); - /* "_record.pyx":243 + /* "sklearn/earth/_record.pyx":246 * cdef class FirstForwardPassIteration(ForwardPassIteration): * def __init__(FirstForwardPassIteration self, FLOAT_t mse): * self.mse = mse # <<<<<<<<<<<<<< @@ -7632,17 +7707,17 @@ static int __pyx_pf_7_record_25FirstForwardPassIteration___init__(struct __pyx_o } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_25FirstForwardPassIteration_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7_record_25FirstForwardPassIteration_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_7_record_25FirstForwardPassIteration_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_25FirstForwardPassIteration_3__reduce__(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__reduce__ (wrapper)", 0); - __pyx_r = __pyx_pf_7_record_25FirstForwardPassIteration_2__reduce__(((struct __pyx_obj_7_record_FirstForwardPassIteration *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_25FirstForwardPassIteration_2__reduce__(((struct __pyx_obj_7sklearn_5earth_7_record_FirstForwardPassIteration *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":245 +/* "sklearn/earth/_record.pyx":248 * self.mse = mse * * def __reduce__(FirstForwardPassIteration self): # <<<<<<<<<<<<<< @@ -7650,7 +7725,7 @@ static PyObject *__pyx_pw_7_record_25FirstForwardPassIteration_3__reduce__(PyObj * */ -static PyObject *__pyx_pf_7_record_25FirstForwardPassIteration_2__reduce__(struct __pyx_obj_7_record_FirstForwardPassIteration *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_25FirstForwardPassIteration_2__reduce__(struct __pyx_obj_7sklearn_5earth_7_record_FirstForwardPassIteration *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -7661,7 +7736,7 @@ static PyObject *__pyx_pf_7_record_25FirstForwardPassIteration_2__reduce__(struc int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce__", 0); - /* "_record.pyx":246 + /* "sklearn/earth/_record.pyx":249 * * def __reduce__(FirstForwardPassIteration self): * return (FirstForwardPassIteration, (1.0,), self._getstate()) # <<<<<<<<<<<<<< @@ -7669,23 +7744,23 @@ static PyObject *__pyx_pf_7_record_25FirstForwardPassIteration_2__reduce__(struc * def _getstate(FirstForwardPassIteration self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7_record_FirstForwardPassIteration))); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7_record_FirstForwardPassIteration))); - __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7_record_FirstForwardPassIteration))); + __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_FirstForwardPassIteration))); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_FirstForwardPassIteration))); + __Pyx_GIVEREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_FirstForwardPassIteration))); PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_t_2)); __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_3); @@ -7702,7 +7777,7 @@ static PyObject *__pyx_pf_7_record_25FirstForwardPassIteration_2__reduce__(struc __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_record.FirstForwardPassIteration.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.FirstForwardPassIteration.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -7711,17 +7786,17 @@ static PyObject *__pyx_pf_7_record_25FirstForwardPassIteration_2__reduce__(struc } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_25FirstForwardPassIteration_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7_record_25FirstForwardPassIteration_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_7_record_25FirstForwardPassIteration_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_25FirstForwardPassIteration_5_getstate(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_getstate (wrapper)", 0); - __pyx_r = __pyx_pf_7_record_25FirstForwardPassIteration_4_getstate(((struct __pyx_obj_7_record_FirstForwardPassIteration *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_25FirstForwardPassIteration_4_getstate(((struct __pyx_obj_7sklearn_5earth_7_record_FirstForwardPassIteration *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":248 +/* "sklearn/earth/_record.pyx":251 * return (FirstForwardPassIteration, (1.0,), self._getstate()) * * def _getstate(FirstForwardPassIteration self): # <<<<<<<<<<<<<< @@ -7729,7 +7804,7 @@ static PyObject *__pyx_pw_7_record_25FirstForwardPassIteration_5_getstate(PyObje * */ -static PyObject *__pyx_pf_7_record_25FirstForwardPassIteration_4_getstate(struct __pyx_obj_7_record_FirstForwardPassIteration *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_25FirstForwardPassIteration_4_getstate(struct __pyx_obj_7sklearn_5earth_7_record_FirstForwardPassIteration *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -7739,7 +7814,7 @@ static PyObject *__pyx_pf_7_record_25FirstForwardPassIteration_4_getstate(struct int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_getstate", 0); - /* "_record.pyx":249 + /* "sklearn/earth/_record.pyx":252 * * def _getstate(FirstForwardPassIteration self): * return {'mse': self.mse} # <<<<<<<<<<<<<< @@ -7747,11 +7822,11 @@ static PyObject *__pyx_pf_7_record_25FirstForwardPassIteration_4_getstate(struct * def __setstate__(FirstForwardPassIteration self, dict state): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.__pyx_base.mse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.__pyx_base.mse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__mse), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__mse), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; @@ -7762,7 +7837,7 @@ static PyObject *__pyx_pf_7_record_25FirstForwardPassIteration_4_getstate(struct __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_record.FirstForwardPassIteration._getstate", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.FirstForwardPassIteration._getstate", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -7771,16 +7846,16 @@ static PyObject *__pyx_pf_7_record_25FirstForwardPassIteration_4_getstate(struct } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_25FirstForwardPassIteration_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ -static PyObject *__pyx_pw_7_record_25FirstForwardPassIteration_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { - int __pyx_lineno = 0; - const char *__pyx_filename = NULL; - int __pyx_clineno = 0; +static PyObject *__pyx_pw_7sklearn_5earth_7_record_25FirstForwardPassIteration_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_25FirstForwardPassIteration_7__setstate__(PyObject *__pyx_v_self, PyObject *__pyx_v_state) { + CYTHON_UNUSED int __pyx_lineno = 0; + CYTHON_UNUSED const char *__pyx_filename = NULL; + CYTHON_UNUSED int __pyx_clineno = 0; PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), (&PyDict_Type), 1, "state", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7_record_25FirstForwardPassIteration_6__setstate__(((struct __pyx_obj_7_record_FirstForwardPassIteration *)__pyx_v_self), ((PyObject*)__pyx_v_state)); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), (&PyDict_Type), 1, "state", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_25FirstForwardPassIteration_6__setstate__(((struct __pyx_obj_7sklearn_5earth_7_record_FirstForwardPassIteration *)__pyx_v_self), ((PyObject*)__pyx_v_state)); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -7789,7 +7864,7 @@ static PyObject *__pyx_pw_7_record_25FirstForwardPassIteration_7__setstate__(PyO return __pyx_r; } -/* "_record.pyx":251 +/* "sklearn/earth/_record.pyx":254 * return {'mse': self.mse} * * def __setstate__(FirstForwardPassIteration self, dict state): # <<<<<<<<<<<<<< @@ -7797,17 +7872,17 @@ static PyObject *__pyx_pw_7_record_25FirstForwardPassIteration_7__setstate__(PyO * */ -static PyObject *__pyx_pf_7_record_25FirstForwardPassIteration_6__setstate__(struct __pyx_obj_7_record_FirstForwardPassIteration *__pyx_v_self, PyObject *__pyx_v_state) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_25FirstForwardPassIteration_6__setstate__(struct __pyx_obj_7sklearn_5earth_7_record_FirstForwardPassIteration *__pyx_v_self, PyObject *__pyx_v_state) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; - __pyx_t_7_record_FLOAT_t __pyx_t_2; + __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_t_2; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate__", 0); - /* "_record.pyx":252 + /* "sklearn/earth/_record.pyx":255 * * def __setstate__(FirstForwardPassIteration self, dict state): * self.mse = state['mse'] # <<<<<<<<<<<<<< @@ -7816,11 +7891,11 @@ static PyObject *__pyx_pf_7_record_25FirstForwardPassIteration_6__setstate__(str */ if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__mse)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__mse)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->__pyx_base.__pyx_base.mse = __pyx_t_2; @@ -7828,7 +7903,7 @@ static PyObject *__pyx_pf_7_record_25FirstForwardPassIteration_6__setstate__(str goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_record.FirstForwardPassIteration.__setstate__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.FirstForwardPassIteration.__setstate__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -7836,7 +7911,7 @@ static PyObject *__pyx_pf_7_record_25FirstForwardPassIteration_6__setstate__(str return __pyx_r; } -/* "_record.pyx":254 +/* "sklearn/earth/_record.pyx":257 * self.mse = state['mse'] * * cpdef INDEX_t get_size(FirstForwardPassIteration self): # <<<<<<<<<<<<<< @@ -7844,13 +7919,13 @@ static PyObject *__pyx_pf_7_record_25FirstForwardPassIteration_6__setstate__(str * */ -static PyObject *__pyx_pw_7_record_25FirstForwardPassIteration_9get_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static __pyx_t_7_record_INDEX_t __pyx_f_7_record_25FirstForwardPassIteration_get_size(CYTHON_UNUSED struct __pyx_obj_7_record_FirstForwardPassIteration *__pyx_v_self, int __pyx_skip_dispatch) { - __pyx_t_7_record_INDEX_t __pyx_r; +static PyObject *__pyx_pw_7sklearn_5earth_7_record_25FirstForwardPassIteration_9get_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_f_7sklearn_5earth_7_record_25FirstForwardPassIteration_get_size(CYTHON_UNUSED struct __pyx_obj_7sklearn_5earth_7_record_FirstForwardPassIteration *__pyx_v_self, int __pyx_skip_dispatch) { + __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - __pyx_t_7_record_INDEX_t __pyx_t_3; + __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_t_3; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -7859,12 +7934,12 @@ static __pyx_t_7_record_INDEX_t __pyx_f_7_record_25FirstForwardPassIteration_get if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7_record_25FirstForwardPassIteration_9get_size)) { - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_25FirstForwardPassIteration_9get_size)) { + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -7873,7 +7948,7 @@ static __pyx_t_7_record_INDEX_t __pyx_f_7_record_25FirstForwardPassIteration_get __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "_record.pyx":255 + /* "sklearn/earth/_record.pyx":258 * * cpdef INDEX_t get_size(FirstForwardPassIteration self): * return 1 # <<<<<<<<<<<<<< @@ -7888,7 +7963,7 @@ static __pyx_t_7_record_INDEX_t __pyx_f_7_record_25FirstForwardPassIteration_get __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_WriteUnraisable("_record.FirstForwardPassIteration.get_size", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_WriteUnraisable("sklearn.earth._record.FirstForwardPassIteration.get_size", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -7896,17 +7971,17 @@ static __pyx_t_7_record_INDEX_t __pyx_f_7_record_25FirstForwardPassIteration_get } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_25FirstForwardPassIteration_9get_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ -static PyObject *__pyx_pw_7_record_25FirstForwardPassIteration_9get_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { +static PyObject *__pyx_pw_7sklearn_5earth_7_record_25FirstForwardPassIteration_9get_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_25FirstForwardPassIteration_9get_size(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_size (wrapper)", 0); - __pyx_r = __pyx_pf_7_record_25FirstForwardPassIteration_8get_size(((struct __pyx_obj_7_record_FirstForwardPassIteration *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_25FirstForwardPassIteration_8get_size(((struct __pyx_obj_7sklearn_5earth_7_record_FirstForwardPassIteration *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":254 +/* "sklearn/earth/_record.pyx":257 * self.mse = state['mse'] * * cpdef INDEX_t get_size(FirstForwardPassIteration self): # <<<<<<<<<<<<<< @@ -7914,7 +7989,7 @@ static PyObject *__pyx_pw_7_record_25FirstForwardPassIteration_9get_size(PyObjec * */ -static PyObject *__pyx_pf_7_record_25FirstForwardPassIteration_8get_size(struct __pyx_obj_7_record_FirstForwardPassIteration *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_25FirstForwardPassIteration_8get_size(struct __pyx_obj_7sklearn_5earth_7_record_FirstForwardPassIteration *__pyx_v_self) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -7923,7 +7998,7 @@ static PyObject *__pyx_pf_7_record_25FirstForwardPassIteration_8get_size(struct int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_size", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_7_record_FirstForwardPassIteration *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.get_size(((struct __pyx_obj_7_record_Iteration *)__pyx_v_self), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_FirstForwardPassIteration *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.get_size(((struct __pyx_obj_7sklearn_5earth_7_record_Iteration *)__pyx_v_self), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -7933,7 +8008,7 @@ static PyObject *__pyx_pf_7_record_25FirstForwardPassIteration_8get_size(struct goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_record.FirstForwardPassIteration.get_size", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.FirstForwardPassIteration.get_size", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -7942,17 +8017,17 @@ static PyObject *__pyx_pf_7_record_25FirstForwardPassIteration_8get_size(struct } /* Python wrapper */ -static PyObject *__pyx_pw_7_record_25FirstForwardPassIteration_11__str__(PyObject *__pyx_v_self); /*proto*/ -static PyObject *__pyx_pw_7_record_25FirstForwardPassIteration_11__str__(PyObject *__pyx_v_self) { +static PyObject *__pyx_pw_7sklearn_5earth_7_record_25FirstForwardPassIteration_11__str__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_7_record_25FirstForwardPassIteration_11__str__(PyObject *__pyx_v_self) { PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__ (wrapper)", 0); - __pyx_r = __pyx_pf_7_record_25FirstForwardPassIteration_10__str__(((struct __pyx_obj_7_record_FirstForwardPassIteration *)__pyx_v_self)); + __pyx_r = __pyx_pf_7sklearn_5earth_7_record_25FirstForwardPassIteration_10__str__(((struct __pyx_obj_7sklearn_5earth_7_record_FirstForwardPassIteration *)__pyx_v_self)); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_record.pyx":257 +/* "sklearn/earth/_record.pyx":260 * return 1 * * def __str__(self): # <<<<<<<<<<<<<< @@ -7960,7 +8035,7 @@ static PyObject *__pyx_pw_7_record_25FirstForwardPassIteration_11__str__(PyObjec * return result */ -static PyObject *__pyx_pf_7_record_25FirstForwardPassIteration_10__str__(struct __pyx_obj_7_record_FirstForwardPassIteration *__pyx_v_self) { +static PyObject *__pyx_pf_7sklearn_5earth_7_record_25FirstForwardPassIteration_10__str__(struct __pyx_obj_7sklearn_5earth_7_record_FirstForwardPassIteration *__pyx_v_self) { PyObject *__pyx_v_result = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -7971,16 +8046,16 @@ static PyObject *__pyx_pf_7_record_25FirstForwardPassIteration_10__str__(struct int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - /* "_record.pyx":258 + /* "sklearn/earth/_record.pyx":261 * * def __str__(self): * result = '%s\t%s\t%s\t%4f\t%s' % ('-','-','-',self.mse,1) # <<<<<<<<<<<<<< * return result * */ - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.__pyx_base.mse); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.__pyx_base.mse); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_kp_s_18)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_18)); @@ -7997,13 +8072,13 @@ static PyObject *__pyx_pf_7_record_25FirstForwardPassIteration_10__str__(struct PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_v_result = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "_record.pyx":259 + /* "sklearn/earth/_record.pyx":262 * def __str__(self): * result = '%s\t%s\t%s\t%4f\t%s' % ('-','-','-',self.mse,1) * return result # <<<<<<<<<<<<<< @@ -8019,7 +8094,7 @@ static PyObject *__pyx_pf_7_record_25FirstForwardPassIteration_10__str__(struct __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_AddTraceback("_record.FirstForwardPassIteration.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._record.FirstForwardPassIteration.__str__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_result); @@ -8085,7 +8160,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * * cdef int copy_shape, i, ndim */ - __pyx_t_1 = (__pyx_v_info == NULL); + __pyx_t_1 = ((__pyx_v_info == NULL) != 0); if (__pyx_t_1) { __pyx_r = 0; goto __pyx_L0; @@ -8127,7 +8202,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * copy_shape = 1 * else: */ - __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); if (__pyx_t_1) { /* "numpy.pxd":209 @@ -8160,7 +8235,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); + __pyx_t_1 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0); if (__pyx_t_1) { /* "numpy.pxd":214 @@ -8170,7 +8245,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * raise ValueError(u"ndarray is not C contiguous") * */ - __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS)); + __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; @@ -8200,7 +8275,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") */ - __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); + __pyx_t_3 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0); if (__pyx_t_3) { /* "numpy.pxd":218 @@ -8210,7 +8285,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * raise ValueError(u"ndarray is not Fortran contiguous") * */ - __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS)); + __pyx_t_1 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; @@ -8258,7 +8333,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. */ - if (__pyx_v_copy_shape) { + __pyx_t_2 = (__pyx_v_copy_shape != 0); + if (__pyx_t_2) { /* "numpy.pxd":226 * # Allocate new buffer for strides and shape info. @@ -8356,7 +8432,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * * cdef int t */ - __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self)); + __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0)); /* "numpy.pxd":239 * @@ -8395,9 +8471,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * # do not call releasebuffer * info.obj = None */ - __pyx_t_2 = (!__pyx_v_hasfields); + __pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0); if (__pyx_t_2) { - __pyx_t_3 = (!__pyx_v_copy_shape); + __pyx_t_3 = ((!(__pyx_v_copy_shape != 0)) != 0); __pyx_t_1 = __pyx_t_3; } else { __pyx_t_1 = __pyx_t_2; @@ -8442,7 +8518,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or */ - __pyx_t_1 = (!__pyx_v_hasfields); + __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0); if (__pyx_t_1) { /* "numpy.pxd":254 @@ -8462,9 +8538,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ - __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); + __pyx_t_1 = ((__pyx_v_descr->byteorder == '>') != 0); if (__pyx_t_1) { - __pyx_t_2 = __pyx_v_little_endian; + __pyx_t_2 = (__pyx_v_little_endian != 0); } else { __pyx_t_2 = __pyx_t_1; } @@ -8477,9 +8553,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" */ - __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); + __pyx_t_1 = ((__pyx_v_descr->byteorder == '<') != 0); if (__pyx_t_1) { - __pyx_t_3 = (!__pyx_v_little_endian); + __pyx_t_3 = ((!(__pyx_v_little_endian != 0)) != 0); __pyx_t_7 = __pyx_t_3; } else { __pyx_t_7 = __pyx_t_1; @@ -8851,7 +8927,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self); + __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0); if (__pyx_t_1) { /* "numpy.pxd":290 @@ -8873,7 +8949,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s * stdlib.free(info.strides) * # info.shape was stored after info.strides in the same block */ - __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); if (__pyx_t_1) { /* "numpy.pxd":292 @@ -9304,9 +9380,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ - __pyx_t_7 = (__pyx_v_child->byteorder == '>'); + __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0); if (__pyx_t_7) { - __pyx_t_8 = __pyx_v_little_endian; + __pyx_t_8 = (__pyx_v_little_endian != 0); } else { __pyx_t_8 = __pyx_t_7; } @@ -9319,9 +9395,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ - __pyx_t_7 = (__pyx_v_child->byteorder == '<'); + __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0); if (__pyx_t_7) { - __pyx_t_9 = (!__pyx_v_little_endian); + __pyx_t_9 = ((!(__pyx_v_little_endian != 0)) != 0); __pyx_t_10 = __pyx_t_9; } else { __pyx_t_10 = __pyx_t_7; @@ -9410,7 +9486,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * t = child.type_num * if end - f < 5: */ - __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child)); + __pyx_t_7 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0); if (__pyx_t_7) { /* "numpy.pxd":821 @@ -9433,7 +9509,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * raise RuntimeError(u"Format string allocated too short.") * */ - __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5); + __pyx_t_7 = (((__pyx_v_end - __pyx_v_f) < 5) != 0); if (__pyx_t_7) { /* "numpy.pxd":823 @@ -9855,6 +9931,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a PyObject *__pyx_v_baseptr; __Pyx_RefNannyDeclarations int __pyx_t_1; + int __pyx_t_2; __Pyx_RefNannySetupContext("set_array_base", 0); /* "numpy.pxd":967 @@ -9865,7 +9942,8 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a * else: */ __pyx_t_1 = (__pyx_v_base == Py_None); - if (__pyx_t_1) { + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { /* "numpy.pxd":968 * cdef PyObject* baseptr @@ -9941,7 +10019,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py * return None * else: */ - __pyx_t_1 = (__pyx_v_arr->base == NULL); + __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0); if (__pyx_t_1) { /* "numpy.pxd":977 @@ -9977,165 +10055,110 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py __Pyx_RefNannyFinishContext(); return __pyx_r; } -static struct __pyx_vtabstruct_7_record_Record __pyx_vtable_7_record_Record; +static struct __pyx_vtabstruct_7sklearn_5earth_7_record_Iteration __pyx_vtable_7sklearn_5earth_7_record_Iteration; -static PyObject *__pyx_tp_new_7_record_Record(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_7_record_Record *p; +static PyObject *__pyx_tp_new_7sklearn_5earth_7_record_Iteration(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_7sklearn_5earth_7_record_Iteration *p; PyObject *o; o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7_record_Record *)o); - p->__pyx_vtab = __pyx_vtabptr_7_record_Record; - p->iterations = ((PyObject*)Py_None); Py_INCREF(Py_None); + p = ((struct __pyx_obj_7sklearn_5earth_7_record_Iteration *)o); + p->__pyx_vtab = __pyx_vtabptr_7sklearn_5earth_7_record_Iteration; return o; } -static void __pyx_tp_dealloc_7_record_Record(PyObject *o) { - struct __pyx_obj_7_record_Record *p = (struct __pyx_obj_7_record_Record *)o; - PyObject_GC_UnTrack(o); - Py_CLEAR(p->iterations); +static void __pyx_tp_dealloc_7sklearn_5earth_7_record_Iteration(PyObject *o) { (*Py_TYPE(o)->tp_free)(o); } -static int __pyx_tp_traverse_7_record_Record(PyObject *o, visitproc v, void *a) { - int e; - struct __pyx_obj_7_record_Record *p = (struct __pyx_obj_7_record_Record *)o; - if (p->iterations) { - e = (*v)(p->iterations, a); if (e) return e; - } - return 0; -} - -static int __pyx_tp_clear_7_record_Record(PyObject *o) { - struct __pyx_obj_7_record_Record *p = (struct __pyx_obj_7_record_Record *)o; - PyObject* tmp; - tmp = ((PyObject*)p->iterations); - p->iterations = ((PyObject*)Py_None); Py_INCREF(Py_None); - Py_XDECREF(tmp); - return 0; -} -static PyObject *__pyx_sq_item_7_record_Record(PyObject *o, Py_ssize_t i) { - PyObject *r; - PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; - r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); - Py_DECREF(x); - return r; -} - -static PyMethodDef __pyx_methods_7_record_Record[] = { - {__Pyx_NAMESTR("_eq"), (PyCFunction)__pyx_pw_7_record_6Record_3_eq, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("append"), (PyCFunction)__pyx_pw_7_record_6Record_9append, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("mse"), (PyCFunction)__pyx_pw_7_record_6Record_11mse, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("gcv"), (PyCFunction)__pyx_pw_7_record_6Record_13gcv, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("rsq"), (PyCFunction)__pyx_pw_7_record_6Record_15rsq, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("grsq"), (PyCFunction)__pyx_pw_7_record_6Record_17grsq, METH_O, __Pyx_DOCSTR(0)}, +static PyMethodDef __pyx_methods_7sklearn_5earth_7_record_Iteration[] = { + {__Pyx_NAMESTR("_eq"), (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_9Iteration_3_eq, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_mse"), (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_9Iteration_5get_mse, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_size"), (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_9Iteration_7get_size, METH_NOARGS, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; -static PyNumberMethods __pyx_tp_as_number_Record = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ +static PyTypeObject __pyx_type_7sklearn_5earth_7_record_Iteration = { + PyVarObject_HEAD_INIT(0, 0) + __Pyx_NAMESTR("sklearn.earth._record.Iteration"), /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_5earth_7_record_Iteration), /*tp_basicsize*/ + 0, /*tp_itemsize*/ + __pyx_tp_dealloc_7sklearn_5earth_7_record_Iteration, /*tp_dealloc*/ + 0, /*tp_print*/ + 0, /*tp_getattr*/ + 0, /*tp_setattr*/ #if PY_MAJOR_VERSION < 3 - 0, /*nb_long*/ + 0, /*tp_compare*/ #else 0, /*reserved*/ #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if PY_VERSION_HEX >= 0x02050000 - 0, /*nb_index*/ + 0, /*tp_repr*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ + 0, /*tp_hash*/ + 0, /*tp_call*/ + 0, /*tp_str*/ + 0, /*tp_getattro*/ + 0, /*tp_setattro*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + 0, /*tp_doc*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + __pyx_pw_7sklearn_5earth_7_record_9Iteration_1__richcmp__, /*tp_richcompare*/ + 0, /*tp_weaklistoffset*/ + 0, /*tp_iter*/ + 0, /*tp_iternext*/ + __pyx_methods_7sklearn_5earth_7_record_Iteration, /*tp_methods*/ + 0, /*tp_members*/ + 0, /*tp_getset*/ + 0, /*tp_base*/ + 0, /*tp_dict*/ + 0, /*tp_descr_get*/ + 0, /*tp_descr_set*/ + 0, /*tp_dictoffset*/ + 0, /*tp_init*/ + 0, /*tp_alloc*/ + __pyx_tp_new_7sklearn_5earth_7_record_Iteration, /*tp_new*/ + 0, /*tp_free*/ + 0, /*tp_is_gc*/ + 0, /*tp_bases*/ + 0, /*tp_mro*/ + 0, /*tp_cache*/ + 0, /*tp_subclasses*/ + 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ #endif }; +static struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassIteration __pyx_vtable_7sklearn_5earth_7_record_ForwardPassIteration; -static PySequenceMethods __pyx_tp_as_sequence_Record = { - __pyx_pw_7_record_6Record_7__len__, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - __pyx_sq_item_7_record_Record, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_Record = { - __pyx_pw_7_record_6Record_7__len__, /*mp_length*/ - __pyx_pw_7_record_6Record_5__getitem__, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; +static PyObject *__pyx_tp_new_7sklearn_5earth_7_record_ForwardPassIteration(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration *p; + PyObject *o = __pyx_tp_new_7sklearn_5earth_7_record_Iteration(t, a, k); + if (unlikely(!o)) return 0; + p = ((struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_5earth_7_record_Iteration*)__pyx_vtabptr_7sklearn_5earth_7_record_ForwardPassIteration; + return o; +} -static PyBufferProcs __pyx_tp_as_buffer_Record = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif +static PyMethodDef __pyx_methods_7sklearn_5earth_7_record_ForwardPassIteration[] = { + {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_20ForwardPassIteration_3__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_getstate"), (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_20ForwardPassIteration_5_getstate, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__setstate__"), (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_20ForwardPassIteration_7__setstate__, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("set_no_candidates"), (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_20ForwardPassIteration_11set_no_candidates, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("no_further_candidates"), (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_20ForwardPassIteration_13no_further_candidates, METH_NOARGS, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} }; -static PyTypeObject __pyx_type_7_record_Record = { +static PyTypeObject __pyx_type_7sklearn_5earth_7_record_ForwardPassIteration = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_record.Record"), /*tp_name*/ - sizeof(struct __pyx_obj_7_record_Record), /*tp_basicsize*/ + __Pyx_NAMESTR("sklearn.earth._record.ForwardPassIteration"), /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7_record_Record, /*tp_dealloc*/ + __pyx_tp_dealloc_7sklearn_5earth_7_record_Iteration, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -10145,24 +10168,24 @@ static PyTypeObject __pyx_type_7_record_Record = { 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number_Record, /*tp_as_number*/ - &__pyx_tp_as_sequence_Record, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_Record, /*tp_as_mapping*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ - 0, /*tp_str*/ + __pyx_pw_7sklearn_5earth_7_record_20ForwardPassIteration_9__str__, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_Record, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_7_record_Record, /*tp_traverse*/ - __pyx_tp_clear_7_record_Record, /*tp_clear*/ - __pyx_pw_7_record_6Record_1__richcmp__, /*tp_richcompare*/ + 0, /*tp_traverse*/ + 0, /*tp_clear*/ + 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7_record_Record, /*tp_methods*/ + __pyx_methods_7sklearn_5earth_7_record_ForwardPassIteration, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -10170,9 +10193,9 @@ static PyTypeObject __pyx_type_7_record_Record = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - 0, /*tp_init*/ + __pyx_pw_7sklearn_5earth_7_record_20ForwardPassIteration_1__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7_record_Record, /*tp_new*/ + __pyx_tp_new_7sklearn_5earth_7_record_ForwardPassIteration, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -10185,94 +10208,66 @@ static PyTypeObject __pyx_type_7_record_Record = { 0, /*tp_version_tag*/ #endif }; -static struct __pyx_vtabstruct_7_record_PruningPassRecord __pyx_vtable_7_record_PruningPassRecord; +static struct __pyx_vtabstruct_7sklearn_5earth_7_record_Record __pyx_vtable_7sklearn_5earth_7_record_Record; -static PyObject *__pyx_tp_new_7_record_PruningPassRecord(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_7_record_PruningPassRecord *p; - PyObject *o = __pyx_tp_new_7_record_Record(t, a, k); +static PyObject *__pyx_tp_new_7sklearn_5earth_7_record_Record(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { + struct __pyx_obj_7sklearn_5earth_7_record_Record *p; + PyObject *o; + o = (*t->tp_alloc)(t, 0); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7_record_PruningPassRecord *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7_record_Record*)__pyx_vtabptr_7_record_PruningPassRecord; + p = ((struct __pyx_obj_7sklearn_5earth_7_record_Record *)o); + p->__pyx_vtab = __pyx_vtabptr_7sklearn_5earth_7_record_Record; + p->iterations = ((PyObject*)Py_None); Py_INCREF(Py_None); return o; } -static PyMethodDef __pyx_methods_7_record_PruningPassRecord[] = { - {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_7_record_17PruningPassRecord_3__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("_getstate"), (PyCFunction)__pyx_pw_7_record_17PruningPassRecord_5_getstate, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("__setstate__"), (PyCFunction)__pyx_pw_7_record_17PruningPassRecord_7__setstate__, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("set_selected"), (PyCFunction)__pyx_pw_7_record_17PruningPassRecord_9set_selected, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_selected"), (PyCFunction)__pyx_pw_7_record_17PruningPassRecord_11get_selected, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("roll_back"), (PyCFunction)__pyx_pw_7_record_17PruningPassRecord_13roll_back, METH_O, __Pyx_DOCSTR(0)}, - {0, 0, 0, 0} -}; +static void __pyx_tp_dealloc_7sklearn_5earth_7_record_Record(PyObject *o) { + struct __pyx_obj_7sklearn_5earth_7_record_Record *p = (struct __pyx_obj_7sklearn_5earth_7_record_Record *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->iterations); + (*Py_TYPE(o)->tp_free)(o); +} -static PyNumberMethods __pyx_tp_as_number_PruningPassRecord = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_long*/ - #else - 0, /*reserved*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if PY_VERSION_HEX >= 0x02050000 - 0, /*nb_index*/ - #endif +static int __pyx_tp_traverse_7sklearn_5earth_7_record_Record(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_7sklearn_5earth_7_record_Record *p = (struct __pyx_obj_7sklearn_5earth_7_record_Record *)o; + if (p->iterations) { + e = (*v)(p->iterations, a); if (e) return e; + } + return 0; +} + +static int __pyx_tp_clear_7sklearn_5earth_7_record_Record(PyObject *o) { + struct __pyx_obj_7sklearn_5earth_7_record_Record *p = (struct __pyx_obj_7sklearn_5earth_7_record_Record *)o; + PyObject* tmp; + tmp = ((PyObject*)p->iterations); + p->iterations = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; +} +static PyObject *__pyx_sq_item_7sklearn_5earth_7_record_Record(PyObject *o, Py_ssize_t i) { + PyObject *r; + PyObject *x = PyInt_FromSsize_t(i); if(!x) return 0; + r = Py_TYPE(o)->tp_as_mapping->mp_subscript(o, x); + Py_DECREF(x); + return r; +} + +static PyMethodDef __pyx_methods_7sklearn_5earth_7_record_Record[] = { + {__Pyx_NAMESTR("_eq"), (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_6Record_3_eq, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("append"), (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_6Record_9append, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("mse"), (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_6Record_11mse, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("gcv"), (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_6Record_13gcv, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("rsq"), (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_6Record_15rsq, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("grsq"), (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_6Record_17grsq, METH_O, __Pyx_DOCSTR(0)}, + {0, 0, 0, 0} }; -static PySequenceMethods __pyx_tp_as_sequence_PruningPassRecord = { - #if CYTHON_COMPILING_IN_PYPY - __pyx_pw_7_record_6Record_7__len__, /*sq_length*/ - #else - 0, /*sq_length*/ - #endif +static PySequenceMethods __pyx_tp_as_sequence_Record = { + __pyx_pw_7sklearn_5earth_7_record_6Record_7__len__, /*sq_length*/ 0, /*sq_concat*/ 0, /*sq_repeat*/ - 0, /*sq_item*/ + __pyx_sq_item_7sklearn_5earth_7_record_Record, /*sq_item*/ 0, /*sq_slice*/ 0, /*sq_ass_item*/ 0, /*sq_ass_slice*/ @@ -10281,47 +10276,18 @@ static PySequenceMethods __pyx_tp_as_sequence_PruningPassRecord = { 0, /*sq_inplace_repeat*/ }; -static PyMappingMethods __pyx_tp_as_mapping_PruningPassRecord = { - #if CYTHON_COMPILING_IN_PYPY - __pyx_pw_7_record_6Record_7__len__, /*mp_length*/ - #else - 0, /*mp_length*/ - #endif - #if CYTHON_COMPILING_IN_PYPY - __pyx_pw_7_record_6Record_5__getitem__, /*mp_subscript*/ - #else - 0, /*mp_subscript*/ - #endif +static PyMappingMethods __pyx_tp_as_mapping_Record = { + __pyx_pw_7sklearn_5earth_7_record_6Record_7__len__, /*mp_length*/ + __pyx_pw_7sklearn_5earth_7_record_6Record_5__getitem__, /*mp_subscript*/ 0, /*mp_ass_subscript*/ }; -static PyBufferProcs __pyx_tp_as_buffer_PruningPassRecord = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -static PyTypeObject __pyx_type_7_record_PruningPassRecord = { +static PyTypeObject __pyx_type_7sklearn_5earth_7_record_Record = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_record.PruningPassRecord"), /*tp_name*/ - sizeof(struct __pyx_obj_7_record_PruningPassRecord), /*tp_basicsize*/ + __Pyx_NAMESTR("sklearn.earth._record.Record"), /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_5earth_7_record_Record), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7_record_Record, /*tp_dealloc*/ + __pyx_tp_dealloc_7sklearn_5earth_7_record_Record, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -10331,24 +10297,24 @@ static PyTypeObject __pyx_type_7_record_PruningPassRecord = { 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number_PruningPassRecord, /*tp_as_number*/ - &__pyx_tp_as_sequence_PruningPassRecord, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_PruningPassRecord, /*tp_as_mapping*/ + 0, /*tp_as_number*/ + &__pyx_tp_as_sequence_Record, /*tp_as_sequence*/ + &__pyx_tp_as_mapping_Record, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ - __pyx_pw_7_record_17PruningPassRecord_15__str__, /*tp_str*/ + 0, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_PruningPassRecord, /*tp_as_buffer*/ + 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - __pyx_tp_traverse_7_record_Record, /*tp_traverse*/ - __pyx_tp_clear_7_record_Record, /*tp_clear*/ - 0, /*tp_richcompare*/ + __pyx_tp_traverse_7sklearn_5earth_7_record_Record, /*tp_traverse*/ + __pyx_tp_clear_7sklearn_5earth_7_record_Record, /*tp_clear*/ + __pyx_pw_7sklearn_5earth_7_record_6Record_1__richcmp__, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7_record_PruningPassRecord, /*tp_methods*/ + __pyx_methods_7sklearn_5earth_7_record_Record, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -10356,9 +10322,9 @@ static PyTypeObject __pyx_type_7_record_PruningPassRecord = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pw_7_record_17PruningPassRecord_1__init__, /*tp_init*/ + 0, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7_record_PruningPassRecord, /*tp_new*/ + __pyx_tp_new_7sklearn_5earth_7_record_Record, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -10371,317 +10337,60 @@ static PyTypeObject __pyx_type_7_record_PruningPassRecord = { 0, /*tp_version_tag*/ #endif }; -static struct __pyx_vtabstruct_7_record_ForwardPassRecord __pyx_vtable_7_record_ForwardPassRecord; +static struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord __pyx_vtable_7sklearn_5earth_7_record_ForwardPassRecord; -static PyObject *__pyx_tp_new_7_record_ForwardPassRecord(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_7_record_ForwardPassRecord *p; - PyObject *o = __pyx_tp_new_7_record_Record(t, a, k); +static PyObject *__pyx_tp_new_7sklearn_5earth_7_record_ForwardPassRecord(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *p; + PyObject *o = __pyx_tp_new_7sklearn_5earth_7_record_Record(t, a, k); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7_record_ForwardPassRecord *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7_record_Record*)__pyx_vtabptr_7_record_ForwardPassRecord; + p = ((struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_5earth_7_record_Record*)__pyx_vtabptr_7sklearn_5earth_7_record_ForwardPassRecord; + p->xlabels = ((PyObject*)Py_None); Py_INCREF(Py_None); return o; } -static PyMethodDef __pyx_methods_7_record_ForwardPassRecord[] = { - {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_7_record_17ForwardPassRecord_3__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("_getstate"), (PyCFunction)__pyx_pw_7_record_17ForwardPassRecord_5_getstate, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("__setstate__"), (PyCFunction)__pyx_pw_7_record_17ForwardPassRecord_7__setstate__, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("set_stopping_condition"), (PyCFunction)__pyx_pw_7_record_17ForwardPassRecord_9set_stopping_condition, METH_O, __Pyx_DOCSTR(0)}, - {0, 0, 0, 0} -}; +static void __pyx_tp_dealloc_7sklearn_5earth_7_record_ForwardPassRecord(PyObject *o) { + struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *p = (struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *)o; + PyObject_GC_UnTrack(o); + Py_CLEAR(p->xlabels); + PyObject_GC_Track(o); + __pyx_tp_dealloc_7sklearn_5earth_7_record_Record(o); +} -static PyNumberMethods __pyx_tp_as_number_ForwardPassRecord = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_long*/ - #else - 0, /*reserved*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if PY_VERSION_HEX >= 0x02050000 - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_ForwardPassRecord = { - #if CYTHON_COMPILING_IN_PYPY - __pyx_pw_7_record_6Record_7__len__, /*sq_length*/ - #else - 0, /*sq_length*/ - #endif - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_ForwardPassRecord = { - #if CYTHON_COMPILING_IN_PYPY - __pyx_pw_7_record_6Record_7__len__, /*mp_length*/ - #else - 0, /*mp_length*/ - #endif - #if CYTHON_COMPILING_IN_PYPY - __pyx_pw_7_record_6Record_5__getitem__, /*mp_subscript*/ - #else - 0, /*mp_subscript*/ - #endif - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_ForwardPassRecord = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -static PyTypeObject __pyx_type_7_record_ForwardPassRecord = { - PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_record.ForwardPassRecord"), /*tp_name*/ - sizeof(struct __pyx_obj_7_record_ForwardPassRecord), /*tp_basicsize*/ - 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7_record_Record, /*tp_dealloc*/ - 0, /*tp_print*/ - 0, /*tp_getattr*/ - 0, /*tp_setattr*/ - #if PY_MAJOR_VERSION < 3 - 0, /*tp_compare*/ - #else - 0, /*reserved*/ - #endif - 0, /*tp_repr*/ - &__pyx_tp_as_number_ForwardPassRecord, /*tp_as_number*/ - &__pyx_tp_as_sequence_ForwardPassRecord, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_ForwardPassRecord, /*tp_as_mapping*/ - 0, /*tp_hash*/ - 0, /*tp_call*/ - __pyx_pw_7_record_17ForwardPassRecord_11__str__, /*tp_str*/ - 0, /*tp_getattro*/ - 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_ForwardPassRecord, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - 0, /*tp_doc*/ - __pyx_tp_traverse_7_record_Record, /*tp_traverse*/ - __pyx_tp_clear_7_record_Record, /*tp_clear*/ - 0, /*tp_richcompare*/ - 0, /*tp_weaklistoffset*/ - 0, /*tp_iter*/ - 0, /*tp_iternext*/ - __pyx_methods_7_record_ForwardPassRecord, /*tp_methods*/ - 0, /*tp_members*/ - 0, /*tp_getset*/ - 0, /*tp_base*/ - 0, /*tp_dict*/ - 0, /*tp_descr_get*/ - 0, /*tp_descr_set*/ - 0, /*tp_dictoffset*/ - __pyx_pw_7_record_17ForwardPassRecord_1__init__, /*tp_init*/ - 0, /*tp_alloc*/ - __pyx_tp_new_7_record_ForwardPassRecord, /*tp_new*/ - 0, /*tp_free*/ - 0, /*tp_is_gc*/ - 0, /*tp_bases*/ - 0, /*tp_mro*/ - 0, /*tp_cache*/ - 0, /*tp_subclasses*/ - 0, /*tp_weaklist*/ - 0, /*tp_del*/ - #if PY_VERSION_HEX >= 0x02060000 - 0, /*tp_version_tag*/ - #endif -}; -static struct __pyx_vtabstruct_7_record_Iteration __pyx_vtable_7_record_Iteration; - -static PyObject *__pyx_tp_new_7_record_Iteration(PyTypeObject *t, CYTHON_UNUSED PyObject *a, CYTHON_UNUSED PyObject *k) { - struct __pyx_obj_7_record_Iteration *p; - PyObject *o; - o = (*t->tp_alloc)(t, 0); - if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7_record_Iteration *)o); - p->__pyx_vtab = __pyx_vtabptr_7_record_Iteration; - return o; +static int __pyx_tp_traverse_7sklearn_5earth_7_record_ForwardPassRecord(PyObject *o, visitproc v, void *a) { + int e; + struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *p = (struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *)o; + e = __pyx_tp_traverse_7sklearn_5earth_7_record_Record(o, v, a); if (e) return e; + if (p->xlabels) { + e = (*v)(p->xlabels, a); if (e) return e; + } + return 0; } -static void __pyx_tp_dealloc_7_record_Iteration(PyObject *o) { - (*Py_TYPE(o)->tp_free)(o); +static int __pyx_tp_clear_7sklearn_5earth_7_record_ForwardPassRecord(PyObject *o) { + struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *p = (struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *)o; + PyObject* tmp; + __pyx_tp_clear_7sklearn_5earth_7_record_Record(o); + tmp = ((PyObject*)p->xlabels); + p->xlabels = ((PyObject*)Py_None); Py_INCREF(Py_None); + Py_XDECREF(tmp); + return 0; } -static PyMethodDef __pyx_methods_7_record_Iteration[] = { - {__Pyx_NAMESTR("_eq"), (PyCFunction)__pyx_pw_7_record_9Iteration_3_eq, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_mse"), (PyCFunction)__pyx_pw_7_record_9Iteration_5get_mse, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_size"), (PyCFunction)__pyx_pw_7_record_9Iteration_7get_size, METH_NOARGS, __Pyx_DOCSTR(0)}, +static PyMethodDef __pyx_methods_7sklearn_5earth_7_record_ForwardPassRecord[] = { + {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_17ForwardPassRecord_3__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_getstate"), (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_17ForwardPassRecord_5_getstate, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__setstate__"), (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_17ForwardPassRecord_7__setstate__, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("set_stopping_condition"), (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_17ForwardPassRecord_9set_stopping_condition, METH_O, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; -static PyNumberMethods __pyx_tp_as_number_Iteration = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_long*/ - #else - 0, /*reserved*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if PY_VERSION_HEX >= 0x02050000 - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_Iteration = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_Iteration = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_Iteration = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -static PyTypeObject __pyx_type_7_record_Iteration = { +static PyTypeObject __pyx_type_7sklearn_5earth_7_record_ForwardPassRecord = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_record.Iteration"), /*tp_name*/ - sizeof(struct __pyx_obj_7_record_Iteration), /*tp_basicsize*/ + __Pyx_NAMESTR("sklearn.earth._record.ForwardPassRecord"), /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7_record_Iteration, /*tp_dealloc*/ + __pyx_tp_dealloc_7sklearn_5earth_7_record_ForwardPassRecord, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -10691,24 +10400,24 @@ static PyTypeObject __pyx_type_7_record_Iteration = { 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number_Iteration, /*tp_as_number*/ - &__pyx_tp_as_sequence_Iteration, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_Iteration, /*tp_as_mapping*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ - 0, /*tp_str*/ + __pyx_pw_7sklearn_5earth_7_record_17ForwardPassRecord_11__str__, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_Iteration, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ - __pyx_pw_7_record_9Iteration_1__richcmp__, /*tp_richcompare*/ + __pyx_tp_traverse_7sklearn_5earth_7_record_ForwardPassRecord, /*tp_traverse*/ + __pyx_tp_clear_7sklearn_5earth_7_record_ForwardPassRecord, /*tp_clear*/ + 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7_record_Iteration, /*tp_methods*/ + __pyx_methods_7sklearn_5earth_7_record_ForwardPassRecord, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -10716,9 +10425,9 @@ static PyTypeObject __pyx_type_7_record_Iteration = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - 0, /*tp_init*/ + __pyx_pw_7sklearn_5earth_7_record_17ForwardPassRecord_1__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7_record_Iteration, /*tp_new*/ + __pyx_tp_new_7sklearn_5earth_7_record_ForwardPassRecord, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -10731,129 +10440,31 @@ static PyTypeObject __pyx_type_7_record_Iteration = { 0, /*tp_version_tag*/ #endif }; -static struct __pyx_vtabstruct_7_record_PruningPassIteration __pyx_vtable_7_record_PruningPassIteration; +static struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassIteration __pyx_vtable_7sklearn_5earth_7_record_PruningPassIteration; -static PyObject *__pyx_tp_new_7_record_PruningPassIteration(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_7_record_PruningPassIteration *p; - PyObject *o = __pyx_tp_new_7_record_Iteration(t, a, k); +static PyObject *__pyx_tp_new_7sklearn_5earth_7_record_PruningPassIteration(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7sklearn_5earth_7_record_PruningPassIteration *p; + PyObject *o = __pyx_tp_new_7sklearn_5earth_7_record_Iteration(t, a, k); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7_record_PruningPassIteration *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7_record_Iteration*)__pyx_vtabptr_7_record_PruningPassIteration; + p = ((struct __pyx_obj_7sklearn_5earth_7_record_PruningPassIteration *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_5earth_7_record_Iteration*)__pyx_vtabptr_7sklearn_5earth_7_record_PruningPassIteration; return o; } -static PyMethodDef __pyx_methods_7_record_PruningPassIteration[] = { - {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_7_record_20PruningPassIteration_3__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("_getstate"), (PyCFunction)__pyx_pw_7_record_20PruningPassIteration_5_getstate, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("__setstate__"), (PyCFunction)__pyx_pw_7_record_20PruningPassIteration_7__setstate__, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_pruned"), (PyCFunction)__pyx_pw_7_record_20PruningPassIteration_9get_pruned, METH_NOARGS, __Pyx_DOCSTR(0)}, +static PyMethodDef __pyx_methods_7sklearn_5earth_7_record_PruningPassIteration[] = { + {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_20PruningPassIteration_3__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_getstate"), (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_20PruningPassIteration_5_getstate, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__setstate__"), (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_20PruningPassIteration_7__setstate__, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_pruned"), (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_20PruningPassIteration_9get_pruned, METH_NOARGS, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; -static PyNumberMethods __pyx_tp_as_number_PruningPassIteration = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_long*/ - #else - 0, /*reserved*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if PY_VERSION_HEX >= 0x02050000 - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_PruningPassIteration = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_PruningPassIteration = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_PruningPassIteration = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -static PyTypeObject __pyx_type_7_record_PruningPassIteration = { +static PyTypeObject __pyx_type_7sklearn_5earth_7_record_PruningPassIteration = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_record.PruningPassIteration"), /*tp_name*/ - sizeof(struct __pyx_obj_7_record_PruningPassIteration), /*tp_basicsize*/ + __Pyx_NAMESTR("sklearn.earth._record.PruningPassIteration"), /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassIteration), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7_record_Iteration, /*tp_dealloc*/ + __pyx_tp_dealloc_7sklearn_5earth_7_record_Iteration, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -10863,15 +10474,15 @@ static PyTypeObject __pyx_type_7_record_PruningPassIteration = { 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number_PruningPassIteration, /*tp_as_number*/ - &__pyx_tp_as_sequence_PruningPassIteration, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_PruningPassIteration, /*tp_as_mapping*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ - __pyx_pw_7_record_20PruningPassIteration_11__str__, /*tp_str*/ + __pyx_pw_7sklearn_5earth_7_record_20PruningPassIteration_11__str__, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_PruningPassIteration, /*tp_as_buffer*/ + 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ 0, /*tp_doc*/ 0, /*tp_traverse*/ @@ -10880,7 +10491,7 @@ static PyTypeObject __pyx_type_7_record_PruningPassIteration = { 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7_record_PruningPassIteration, /*tp_methods*/ + __pyx_methods_7sklearn_5earth_7_record_PruningPassIteration, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -10888,9 +10499,9 @@ static PyTypeObject __pyx_type_7_record_PruningPassIteration = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pw_7_record_20PruningPassIteration_1__init__, /*tp_init*/ + __pyx_pw_7sklearn_5earth_7_record_20PruningPassIteration_1__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7_record_PruningPassIteration, /*tp_new*/ + __pyx_tp_new_7sklearn_5earth_7_record_PruningPassIteration, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -10903,128 +10514,30 @@ static PyTypeObject __pyx_type_7_record_PruningPassIteration = { 0, /*tp_version_tag*/ #endif }; -static struct __pyx_vtabstruct_7_record_FirstPruningPassIteration __pyx_vtable_7_record_FirstPruningPassIteration; +static struct __pyx_vtabstruct_7sklearn_5earth_7_record_FirstPruningPassIteration __pyx_vtable_7sklearn_5earth_7_record_FirstPruningPassIteration; -static PyObject *__pyx_tp_new_7_record_FirstPruningPassIteration(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_7_record_FirstPruningPassIteration *p; - PyObject *o = __pyx_tp_new_7_record_PruningPassIteration(t, a, k); +static PyObject *__pyx_tp_new_7sklearn_5earth_7_record_FirstPruningPassIteration(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7sklearn_5earth_7_record_FirstPruningPassIteration *p; + PyObject *o = __pyx_tp_new_7sklearn_5earth_7_record_PruningPassIteration(t, a, k); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7_record_FirstPruningPassIteration *)o); - p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7_record_Iteration*)__pyx_vtabptr_7_record_FirstPruningPassIteration; + p = ((struct __pyx_obj_7sklearn_5earth_7_record_FirstPruningPassIteration *)o); + p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_5earth_7_record_Iteration*)__pyx_vtabptr_7sklearn_5earth_7_record_FirstPruningPassIteration; return o; } -static PyMethodDef __pyx_methods_7_record_FirstPruningPassIteration[] = { - {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_7_record_25FirstPruningPassIteration_3__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("_getstate"), (PyCFunction)__pyx_pw_7_record_25FirstPruningPassIteration_5_getstate, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("__setstate__"), (PyCFunction)__pyx_pw_7_record_25FirstPruningPassIteration_7__setstate__, METH_O, __Pyx_DOCSTR(0)}, +static PyMethodDef __pyx_methods_7sklearn_5earth_7_record_FirstPruningPassIteration[] = { + {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_25FirstPruningPassIteration_3__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_getstate"), (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_25FirstPruningPassIteration_5_getstate, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__setstate__"), (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_25FirstPruningPassIteration_7__setstate__, METH_O, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; -static PyNumberMethods __pyx_tp_as_number_FirstPruningPassIteration = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_long*/ - #else - 0, /*reserved*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if PY_VERSION_HEX >= 0x02050000 - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_FirstPruningPassIteration = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_FirstPruningPassIteration = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_FirstPruningPassIteration = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -static PyTypeObject __pyx_type_7_record_FirstPruningPassIteration = { +static PyTypeObject __pyx_type_7sklearn_5earth_7_record_FirstPruningPassIteration = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_record.FirstPruningPassIteration"), /*tp_name*/ - sizeof(struct __pyx_obj_7_record_FirstPruningPassIteration), /*tp_basicsize*/ + __Pyx_NAMESTR("sklearn.earth._record.FirstPruningPassIteration"), /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_5earth_7_record_FirstPruningPassIteration), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7_record_Iteration, /*tp_dealloc*/ + __pyx_tp_dealloc_7sklearn_5earth_7_record_Iteration, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -11034,15 +10547,15 @@ static PyTypeObject __pyx_type_7_record_FirstPruningPassIteration = { 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number_FirstPruningPassIteration, /*tp_as_number*/ - &__pyx_tp_as_sequence_FirstPruningPassIteration, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_FirstPruningPassIteration, /*tp_as_mapping*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ - __pyx_pw_7_record_25FirstPruningPassIteration_9__str__, /*tp_str*/ + __pyx_pw_7sklearn_5earth_7_record_25FirstPruningPassIteration_9__str__, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_FirstPruningPassIteration, /*tp_as_buffer*/ + 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ 0, /*tp_doc*/ 0, /*tp_traverse*/ @@ -11051,7 +10564,7 @@ static PyTypeObject __pyx_type_7_record_FirstPruningPassIteration = { 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7_record_FirstPruningPassIteration, /*tp_methods*/ + __pyx_methods_7sklearn_5earth_7_record_FirstPruningPassIteration, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -11059,9 +10572,9 @@ static PyTypeObject __pyx_type_7_record_FirstPruningPassIteration = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pw_7_record_25FirstPruningPassIteration_1__init__, /*tp_init*/ + __pyx_pw_7sklearn_5earth_7_record_25FirstPruningPassIteration_1__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7_record_FirstPruningPassIteration, /*tp_new*/ + __pyx_tp_new_7sklearn_5earth_7_record_FirstPruningPassIteration, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -11074,130 +10587,31 @@ static PyTypeObject __pyx_type_7_record_FirstPruningPassIteration = { 0, /*tp_version_tag*/ #endif }; -static struct __pyx_vtabstruct_7_record_ForwardPassIteration __pyx_vtable_7_record_ForwardPassIteration; +static struct __pyx_vtabstruct_7sklearn_5earth_7_record_FirstForwardPassIteration __pyx_vtable_7sklearn_5earth_7_record_FirstForwardPassIteration; -static PyObject *__pyx_tp_new_7_record_ForwardPassIteration(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_7_record_ForwardPassIteration *p; - PyObject *o = __pyx_tp_new_7_record_Iteration(t, a, k); +static PyObject *__pyx_tp_new_7sklearn_5earth_7_record_FirstForwardPassIteration(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7sklearn_5earth_7_record_FirstForwardPassIteration *p; + PyObject *o = __pyx_tp_new_7sklearn_5earth_7_record_ForwardPassIteration(t, a, k); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7_record_ForwardPassIteration *)o); - p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7_record_Iteration*)__pyx_vtabptr_7_record_ForwardPassIteration; + p = ((struct __pyx_obj_7sklearn_5earth_7_record_FirstForwardPassIteration *)o); + p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_5earth_7_record_Iteration*)__pyx_vtabptr_7sklearn_5earth_7_record_FirstForwardPassIteration; return o; } -static PyMethodDef __pyx_methods_7_record_ForwardPassIteration[] = { - {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_7_record_20ForwardPassIteration_3__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("_getstate"), (PyCFunction)__pyx_pw_7_record_20ForwardPassIteration_5_getstate, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("__setstate__"), (PyCFunction)__pyx_pw_7_record_20ForwardPassIteration_7__setstate__, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("set_no_candidates"), (PyCFunction)__pyx_pw_7_record_20ForwardPassIteration_11set_no_candidates, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("no_further_candidates"), (PyCFunction)__pyx_pw_7_record_20ForwardPassIteration_13no_further_candidates, METH_NOARGS, __Pyx_DOCSTR(0)}, +static PyMethodDef __pyx_methods_7sklearn_5earth_7_record_FirstForwardPassIteration[] = { + {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_25FirstForwardPassIteration_3__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_getstate"), (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_25FirstForwardPassIteration_5_getstate, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__setstate__"), (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_25FirstForwardPassIteration_7__setstate__, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_size"), (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_25FirstForwardPassIteration_9get_size, METH_NOARGS, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; -static PyNumberMethods __pyx_tp_as_number_ForwardPassIteration = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_long*/ - #else - 0, /*reserved*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if PY_VERSION_HEX >= 0x02050000 - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_ForwardPassIteration = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_ForwardPassIteration = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_ForwardPassIteration = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -static PyTypeObject __pyx_type_7_record_ForwardPassIteration = { +static PyTypeObject __pyx_type_7sklearn_5earth_7_record_FirstForwardPassIteration = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_record.ForwardPassIteration"), /*tp_name*/ - sizeof(struct __pyx_obj_7_record_ForwardPassIteration), /*tp_basicsize*/ + __Pyx_NAMESTR("sklearn.earth._record.FirstForwardPassIteration"), /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_5earth_7_record_FirstForwardPassIteration), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7_record_Iteration, /*tp_dealloc*/ + __pyx_tp_dealloc_7sklearn_5earth_7_record_Iteration, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -11207,15 +10621,15 @@ static PyTypeObject __pyx_type_7_record_ForwardPassIteration = { 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number_ForwardPassIteration, /*tp_as_number*/ - &__pyx_tp_as_sequence_ForwardPassIteration, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_ForwardPassIteration, /*tp_as_mapping*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ - __pyx_pw_7_record_20ForwardPassIteration_9__str__, /*tp_str*/ + __pyx_pw_7sklearn_5earth_7_record_25FirstForwardPassIteration_11__str__, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_ForwardPassIteration, /*tp_as_buffer*/ + 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ 0, /*tp_doc*/ 0, /*tp_traverse*/ @@ -11224,7 +10638,7 @@ static PyTypeObject __pyx_type_7_record_ForwardPassIteration = { 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7_record_ForwardPassIteration, /*tp_methods*/ + __pyx_methods_7sklearn_5earth_7_record_FirstForwardPassIteration, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -11232,9 +10646,9 @@ static PyTypeObject __pyx_type_7_record_ForwardPassIteration = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pw_7_record_20ForwardPassIteration_1__init__, /*tp_init*/ + __pyx_pw_7sklearn_5earth_7_record_25FirstForwardPassIteration_1__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7_record_ForwardPassIteration, /*tp_new*/ + __pyx_tp_new_7sklearn_5earth_7_record_FirstForwardPassIteration, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -11247,129 +10661,33 @@ static PyTypeObject __pyx_type_7_record_ForwardPassIteration = { 0, /*tp_version_tag*/ #endif }; -static struct __pyx_vtabstruct_7_record_FirstForwardPassIteration __pyx_vtable_7_record_FirstForwardPassIteration; +static struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord __pyx_vtable_7sklearn_5earth_7_record_PruningPassRecord; -static PyObject *__pyx_tp_new_7_record_FirstForwardPassIteration(PyTypeObject *t, PyObject *a, PyObject *k) { - struct __pyx_obj_7_record_FirstForwardPassIteration *p; - PyObject *o = __pyx_tp_new_7_record_ForwardPassIteration(t, a, k); +static PyObject *__pyx_tp_new_7sklearn_5earth_7_record_PruningPassRecord(PyTypeObject *t, PyObject *a, PyObject *k) { + struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *p; + PyObject *o = __pyx_tp_new_7sklearn_5earth_7_record_Record(t, a, k); if (unlikely(!o)) return 0; - p = ((struct __pyx_obj_7_record_FirstForwardPassIteration *)o); - p->__pyx_base.__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7_record_Iteration*)__pyx_vtabptr_7_record_FirstForwardPassIteration; + p = ((struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *)o); + p->__pyx_base.__pyx_vtab = (struct __pyx_vtabstruct_7sklearn_5earth_7_record_Record*)__pyx_vtabptr_7sklearn_5earth_7_record_PruningPassRecord; return o; } -static PyMethodDef __pyx_methods_7_record_FirstForwardPassIteration[] = { - {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_7_record_25FirstForwardPassIteration_3__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("_getstate"), (PyCFunction)__pyx_pw_7_record_25FirstForwardPassIteration_5_getstate, METH_NOARGS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("__setstate__"), (PyCFunction)__pyx_pw_7_record_25FirstForwardPassIteration_7__setstate__, METH_O, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("get_size"), (PyCFunction)__pyx_pw_7_record_25FirstForwardPassIteration_9get_size, METH_NOARGS, __Pyx_DOCSTR(0)}, +static PyMethodDef __pyx_methods_7sklearn_5earth_7_record_PruningPassRecord[] = { + {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_3__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("_getstate"), (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_5_getstate, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("__setstate__"), (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_7__setstate__, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("set_selected"), (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_9set_selected, METH_O, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("get_selected"), (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_11get_selected, METH_NOARGS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("roll_back"), (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_13roll_back, METH_O, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; -static PyNumberMethods __pyx_tp_as_number_FirstForwardPassIteration = { - 0, /*nb_add*/ - 0, /*nb_subtract*/ - 0, /*nb_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_divide*/ - #endif - 0, /*nb_remainder*/ - 0, /*nb_divmod*/ - 0, /*nb_power*/ - 0, /*nb_negative*/ - 0, /*nb_positive*/ - 0, /*nb_absolute*/ - 0, /*nb_nonzero*/ - 0, /*nb_invert*/ - 0, /*nb_lshift*/ - 0, /*nb_rshift*/ - 0, /*nb_and*/ - 0, /*nb_xor*/ - 0, /*nb_or*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_coerce*/ - #endif - 0, /*nb_int*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_long*/ - #else - 0, /*reserved*/ - #endif - 0, /*nb_float*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_oct*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*nb_hex*/ - #endif - 0, /*nb_inplace_add*/ - 0, /*nb_inplace_subtract*/ - 0, /*nb_inplace_multiply*/ - #if PY_MAJOR_VERSION < 3 - 0, /*nb_inplace_divide*/ - #endif - 0, /*nb_inplace_remainder*/ - 0, /*nb_inplace_power*/ - 0, /*nb_inplace_lshift*/ - 0, /*nb_inplace_rshift*/ - 0, /*nb_inplace_and*/ - 0, /*nb_inplace_xor*/ - 0, /*nb_inplace_or*/ - 0, /*nb_floor_divide*/ - 0, /*nb_true_divide*/ - 0, /*nb_inplace_floor_divide*/ - 0, /*nb_inplace_true_divide*/ - #if PY_VERSION_HEX >= 0x02050000 - 0, /*nb_index*/ - #endif -}; - -static PySequenceMethods __pyx_tp_as_sequence_FirstForwardPassIteration = { - 0, /*sq_length*/ - 0, /*sq_concat*/ - 0, /*sq_repeat*/ - 0, /*sq_item*/ - 0, /*sq_slice*/ - 0, /*sq_ass_item*/ - 0, /*sq_ass_slice*/ - 0, /*sq_contains*/ - 0, /*sq_inplace_concat*/ - 0, /*sq_inplace_repeat*/ -}; - -static PyMappingMethods __pyx_tp_as_mapping_FirstForwardPassIteration = { - 0, /*mp_length*/ - 0, /*mp_subscript*/ - 0, /*mp_ass_subscript*/ -}; - -static PyBufferProcs __pyx_tp_as_buffer_FirstForwardPassIteration = { - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getreadbuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getwritebuffer*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getsegcount*/ - #endif - #if PY_MAJOR_VERSION < 3 - 0, /*bf_getcharbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_getbuffer*/ - #endif - #if PY_VERSION_HEX >= 0x02060000 - 0, /*bf_releasebuffer*/ - #endif -}; - -static PyTypeObject __pyx_type_7_record_FirstForwardPassIteration = { +static PyTypeObject __pyx_type_7sklearn_5earth_7_record_PruningPassRecord = { PyVarObject_HEAD_INIT(0, 0) - __Pyx_NAMESTR("_record.FirstForwardPassIteration"), /*tp_name*/ - sizeof(struct __pyx_obj_7_record_FirstForwardPassIteration), /*tp_basicsize*/ + __Pyx_NAMESTR("sklearn.earth._record.PruningPassRecord"), /*tp_name*/ + sizeof(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord), /*tp_basicsize*/ 0, /*tp_itemsize*/ - __pyx_tp_dealloc_7_record_Iteration, /*tp_dealloc*/ + __pyx_tp_dealloc_7sklearn_5earth_7_record_Record, /*tp_dealloc*/ 0, /*tp_print*/ 0, /*tp_getattr*/ 0, /*tp_setattr*/ @@ -11379,24 +10697,24 @@ static PyTypeObject __pyx_type_7_record_FirstForwardPassIteration = { 0, /*reserved*/ #endif 0, /*tp_repr*/ - &__pyx_tp_as_number_FirstForwardPassIteration, /*tp_as_number*/ - &__pyx_tp_as_sequence_FirstForwardPassIteration, /*tp_as_sequence*/ - &__pyx_tp_as_mapping_FirstForwardPassIteration, /*tp_as_mapping*/ + 0, /*tp_as_number*/ + 0, /*tp_as_sequence*/ + 0, /*tp_as_mapping*/ 0, /*tp_hash*/ 0, /*tp_call*/ - __pyx_pw_7_record_25FirstForwardPassIteration_11__str__, /*tp_str*/ + __pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_15__str__, /*tp_str*/ 0, /*tp_getattro*/ 0, /*tp_setattro*/ - &__pyx_tp_as_buffer_FirstForwardPassIteration, /*tp_as_buffer*/ - Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE, /*tp_flags*/ + 0, /*tp_as_buffer*/ + Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ 0, /*tp_doc*/ - 0, /*tp_traverse*/ - 0, /*tp_clear*/ + __pyx_tp_traverse_7sklearn_5earth_7_record_Record, /*tp_traverse*/ + __pyx_tp_clear_7sklearn_5earth_7_record_Record, /*tp_clear*/ 0, /*tp_richcompare*/ 0, /*tp_weaklistoffset*/ 0, /*tp_iter*/ 0, /*tp_iternext*/ - __pyx_methods_7_record_FirstForwardPassIteration, /*tp_methods*/ + __pyx_methods_7sklearn_5earth_7_record_PruningPassRecord, /*tp_methods*/ 0, /*tp_members*/ 0, /*tp_getset*/ 0, /*tp_base*/ @@ -11404,9 +10722,9 @@ static PyTypeObject __pyx_type_7_record_FirstForwardPassIteration = { 0, /*tp_descr_get*/ 0, /*tp_descr_set*/ 0, /*tp_dictoffset*/ - __pyx_pw_7_record_25FirstForwardPassIteration_1__init__, /*tp_init*/ + __pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_1__init__, /*tp_init*/ 0, /*tp_alloc*/ - __pyx_tp_new_7_record_FirstForwardPassIteration, /*tp_new*/ + __pyx_tp_new_7sklearn_5earth_7_record_PruningPassRecord, /*tp_new*/ 0, /*tp_free*/ 0, /*tp_is_gc*/ 0, /*tp_bases*/ @@ -11472,6 +10790,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s____class__, __pyx_k____class__, sizeof(__pyx_k____class__), 0, 0, 1, 1}, {&__pyx_n_s____import__, __pyx_k____import__, sizeof(__pyx_k____import__), 0, 0, 1, 1}, {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____pyx_vtable__, __pyx_k____pyx_vtable__, sizeof(__pyx_k____pyx_vtable__), 0, 0, 1, 1}, {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, {&__pyx_n_s___eq, __pyx_k___eq, sizeof(__pyx_k___eq), 0, 0, 1, 1}, {&__pyx_n_s___forward, __pyx_k___forward, sizeof(__pyx_k___forward), 0, 0, 1, 1}, @@ -11507,6 +10826,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s__unprune, __pyx_k__unprune, sizeof(__pyx_k__unprune), 0, 0, 1, 1}, {&__pyx_n_s__var, __pyx_k__var, sizeof(__pyx_k__var), 0, 0, 1, 1}, {&__pyx_n_s__variable, __pyx_k__variable, sizeof(__pyx_k__variable), 0, 0, 1, 1}, + {&__pyx_n_s__xlabels, __pyx_k__xlabels, sizeof(__pyx_k__xlabels), 0, 0, 1, 1}, {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { @@ -11524,7 +10844,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "_record.pyx":93 + /* "sklearn/earth/_record.pyx":93 * result = '' * result += 'Pruning Pass\n' * header = 'iter\tbf\tterms\tmse\tgcv\trsq\tgrsq'.split('\t') # <<<<<<<<<<<<<< @@ -11535,7 +10855,7 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_5); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5)); - /* "_record.pyx":97 + /* "sklearn/earth/_record.pyx":97 * for i, iteration in enumerate(self.iterations): * row = str(i) + '\t' + str(iteration) + '\t%.3f\t%.3f\t%.3f' % (self.gcv(i),self.rsq(i),self.grsq(i)) * data.append(row.split('\t')) # <<<<<<<<<<<<<< @@ -11546,17 +10866,17 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_GOTREF(__pyx_k_tuple_7); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7)); - /* "_record.pyx":134 + /* "sklearn/earth/_record.pyx":137 * data = [] * for i, iteration in enumerate(self.iterations): * data.append([str(i)] + str(iteration).split('\t') + ('%.3f\t%.3f\t%.3f' % (self.gcv(i),self.rsq(i),self.grsq(i))).split('\t')) # <<<<<<<<<<<<<< * result = '' * result += 'Forward Pass\n' */ - __pyx_k_tuple_11 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_11 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_11); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11)); - __pyx_k_tuple_13 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_13 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_13); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13)); @@ -11699,8 +11019,8 @@ PyMODINIT_FUNC PyInit__record(void) #if PY_MAJOR_VERSION >= 3 { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (!PyDict_GetItemString(modules, "_record")) { - if (unlikely(PyDict_SetItemString(modules, "_record", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyDict_GetItemString(modules, "sklearn.earth._record")) { + if (unlikely(PyDict_SetItemString(modules, "sklearn.earth._record", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif @@ -11714,7 +11034,7 @@ PyMODINIT_FUNC PyInit__record(void) #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif - if (__pyx_module_is_main__record) { + if (__pyx_module_is_main_sklearn__earth___record) { if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; } /*--- Builtin init code ---*/ @@ -11725,73 +11045,73 @@ PyMODINIT_FUNC PyInit__record(void) /*--- Variable export code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ - __pyx_vtabptr_7_record_Record = &__pyx_vtable_7_record_Record; - __pyx_vtable_7_record_Record.append = (PyObject *(*)(struct __pyx_obj_7_record_Record *, struct __pyx_obj_7_record_Iteration *, int __pyx_skip_dispatch))__pyx_f_7_record_6Record_append; - __pyx_vtable_7_record_Record.mse = (__pyx_t_7_record_FLOAT_t (*)(struct __pyx_obj_7_record_Record *, __pyx_t_7_record_INDEX_t, int __pyx_skip_dispatch))__pyx_f_7_record_6Record_mse; - __pyx_vtable_7_record_Record.rsq = (__pyx_t_7_record_FLOAT_t (*)(struct __pyx_obj_7_record_Record *, __pyx_t_7_record_INDEX_t, int __pyx_skip_dispatch))__pyx_f_7_record_6Record_rsq; - __pyx_vtable_7_record_Record.gcv = (__pyx_t_7_record_FLOAT_t (*)(struct __pyx_obj_7_record_Record *, __pyx_t_7_record_INDEX_t, int __pyx_skip_dispatch))__pyx_f_7_record_6Record_gcv; - __pyx_vtable_7_record_Record.grsq = (__pyx_t_7_record_FLOAT_t (*)(struct __pyx_obj_7_record_Record *, __pyx_t_7_record_INDEX_t, int __pyx_skip_dispatch))__pyx_f_7_record_6Record_grsq; - if (PyType_Ready(&__pyx_type_7_record_Record) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7_record_Record.tp_dict, __pyx_vtabptr_7_record_Record) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "Record", (PyObject *)&__pyx_type_7_record_Record) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7_record_Record = &__pyx_type_7_record_Record; - __pyx_vtabptr_7_record_PruningPassRecord = &__pyx_vtable_7_record_PruningPassRecord; - __pyx_vtable_7_record_PruningPassRecord.__pyx_base = *__pyx_vtabptr_7_record_Record; - __pyx_vtable_7_record_PruningPassRecord.set_selected = (PyObject *(*)(struct __pyx_obj_7_record_PruningPassRecord *, __pyx_t_7_record_INDEX_t, int __pyx_skip_dispatch))__pyx_f_7_record_17PruningPassRecord_set_selected; - __pyx_vtable_7_record_PruningPassRecord.get_selected = (__pyx_t_7_record_INDEX_t (*)(struct __pyx_obj_7_record_PruningPassRecord *, int __pyx_skip_dispatch))__pyx_f_7_record_17PruningPassRecord_get_selected; - __pyx_vtable_7_record_PruningPassRecord.roll_back = (PyObject *(*)(struct __pyx_obj_7_record_PruningPassRecord *, struct __pyx_obj_6_basis_Basis *, int __pyx_skip_dispatch))__pyx_f_7_record_17PruningPassRecord_roll_back; - __pyx_type_7_record_PruningPassRecord.tp_base = __pyx_ptype_7_record_Record; - if (PyType_Ready(&__pyx_type_7_record_PruningPassRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7_record_PruningPassRecord.tp_dict, __pyx_vtabptr_7_record_PruningPassRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "PruningPassRecord", (PyObject *)&__pyx_type_7_record_PruningPassRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7_record_PruningPassRecord = &__pyx_type_7_record_PruningPassRecord; - __pyx_vtabptr_7_record_ForwardPassRecord = &__pyx_vtable_7_record_ForwardPassRecord; - __pyx_vtable_7_record_ForwardPassRecord.__pyx_base = *__pyx_vtabptr_7_record_Record; - __pyx_vtable_7_record_ForwardPassRecord.set_stopping_condition = (PyObject *(*)(struct __pyx_obj_7_record_ForwardPassRecord *, int, int __pyx_skip_dispatch))__pyx_f_7_record_17ForwardPassRecord_set_stopping_condition; - __pyx_type_7_record_ForwardPassRecord.tp_base = __pyx_ptype_7_record_Record; - if (PyType_Ready(&__pyx_type_7_record_ForwardPassRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7_record_ForwardPassRecord.tp_dict, __pyx_vtabptr_7_record_ForwardPassRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "ForwardPassRecord", (PyObject *)&__pyx_type_7_record_ForwardPassRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7_record_ForwardPassRecord = &__pyx_type_7_record_ForwardPassRecord; - __pyx_vtabptr_7_record_Iteration = &__pyx_vtable_7_record_Iteration; - __pyx_vtable_7_record_Iteration.get_mse = (__pyx_t_7_record_FLOAT_t (*)(struct __pyx_obj_7_record_Iteration *, int __pyx_skip_dispatch))__pyx_f_7_record_9Iteration_get_mse; - __pyx_vtable_7_record_Iteration.get_size = (__pyx_t_7_record_INDEX_t (*)(struct __pyx_obj_7_record_Iteration *, int __pyx_skip_dispatch))__pyx_f_7_record_9Iteration_get_size; - if (PyType_Ready(&__pyx_type_7_record_Iteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7_record_Iteration.tp_dict, __pyx_vtabptr_7_record_Iteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "Iteration", (PyObject *)&__pyx_type_7_record_Iteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7_record_Iteration = &__pyx_type_7_record_Iteration; - __pyx_vtabptr_7_record_PruningPassIteration = &__pyx_vtable_7_record_PruningPassIteration; - __pyx_vtable_7_record_PruningPassIteration.__pyx_base = *__pyx_vtabptr_7_record_Iteration; - __pyx_vtable_7_record_PruningPassIteration.get_pruned = (__pyx_t_7_record_INDEX_t (*)(struct __pyx_obj_7_record_PruningPassIteration *, int __pyx_skip_dispatch))__pyx_f_7_record_20PruningPassIteration_get_pruned; - __pyx_type_7_record_PruningPassIteration.tp_base = __pyx_ptype_7_record_Iteration; - if (PyType_Ready(&__pyx_type_7_record_PruningPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7_record_PruningPassIteration.tp_dict, __pyx_vtabptr_7_record_PruningPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "PruningPassIteration", (PyObject *)&__pyx_type_7_record_PruningPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7_record_PruningPassIteration = &__pyx_type_7_record_PruningPassIteration; - __pyx_vtabptr_7_record_FirstPruningPassIteration = &__pyx_vtable_7_record_FirstPruningPassIteration; - __pyx_vtable_7_record_FirstPruningPassIteration.__pyx_base = *__pyx_vtabptr_7_record_PruningPassIteration; - __pyx_type_7_record_FirstPruningPassIteration.tp_base = __pyx_ptype_7_record_PruningPassIteration; - if (PyType_Ready(&__pyx_type_7_record_FirstPruningPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7_record_FirstPruningPassIteration.tp_dict, __pyx_vtabptr_7_record_FirstPruningPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "FirstPruningPassIteration", (PyObject *)&__pyx_type_7_record_FirstPruningPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7_record_FirstPruningPassIteration = &__pyx_type_7_record_FirstPruningPassIteration; - __pyx_vtabptr_7_record_ForwardPassIteration = &__pyx_vtable_7_record_ForwardPassIteration; - __pyx_vtable_7_record_ForwardPassIteration.__pyx_base = *__pyx_vtabptr_7_record_Iteration; - __pyx_vtable_7_record_ForwardPassIteration.set_no_candidates = (PyObject *(*)(struct __pyx_obj_7_record_ForwardPassIteration *, int, int __pyx_skip_dispatch))__pyx_f_7_record_20ForwardPassIteration_set_no_candidates; - __pyx_vtable_7_record_ForwardPassIteration.no_further_candidates = (PyObject *(*)(struct __pyx_obj_7_record_ForwardPassIteration *, int __pyx_skip_dispatch))__pyx_f_7_record_20ForwardPassIteration_no_further_candidates; - __pyx_type_7_record_ForwardPassIteration.tp_base = __pyx_ptype_7_record_Iteration; - if (PyType_Ready(&__pyx_type_7_record_ForwardPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7_record_ForwardPassIteration.tp_dict, __pyx_vtabptr_7_record_ForwardPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "ForwardPassIteration", (PyObject *)&__pyx_type_7_record_ForwardPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7_record_ForwardPassIteration = &__pyx_type_7_record_ForwardPassIteration; - __pyx_vtabptr_7_record_FirstForwardPassIteration = &__pyx_vtable_7_record_FirstForwardPassIteration; - __pyx_vtable_7_record_FirstForwardPassIteration.__pyx_base = *__pyx_vtabptr_7_record_ForwardPassIteration; - __pyx_vtable_7_record_FirstForwardPassIteration.__pyx_base.__pyx_base.get_size = (__pyx_t_7_record_INDEX_t (*)(struct __pyx_obj_7_record_Iteration *, int __pyx_skip_dispatch))__pyx_f_7_record_25FirstForwardPassIteration_get_size; - __pyx_type_7_record_FirstForwardPassIteration.tp_base = __pyx_ptype_7_record_ForwardPassIteration; - if (PyType_Ready(&__pyx_type_7_record_FirstForwardPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7_record_FirstForwardPassIteration.tp_dict, __pyx_vtabptr_7_record_FirstForwardPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "FirstForwardPassIteration", (PyObject *)&__pyx_type_7_record_FirstForwardPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7_record_FirstForwardPassIteration = &__pyx_type_7_record_FirstForwardPassIteration; + __pyx_vtabptr_7sklearn_5earth_7_record_Iteration = &__pyx_vtable_7sklearn_5earth_7_record_Iteration; + __pyx_vtable_7sklearn_5earth_7_record_Iteration.get_mse = (__pyx_t_7sklearn_5earth_7_record_FLOAT_t (*)(struct __pyx_obj_7sklearn_5earth_7_record_Iteration *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_7_record_9Iteration_get_mse; + __pyx_vtable_7sklearn_5earth_7_record_Iteration.get_size = (__pyx_t_7sklearn_5earth_7_record_INDEX_t (*)(struct __pyx_obj_7sklearn_5earth_7_record_Iteration *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_7_record_9Iteration_get_size; + if (PyType_Ready(&__pyx_type_7sklearn_5earth_7_record_Iteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_5earth_7_record_Iteration.tp_dict, __pyx_vtabptr_7sklearn_5earth_7_record_Iteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "Iteration", (PyObject *)&__pyx_type_7sklearn_5earth_7_record_Iteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_7_record_Iteration = &__pyx_type_7sklearn_5earth_7_record_Iteration; + __pyx_vtabptr_7sklearn_5earth_7_record_ForwardPassIteration = &__pyx_vtable_7sklearn_5earth_7_record_ForwardPassIteration; + __pyx_vtable_7sklearn_5earth_7_record_ForwardPassIteration.__pyx_base = *__pyx_vtabptr_7sklearn_5earth_7_record_Iteration; + __pyx_vtable_7sklearn_5earth_7_record_ForwardPassIteration.set_no_candidates = (PyObject *(*)(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration *, int, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_7_record_20ForwardPassIteration_set_no_candidates; + __pyx_vtable_7sklearn_5earth_7_record_ForwardPassIteration.no_further_candidates = (PyObject *(*)(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_7_record_20ForwardPassIteration_no_further_candidates; + __pyx_type_7sklearn_5earth_7_record_ForwardPassIteration.tp_base = __pyx_ptype_7sklearn_5earth_7_record_Iteration; + if (PyType_Ready(&__pyx_type_7sklearn_5earth_7_record_ForwardPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_5earth_7_record_ForwardPassIteration.tp_dict, __pyx_vtabptr_7sklearn_5earth_7_record_ForwardPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "ForwardPassIteration", (PyObject *)&__pyx_type_7sklearn_5earth_7_record_ForwardPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_7_record_ForwardPassIteration = &__pyx_type_7sklearn_5earth_7_record_ForwardPassIteration; + __pyx_vtabptr_7sklearn_5earth_7_record_Record = &__pyx_vtable_7sklearn_5earth_7_record_Record; + __pyx_vtable_7sklearn_5earth_7_record_Record.append = (PyObject *(*)(struct __pyx_obj_7sklearn_5earth_7_record_Record *, struct __pyx_obj_7sklearn_5earth_7_record_Iteration *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_7_record_6Record_append; + __pyx_vtable_7sklearn_5earth_7_record_Record.mse = (__pyx_t_7sklearn_5earth_7_record_FLOAT_t (*)(struct __pyx_obj_7sklearn_5earth_7_record_Record *, __pyx_t_7sklearn_5earth_7_record_INDEX_t, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_7_record_6Record_mse; + __pyx_vtable_7sklearn_5earth_7_record_Record.rsq = (__pyx_t_7sklearn_5earth_7_record_FLOAT_t (*)(struct __pyx_obj_7sklearn_5earth_7_record_Record *, __pyx_t_7sklearn_5earth_7_record_INDEX_t, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_7_record_6Record_rsq; + __pyx_vtable_7sklearn_5earth_7_record_Record.gcv = (__pyx_t_7sklearn_5earth_7_record_FLOAT_t (*)(struct __pyx_obj_7sklearn_5earth_7_record_Record *, __pyx_t_7sklearn_5earth_7_record_INDEX_t, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_7_record_6Record_gcv; + __pyx_vtable_7sklearn_5earth_7_record_Record.grsq = (__pyx_t_7sklearn_5earth_7_record_FLOAT_t (*)(struct __pyx_obj_7sklearn_5earth_7_record_Record *, __pyx_t_7sklearn_5earth_7_record_INDEX_t, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_7_record_6Record_grsq; + if (PyType_Ready(&__pyx_type_7sklearn_5earth_7_record_Record) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_5earth_7_record_Record.tp_dict, __pyx_vtabptr_7sklearn_5earth_7_record_Record) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "Record", (PyObject *)&__pyx_type_7sklearn_5earth_7_record_Record) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_7_record_Record = &__pyx_type_7sklearn_5earth_7_record_Record; + __pyx_vtabptr_7sklearn_5earth_7_record_ForwardPassRecord = &__pyx_vtable_7sklearn_5earth_7_record_ForwardPassRecord; + __pyx_vtable_7sklearn_5earth_7_record_ForwardPassRecord.__pyx_base = *__pyx_vtabptr_7sklearn_5earth_7_record_Record; + __pyx_vtable_7sklearn_5earth_7_record_ForwardPassRecord.set_stopping_condition = (PyObject *(*)(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *, int, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_7_record_17ForwardPassRecord_set_stopping_condition; + __pyx_type_7sklearn_5earth_7_record_ForwardPassRecord.tp_base = __pyx_ptype_7sklearn_5earth_7_record_Record; + if (PyType_Ready(&__pyx_type_7sklearn_5earth_7_record_ForwardPassRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_5earth_7_record_ForwardPassRecord.tp_dict, __pyx_vtabptr_7sklearn_5earth_7_record_ForwardPassRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "ForwardPassRecord", (PyObject *)&__pyx_type_7sklearn_5earth_7_record_ForwardPassRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_7_record_ForwardPassRecord = &__pyx_type_7sklearn_5earth_7_record_ForwardPassRecord; + __pyx_vtabptr_7sklearn_5earth_7_record_PruningPassIteration = &__pyx_vtable_7sklearn_5earth_7_record_PruningPassIteration; + __pyx_vtable_7sklearn_5earth_7_record_PruningPassIteration.__pyx_base = *__pyx_vtabptr_7sklearn_5earth_7_record_Iteration; + __pyx_vtable_7sklearn_5earth_7_record_PruningPassIteration.get_pruned = (__pyx_t_7sklearn_5earth_7_record_INDEX_t (*)(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassIteration *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_7_record_20PruningPassIteration_get_pruned; + __pyx_type_7sklearn_5earth_7_record_PruningPassIteration.tp_base = __pyx_ptype_7sklearn_5earth_7_record_Iteration; + if (PyType_Ready(&__pyx_type_7sklearn_5earth_7_record_PruningPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_5earth_7_record_PruningPassIteration.tp_dict, __pyx_vtabptr_7sklearn_5earth_7_record_PruningPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "PruningPassIteration", (PyObject *)&__pyx_type_7sklearn_5earth_7_record_PruningPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_7_record_PruningPassIteration = &__pyx_type_7sklearn_5earth_7_record_PruningPassIteration; + __pyx_vtabptr_7sklearn_5earth_7_record_FirstPruningPassIteration = &__pyx_vtable_7sklearn_5earth_7_record_FirstPruningPassIteration; + __pyx_vtable_7sklearn_5earth_7_record_FirstPruningPassIteration.__pyx_base = *__pyx_vtabptr_7sklearn_5earth_7_record_PruningPassIteration; + __pyx_type_7sklearn_5earth_7_record_FirstPruningPassIteration.tp_base = __pyx_ptype_7sklearn_5earth_7_record_PruningPassIteration; + if (PyType_Ready(&__pyx_type_7sklearn_5earth_7_record_FirstPruningPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_5earth_7_record_FirstPruningPassIteration.tp_dict, __pyx_vtabptr_7sklearn_5earth_7_record_FirstPruningPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "FirstPruningPassIteration", (PyObject *)&__pyx_type_7sklearn_5earth_7_record_FirstPruningPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_7_record_FirstPruningPassIteration = &__pyx_type_7sklearn_5earth_7_record_FirstPruningPassIteration; + __pyx_vtabptr_7sklearn_5earth_7_record_FirstForwardPassIteration = &__pyx_vtable_7sklearn_5earth_7_record_FirstForwardPassIteration; + __pyx_vtable_7sklearn_5earth_7_record_FirstForwardPassIteration.__pyx_base = *__pyx_vtabptr_7sklearn_5earth_7_record_ForwardPassIteration; + __pyx_vtable_7sklearn_5earth_7_record_FirstForwardPassIteration.__pyx_base.__pyx_base.get_size = (__pyx_t_7sklearn_5earth_7_record_INDEX_t (*)(struct __pyx_obj_7sklearn_5earth_7_record_Iteration *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_7_record_25FirstForwardPassIteration_get_size; + __pyx_type_7sklearn_5earth_7_record_FirstForwardPassIteration.tp_base = __pyx_ptype_7sklearn_5earth_7_record_ForwardPassIteration; + if (PyType_Ready(&__pyx_type_7sklearn_5earth_7_record_FirstForwardPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_5earth_7_record_FirstForwardPassIteration.tp_dict, __pyx_vtabptr_7sklearn_5earth_7_record_FirstForwardPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "FirstForwardPassIteration", (PyObject *)&__pyx_type_7sklearn_5earth_7_record_FirstForwardPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_7_record_FirstForwardPassIteration = &__pyx_type_7sklearn_5earth_7_record_FirstForwardPassIteration; + __pyx_vtabptr_7sklearn_5earth_7_record_PruningPassRecord = &__pyx_vtable_7sklearn_5earth_7_record_PruningPassRecord; + __pyx_vtable_7sklearn_5earth_7_record_PruningPassRecord.__pyx_base = *__pyx_vtabptr_7sklearn_5earth_7_record_Record; + __pyx_vtable_7sklearn_5earth_7_record_PruningPassRecord.set_selected = (PyObject *(*)(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *, __pyx_t_7sklearn_5earth_7_record_INDEX_t, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_7_record_17PruningPassRecord_set_selected; + __pyx_vtable_7sklearn_5earth_7_record_PruningPassRecord.get_selected = (__pyx_t_7sklearn_5earth_7_record_INDEX_t (*)(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_7_record_17PruningPassRecord_get_selected; + __pyx_vtable_7sklearn_5earth_7_record_PruningPassRecord.roll_back = (PyObject *(*)(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *, struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_7_record_17PruningPassRecord_roll_back; + __pyx_type_7sklearn_5earth_7_record_PruningPassRecord.tp_base = __pyx_ptype_7sklearn_5earth_7_record_Record; + if (PyType_Ready(&__pyx_type_7sklearn_5earth_7_record_PruningPassRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_5earth_7_record_PruningPassRecord.tp_dict, __pyx_vtabptr_7sklearn_5earth_7_record_PruningPassRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "PruningPassRecord", (PyObject *)&__pyx_type_7sklearn_5earth_7_record_PruningPassRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_7_record_PruningPassRecord = &__pyx_type_7sklearn_5earth_7_record_PruningPassRecord; /*--- Type import code ---*/ __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", #if CYTHON_COMPILING_IN_PYPY @@ -11805,25 +11125,25 @@ PyMODINIT_FUNC PyInit__record(void) __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_6_basis_BasisFunction = __Pyx_ImportType("_basis", "BasisFunction", sizeof(struct __pyx_obj_6_basis_BasisFunction), 1); if (unlikely(!__pyx_ptype_6_basis_BasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_vtabptr_6_basis_BasisFunction = (struct __pyx_vtabstruct_6_basis_BasisFunction*)__Pyx_GetVtable(__pyx_ptype_6_basis_BasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_6_basis_BasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_6_basis_ConstantBasisFunction = __Pyx_ImportType("_basis", "ConstantBasisFunction", sizeof(struct __pyx_obj_6_basis_ConstantBasisFunction), 1); if (unlikely(!__pyx_ptype_6_basis_ConstantBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_vtabptr_6_basis_ConstantBasisFunction = (struct __pyx_vtabstruct_6_basis_ConstantBasisFunction*)__Pyx_GetVtable(__pyx_ptype_6_basis_ConstantBasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_6_basis_ConstantBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_6_basis_HingeBasisFunction = __Pyx_ImportType("_basis", "HingeBasisFunction", sizeof(struct __pyx_obj_6_basis_HingeBasisFunction), 1); if (unlikely(!__pyx_ptype_6_basis_HingeBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_vtabptr_6_basis_HingeBasisFunction = (struct __pyx_vtabstruct_6_basis_HingeBasisFunction*)__Pyx_GetVtable(__pyx_ptype_6_basis_HingeBasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_6_basis_HingeBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_6_basis_LinearBasisFunction = __Pyx_ImportType("_basis", "LinearBasisFunction", sizeof(struct __pyx_obj_6_basis_LinearBasisFunction), 1); if (unlikely(!__pyx_ptype_6_basis_LinearBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_vtabptr_6_basis_LinearBasisFunction = (struct __pyx_vtabstruct_6_basis_LinearBasisFunction*)__Pyx_GetVtable(__pyx_ptype_6_basis_LinearBasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_6_basis_LinearBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_6_basis_Basis = __Pyx_ImportType("_basis", "Basis", sizeof(struct __pyx_obj_6_basis_Basis), 1); if (unlikely(!__pyx_ptype_6_basis_Basis)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_vtabptr_6_basis_Basis = (struct __pyx_vtabstruct_6_basis_Basis*)__Pyx_GetVtable(__pyx_ptype_6_basis_Basis->tp_dict); if (unlikely(!__pyx_vtabptr_6_basis_Basis)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction = __Pyx_ImportType("sklearn.earth._basis", "BasisFunction", sizeof(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_6_basis_BasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5earth_6_basis_BasisFunction = (struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_6_basis_BasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_6_basis_BasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_6_basis_ConstantBasisFunction = __Pyx_ImportType("sklearn.earth._basis", "ConstantBasisFunction", sizeof(struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_6_basis_ConstantBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5earth_6_basis_ConstantBasisFunction = (struct __pyx_vtabstruct_7sklearn_5earth_6_basis_ConstantBasisFunction*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_6_basis_ConstantBasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_6_basis_ConstantBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_6_basis_HingeBasisFunction = __Pyx_ImportType("sklearn.earth._basis", "HingeBasisFunction", sizeof(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_6_basis_HingeBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5earth_6_basis_HingeBasisFunction = (struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_6_basis_HingeBasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_6_basis_HingeBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_6_basis_LinearBasisFunction = __Pyx_ImportType("sklearn.earth._basis", "LinearBasisFunction", sizeof(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_6_basis_LinearBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5earth_6_basis_LinearBasisFunction = (struct __pyx_vtabstruct_7sklearn_5earth_6_basis_LinearBasisFunction*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_6_basis_LinearBasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_6_basis_LinearBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_6_basis_Basis = __Pyx_ImportType("sklearn.earth._basis", "Basis", sizeof(struct __pyx_obj_7sklearn_5earth_6_basis_Basis), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_6_basis_Basis)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5earth_6_basis_Basis = (struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_6_basis_Basis->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_6_basis_Basis)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Variable import code ---*/ /*--- Function import code ---*/ - __pyx_t_1 = __Pyx_ImportModule("_util"); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_ImportFunction(__pyx_t_1, "gcv", (void (**)(void))&__pyx_f_5_util_gcv, "__pyx_t_5_util_FLOAT_t (__pyx_t_5_util_FLOAT_t, __pyx_t_5_util_INDEX_t, __pyx_t_5_util_INDEX_t, __pyx_t_5_util_FLOAT_t, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_ImportFunction(__pyx_t_1, "ascii_table", (void (**)(void))&__pyx_f_5_util_ascii_table, "PyObject *(PyObject *, PyObject *, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_ImportModule("sklearn.earth._util"); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_t_1, "gcv", (void (**)(void))&__pyx_f_7sklearn_5earth_5_util_gcv, "__pyx_t_7sklearn_5earth_5_util_FLOAT_t (__pyx_t_7sklearn_5earth_5_util_FLOAT_t, __pyx_t_7sklearn_5earth_5_util_INDEX_t, __pyx_t_7sklearn_5earth_5_util_INDEX_t, __pyx_t_7sklearn_5earth_5_util_FLOAT_t, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_t_1, "ascii_table", (void (**)(void))&__pyx_f_7sklearn_5earth_5_util_ascii_table, "PyObject *(PyObject *, PyObject *, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_t_1); __pyx_t_1 = 0; /*--- Execution code ---*/ - /* "_record.pyx":8 + /* "sklearn/earth/_record.pyx":8 * * from _util cimport gcv, ascii_table * import _forward # <<<<<<<<<<<<<< @@ -11835,7 +11155,7 @@ PyMODINIT_FUNC PyInit__record(void) if (PyDict_SetItem(__pyx_d, __pyx_n_s___forward, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "_record.pyx":1 + /* "sklearn/earth/_record.pyx":1 * # distutils: language = c # <<<<<<<<<<<<<< * # cython: cdivision = True * # cython: boundscheck = False @@ -11857,10 +11177,10 @@ PyMODINIT_FUNC PyInit__record(void) __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); if (__pyx_m) { - __Pyx_AddTraceback("init _record", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("init sklearn.earth._record", __pyx_clineno, __pyx_lineno, __pyx_filename); Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init _record"); + PyErr_SetString(PyExc_ImportError, "init sklearn.earth._record"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); @@ -11921,6 +11241,56 @@ static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed return 0; } +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +#else + PyErr_Restore(type, value, tb); +#endif +} +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +#if CYTHON_COMPILING_IN_CPYTHON + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +#else + PyErr_Fetch(type, value, tb); +#endif +} + +static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, + CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) { + PyObject *old_exc, *old_val, *old_tb; + PyObject *ctx; + __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); + #if PY_MAJOR_VERSION < 3 + ctx = PyString_FromString(name); + #else + ctx = PyUnicode_FromString(name); + #endif + __Pyx_ErrRestore(old_exc, old_val, old_tb); + if (!ctx) { + PyErr_WriteUnraisable(Py_None); + } else { + PyErr_WriteUnraisable(ctx); + Py_DECREF(ctx); + } +} + static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { if (unlikely(!type)) { PyErr_Format(PyExc_SystemError, "Missing type object"); @@ -12167,37 +11537,6 @@ static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, return __Pyx_GetItemInt_Generic(o, PyInt_FromSsize_t(i)); } -static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { -#if CYTHON_COMPILING_IN_CPYTHON - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyThreadState *tstate = PyThreadState_GET(); - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -#else - PyErr_Restore(type, value, tb); -#endif -} -static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { -#if CYTHON_COMPILING_IN_CPYTHON - PyThreadState *tstate = PyThreadState_GET(); - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -#else - PyErr_Fetch(type, value, tb); -#endif -} - #if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb, CYTHON_UNUSED PyObject *cause) { @@ -12410,6 +11749,42 @@ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected) { return 0; } +static int __Pyx_SetVtable(PyObject *dict, void *vtable) { +#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) + PyObject *ob = PyCapsule_New(vtable, 0, 0); +#else + PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); +#endif + if (!ob) + goto bad; + if (PyDict_SetItem(dict, __pyx_n_s____pyx_vtable__, ob) < 0) + goto bad; + Py_DECREF(ob); + return 0; +bad: + Py_XDECREF(ob); + return -1; +} + +static void* __Pyx_GetVtable(PyObject *dict) { + void* ptr; + PyObject *ob = PyObject_GetItem(dict, __pyx_n_s____pyx_vtable__); + if (!ob) + goto bad; +#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) + ptr = PyCapsule_GetPointer(ob, 0); +#else + ptr = PyCObject_AsVoidPtr(ob); +#endif + if (!ptr && !PyErr_Occurred()) + PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); + Py_DECREF(ob); + return ptr; +bad: + Py_XDECREF(ob); + return NULL; +} + static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { PyObject *empty_list = 0; PyObject *module = 0; @@ -13370,25 +12745,6 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* } } -static void __Pyx_WriteUnraisable(const char *name, CYTHON_UNUSED int clineno, - CYTHON_UNUSED int lineno, CYTHON_UNUSED const char *filename) { - PyObject *old_exc, *old_val, *old_tb; - PyObject *ctx; - __Pyx_ErrFetch(&old_exc, &old_val, &old_tb); - #if PY_MAJOR_VERSION < 3 - ctx = PyString_FromString(name); - #else - ctx = PyUnicode_FromString(name); - #endif - __Pyx_ErrRestore(old_exc, old_val, old_tb); - if (!ctx) { - PyErr_WriteUnraisable(Py_None); - } else { - PyErr_WriteUnraisable(ctx); - Py_DECREF(ctx); - } -} - static int __Pyx_check_binary_version(void) { char ctversion[4], rtversion[4]; PyOS_snprintf(ctversion, 4, "%d.%d", PY_MAJOR_VERSION, PY_MINOR_VERSION); @@ -13408,23 +12764,6 @@ static int __Pyx_check_binary_version(void) { return 0; } -static int __Pyx_SetVtable(PyObject *dict, void *vtable) { -#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) - PyObject *ob = PyCapsule_New(vtable, 0, 0); -#else - PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); -#endif - if (!ob) - goto bad; - if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0) - goto bad; - Py_DECREF(ob); - return 0; -bad: - Py_XDECREF(ob); - return -1; -} - #ifndef __PYX_HAVE_RT_ImportModule #define __PYX_HAVE_RT_ImportModule static PyObject *__Pyx_ImportModule(const char *name) { @@ -13510,25 +12849,6 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class } #endif -static void* __Pyx_GetVtable(PyObject *dict) { - void* ptr; - PyObject *ob = PyMapping_GetItemString(dict, (char *)"__pyx_vtable__"); - if (!ob) - goto bad; -#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3&&PY_MINOR_VERSION==0) - ptr = PyCapsule_GetPointer(ob, 0); -#else - ptr = PyCObject_AsVoidPtr(ob); -#endif - if (!ptr && !PyErr_Occurred()) - PyErr_SetString(PyExc_RuntimeError, "invalid vtable found for imported type"); - Py_DECREF(ob); - return ptr; -bad: - Py_XDECREF(ob); - return NULL; -} - #ifndef __PYX_HAVE_RT_ImportFunction #define __PYX_HAVE_RT_ImportFunction static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { diff --git a/sklearn/earth/_record.pxd b/sklearn/earth/_record.pxd index d8846e8ad8f0e..89bb628ce7ef0 100644 --- a/sklearn/earth/_record.pxd +++ b/sklearn/earth/_record.pxd @@ -34,6 +34,8 @@ cdef class PruningPassRecord(Record): cdef class ForwardPassRecord(Record): cdef int stopping_condition + cdef list xlabels + cpdef set_stopping_condition(ForwardPassRecord self, int stopping_condition) cdef class Iteration: diff --git a/sklearn/earth/_record.pyx b/sklearn/earth/_record.pyx index bdd05c3adc8ff..d44a39451fc8f 100644 --- a/sklearn/earth/_record.pyx +++ b/sklearn/earth/_record.pyx @@ -100,22 +100,24 @@ cdef class PruningPassRecord(Record): return result cdef class ForwardPassRecord(Record): - def __init__(ForwardPassRecord self, INDEX_t num_samples, INDEX_t num_variables, FLOAT_t penalty, FLOAT_t sst): + def __init__(ForwardPassRecord self, INDEX_t num_samples, INDEX_t num_variables, FLOAT_t penalty, FLOAT_t sst, list xlabels): self.num_samples = num_samples self.num_variables = num_variables self.penalty = penalty self.sst = sst self.iterations = [FirstForwardPassIteration(self.sst)] + self.xlabels = xlabels def __reduce__(ForwardPassRecord self): - return (ForwardPassRecord, (1,1,1.0,1.0), self._getstate()) + return (ForwardPassRecord, (self.num_samples,self.num_variables,self.penalty,self.sst,self.xlabels), self._getstate()) def _getstate(ForwardPassRecord self): return {'num_samples': self.num_samples, 'num_variables': self.num_variables, 'penalty': self.penalty, 'sst': self.sst, - 'iterations': self.iterations} + 'iterations': self.iterations, + 'xlabels': self.xlabels} def __setstate__(ForwardPassRecord self, dict state): self.num_samples = state['num_samples'] @@ -123,6 +125,7 @@ cdef class ForwardPassRecord(Record): self.penalty = state['penalty'] self.sst = state['sst'] self.iterations = state['iterations'] + self.xlabels = state['xlabels'] cpdef set_stopping_condition(ForwardPassRecord self, int stopping_condition): self.stopping_condition = stopping_condition diff --git a/sklearn/earth/_util.c b/sklearn/earth/_util.c index 89ccf94e8e3ad..060001d12bbcb 100644 --- a/sklearn/earth/_util.c +++ b/sklearn/earth/_util.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19 on Sat Jul 20 23:46:45 2013 */ +/* Generated by Cython 0.19.1 on Thu Jul 25 22:12:25 2013 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS @@ -261,6 +261,17 @@ #define CYTHON_INLINE #endif #endif +#ifndef CYTHON_RESTRICT + #if defined(__GNUC__) + #define CYTHON_RESTRICT __restrict__ + #elif defined(_MSC_VER) + #define CYTHON_RESTRICT __restrict + #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L + #define CYTHON_RESTRICT restrict + #else + #define CYTHON_RESTRICT + #endif +#endif #ifdef NAN #define __PYX_NAN() ((float) NAN) #else @@ -295,8 +306,8 @@ static CYTHON_INLINE float __PYX_NAN() { #define _USE_MATH_DEFINES #endif #include -#define __PYX_HAVE___util -#define __PYX_HAVE_API___util +#define __PYX_HAVE__sklearn__earth___util +#define __PYX_HAVE_API__sklearn__earth___util #include "string.h" #include "stdio.h" #include "stdlib.h" @@ -725,40 +736,40 @@ typedef npy_double __pyx_t_5numpy_double_t; */ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; -/* "_util.pxd":2 +/* "sklearn/earth/_util.pxd":2 * cimport numpy as cnp * ctypedef cnp.float64_t FLOAT_t # <<<<<<<<<<<<<< * ctypedef cnp.intp_t INT_t * ctypedef cnp.ulong_t INDEX_t */ -typedef __pyx_t_5numpy_float64_t __pyx_t_5_util_FLOAT_t; +typedef __pyx_t_5numpy_float64_t __pyx_t_7sklearn_5earth_5_util_FLOAT_t; -/* "_util.pxd":3 +/* "sklearn/earth/_util.pxd":3 * cimport numpy as cnp * ctypedef cnp.float64_t FLOAT_t * ctypedef cnp.intp_t INT_t # <<<<<<<<<<<<<< * ctypedef cnp.ulong_t INDEX_t * ctypedef cnp.uint8_t BOOL_t */ -typedef __pyx_t_5numpy_intp_t __pyx_t_5_util_INT_t; +typedef __pyx_t_5numpy_intp_t __pyx_t_7sklearn_5earth_5_util_INT_t; -/* "_util.pxd":4 +/* "sklearn/earth/_util.pxd":4 * ctypedef cnp.float64_t FLOAT_t * ctypedef cnp.intp_t INT_t * ctypedef cnp.ulong_t INDEX_t # <<<<<<<<<<<<<< * ctypedef cnp.uint8_t BOOL_t * */ -typedef __pyx_t_5numpy_ulong_t __pyx_t_5_util_INDEX_t; +typedef __pyx_t_5numpy_ulong_t __pyx_t_7sklearn_5earth_5_util_INDEX_t; -/* "_util.pxd":5 +/* "sklearn/earth/_util.pxd":5 * ctypedef cnp.intp_t INT_t * ctypedef cnp.ulong_t INDEX_t * ctypedef cnp.uint8_t BOOL_t # <<<<<<<<<<<<<< * * cdef FLOAT_t log2(FLOAT_t x) */ -typedef __pyx_t_5numpy_uint8_t __pyx_t_5_util_BOOL_t; +typedef __pyx_t_5numpy_uint8_t __pyx_t_7sklearn_5earth_5_util_BOOL_t; #if CYTHON_CCOMPLEX #ifdef __cplusplus typedef ::std::complex< float > __pyx_t_float_complex; @@ -1170,28 +1181,28 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, cha /* Module declarations from 'libc.math' */ -/* Module declarations from '_util' */ -static PyObject *__pyx_f_5_util_apply_weights_2d(PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); /*proto*/ -static PyObject *__pyx_f_5_util_apply_weights_1d(PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); /*proto*/ -static __pyx_t_5_util_FLOAT_t __pyx_f_5_util_gcv(__pyx_t_5_util_FLOAT_t, __pyx_t_5_util_INDEX_t, __pyx_t_5_util_INDEX_t, __pyx_t_5_util_FLOAT_t, int __pyx_skip_dispatch); /*proto*/ -static __pyx_t_5_util_FLOAT_t __pyx_f_5_util_gcv_adjust(__pyx_t_5_util_INDEX_t, __pyx_t_5_util_INDEX_t, __pyx_t_5_util_FLOAT_t, int __pyx_skip_dispatch); /*proto*/ -static PyObject *__pyx_f_5_util_str_pad(PyObject *, PyObject *, int __pyx_skip_dispatch); /*proto*/ -static PyObject *__pyx_f_5_util_ascii_table(PyObject *, PyObject *, int __pyx_skip_dispatch); /*proto*/ -static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5_util_FLOAT_t = { "FLOAT_t", NULL, sizeof(__pyx_t_5_util_FLOAT_t), { 0 }, 0, 'R', 0, 0 }; -#define __Pyx_MODULE_NAME "_util" -int __pyx_module_is_main__util = 0; - -/* Implementation of '_util' */ +/* Module declarations from 'sklearn.earth._util' */ +static PyObject *__pyx_f_7sklearn_5earth_5_util_apply_weights_2d(PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); /*proto*/ +static PyObject *__pyx_f_7sklearn_5earth_5_util_apply_weights_1d(PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); /*proto*/ +static __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_f_7sklearn_5earth_5_util_gcv(__pyx_t_7sklearn_5earth_5_util_FLOAT_t, __pyx_t_7sklearn_5earth_5_util_INDEX_t, __pyx_t_7sklearn_5earth_5_util_INDEX_t, __pyx_t_7sklearn_5earth_5_util_FLOAT_t, int __pyx_skip_dispatch); /*proto*/ +static __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_f_7sklearn_5earth_5_util_gcv_adjust(__pyx_t_7sklearn_5earth_5_util_INDEX_t, __pyx_t_7sklearn_5earth_5_util_INDEX_t, __pyx_t_7sklearn_5earth_5_util_FLOAT_t, int __pyx_skip_dispatch); /*proto*/ +static PyObject *__pyx_f_7sklearn_5earth_5_util_str_pad(PyObject *, PyObject *, int __pyx_skip_dispatch); /*proto*/ +static PyObject *__pyx_f_7sklearn_5earth_5_util_ascii_table(PyObject *, PyObject *, int __pyx_skip_dispatch); /*proto*/ +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_5_util_FLOAT_t = { "FLOAT_t", NULL, sizeof(__pyx_t_7sklearn_5earth_5_util_FLOAT_t), { 0 }, 0, 'R', 0, 0 }; +#define __Pyx_MODULE_NAME "sklearn.earth._util" +int __pyx_module_is_main_sklearn__earth___util = 0; + +/* Implementation of 'sklearn.earth._util' */ static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_enumerate; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_RuntimeError; -static PyObject *__pyx_pf_5_util_apply_weights_2d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_B, PyArrayObject *__pyx_v_weights); /* proto */ -static PyObject *__pyx_pf_5_util_2apply_weights_1d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_y, PyArrayObject *__pyx_v_weights); /* proto */ -static PyObject *__pyx_pf_5_util_4gcv(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_5_util_FLOAT_t __pyx_v_mse, __pyx_t_5_util_INDEX_t __pyx_v_basis_size, __pyx_t_5_util_INDEX_t __pyx_v_data_size, __pyx_t_5_util_FLOAT_t __pyx_v_penalty); /* proto */ -static PyObject *__pyx_pf_5_util_6gcv_adjust(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_5_util_INDEX_t __pyx_v_basis_size, __pyx_t_5_util_INDEX_t __pyx_v_data_size, __pyx_t_5_util_FLOAT_t __pyx_v_penalty); /* proto */ -static PyObject *__pyx_pf_5_util_8str_pad(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_string, PyObject *__pyx_v_length); /* proto */ -static PyObject *__pyx_pf_5_util_10ascii_table(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_header, PyObject *__pyx_v_data); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_5_util_apply_weights_2d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_B, PyArrayObject *__pyx_v_weights); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_5_util_2apply_weights_1d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_y, PyArrayObject *__pyx_v_weights); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_5_util_4gcv(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_v_mse, __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_basis_size, __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_data_size, __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_v_penalty); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_5_util_6gcv_adjust(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_basis_size, __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_data_size, __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_v_penalty); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_5_util_8str_pad(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_string, PyObject *__pyx_v_length); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_5_util_10ascii_table(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_header, PyObject *__pyx_v_data); /* proto */ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ static char __pyx_k_1[] = " "; @@ -1284,7 +1295,7 @@ static PyObject *__pyx_k_tuple_13; static PyObject *__pyx_k_tuple_14; static PyObject *__pyx_k_tuple_16; -/* "_util.pyx":10 +/* "sklearn/earth/_util.pyx":10 * from libc.math cimport sqrt, log * * cdef FLOAT_t log2(FLOAT_t x): # <<<<<<<<<<<<<< @@ -1292,12 +1303,12 @@ static PyObject *__pyx_k_tuple_16; * */ -static __pyx_t_5_util_FLOAT_t __pyx_f_5_util_log2(__pyx_t_5_util_FLOAT_t __pyx_v_x) { - __pyx_t_5_util_FLOAT_t __pyx_r; +static __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_f_7sklearn_5earth_5_util_log2(__pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_v_x) { + __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("log2", 0); - /* "_util.pyx":11 + /* "sklearn/earth/_util.pyx":11 * * cdef FLOAT_t log2(FLOAT_t x): * return log(x) / log(2.0) # <<<<<<<<<<<<<< @@ -1313,7 +1324,7 @@ static __pyx_t_5_util_FLOAT_t __pyx_f_5_util_log2(__pyx_t_5_util_FLOAT_t __pyx_v return __pyx_r; } -/* "_util.pyx":13 +/* "sklearn/earth/_util.pyx":13 * return log(x) / log(2.0) * * cpdef apply_weights_2d(cnp.ndarray[FLOAT_t, ndim=2] B, cnp.ndarray[FLOAT_t, ndim=1] weights): # <<<<<<<<<<<<<< @@ -1321,25 +1332,25 @@ static __pyx_t_5_util_FLOAT_t __pyx_f_5_util_log2(__pyx_t_5_util_FLOAT_t __pyx_v * cdef INDEX_t j */ -static PyObject *__pyx_pw_5_util_1apply_weights_2d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_5_util_apply_weights_2d(PyArrayObject *__pyx_v_B, PyArrayObject *__pyx_v_weights, CYTHON_UNUSED int __pyx_skip_dispatch) { - __pyx_t_5_util_INDEX_t __pyx_v_i; - __pyx_t_5_util_INDEX_t __pyx_v_j; - __pyx_t_5_util_INDEX_t __pyx_v_m; - __pyx_t_5_util_INDEX_t __pyx_v_n; +static PyObject *__pyx_pw_7sklearn_5earth_5_util_1apply_weights_2d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_7sklearn_5earth_5_util_apply_weights_2d(PyArrayObject *__pyx_v_B, PyArrayObject *__pyx_v_weights, CYTHON_UNUSED int __pyx_skip_dispatch) { + __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_i; + __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_j; + __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_m; + __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_n; __Pyx_LocalBuf_ND __pyx_pybuffernd_B; __Pyx_Buffer __pyx_pybuffer_B; __Pyx_LocalBuf_ND __pyx_pybuffernd_weights; __Pyx_Buffer __pyx_pybuffer_weights; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __pyx_t_5_util_INDEX_t __pyx_t_1; - __pyx_t_5_util_INDEX_t __pyx_t_2; - __pyx_t_5_util_INDEX_t __pyx_t_3; - __pyx_t_5_util_INDEX_t __pyx_t_4; - __pyx_t_5_util_INDEX_t __pyx_t_5; - __pyx_t_5_util_INDEX_t __pyx_t_6; - __pyx_t_5_util_INDEX_t __pyx_t_7; + __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_t_1; + __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_t_2; + __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_t_3; + __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_t_4; + __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_t_5; + __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_t_6; + __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_t_7; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -1354,16 +1365,16 @@ static PyObject *__pyx_f_5_util_apply_weights_2d(PyArrayObject *__pyx_v_B, PyArr __pyx_pybuffernd_weights.rcbuffer = &__pyx_pybuffer_weights; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_v_B, &__Pyx_TypeInfo_nn___pyx_t_5_util_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_v_B, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_5_util_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_B.diminfo[0].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B.diminfo[0].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B.diminfo[1].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B.diminfo[1].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_5_util_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_5_util_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_weights.diminfo[0].strides = __pyx_pybuffernd_weights.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weights.diminfo[0].shape = __pyx_pybuffernd_weights.rcbuffer->pybuffer.shape[0]; - /* "_util.pyx":16 + /* "sklearn/earth/_util.pyx":16 * cdef INDEX_t i * cdef INDEX_t j * cdef INDEX_t m = B.shape[0] # <<<<<<<<<<<<<< @@ -1372,7 +1383,7 @@ static PyObject *__pyx_f_5_util_apply_weights_2d(PyArrayObject *__pyx_v_B, PyArr */ __pyx_v_m = (__pyx_v_B->dimensions[0]); - /* "_util.pyx":17 + /* "sklearn/earth/_util.pyx":17 * cdef INDEX_t j * cdef INDEX_t m = B.shape[0] * cdef INDEX_t n = B.shape[1] # <<<<<<<<<<<<<< @@ -1381,7 +1392,7 @@ static PyObject *__pyx_f_5_util_apply_weights_2d(PyArrayObject *__pyx_v_B, PyArr */ __pyx_v_n = (__pyx_v_B->dimensions[1]); - /* "_util.pyx":18 + /* "sklearn/earth/_util.pyx":18 * cdef INDEX_t m = B.shape[0] * cdef INDEX_t n = B.shape[1] * for i in range(m): # <<<<<<<<<<<<<< @@ -1392,7 +1403,7 @@ static PyObject *__pyx_f_5_util_apply_weights_2d(PyArrayObject *__pyx_v_B, PyArr for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "_util.pyx":19 + /* "sklearn/earth/_util.pyx":19 * cdef INDEX_t n = B.shape[1] * for i in range(m): * for j in range(n): # <<<<<<<<<<<<<< @@ -1403,7 +1414,7 @@ static PyObject *__pyx_f_5_util_apply_weights_2d(PyArrayObject *__pyx_v_B, PyArr for (__pyx_t_4 = 0; __pyx_t_4 < __pyx_t_3; __pyx_t_4+=1) { __pyx_v_j = __pyx_t_4; - /* "_util.pyx":20 + /* "sklearn/earth/_util.pyx":20 * for i in range(m): * for j in range(n): * B[i,j] *= sqrt(weights[i]) # <<<<<<<<<<<<<< @@ -1413,7 +1424,7 @@ static PyObject *__pyx_f_5_util_apply_weights_2d(PyArrayObject *__pyx_v_B, PyArr __pyx_t_5 = __pyx_v_i; __pyx_t_6 = __pyx_v_i; __pyx_t_7 = __pyx_v_j; - *__Pyx_BufPtrStrided2d(__pyx_t_5_util_FLOAT_t *, __pyx_pybuffernd_B.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_B.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_B.diminfo[1].strides) *= sqrt((*__Pyx_BufPtrStrided1d(__pyx_t_5_util_FLOAT_t *, __pyx_pybuffernd_weights.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_weights.diminfo[0].strides))); + *__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_5_util_FLOAT_t *, __pyx_pybuffernd_B.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_B.diminfo[0].strides, __pyx_t_7, __pyx_pybuffernd_B.diminfo[1].strides) *= sqrt((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_5_util_FLOAT_t *, __pyx_pybuffernd_weights.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_weights.diminfo[0].strides))); } } @@ -1425,7 +1436,7 @@ static PyObject *__pyx_f_5_util_apply_weights_2d(PyArrayObject *__pyx_v_B, PyArr __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_B.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("_util.apply_weights_2d", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._util.apply_weights_2d", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; goto __pyx_L2; __pyx_L0:; @@ -1438,8 +1449,8 @@ static PyObject *__pyx_f_5_util_apply_weights_2d(PyArrayObject *__pyx_v_B, PyArr } /* Python wrapper */ -static PyObject *__pyx_pw_5_util_1apply_weights_2d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_5_util_1apply_weights_2d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_7sklearn_5earth_5_util_1apply_weights_2d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_5_util_1apply_weights_2d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_B = 0; PyArrayObject *__pyx_v_weights = 0; int __pyx_lineno = 0; @@ -1487,13 +1498,13 @@ static PyObject *__pyx_pw_5_util_1apply_weights_2d(PyObject *__pyx_self, PyObjec __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("apply_weights_2d", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_util.apply_weights_2d", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._util.apply_weights_2d", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_B), __pyx_ptype_5numpy_ndarray, 1, "B", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weights), __pyx_ptype_5numpy_ndarray, 1, "weights", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_5_util_apply_weights_2d(__pyx_self, __pyx_v_B, __pyx_v_weights); + __pyx_r = __pyx_pf_7sklearn_5earth_5_util_apply_weights_2d(__pyx_self, __pyx_v_B, __pyx_v_weights); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -1502,7 +1513,7 @@ static PyObject *__pyx_pw_5_util_1apply_weights_2d(PyObject *__pyx_self, PyObjec return __pyx_r; } -/* "_util.pyx":13 +/* "sklearn/earth/_util.pyx":13 * return log(x) / log(2.0) * * cpdef apply_weights_2d(cnp.ndarray[FLOAT_t, ndim=2] B, cnp.ndarray[FLOAT_t, ndim=1] weights): # <<<<<<<<<<<<<< @@ -1510,7 +1521,7 @@ static PyObject *__pyx_pw_5_util_1apply_weights_2d(PyObject *__pyx_self, PyObjec * cdef INDEX_t j */ -static PyObject *__pyx_pf_5_util_apply_weights_2d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_B, PyArrayObject *__pyx_v_weights) { +static PyObject *__pyx_pf_7sklearn_5earth_5_util_apply_weights_2d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_B, PyArrayObject *__pyx_v_weights) { __Pyx_LocalBuf_ND __pyx_pybuffernd_B; __Pyx_Buffer __pyx_pybuffer_B; __Pyx_LocalBuf_ND __pyx_pybuffernd_weights; @@ -1532,16 +1543,16 @@ static PyObject *__pyx_pf_5_util_apply_weights_2d(CYTHON_UNUSED PyObject *__pyx_ __pyx_pybuffernd_weights.rcbuffer = &__pyx_pybuffer_weights; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_v_B, &__Pyx_TypeInfo_nn___pyx_t_5_util_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_v_B, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_5_util_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_B.diminfo[0].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B.diminfo[0].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B.diminfo[1].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B.diminfo[1].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_5_util_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_5_util_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_weights.diminfo[0].strides = __pyx_pybuffernd_weights.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weights.diminfo[0].shape = __pyx_pybuffernd_weights.rcbuffer->pybuffer.shape[0]; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_5_util_apply_weights_2d(((PyArrayObject *)__pyx_v_B), ((PyArrayObject *)__pyx_v_weights), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_f_7sklearn_5earth_5_util_apply_weights_2d(((PyArrayObject *)__pyx_v_B), ((PyArrayObject *)__pyx_v_weights), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1556,7 +1567,7 @@ static PyObject *__pyx_pf_5_util_apply_weights_2d(CYTHON_UNUSED PyObject *__pyx_ __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_B.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("_util.apply_weights_2d", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._util.apply_weights_2d", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; @@ -1568,7 +1579,7 @@ static PyObject *__pyx_pf_5_util_apply_weights_2d(CYTHON_UNUSED PyObject *__pyx_ return __pyx_r; } -/* "_util.pyx":22 +/* "sklearn/earth/_util.pyx":22 * B[i,j] *= sqrt(weights[i]) * * cpdef apply_weights_1d(cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] weights): # <<<<<<<<<<<<<< @@ -1576,20 +1587,20 @@ static PyObject *__pyx_pf_5_util_apply_weights_2d(CYTHON_UNUSED PyObject *__pyx_ * cdef INDEX_t m = y.shape[0] */ -static PyObject *__pyx_pw_5_util_3apply_weights_1d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_5_util_apply_weights_1d(PyArrayObject *__pyx_v_y, PyArrayObject *__pyx_v_weights, CYTHON_UNUSED int __pyx_skip_dispatch) { - __pyx_t_5_util_INDEX_t __pyx_v_i; - __pyx_t_5_util_INDEX_t __pyx_v_m; +static PyObject *__pyx_pw_7sklearn_5earth_5_util_3apply_weights_1d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_7sklearn_5earth_5_util_apply_weights_1d(PyArrayObject *__pyx_v_y, PyArrayObject *__pyx_v_weights, CYTHON_UNUSED int __pyx_skip_dispatch) { + __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_i; + __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_m; __Pyx_LocalBuf_ND __pyx_pybuffernd_weights; __Pyx_Buffer __pyx_pybuffer_weights; __Pyx_LocalBuf_ND __pyx_pybuffernd_y; __Pyx_Buffer __pyx_pybuffer_y; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations - __pyx_t_5_util_INDEX_t __pyx_t_1; - __pyx_t_5_util_INDEX_t __pyx_t_2; - __pyx_t_5_util_INDEX_t __pyx_t_3; - __pyx_t_5_util_INDEX_t __pyx_t_4; + __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_t_1; + __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_t_2; + __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_t_3; + __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_t_4; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -1604,16 +1615,16 @@ static PyObject *__pyx_f_5_util_apply_weights_1d(PyArrayObject *__pyx_v_y, PyArr __pyx_pybuffernd_weights.rcbuffer = &__pyx_pybuffer_weights; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_5_util_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_5_util_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_y.diminfo[0].strides = __pyx_pybuffernd_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y.diminfo[0].shape = __pyx_pybuffernd_y.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_5_util_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_5_util_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_weights.diminfo[0].strides = __pyx_pybuffernd_weights.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weights.diminfo[0].shape = __pyx_pybuffernd_weights.rcbuffer->pybuffer.shape[0]; - /* "_util.pyx":24 + /* "sklearn/earth/_util.pyx":24 * cpdef apply_weights_1d(cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] weights): * cdef INDEX_t i * cdef INDEX_t m = y.shape[0] # <<<<<<<<<<<<<< @@ -1622,7 +1633,7 @@ static PyObject *__pyx_f_5_util_apply_weights_1d(PyArrayObject *__pyx_v_y, PyArr */ __pyx_v_m = (__pyx_v_y->dimensions[0]); - /* "_util.pyx":25 + /* "sklearn/earth/_util.pyx":25 * cdef INDEX_t i * cdef INDEX_t m = y.shape[0] * for i in range(m): # <<<<<<<<<<<<<< @@ -1633,7 +1644,7 @@ static PyObject *__pyx_f_5_util_apply_weights_1d(PyArrayObject *__pyx_v_y, PyArr for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "_util.pyx":26 + /* "sklearn/earth/_util.pyx":26 * cdef INDEX_t m = y.shape[0] * for i in range(m): * y[i] *= sqrt(weights[i]) # <<<<<<<<<<<<<< @@ -1642,7 +1653,7 @@ static PyObject *__pyx_f_5_util_apply_weights_1d(PyArrayObject *__pyx_v_y, PyArr */ __pyx_t_3 = __pyx_v_i; __pyx_t_4 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(__pyx_t_5_util_FLOAT_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_y.diminfo[0].strides) *= sqrt((*__Pyx_BufPtrStrided1d(__pyx_t_5_util_FLOAT_t *, __pyx_pybuffernd_weights.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_weights.diminfo[0].strides))); + *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_5_util_FLOAT_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_y.diminfo[0].strides) *= sqrt((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_5_util_FLOAT_t *, __pyx_pybuffernd_weights.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_weights.diminfo[0].strides))); } __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -1653,7 +1664,7 @@ static PyObject *__pyx_f_5_util_apply_weights_1d(PyArrayObject *__pyx_v_y, PyArr __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("_util.apply_weights_1d", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._util.apply_weights_1d", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; goto __pyx_L2; __pyx_L0:; @@ -1666,8 +1677,8 @@ static PyObject *__pyx_f_5_util_apply_weights_1d(PyArrayObject *__pyx_v_y, PyArr } /* Python wrapper */ -static PyObject *__pyx_pw_5_util_3apply_weights_1d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_5_util_3apply_weights_1d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_7sklearn_5earth_5_util_3apply_weights_1d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_5_util_3apply_weights_1d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_y = 0; PyArrayObject *__pyx_v_weights = 0; int __pyx_lineno = 0; @@ -1715,13 +1726,13 @@ static PyObject *__pyx_pw_5_util_3apply_weights_1d(PyObject *__pyx_self, PyObjec __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("apply_weights_1d", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_util.apply_weights_1d", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._util.apply_weights_1d", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weights), __pyx_ptype_5numpy_ndarray, 1, "weights", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_5_util_2apply_weights_1d(__pyx_self, __pyx_v_y, __pyx_v_weights); + __pyx_r = __pyx_pf_7sklearn_5earth_5_util_2apply_weights_1d(__pyx_self, __pyx_v_y, __pyx_v_weights); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -1730,7 +1741,7 @@ static PyObject *__pyx_pw_5_util_3apply_weights_1d(PyObject *__pyx_self, PyObjec return __pyx_r; } -/* "_util.pyx":22 +/* "sklearn/earth/_util.pyx":22 * B[i,j] *= sqrt(weights[i]) * * cpdef apply_weights_1d(cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] weights): # <<<<<<<<<<<<<< @@ -1738,7 +1749,7 @@ static PyObject *__pyx_pw_5_util_3apply_weights_1d(PyObject *__pyx_self, PyObjec * cdef INDEX_t m = y.shape[0] */ -static PyObject *__pyx_pf_5_util_2apply_weights_1d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_y, PyArrayObject *__pyx_v_weights) { +static PyObject *__pyx_pf_7sklearn_5earth_5_util_2apply_weights_1d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_y, PyArrayObject *__pyx_v_weights) { __Pyx_LocalBuf_ND __pyx_pybuffernd_weights; __Pyx_Buffer __pyx_pybuffer_weights; __Pyx_LocalBuf_ND __pyx_pybuffernd_y; @@ -1760,16 +1771,16 @@ static PyObject *__pyx_pf_5_util_2apply_weights_1d(CYTHON_UNUSED PyObject *__pyx __pyx_pybuffernd_weights.rcbuffer = &__pyx_pybuffer_weights; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_5_util_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_5_util_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_y.diminfo[0].strides = __pyx_pybuffernd_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y.diminfo[0].shape = __pyx_pybuffernd_y.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_5_util_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_5_util_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_weights.diminfo[0].strides = __pyx_pybuffernd_weights.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weights.diminfo[0].shape = __pyx_pybuffernd_weights.rcbuffer->pybuffer.shape[0]; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_5_util_apply_weights_1d(((PyArrayObject *)__pyx_v_y), ((PyArrayObject *)__pyx_v_weights), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_f_7sklearn_5earth_5_util_apply_weights_1d(((PyArrayObject *)__pyx_v_y), ((PyArrayObject *)__pyx_v_weights), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1784,7 +1795,7 @@ static PyObject *__pyx_pf_5_util_2apply_weights_1d(CYTHON_UNUSED PyObject *__pyx __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} - __Pyx_AddTraceback("_util.apply_weights_1d", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._util.apply_weights_1d", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; goto __pyx_L2; __pyx_L0:; @@ -1796,7 +1807,7 @@ static PyObject *__pyx_pf_5_util_2apply_weights_1d(CYTHON_UNUSED PyObject *__pyx return __pyx_r; } -/* "_util.pyx":28 +/* "sklearn/earth/_util.pyx":28 * y[i] *= sqrt(weights[i]) * * cpdef FLOAT_t gcv(FLOAT_t mse, INDEX_t basis_size, INDEX_t data_size, FLOAT_t penalty): # <<<<<<<<<<<<<< @@ -1804,20 +1815,20 @@ static PyObject *__pyx_pf_5_util_2apply_weights_1d(CYTHON_UNUSED PyObject *__pyx * */ -static PyObject *__pyx_pw_5_util_5gcv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static __pyx_t_5_util_FLOAT_t __pyx_f_5_util_gcv(__pyx_t_5_util_FLOAT_t __pyx_v_mse, __pyx_t_5_util_INDEX_t __pyx_v_basis_size, __pyx_t_5_util_INDEX_t __pyx_v_data_size, __pyx_t_5_util_FLOAT_t __pyx_v_penalty, CYTHON_UNUSED int __pyx_skip_dispatch) { - __pyx_t_5_util_FLOAT_t __pyx_r; +static PyObject *__pyx_pw_7sklearn_5earth_5_util_5gcv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_f_7sklearn_5earth_5_util_gcv(__pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_v_mse, __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_basis_size, __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_data_size, __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_v_penalty, CYTHON_UNUSED int __pyx_skip_dispatch) { + __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gcv", 0); - /* "_util.pyx":29 + /* "sklearn/earth/_util.pyx":29 * * cpdef FLOAT_t gcv(FLOAT_t mse, INDEX_t basis_size, INDEX_t data_size, FLOAT_t penalty): * return mse * gcv_adjust(basis_size, data_size, penalty) # <<<<<<<<<<<<<< * * cpdef FLOAT_t gcv_adjust(INDEX_t basis_size, INDEX_t data_size, FLOAT_t penalty): */ - __pyx_r = (__pyx_v_mse * __pyx_f_5_util_gcv_adjust(__pyx_v_basis_size, __pyx_v_data_size, __pyx_v_penalty, 0)); + __pyx_r = (__pyx_v_mse * __pyx_f_7sklearn_5earth_5_util_gcv_adjust(__pyx_v_basis_size, __pyx_v_data_size, __pyx_v_penalty, 0)); goto __pyx_L0; __pyx_r = 0; @@ -1827,12 +1838,12 @@ static __pyx_t_5_util_FLOAT_t __pyx_f_5_util_gcv(__pyx_t_5_util_FLOAT_t __pyx_v_ } /* Python wrapper */ -static PyObject *__pyx_pw_5_util_5gcv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_5_util_5gcv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __pyx_t_5_util_FLOAT_t __pyx_v_mse; - __pyx_t_5_util_INDEX_t __pyx_v_basis_size; - __pyx_t_5_util_INDEX_t __pyx_v_data_size; - __pyx_t_5_util_FLOAT_t __pyx_v_penalty; +static PyObject *__pyx_pw_7sklearn_5earth_5_util_5gcv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_5_util_5gcv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_v_mse; + __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_basis_size; + __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_data_size; + __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_v_penalty; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -1894,16 +1905,16 @@ static PyObject *__pyx_pw_5_util_5gcv(PyObject *__pyx_self, PyObject *__pyx_args __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gcv", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_util.gcv", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._util.gcv", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5_util_4gcv(__pyx_self, __pyx_v_mse, __pyx_v_basis_size, __pyx_v_data_size, __pyx_v_penalty); + __pyx_r = __pyx_pf_7sklearn_5earth_5_util_4gcv(__pyx_self, __pyx_v_mse, __pyx_v_basis_size, __pyx_v_data_size, __pyx_v_penalty); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_util.pyx":28 +/* "sklearn/earth/_util.pyx":28 * y[i] *= sqrt(weights[i]) * * cpdef FLOAT_t gcv(FLOAT_t mse, INDEX_t basis_size, INDEX_t data_size, FLOAT_t penalty): # <<<<<<<<<<<<<< @@ -1911,7 +1922,7 @@ static PyObject *__pyx_pw_5_util_5gcv(PyObject *__pyx_self, PyObject *__pyx_args * */ -static PyObject *__pyx_pf_5_util_4gcv(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_5_util_FLOAT_t __pyx_v_mse, __pyx_t_5_util_INDEX_t __pyx_v_basis_size, __pyx_t_5_util_INDEX_t __pyx_v_data_size, __pyx_t_5_util_FLOAT_t __pyx_v_penalty) { +static PyObject *__pyx_pf_7sklearn_5earth_5_util_4gcv(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_v_mse, __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_basis_size, __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_data_size, __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_v_penalty) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -1920,7 +1931,7 @@ static PyObject *__pyx_pf_5_util_4gcv(CYTHON_UNUSED PyObject *__pyx_self, __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gcv", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(__pyx_f_5_util_gcv(__pyx_v_mse, __pyx_v_basis_size, __pyx_v_data_size, __pyx_v_penalty, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(__pyx_f_7sklearn_5earth_5_util_gcv(__pyx_v_mse, __pyx_v_basis_size, __pyx_v_data_size, __pyx_v_penalty, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1930,7 +1941,7 @@ static PyObject *__pyx_pf_5_util_4gcv(CYTHON_UNUSED PyObject *__pyx_self, __pyx_ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_util.gcv", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._util.gcv", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -1938,7 +1949,7 @@ static PyObject *__pyx_pf_5_util_4gcv(CYTHON_UNUSED PyObject *__pyx_self, __pyx_ return __pyx_r; } -/* "_util.pyx":31 +/* "sklearn/earth/_util.pyx":31 * return mse * gcv_adjust(basis_size, data_size, penalty) * * cpdef FLOAT_t gcv_adjust(INDEX_t basis_size, INDEX_t data_size, FLOAT_t penalty): # <<<<<<<<<<<<<< @@ -1946,13 +1957,13 @@ static PyObject *__pyx_pf_5_util_4gcv(CYTHON_UNUSED PyObject *__pyx_self, __pyx_ * */ -static PyObject *__pyx_pw_5_util_7gcv_adjust(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static __pyx_t_5_util_FLOAT_t __pyx_f_5_util_gcv_adjust(__pyx_t_5_util_INDEX_t __pyx_v_basis_size, __pyx_t_5_util_INDEX_t __pyx_v_data_size, __pyx_t_5_util_FLOAT_t __pyx_v_penalty, CYTHON_UNUSED int __pyx_skip_dispatch) { - __pyx_t_5_util_FLOAT_t __pyx_r; +static PyObject *__pyx_pw_7sklearn_5earth_5_util_7gcv_adjust(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_f_7sklearn_5earth_5_util_gcv_adjust(__pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_basis_size, __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_data_size, __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_v_penalty, CYTHON_UNUSED int __pyx_skip_dispatch) { + __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gcv_adjust", 0); - /* "_util.pyx":32 + /* "sklearn/earth/_util.pyx":32 * * cpdef FLOAT_t gcv_adjust(INDEX_t basis_size, INDEX_t data_size, FLOAT_t penalty): * return 1.0 / ((1 - ((basis_size + penalty*(basis_size - 1))/data_size)) ** 2) # <<<<<<<<<<<<<< @@ -1969,11 +1980,11 @@ static __pyx_t_5_util_FLOAT_t __pyx_f_5_util_gcv_adjust(__pyx_t_5_util_INDEX_t _ } /* Python wrapper */ -static PyObject *__pyx_pw_5_util_7gcv_adjust(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_5_util_7gcv_adjust(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { - __pyx_t_5_util_INDEX_t __pyx_v_basis_size; - __pyx_t_5_util_INDEX_t __pyx_v_data_size; - __pyx_t_5_util_FLOAT_t __pyx_v_penalty; +static PyObject *__pyx_pw_7sklearn_5earth_5_util_7gcv_adjust(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_5_util_7gcv_adjust(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_basis_size; + __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_data_size; + __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_v_penalty; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -2027,16 +2038,16 @@ static PyObject *__pyx_pw_5_util_7gcv_adjust(PyObject *__pyx_self, PyObject *__p __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("gcv_adjust", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_util.gcv_adjust", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._util.gcv_adjust", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5_util_6gcv_adjust(__pyx_self, __pyx_v_basis_size, __pyx_v_data_size, __pyx_v_penalty); + __pyx_r = __pyx_pf_7sklearn_5earth_5_util_6gcv_adjust(__pyx_self, __pyx_v_basis_size, __pyx_v_data_size, __pyx_v_penalty); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_util.pyx":31 +/* "sklearn/earth/_util.pyx":31 * return mse * gcv_adjust(basis_size, data_size, penalty) * * cpdef FLOAT_t gcv_adjust(INDEX_t basis_size, INDEX_t data_size, FLOAT_t penalty): # <<<<<<<<<<<<<< @@ -2044,7 +2055,7 @@ static PyObject *__pyx_pw_5_util_7gcv_adjust(PyObject *__pyx_self, PyObject *__p * */ -static PyObject *__pyx_pf_5_util_6gcv_adjust(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_5_util_INDEX_t __pyx_v_basis_size, __pyx_t_5_util_INDEX_t __pyx_v_data_size, __pyx_t_5_util_FLOAT_t __pyx_v_penalty) { +static PyObject *__pyx_pf_7sklearn_5earth_5_util_6gcv_adjust(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_basis_size, __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_data_size, __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_v_penalty) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -2053,7 +2064,7 @@ static PyObject *__pyx_pf_5_util_6gcv_adjust(CYTHON_UNUSED PyObject *__pyx_self, int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gcv_adjust", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(__pyx_f_5_util_gcv_adjust(__pyx_v_basis_size, __pyx_v_data_size, __pyx_v_penalty, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(__pyx_f_7sklearn_5earth_5_util_gcv_adjust(__pyx_v_basis_size, __pyx_v_data_size, __pyx_v_penalty, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2063,7 +2074,7 @@ static PyObject *__pyx_pf_5_util_6gcv_adjust(CYTHON_UNUSED PyObject *__pyx_self, goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_util.gcv_adjust", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._util.gcv_adjust", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2071,7 +2082,7 @@ static PyObject *__pyx_pf_5_util_6gcv_adjust(CYTHON_UNUSED PyObject *__pyx_self, return __pyx_r; } -/* "_util.pyx":34 +/* "sklearn/earth/_util.pyx":34 * return 1.0 / ((1 - ((basis_size + penalty*(basis_size - 1))/data_size)) ** 2) * * cpdef str_pad(string, length): # <<<<<<<<<<<<<< @@ -2079,8 +2090,8 @@ static PyObject *__pyx_pf_5_util_6gcv_adjust(CYTHON_UNUSED PyObject *__pyx_self, * return string[0:length] */ -static PyObject *__pyx_pw_5_util_9str_pad(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_5_util_str_pad(PyObject *__pyx_v_string, PyObject *__pyx_v_length, CYTHON_UNUSED int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_7sklearn_5earth_5_util_9str_pad(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_7sklearn_5earth_5_util_str_pad(PyObject *__pyx_v_string, PyObject *__pyx_v_length, CYTHON_UNUSED int __pyx_skip_dispatch) { PyObject *__pyx_v_pad = NULL; PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations @@ -2093,7 +2104,7 @@ static PyObject *__pyx_f_5_util_str_pad(PyObject *__pyx_v_string, PyObject *__py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("str_pad", 0); - /* "_util.pyx":35 + /* "sklearn/earth/_util.pyx":35 * * cpdef str_pad(string, length): * if len(string) >= length: # <<<<<<<<<<<<<< @@ -2109,7 +2120,7 @@ static PyObject *__pyx_f_5_util_str_pad(PyObject *__pyx_v_string, PyObject *__py __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_4) { - /* "_util.pyx":36 + /* "sklearn/earth/_util.pyx":36 * cpdef str_pad(string, length): * if len(string) >= length: * return string[0:length] # <<<<<<<<<<<<<< @@ -2126,7 +2137,7 @@ static PyObject *__pyx_f_5_util_str_pad(PyObject *__pyx_v_string, PyObject *__py } __pyx_L3:; - /* "_util.pyx":37 + /* "sklearn/earth/_util.pyx":37 * if len(string) >= length: * return string[0:length] * pad = length - len(string) # <<<<<<<<<<<<<< @@ -2142,7 +2153,7 @@ static PyObject *__pyx_f_5_util_str_pad(PyObject *__pyx_v_string, PyObject *__py __pyx_v_pad = __pyx_t_2; __pyx_t_2 = 0; - /* "_util.pyx":38 + /* "sklearn/earth/_util.pyx":38 * return string[0:length] * pad = length - len(string) * return string + ' '*pad # <<<<<<<<<<<<<< @@ -2164,7 +2175,7 @@ static PyObject *__pyx_f_5_util_str_pad(PyObject *__pyx_v_string, PyObject *__py __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_AddTraceback("_util.str_pad", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._util.str_pad", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_pad); @@ -2174,8 +2185,8 @@ static PyObject *__pyx_f_5_util_str_pad(PyObject *__pyx_v_string, PyObject *__py } /* Python wrapper */ -static PyObject *__pyx_pw_5_util_9str_pad(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_5_util_9str_pad(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_7sklearn_5earth_5_util_9str_pad(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_5_util_9str_pad(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_string = 0; PyObject *__pyx_v_length = 0; int __pyx_lineno = 0; @@ -2223,16 +2234,16 @@ static PyObject *__pyx_pw_5_util_9str_pad(PyObject *__pyx_self, PyObject *__pyx_ __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("str_pad", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_util.str_pad", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._util.str_pad", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5_util_8str_pad(__pyx_self, __pyx_v_string, __pyx_v_length); + __pyx_r = __pyx_pf_7sklearn_5earth_5_util_8str_pad(__pyx_self, __pyx_v_string, __pyx_v_length); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_util.pyx":34 +/* "sklearn/earth/_util.pyx":34 * return 1.0 / ((1 - ((basis_size + penalty*(basis_size - 1))/data_size)) ** 2) * * cpdef str_pad(string, length): # <<<<<<<<<<<<<< @@ -2240,7 +2251,7 @@ static PyObject *__pyx_pw_5_util_9str_pad(PyObject *__pyx_self, PyObject *__pyx_ * return string[0:length] */ -static PyObject *__pyx_pf_5_util_8str_pad(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_string, PyObject *__pyx_v_length) { +static PyObject *__pyx_pf_7sklearn_5earth_5_util_8str_pad(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_string, PyObject *__pyx_v_length) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -2249,7 +2260,7 @@ static PyObject *__pyx_pf_5_util_8str_pad(CYTHON_UNUSED PyObject *__pyx_self, Py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("str_pad", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_5_util_str_pad(__pyx_v_string, __pyx_v_length, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_f_7sklearn_5earth_5_util_str_pad(__pyx_v_string, __pyx_v_length, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2259,7 +2270,7 @@ static PyObject *__pyx_pf_5_util_8str_pad(CYTHON_UNUSED PyObject *__pyx_self, Py goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_util.str_pad", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._util.str_pad", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -2267,7 +2278,7 @@ static PyObject *__pyx_pf_5_util_8str_pad(CYTHON_UNUSED PyObject *__pyx_self, Py return __pyx_r; } -/* "_util.pyx":40 +/* "sklearn/earth/_util.pyx":40 * return string + ' '*pad * * cpdef ascii_table(header, data): # <<<<<<<<<<<<<< @@ -2275,8 +2286,8 @@ static PyObject *__pyx_pf_5_util_8str_pad(CYTHON_UNUSED PyObject *__pyx_self, Py * header - list of strings representing the header row */ -static PyObject *__pyx_pw_5_util_11ascii_table(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_f_5_util_ascii_table(PyObject *__pyx_v_header, PyObject *__pyx_v_data, CYTHON_UNUSED int __pyx_skip_dispatch) { +static PyObject *__pyx_pw_7sklearn_5earth_5_util_11ascii_table(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_7sklearn_5earth_5_util_ascii_table(PyObject *__pyx_v_header, PyObject *__pyx_v_data, CYTHON_UNUSED int __pyx_skip_dispatch) { CYTHON_UNUSED PyObject *__pyx_v_m = NULL; PyObject *__pyx_v_n = NULL; PyObject *__pyx_v_column_widths = NULL; @@ -2308,7 +2319,7 @@ static PyObject *__pyx_f_5_util_ascii_table(PyObject *__pyx_v_header, PyObject * int __pyx_clineno = 0; __Pyx_RefNannySetupContext("ascii_table", 0); - /* "_util.pyx":45 + /* "sklearn/earth/_util.pyx":45 * data - list of lists of strings representing data rows * ''' * m = len(data) # <<<<<<<<<<<<<< @@ -2321,7 +2332,7 @@ static PyObject *__pyx_f_5_util_ascii_table(PyObject *__pyx_v_header, PyObject * __pyx_v_m = __pyx_t_2; __pyx_t_2 = 0; - /* "_util.pyx":46 + /* "sklearn/earth/_util.pyx":46 * ''' * m = len(data) * n = len(header) # <<<<<<<<<<<<<< @@ -2334,7 +2345,7 @@ static PyObject *__pyx_f_5_util_ascii_table(PyObject *__pyx_v_header, PyObject * __pyx_v_n = __pyx_t_2; __pyx_t_2 = 0; - /* "_util.pyx":47 + /* "sklearn/earth/_util.pyx":47 * m = len(data) * n = len(header) * column_widths = [len(head) for head in header] # <<<<<<<<<<<<<< @@ -2390,7 +2401,7 @@ static PyObject *__pyx_f_5_util_ascii_table(PyObject *__pyx_v_header, PyObject * __pyx_v_column_widths = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "_util.pyx":48 + /* "sklearn/earth/_util.pyx":48 * n = len(header) * column_widths = [len(head) for head in header] * for i, row in enumerate(data): # <<<<<<<<<<<<<< @@ -2445,7 +2456,7 @@ static PyObject *__pyx_f_5_util_ascii_table(PyObject *__pyx_v_header, PyObject * __pyx_t_2 = __pyx_t_5; __pyx_t_5 = 0; - /* "_util.pyx":49 + /* "sklearn/earth/_util.pyx":49 * column_widths = [len(head) for head in header] * for i, row in enumerate(data): * for j, col in enumerate(row): # <<<<<<<<<<<<<< @@ -2500,7 +2511,7 @@ static PyObject *__pyx_f_5_util_ascii_table(PyObject *__pyx_v_header, PyObject * __pyx_t_5 = __pyx_t_9; __pyx_t_9 = 0; - /* "_util.pyx":50 + /* "sklearn/earth/_util.pyx":50 * for i, row in enumerate(data): * for j, col in enumerate(row): * if len(col) > column_widths[j]: # <<<<<<<<<<<<<< @@ -2519,7 +2530,7 @@ static PyObject *__pyx_f_5_util_ascii_table(PyObject *__pyx_v_header, PyObject * __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; if (__pyx_t_13) { - /* "_util.pyx":51 + /* "sklearn/earth/_util.pyx":51 * for j, col in enumerate(row): * if len(col) > column_widths[j]: * column_widths[j] = len(col) # <<<<<<<<<<<<<< @@ -2541,7 +2552,7 @@ static PyObject *__pyx_f_5_util_ascii_table(PyObject *__pyx_v_header, PyObject * __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "_util.pyx":53 + /* "sklearn/earth/_util.pyx":53 * column_widths[j] = len(col) * * for j in range(n): # <<<<<<<<<<<<<< @@ -2595,7 +2606,7 @@ static PyObject *__pyx_f_5_util_ascii_table(PyObject *__pyx_v_header, PyObject * __pyx_v_j = __pyx_t_3; __pyx_t_3 = 0; - /* "_util.pyx":54 + /* "sklearn/earth/_util.pyx":54 * * for j in range(n): * column_widths[j] += 1 # <<<<<<<<<<<<<< @@ -2615,7 +2626,7 @@ static PyObject *__pyx_f_5_util_ascii_table(PyObject *__pyx_v_header, PyObject * } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "_util.pyx":56 + /* "sklearn/earth/_util.pyx":56 * column_widths[j] += 1 * * result = '' # <<<<<<<<<<<<<< @@ -2625,7 +2636,7 @@ static PyObject *__pyx_f_5_util_ascii_table(PyObject *__pyx_v_header, PyObject * __Pyx_INCREF(((PyObject *)__pyx_kp_s_2)); __pyx_v_result = ((PyObject *)__pyx_kp_s_2); - /* "_util.pyx":57 + /* "sklearn/earth/_util.pyx":57 * * result = '' * for j, col_width in enumerate(column_widths): # <<<<<<<<<<<<<< @@ -2654,7 +2665,7 @@ static PyObject *__pyx_f_5_util_ascii_table(PyObject *__pyx_v_header, PyObject * __pyx_t_2 = __pyx_t_7; __pyx_t_7 = 0; - /* "_util.pyx":58 + /* "sklearn/earth/_util.pyx":58 * result = '' * for j, col_width in enumerate(column_widths): * result += '-'*col_width + '-' # <<<<<<<<<<<<<< @@ -2676,7 +2687,7 @@ static PyObject *__pyx_f_5_util_ascii_table(PyObject *__pyx_v_header, PyObject * __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "_util.pyx":59 + /* "sklearn/earth/_util.pyx":59 * for j, col_width in enumerate(column_widths): * result += '-'*col_width + '-' * result += '\n' # <<<<<<<<<<<<<< @@ -2689,7 +2700,7 @@ static PyObject *__pyx_f_5_util_ascii_table(PyObject *__pyx_v_header, PyObject * __pyx_v_result = __pyx_t_2; __pyx_t_2 = 0; - /* "_util.pyx":60 + /* "sklearn/earth/_util.pyx":60 * result += '-'*col_width + '-' * result += '\n' * for j, head in enumerate(header): # <<<<<<<<<<<<<< @@ -2744,7 +2755,7 @@ static PyObject *__pyx_f_5_util_ascii_table(PyObject *__pyx_v_header, PyObject * __pyx_t_2 = __pyx_t_7; __pyx_t_7 = 0; - /* "_util.pyx":61 + /* "sklearn/earth/_util.pyx":61 * result += '\n' * for j, head in enumerate(header): * result += str_pad(head,column_widths[j]) + ' ' # <<<<<<<<<<<<<< @@ -2753,7 +2764,7 @@ static PyObject *__pyx_f_5_util_ascii_table(PyObject *__pyx_v_header, PyObject * */ __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_column_widths), __pyx_v_j); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_5 = __pyx_f_5_util_str_pad(__pyx_v_head, __pyx_t_7, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_f_7sklearn_5earth_5_util_str_pad(__pyx_v_head, __pyx_t_7, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __pyx_t_7 = PyNumber_Add(__pyx_t_5, ((PyObject *)__pyx_kp_s_1)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -2769,7 +2780,7 @@ static PyObject *__pyx_f_5_util_ascii_table(PyObject *__pyx_v_header, PyObject * __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "_util.pyx":62 + /* "sklearn/earth/_util.pyx":62 * for j, head in enumerate(header): * result += str_pad(head,column_widths[j]) + ' ' * result += '\n' # <<<<<<<<<<<<<< @@ -2782,7 +2793,7 @@ static PyObject *__pyx_f_5_util_ascii_table(PyObject *__pyx_v_header, PyObject * __pyx_v_result = __pyx_t_2; __pyx_t_2 = 0; - /* "_util.pyx":63 + /* "sklearn/earth/_util.pyx":63 * result += str_pad(head,column_widths[j]) + ' ' * result += '\n' * for j, col_width in enumerate(column_widths): # <<<<<<<<<<<<<< @@ -2811,7 +2822,7 @@ static PyObject *__pyx_f_5_util_ascii_table(PyObject *__pyx_v_header, PyObject * __pyx_t_2 = __pyx_t_5; __pyx_t_5 = 0; - /* "_util.pyx":64 + /* "sklearn/earth/_util.pyx":64 * result += '\n' * for j, col_width in enumerate(column_widths): * result += '-'*col_width + '-' # <<<<<<<<<<<<<< @@ -2833,7 +2844,7 @@ static PyObject *__pyx_f_5_util_ascii_table(PyObject *__pyx_v_header, PyObject * __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "_util.pyx":65 + /* "sklearn/earth/_util.pyx":65 * for j, col_width in enumerate(column_widths): * result += '-'*col_width + '-' * for i, row in enumerate(data): # <<<<<<<<<<<<<< @@ -2888,7 +2899,7 @@ static PyObject *__pyx_f_5_util_ascii_table(PyObject *__pyx_v_header, PyObject * __pyx_t_2 = __pyx_t_5; __pyx_t_5 = 0; - /* "_util.pyx":66 + /* "sklearn/earth/_util.pyx":66 * result += '-'*col_width + '-' * for i, row in enumerate(data): * result += '\n' # <<<<<<<<<<<<<< @@ -2901,7 +2912,7 @@ static PyObject *__pyx_f_5_util_ascii_table(PyObject *__pyx_v_header, PyObject * __pyx_v_result = __pyx_t_5; __pyx_t_5 = 0; - /* "_util.pyx":67 + /* "sklearn/earth/_util.pyx":67 * for i, row in enumerate(data): * result += '\n' * for j, item in enumerate(row): # <<<<<<<<<<<<<< @@ -2956,7 +2967,7 @@ static PyObject *__pyx_f_5_util_ascii_table(PyObject *__pyx_v_header, PyObject * __pyx_t_5 = __pyx_t_12; __pyx_t_12 = 0; - /* "_util.pyx":68 + /* "sklearn/earth/_util.pyx":68 * result += '\n' * for j, item in enumerate(row): * result += str_pad(item,column_widths[j]) + ' ' # <<<<<<<<<<<<<< @@ -2965,7 +2976,7 @@ static PyObject *__pyx_f_5_util_ascii_table(PyObject *__pyx_v_header, PyObject * */ __pyx_t_12 = PyObject_GetItem(((PyObject *)__pyx_v_column_widths), __pyx_v_j); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - __pyx_t_11 = __pyx_f_5_util_str_pad(__pyx_v_item, __pyx_t_12, 0); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __pyx_f_7sklearn_5earth_5_util_str_pad(__pyx_v_item, __pyx_t_12, 0); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_12 = PyNumber_Add(__pyx_t_11, ((PyObject *)__pyx_kp_s_1)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -2984,7 +2995,7 @@ static PyObject *__pyx_f_5_util_ascii_table(PyObject *__pyx_v_header, PyObject * __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "_util.pyx":69 + /* "sklearn/earth/_util.pyx":69 * for j, item in enumerate(row): * result += str_pad(item,column_widths[j]) + ' ' * result += '\n' # <<<<<<<<<<<<<< @@ -2997,7 +3008,7 @@ static PyObject *__pyx_f_5_util_ascii_table(PyObject *__pyx_v_header, PyObject * __pyx_v_result = __pyx_t_2; __pyx_t_2 = 0; - /* "_util.pyx":70 + /* "sklearn/earth/_util.pyx":70 * result += str_pad(item,column_widths[j]) + ' ' * result += '\n' * for j, col_width in enumerate(column_widths): # <<<<<<<<<<<<<< @@ -3026,7 +3037,7 @@ static PyObject *__pyx_f_5_util_ascii_table(PyObject *__pyx_v_header, PyObject * __pyx_t_2 = __pyx_t_5; __pyx_t_5 = 0; - /* "_util.pyx":71 + /* "sklearn/earth/_util.pyx":71 * result += '\n' * for j, col_width in enumerate(column_widths): * result += '-'*col_width + '-' # <<<<<<<<<<<<<< @@ -3048,7 +3059,7 @@ static PyObject *__pyx_f_5_util_ascii_table(PyObject *__pyx_v_header, PyObject * __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "_util.pyx":72 + /* "sklearn/earth/_util.pyx":72 * for j, col_width in enumerate(column_widths): * result += '-'*col_width + '-' * return result # <<<<<<<<<<<<<< @@ -3070,7 +3081,7 @@ static PyObject *__pyx_f_5_util_ascii_table(PyObject *__pyx_v_header, PyObject * __Pyx_XDECREF(__pyx_t_9); __Pyx_XDECREF(__pyx_t_11); __Pyx_XDECREF(__pyx_t_12); - __Pyx_AddTraceback("_util.ascii_table", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._util.ascii_table", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_m); @@ -3090,9 +3101,9 @@ static PyObject *__pyx_f_5_util_ascii_table(PyObject *__pyx_v_header, PyObject * } /* Python wrapper */ -static PyObject *__pyx_pw_5_util_11ascii_table(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_5_util_10ascii_table[] = "\n header - list of strings representing the header row\n data - list of lists of strings representing data rows\n "; -static PyObject *__pyx_pw_5_util_11ascii_table(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_7sklearn_5earth_5_util_11ascii_table(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7sklearn_5earth_5_util_10ascii_table[] = "\n header - list of strings representing the header row\n data - list of lists of strings representing data rows\n "; +static PyObject *__pyx_pw_7sklearn_5earth_5_util_11ascii_table(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_header = 0; PyObject *__pyx_v_data = 0; int __pyx_lineno = 0; @@ -3140,16 +3151,16 @@ static PyObject *__pyx_pw_5_util_11ascii_table(PyObject *__pyx_self, PyObject *_ __pyx_L5_argtuple_error:; __Pyx_RaiseArgtupleInvalid("ascii_table", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; - __Pyx_AddTraceback("_util.ascii_table", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._util.ascii_table", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_5_util_10ascii_table(__pyx_self, __pyx_v_header, __pyx_v_data); + __pyx_r = __pyx_pf_7sklearn_5earth_5_util_10ascii_table(__pyx_self, __pyx_v_header, __pyx_v_data); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "_util.pyx":40 +/* "sklearn/earth/_util.pyx":40 * return string + ' '*pad * * cpdef ascii_table(header, data): # <<<<<<<<<<<<<< @@ -3157,7 +3168,7 @@ static PyObject *__pyx_pw_5_util_11ascii_table(PyObject *__pyx_self, PyObject *_ * header - list of strings representing the header row */ -static PyObject *__pyx_pf_5_util_10ascii_table(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_header, PyObject *__pyx_v_data) { +static PyObject *__pyx_pf_7sklearn_5earth_5_util_10ascii_table(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_header, PyObject *__pyx_v_data) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3166,7 +3177,7 @@ static PyObject *__pyx_pf_5_util_10ascii_table(CYTHON_UNUSED PyObject *__pyx_sel int __pyx_clineno = 0; __Pyx_RefNannySetupContext("ascii_table", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_5_util_ascii_table(__pyx_v_header, __pyx_v_data, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_f_7sklearn_5earth_5_util_ascii_table(__pyx_v_header, __pyx_v_data, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3176,7 +3187,7 @@ static PyObject *__pyx_pf_5_util_10ascii_table(CYTHON_UNUSED PyObject *__pyx_sel goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_AddTraceback("_util.ascii_table", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("sklearn.earth._util.ascii_table", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); @@ -3241,7 +3252,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * * cdef int copy_shape, i, ndim */ - __pyx_t_1 = (__pyx_v_info == NULL); + __pyx_t_1 = ((__pyx_v_info == NULL) != 0); if (__pyx_t_1) { __pyx_r = 0; goto __pyx_L0; @@ -3283,7 +3294,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * copy_shape = 1 * else: */ - __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); if (__pyx_t_1) { /* "numpy.pxd":209 @@ -3316,7 +3327,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); + __pyx_t_1 = (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS) != 0); if (__pyx_t_1) { /* "numpy.pxd":214 @@ -3326,7 +3337,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * raise ValueError(u"ndarray is not C contiguous") * */ - __pyx_t_2 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS)); + __pyx_t_2 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_C_CONTIGUOUS) != 0)) != 0); __pyx_t_3 = __pyx_t_2; } else { __pyx_t_3 = __pyx_t_1; @@ -3356,7 +3367,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") */ - __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); + __pyx_t_3 = (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS) != 0); if (__pyx_t_3) { /* "numpy.pxd":218 @@ -3366,7 +3377,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * raise ValueError(u"ndarray is not Fortran contiguous") * */ - __pyx_t_1 = (!PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS)); + __pyx_t_1 = ((!(PyArray_CHKFLAGS(__pyx_v_self, NPY_F_CONTIGUOUS) != 0)) != 0); __pyx_t_2 = __pyx_t_1; } else { __pyx_t_2 = __pyx_t_3; @@ -3414,7 +3425,8 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * # Allocate new buffer for strides and shape info. * # This is allocated as one block, strides first. */ - if (__pyx_v_copy_shape) { + __pyx_t_2 = (__pyx_v_copy_shape != 0); + if (__pyx_t_2) { /* "numpy.pxd":226 * # Allocate new buffer for strides and shape info. @@ -3512,7 +3524,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * * cdef int t */ - __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(__pyx_v_self)); + __pyx_v_info->readonly = (!(PyArray_ISWRITEABLE(__pyx_v_self) != 0)); /* "numpy.pxd":239 * @@ -3551,9 +3563,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * # do not call releasebuffer * info.obj = None */ - __pyx_t_2 = (!__pyx_v_hasfields); + __pyx_t_2 = ((!(__pyx_v_hasfields != 0)) != 0); if (__pyx_t_2) { - __pyx_t_3 = (!__pyx_v_copy_shape); + __pyx_t_3 = ((!(__pyx_v_copy_shape != 0)) != 0); __pyx_t_1 = __pyx_t_3; } else { __pyx_t_1 = __pyx_t_2; @@ -3598,7 +3610,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * t = descr.type_num * if ((descr.byteorder == c'>' and little_endian) or */ - __pyx_t_1 = (!__pyx_v_hasfields); + __pyx_t_1 = ((!(__pyx_v_hasfields != 0)) != 0); if (__pyx_t_1) { /* "numpy.pxd":254 @@ -3618,9 +3630,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * (descr.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ - __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); + __pyx_t_1 = ((__pyx_v_descr->byteorder == '>') != 0); if (__pyx_t_1) { - __pyx_t_2 = __pyx_v_little_endian; + __pyx_t_2 = (__pyx_v_little_endian != 0); } else { __pyx_t_2 = __pyx_t_1; } @@ -3633,9 +3645,9 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" */ - __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); + __pyx_t_1 = ((__pyx_v_descr->byteorder == '<') != 0); if (__pyx_t_1) { - __pyx_t_3 = (!__pyx_v_little_endian); + __pyx_t_3 = ((!(__pyx_v_little_endian != 0)) != 0); __pyx_t_7 = __pyx_t_3; } else { __pyx_t_7 = __pyx_t_1; @@ -4007,7 +4019,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_t_1 = PyArray_HASFIELDS(__pyx_v_self); + __pyx_t_1 = (PyArray_HASFIELDS(__pyx_v_self) != 0); if (__pyx_t_1) { /* "numpy.pxd":290 @@ -4029,7 +4041,7 @@ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_s * stdlib.free(info.strides) * # info.shape was stored after info.strides in the same block */ - __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + __pyx_t_1 = (((sizeof(npy_intp)) != (sizeof(Py_ssize_t))) != 0); if (__pyx_t_1) { /* "numpy.pxd":292 @@ -4460,9 +4472,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * (child.byteorder == c'<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ - __pyx_t_7 = (__pyx_v_child->byteorder == '>'); + __pyx_t_7 = ((__pyx_v_child->byteorder == '>') != 0); if (__pyx_t_7) { - __pyx_t_8 = __pyx_v_little_endian; + __pyx_t_8 = (__pyx_v_little_endian != 0); } else { __pyx_t_8 = __pyx_t_7; } @@ -4475,9 +4487,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ - __pyx_t_7 = (__pyx_v_child->byteorder == '<'); + __pyx_t_7 = ((__pyx_v_child->byteorder == '<') != 0); if (__pyx_t_7) { - __pyx_t_9 = (!__pyx_v_little_endian); + __pyx_t_9 = ((!(__pyx_v_little_endian != 0)) != 0); __pyx_t_10 = __pyx_t_9; } else { __pyx_t_10 = __pyx_t_7; @@ -4566,7 +4578,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * t = child.type_num * if end - f < 5: */ - __pyx_t_7 = (!PyDataType_HASFIELDS(__pyx_v_child)); + __pyx_t_7 = ((!(PyDataType_HASFIELDS(__pyx_v_child) != 0)) != 0); if (__pyx_t_7) { /* "numpy.pxd":821 @@ -4589,7 +4601,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * raise RuntimeError(u"Format string allocated too short.") * */ - __pyx_t_7 = ((__pyx_v_end - __pyx_v_f) < 5); + __pyx_t_7 = (((__pyx_v_end - __pyx_v_f) < 5) != 0); if (__pyx_t_7) { /* "numpy.pxd":823 @@ -5011,6 +5023,7 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a PyObject *__pyx_v_baseptr; __Pyx_RefNannyDeclarations int __pyx_t_1; + int __pyx_t_2; __Pyx_RefNannySetupContext("set_array_base", 0); /* "numpy.pxd":967 @@ -5021,7 +5034,8 @@ static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_a * else: */ __pyx_t_1 = (__pyx_v_base == Py_None); - if (__pyx_t_1) { + __pyx_t_2 = (__pyx_t_1 != 0); + if (__pyx_t_2) { /* "numpy.pxd":968 * cdef PyObject* baseptr @@ -5097,7 +5111,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py * return None * else: */ - __pyx_t_1 = (__pyx_v_arr->base == NULL); + __pyx_t_1 = ((__pyx_v_arr->base == NULL) != 0); if (__pyx_t_1) { /* "numpy.pxd":977 @@ -5135,12 +5149,12 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py } static PyMethodDef __pyx_methods[] = { - {__Pyx_NAMESTR("apply_weights_2d"), (PyCFunction)__pyx_pw_5_util_1apply_weights_2d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("apply_weights_1d"), (PyCFunction)__pyx_pw_5_util_3apply_weights_1d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("gcv"), (PyCFunction)__pyx_pw_5_util_5gcv, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("gcv_adjust"), (PyCFunction)__pyx_pw_5_util_7gcv_adjust, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("str_pad"), (PyCFunction)__pyx_pw_5_util_9str_pad, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("ascii_table"), (PyCFunction)__pyx_pw_5_util_11ascii_table, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5_util_10ascii_table)}, + {__Pyx_NAMESTR("apply_weights_2d"), (PyCFunction)__pyx_pw_7sklearn_5earth_5_util_1apply_weights_2d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("apply_weights_1d"), (PyCFunction)__pyx_pw_7sklearn_5earth_5_util_3apply_weights_1d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("gcv"), (PyCFunction)__pyx_pw_7sklearn_5earth_5_util_5gcv, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("gcv_adjust"), (PyCFunction)__pyx_pw_7sklearn_5earth_5_util_7gcv_adjust, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("str_pad"), (PyCFunction)__pyx_pw_7sklearn_5earth_5_util_9str_pad, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("ascii_table"), (PyCFunction)__pyx_pw_7sklearn_5earth_5_util_11ascii_table, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7sklearn_5earth_5_util_10ascii_table)}, {0, 0, 0, 0} }; @@ -5347,8 +5361,8 @@ PyMODINIT_FUNC PyInit__util(void) #if PY_MAJOR_VERSION >= 3 { PyObject *modules = PyImport_GetModuleDict(); if (unlikely(!modules)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (!PyDict_GetItemString(modules, "_util")) { - if (unlikely(PyDict_SetItemString(modules, "_util", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!PyDict_GetItemString(modules, "sklearn.earth._util")) { + if (unlikely(PyDict_SetItemString(modules, "sklearn.earth._util", __pyx_m) < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } } #endif @@ -5362,7 +5376,7 @@ PyMODINIT_FUNC PyInit__util(void) #if PY_MAJOR_VERSION < 3 && (__PYX_DEFAULT_STRING_ENCODING_IS_ASCII || __PYX_DEFAULT_STRING_ENCODING_IS_DEFAULT) if (__Pyx_init_sys_getdefaultencoding_params() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif - if (__pyx_module_is_main__util) { + if (__pyx_module_is_main_sklearn__earth___util) { if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; } /*--- Builtin init code ---*/ @@ -5372,13 +5386,13 @@ PyMODINIT_FUNC PyInit__util(void) /*--- Global init code ---*/ /*--- Variable export code ---*/ /*--- Function export code ---*/ - if (__Pyx_ExportFunction("log2", (void (*)(void))__pyx_f_5_util_log2, "__pyx_t_5_util_FLOAT_t (__pyx_t_5_util_FLOAT_t)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_ExportFunction("apply_weights_2d", (void (*)(void))__pyx_f_5_util_apply_weights_2d, "PyObject *(PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_ExportFunction("apply_weights_1d", (void (*)(void))__pyx_f_5_util_apply_weights_1d, "PyObject *(PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_ExportFunction("gcv", (void (*)(void))__pyx_f_5_util_gcv, "__pyx_t_5_util_FLOAT_t (__pyx_t_5_util_FLOAT_t, __pyx_t_5_util_INDEX_t, __pyx_t_5_util_INDEX_t, __pyx_t_5_util_FLOAT_t, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_ExportFunction("gcv_adjust", (void (*)(void))__pyx_f_5_util_gcv_adjust, "__pyx_t_5_util_FLOAT_t (__pyx_t_5_util_INDEX_t, __pyx_t_5_util_INDEX_t, __pyx_t_5_util_FLOAT_t, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_ExportFunction("str_pad", (void (*)(void))__pyx_f_5_util_str_pad, "PyObject *(PyObject *, PyObject *, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_ExportFunction("ascii_table", (void (*)(void))__pyx_f_5_util_ascii_table, "PyObject *(PyObject *, PyObject *, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("log2", (void (*)(void))__pyx_f_7sklearn_5earth_5_util_log2, "__pyx_t_7sklearn_5earth_5_util_FLOAT_t (__pyx_t_7sklearn_5earth_5_util_FLOAT_t)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("apply_weights_2d", (void (*)(void))__pyx_f_7sklearn_5earth_5_util_apply_weights_2d, "PyObject *(PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("apply_weights_1d", (void (*)(void))__pyx_f_7sklearn_5earth_5_util_apply_weights_1d, "PyObject *(PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("gcv", (void (*)(void))__pyx_f_7sklearn_5earth_5_util_gcv, "__pyx_t_7sklearn_5earth_5_util_FLOAT_t (__pyx_t_7sklearn_5earth_5_util_FLOAT_t, __pyx_t_7sklearn_5earth_5_util_INDEX_t, __pyx_t_7sklearn_5earth_5_util_INDEX_t, __pyx_t_7sklearn_5earth_5_util_FLOAT_t, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("gcv_adjust", (void (*)(void))__pyx_f_7sklearn_5earth_5_util_gcv_adjust, "__pyx_t_7sklearn_5earth_5_util_FLOAT_t (__pyx_t_7sklearn_5earth_5_util_INDEX_t, __pyx_t_7sklearn_5earth_5_util_INDEX_t, __pyx_t_7sklearn_5earth_5_util_FLOAT_t, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("str_pad", (void (*)(void))__pyx_f_7sklearn_5earth_5_util_str_pad, "PyObject *(PyObject *, PyObject *, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("ascii_table", (void (*)(void))__pyx_f_7sklearn_5earth_5_util_ascii_table, "PyObject *(PyObject *, PyObject *, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Type init code ---*/ /*--- Type import code ---*/ __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", @@ -5397,7 +5411,7 @@ PyMODINIT_FUNC PyInit__util(void) /*--- Function import code ---*/ /*--- Execution code ---*/ - /* "_util.pyx":7 + /* "sklearn/earth/_util.pyx":7 * # cython: profile = False * * import numpy as np # <<<<<<<<<<<<<< @@ -5409,7 +5423,7 @@ PyMODINIT_FUNC PyInit__util(void) if (PyDict_SetItem(__pyx_d, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "_util.pyx":1 + /* "sklearn/earth/_util.pyx":1 * # distutils: language = c # <<<<<<<<<<<<<< * # cython: cdivision = True * # cython: boundscheck = False @@ -5430,10 +5444,10 @@ PyMODINIT_FUNC PyInit__util(void) __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); if (__pyx_m) { - __Pyx_AddTraceback("init _util", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_AddTraceback("init sklearn.earth._util", __pyx_clineno, __pyx_lineno, __pyx_filename); Py_DECREF(__pyx_m); __pyx_m = 0; } else if (!PyErr_Occurred()) { - PyErr_SetString(PyExc_ImportError, "init _util"); + PyErr_SetString(PyExc_ImportError, "init sklearn.earth._util"); } __pyx_L0:; __Pyx_RefNannyFinishContext(); diff --git a/sklearn/earth/earth.py b/sklearn/earth/earth.py index 0b25dd72c87db..751fe2f3ed3e2 100644 --- a/sklearn/earth/earth.py +++ b/sklearn/earth/earth.py @@ -102,18 +102,6 @@ class Earth(BaseEstimator, RegressorMixin, TransformerMixin): calculated based on min_search_points (above). - linvars : iterable of strings or ints, optional (empty by default) - Used to specify features that may only enter terms as linear basis functions (without - knots). Can include both column numbers an column names (see xlabels, below). - - - xlabels : iterable of strings, optional (empty by default) - The xlabels argument can be used to assign names to data columns. This argument is not - generally needed, as names can be captured automatically from most standard data - structures. If included, must have length n, where n is the number of features. Note - that column order is used to compute term values and make predictions, not column names. - - Attributes ---------- `coef_` : array, shape = [pruned basis length] @@ -143,11 +131,11 @@ class Earth(BaseEstimator, RegressorMixin, TransformerMixin): forward_pass_arg_names = set(['endspan','minspan','endspan_alpha','minspan_alpha', 'max_terms','max_degree','thresh','penalty','check_every', - 'min_searh_points','xlabels_','linvars']) + 'min_searh_points']) pruning_pass_arg_names = set(['penalty']) def __init__(self, endspan=None, minspan=None, endspan_alpha=None, minspan_alpha=None, max_terms=None, max_degree=None, - thresh=None, penalty=None, check_every=None, min_search_points=None, xlabels=None, linvars=None): + thresh=None, penalty=None, check_every=None, min_search_points=None): kwargs = {} call = locals() for name in self._get_param_names(): @@ -206,39 +194,37 @@ def _pull_unknown_args(self, **kwargs): result[name] = kwargs[name] return result - def _scrub_x(self, X, **kwargs): + def _scrape_labels(self, X): ''' - Sanitize input predictors and extract column names if appropriate. + Try to get labels from input data (for example, if X is a pandas DataFrame). Return None + if no labels can be extracted. ''' - no_labels = False - if 'xlabels' not in kwargs and 'xlabels_' not in self.__dict__: - #Try to get xlabels from input data (for example, if X is a pandas DataFrame) + try: + labels = list(X.columns) + except AttributeError: try: - self.xlabels_ = list(X.columns) + labels = list(X.design_info.column_names) except AttributeError: try: - self.xlabels_ = list(X.design_info.column_names) - except AttributeError: - try: - self.xlabels = list(X.dtype.names) - except TypeError: - no_labels = True - elif 'xlabels_' not in self.__dict__: - self.xlabels_ = kwargs['xlabels'] + labels = list(X.dtype.names) + except TypeError: + labels = None + + return labels + + def _scrub_x(self, X, **kwargs): + ''' + Sanitize input predictors and extract column names if appropriate. + ''' #Convert to internally used data type X = safe_asarray(X,dtype=np.float64) if len(X.shape) == 1: X = X.reshape((X.shape[0], 1)) - m,n = X.shape - #Make up labels if none were found - if no_labels: - self.xlabels = ['x'+str(i) for i in range(n)] - return X - def _scrub(self, X, y, weights, **kwargs): + def _scrub(self, X, y, sample_weight, **kwargs): ''' Sanitize input data. ''' @@ -253,27 +239,27 @@ def _scrub(self, X, y, weights, **kwargs): y = safe_asarray(y,dtype=np.float64) y = y.reshape(y.shape[0]) - #Deal with weights - if weights is None: - weights = np.ones(y.shape[0], dtype=y.dtype) + #Deal with sample_weight + if sample_weight is None: + sample_weight = np.ones(y.shape[0], dtype=y.dtype) else: - weights = safe_asarray(weights) - weights = weights.reshape(weights.shape[0]) + sample_weight = safe_asarray(sample_weight) + sample_weight = sample_weight.reshape(sample_weight.shape[0]) #Make sure dimensions match if y.shape[0] != X.shape[0]: raise ValueError('X and y do not have compatible dimensions.') - if y.shape != weights.shape: - raise ValueError('y and weights do not have compatible dimensions.') + if y.shape != sample_weight.shape: + raise ValueError('y and sample_weight do not have compatible dimensions.') #Make sure everything is finite assert_all_finite(X) assert_all_finite(y) - assert_all_finite(weights) + assert_all_finite(sample_weight) - return X, y, weights + return X, y, sample_weight - def fit(self, X, y = None, weights=None, xlabels=None, linvars=None): + def fit(self, X, y=None, sample_weight=None, xlabels=None, linvars=[]): ''' Fit an Earth model to the input data X and y. @@ -291,37 +277,43 @@ def fit(self, X, y = None, weights=None, xlabels=None, linvars=None): call to patsy.dmatrices (in which case, X contains the response). - weights : array-like, optional (default=None), shape = [m] where m is the number of samples + sample_weight : array-like, optional (default=None), shape = [m] where m is the number of samples Sample weights for training. Weights must be greater than or equal to zero. Rows with greater weights contribute more strongly to the fitted model. Rows with zero weight do not contribute at all. Weights are useful when dealing with heteroscedasticity. In such cases, the weight should be proportional to the inverse of the (known) variance. - xlabels : iterable of strings, optional (default=None) - Convenient way to set the xlabels parameter while calling fit. Ignored if None (default). - See the Earth class for an explanation of the xlabels parameter. - + linvars : iterable of strings or ints, optional (empty by default) + Used to specify features that may only enter terms as linear basis functions (without + knots). Can include both column numbers and column names (see xlabels, below). If left + empty, some variables may still enter linearly during the forward pass if no knot would + provide a reduction in GCV compared to the linear function. Note that this feature differs + from the R package earth. + + + xlabels : iterable of strings, optional (empty by default) + The xlabels argument can be used to assign names to data columns. This argument is not + generally needed, as names can be captured automatically from most standard data + structures. If included, must have length n, where n is the number of features. Note + that column order is used to compute term values and make predictions, not column names. - linvars : iterable of ints or strings or both, optional (default=None) - Convenient way to set the linvars parameter while calling fit. Ignored if None (default). - See the Earth class for an explanation of the linvars parameter. ''' + #Format and label the data - if xlabels is not None: - self.set_params(xlabels_=xlabels) - if linvars is not None: - self.set_params(linvars=linvars) - X, y, weights = self._scrub(X,y,weights,**self.__dict__) + if xlabels is None: + xlabels = self._scrape_labels(X) + self.linvars_ = linvars + X, y, sample_weight = self._scrub(X,y,sample_weight) #Do the actual work - self.forward_pass(X, y, weights) - self.pruning_pass(X, y, weights) - self.linear_fit(X, y, weights) + self.forward_pass(X, y, sample_weight, xlabels, linvars) + self.pruning_pass(X, y, sample_weight) + self.linear_fit(X, y, sample_weight) return self - def forward_pass(self, X, y = None, weights = None, **kwargs): + def forward_pass(self, X, y=None, sample_weight=None, xlabels=None, linvars=[]): ''' Perform the forward pass of the multivariate adaptive regression splines algorithm. Users will normally want to call the fit method instead, which performs the forward pass, the pruning @@ -341,65 +333,40 @@ def forward_pass(self, X, y = None, weights = None, **kwargs): call to patsy.dmatrices (in which case, X contains the response). - weights : array-like, optional (default=None), shape = [m] where m is the number of samples + sample_weight : array-like, optional (default=None), shape = [m] where m is the number of samples Sample weights for training. Weights must be greater than or equal to zero. Rows with greater weights contribute more strongly to the fitted model. Rows with zero weight do not contribute at all. Weights are useful when dealing with heteroscedasticity. In such cases, the weight should be proportional to the inverse of the (known) variance. - xlabels : iterable of strings, optional (default=None) - Convenient way to set the xlabels parameter while calling forward_pass. Ignored if None - (default). See the Earth class for an explanation of the xlabels parameter. - - - linvars : iterable of ints or strings or both, optional (default=None) - Convenient way to set the linvars parameter while calling forward_pass. Ignored if None - (default). See the Earth class for an explanation of the linvars parameter. + linvars : iterable of strings or ints, optional (empty by default) + Used to specify features that may only enter terms as linear basis functions (without + knots). Can include both column numbers an column names (see xlabels, below). + + + xlabels : iterable of strings, optional (empty by default) + The xlabels argument can be used to assign names to data columns. This argument is not + generally needed, as names can be captured automatically from most standard data + structures. If included, must have length n, where n is the number of features. Note + that column order is used to compute term values and make predictions, not column names. - Note - ---- - The forward_pass method accepts all other named parameters listed in Earth.forward_pass_arg_names. - Passing these parameters to the forward_pass method sets them only for this call, and does not - change the parameters of the Earth object itself. To change the parameters of the object - itself, use the set_params method. - ''' - #Pull new labels and linear variables if necessary - if 'xlabels' in kwargs and 'xlabels_' not in self.__dict__: - self.set_params(xlabels_=kwargs['xlabels']) - del kwargs['xlabels'] - if 'linvars' in kwargs and 'linvars' not in self.__dict__: - self.set_params(linvars=kwargs['linvars']) - del kwargs['linvars'] - #Label and format data - X, y, weights = self._scrub(X,y,weights,**self.__dict__) - - #Check for additional forward pass arguments, and fail if someone tried - #to use other arguments - args = self._pull_forward_args(**self.__dict__) - new_args = self._pull_forward_args(**kwargs) - if len(new_args) < len(kwargs): - msg = 'Invalid forward pass arguments: ' - for k, v in kwargs.iteritems(): - if k in new_args: - continue - msg += k+': '+str(v) + ',' - msg = msg[0:-1]+'.' - raise ValueError(msg) - args.update(new_args) - + if xlabels is None: + xlabels = self._scrape_labels(X) + X, y, sample_weight = self._scrub(X,y,sample_weight) + #Do the actual work args = self._pull_forward_args(**self.__dict__) - forward_passer = ForwardPasser(X, y, weights, **args) + forward_passer = ForwardPasser(X, y, sample_weight, xlabels=xlabels, linvars=linvars, **args) forward_passer.run() self.forward_pass_record_ = forward_passer.trace() self.basis_ = forward_passer.get_basis() - def pruning_pass(self, X, y = None, weights = None, **kwargs): + def pruning_pass(self, X, y = None, sample_weight = None): ''' Perform the pruning pass of the multivariate adaptive regression splines algorithm. Users will normally want to call the fit method instead, which performs the forward pass, the pruning @@ -419,38 +386,22 @@ def pruning_pass(self, X, y = None, weights = None, **kwargs): call to patsy.dmatrices (in which case, X contains the response). - weights : array-like, optional (default=None), shape = [m] where m is the number of samples + sample_weight : array-like, optional (default=None), shape = [m] where m is the number of samples Sample weights for training. Weights must be greater than or equal to zero. Rows with greater weights contribute more strongly to the fitted model. Rows with zero weight do not contribute at all. Weights are useful when dealing with heteroscedasticity. In such cases, the weight should be proportional to the inverse of the (known) variance. - - Note - ---- - The pruning_pass method accepts all other named parameters listed in Earth.pruning_pass_arg_names. - Passing these parameters to the pruning_pass method sets them only for this call, and does not - change the parameters of the Earth object itself. To change the parameters of the object - itself, use the set_params method. + ''' #Format data - X, y, weights = self._scrub(X,y,weights) + X, y, sample_weight = self._scrub(X,y,sample_weight) - #Check for additional pruning arguments and raise ValueError if other arguments are present + #Pull arguments from self args = self._pull_pruning_args(**self.__dict__) - new_args = self._pull_pruning_args(**kwargs) - if len(new_args) < len(kwargs): - msg = 'Invalid pruning pass arguments: ' - for k, v in kwargs.iteritems(): - if k in new_args: - continue - msg += k+': '+str(v) + ',' - msg = msg[0:-1]+'.' - raise ValueError(msg) - args.update(new_args) #Do the actual work - pruning_passer = PruningPasser(self.basis_, X, y, weights, **args) + pruning_passer = PruningPasser(self.basis_, X, y, sample_weight, **args) pruning_passer.run() self.pruning_pass_record_ = pruning_passer.trace() @@ -507,7 +458,7 @@ def summary(self): result += 'MSE: %.4f, GCV: %.4f, RSQ: %.4f, GRSQ: %.4f' % (record.mse(selection), record.gcv(selection), record.rsq(selection), record.grsq(selection)) return result - def linear_fit(self, X, y = None, weights = None): + def linear_fit(self, X, y = None, sample_weight = None): ''' Solve the linear least squares problem to determine the coefficients of the unpruned basis functions. @@ -525,7 +476,7 @@ def linear_fit(self, X, y = None, weights = None): call to patsy.dmatrices (in which case, X contains the response). - weights : array-like, optional (default=None), shape = [m] where m is the number of samples + sample_weight : array-like, optional (default=None), shape = [m] where m is the number of samples Sample weights for training. Weights must be greater than or equal to zero. Rows with greater weights contribute more strongly to the fitted model. Rows with zero weight do not contribute at all. Weights are useful when dealing with heteroscedasticity. In such @@ -533,17 +484,17 @@ def linear_fit(self, X, y = None, weights = None): ''' #Format data - X, y, weights = self._scrub(X,y,weights) + X, y, sample_weight = self._scrub(X,y,sample_weight) #Transform into basis space B = self.transform(X) #Apply weights to B - apply_weights_2d(B,weights) + apply_weights_2d(B,sample_weight) #Apply weights to y weighted_y = y.copy() - apply_weights_1d(weighted_y,weights) + apply_weights_1d(weighted_y,sample_weight) #Solve the linear least squares problem self.coef_ = np.linalg.lstsq(B,weighted_y)[0] @@ -564,7 +515,7 @@ def predict(self, X): B = self.transform(X) return np.dot(B,self.coef_) - def score(self, X, y = None, weights = None): + def score(self, X, y = None, sample_weight = None): ''' Calculate the generalized r^2 of the model on data X and y. @@ -581,18 +532,18 @@ def score(self, X, y = None, weights = None): column, a Patsy DesignMatrix, or can be left as None (default) if X was the output of a call to patsy.dmatrices (in which case, X contains the response). - weights : array-like, optional (default=None), shape = [m] where m is the number of samples + sample_weight : array-like, optional (default=None), shape = [m] where m is the number of samples Sample weights for training. Weights must be greater than or equal to zero. Rows with greater weights contribute more strongly to the fitted model. Rows with zero weight do not contribute at all. Weights are useful when dealing with heteroscedasticity. In such cases, the weight should be proportional to the inverse of the (known) variance. ''' - X, y, weights = self._scrub(X, y, weights) + X, y, sample_weight = self._scrub(X, y, sample_weight) y_hat = self.predict(X) - m, n = X.shape + m, _ = X.shape residual = y-y_hat - mse = np.sum(weights * (residual**2)) / m - mse0 = np.sum(weights*((y -np.average(y,weights=weights))**2)) / m + mse = np.sum(sample_weight * (residual**2)) / m + mse0 = np.sum(sample_weight*((y -np.average(y,weights=sample_weight))**2)) / m return 1 - (mse/mse0) def transform(self, X): diff --git a/sklearn/earth/tests/earth_linvars_regress.txt b/sklearn/earth/tests/earth_linvars_regress.txt new file mode 100644 index 0000000000000..319b30faa791d --- /dev/null +++ b/sklearn/earth/tests/earth_linvars_regress.txt @@ -0,0 +1,47 @@ +Forward Pass +--------------------------------------------------------------- +iter parent var knot mse terms gcv rsq grsq +--------------------------------------------------------------- +0 - - - 1.373069 1 1.401 0.000 0.000 +1 0 1 -1 0.861043 2 0.915 0.373 0.347 +2 0 2 -1 0.774582 3 0.858 0.436 0.387 +3 0 3 -1 0.764313 4 0.884 0.443 0.369 +4 0 6 -1 0.753043 5 0.909 0.452 0.351 +5 0 5 -1 0.740056 6 0.934 0.461 0.333 +6 0 7 -1 0.734362 7 0.970 0.465 0.307 +7 0 8 -1 0.732358 8 1.014 0.467 0.276 +8 0 4 -1 0.731261 9 1.061 0.467 0.242 +--------------------------------------------------------------- +Stopping Condition 2: Improvement below threshold + +Pruning Pass +-------------------------------------------- +iter bf terms mse gcv rsq grsq +-------------------------------------------- +0 - 9 0.73 1.061 0.467 0.242 +1 8 8 0.73 1.014 0.467 0.276 +2 7 7 0.73 0.970 0.465 0.307 +3 6 6 0.74 0.934 0.461 0.333 +4 5 5 0.75 0.909 0.452 0.351 +5 4 4 0.76 0.884 0.443 0.369 +6 3 3 0.77 0.858 0.436 0.387 +7 2 2 0.86 0.915 0.373 0.347 +8 1 1 1.37 1.401 0.000 0.000 +-------------------------------------------- +Selected iteration: 6 + +Earth Model +------------------------------------- +Basis Function Pruned Coefficient +------------------------------------- +(Intercept) No 0.657403 +x1 No 0.757872 +x2 No 0.325515 +x3 Yes None +x6 Yes None +x5 Yes None +x7 Yes None +x8 Yes None +x4 Yes None +------------------------------------- +MSE: 0.7746, GCV: 0.8583, RSQ: 0.4359, GRSQ: 0.3874 \ No newline at end of file diff --git a/sklearn/earth/tests/test_basis.py b/sklearn/earth/tests/test_basis.py index b6238f6a6ea23..7a3de7ea9348f 100644 --- a/sklearn/earth/tests/test_basis.py +++ b/sklearn/earth/tests/test_basis.py @@ -4,7 +4,7 @@ @author: jasonrudy ''' from nose.tools import assert_true, assert_false, assert_equal -from pyearth._basis import Basis, ConstantBasisFunction, HingeBasisFunction, LinearBasisFunction +from sklearn.earth._basis import Basis, ConstantBasisFunction, HingeBasisFunction, LinearBasisFunction import numpy import pickle import os diff --git a/sklearn/earth/tests/test_earth.py b/sklearn/earth/tests/test_earth.py index 84665c217bf1e..444c6318a1c39 100644 --- a/sklearn/earth/tests/test_earth.py +++ b/sklearn/earth/tests/test_earth.py @@ -4,8 +4,8 @@ @author: jasonrudy ''' import numpy -from pyearth._basis import Basis, ConstantBasisFunction, HingeBasisFunction, LinearBasisFunction -from pyearth import Earth +from sklearn.earth._basis import Basis, ConstantBasisFunction, HingeBasisFunction, LinearBasisFunction +from sklearn.earth import Earth import pickle import copy import os @@ -37,14 +37,12 @@ def __init__(self): def test_get_params(self): assert_equal(Earth().get_params(), {'penalty': None, 'min_search_points': None, 'endspan_alpha': None, 'check_every': None, - 'max_terms': None, 'xlabels': None, 'max_degree': None, - 'minspan_alpha': None, 'linvars': None, 'thresh': None, - 'minspan': None, 'endspan': None}) + 'max_terms': None, 'max_degree': None, 'minspan_alpha': None, + 'thresh': None, 'minspan': None, 'endspan': None}) assert_equal(Earth(max_degree=3).get_params(), {'penalty': None, 'min_search_points': None, 'endspan_alpha': None, 'check_every': None, - 'max_terms': None, 'xlabels': None, 'max_degree': 3, - 'minspan_alpha': None, 'linvars': None, 'thresh': None, - 'minspan': None, 'endspan': None}) + 'max_terms': None, 'max_degree': 3, 'minspan_alpha': None, + 'thresh': None, 'minspan': None, 'endspan': None}) @if_statsmodels def test_linear_fit(self): @@ -54,31 +52,31 @@ def test_linear_fit(self): soln = OLS(self.y, self.earth.transform(self.X)).fit().params assert_almost_equal(numpy.mean((self.earth.coef_-soln)**2), 0.0) - weights = 1.0 / (numpy.random.normal(size=self.y.shape) ** 2) + sample_weight = 1.0 / (numpy.random.normal(size=self.y.shape) ** 2) self.earth.fit(self.X, self.y) - self.earth.linear_fit(self.X, self.y, weights) - soln = GLS(self.y, self.earth.transform(self.X), 1.0 / weights).fit().params + self.earth.linear_fit(self.X, self.y, sample_weight) + soln = GLS(self.y, self.earth.transform(self.X), 1.0 / sample_weight).fit().params assert_almost_equal(numpy.mean((self.earth.coef_-soln)**2), 0.0) - def test_weights(self): + def test_sample_weight(self): group = numpy.random.binomial(1,.5,size=1000) == 1 - weights = 1 / (group * 100 + 1.0) + sample_weight = 1 / (group * 100 + 1.0) x = numpy.random.uniform(-10,10,size=1000) y = numpy.abs(x) y[group] = numpy.abs(x[group] - 5) y += numpy.random.normal(0,1,size=1000) - model = Earth().fit(x,y,weights = weights) + model = Earth().fit(x,y,sample_weight = sample_weight) #Check that the model fits better for the more heavily weighted group assert_true(model.score(x[group],y[group]) < model.score(x[numpy.logical_not(group)],y[numpy.logical_not(group)])) #Make sure that the score function gives the same answer as the trace - assert_almost_equal(model.score(x,y,weights=weights), model.pruning_trace().rsq(model.pruning_trace().get_selected())) + assert_almost_equal(model.score(x,y,sample_weight=sample_weight), model.pruning_trace().rsq(model.pruning_trace().get_selected())) #Uncomment below to see what this test situation looks like # from matplotlib import pyplot # print model.summary() -# print model.score(x,y,weights = weights) +# print model.score(x,y,sample_weight = sample_weight) # pyplot.figure() # pyplot.plot(x,y,'b.') # pyplot.plot(x,model.predict(x),'r.') @@ -93,12 +91,38 @@ def test_fit(self): prev = fl.read() assert_equal(res,prev) + def test_linvars(self): + self.earth.fit(self.X, self.y, linvars=[0,1,2,3,4,5,6,7,8,9]) + res = str(self.earth.trace()) + '\n' + self.earth.summary() +# with open('earth_linvars_regress.txt','w') as fl: +# fl.write(res) + with open(os.path.join(os.path.dirname(__file__),'earth_linvars_regress.txt'),'r') as fl: + prev = fl.read() + assert_equal(res,prev) + def test_score(self): model = self.earth.fit(self.X, self.y) record = model.pruning_trace() rsq = record.rsq(record.get_selected()) assert_almost_equal(rsq,model.score(self.X,self.y)) - + + @if_pandas + def test_pathological_cases(self): + import pandas + directory = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'pathological_data') + cases = {'issue_44':{}} + for case, settings in cases.iteritems(): + data = pandas.read_csv(os.path.join(directory, case + '.csv')) + y = data['y'] + del data['y'] + X = data + model = Earth(**settings).fit(X,y) +# with open(os.path.join('pathological_data', case + '.txt'), 'w') as outfile: +# outfile.write(model.summary()) + with open(os.path.join(directory, case + '.txt'), 'r') as infile: + correct = infile.read() + assert_equal(model.summary(),correct) + @if_pandas def test_pandas_compatibility(self): import pandas @@ -107,7 +131,7 @@ def test_pandas_compatibility(self): colnames = ['xx'+str(i) for i in range(X.shape[1])] X.columns = colnames model = self.earth.fit(X,y) - assert_list_equal(colnames,model.xlabels) + assert_list_equal(colnames,model.forward_trace()._getstate()['xlabels']) @if_patsy @if_pandas @@ -121,7 +145,7 @@ def test_patsy_compatibility(self): X['y'] = y y, X = patsy.dmatrices('y ~ xx0 + xx1 + xx2 + xx3 + xx4 + xx5 + xx6 + xx7 + xx8 + xx9 - 1',data=X) model = self.earth.fit(X,y) - assert_list_equal(colnames,model.xlabels) + assert_list_equal(colnames,model.forward_trace()._getstate()['xlabels']) def test_pickle_compatibility(self): model = self.earth.fit(self.X, self.y) diff --git a/sklearn/earth/tests/test_forward.py b/sklearn/earth/tests/test_forward.py index 0c5ca99a905ef..7fce0db2465e9 100644 --- a/sklearn/earth/tests/test_forward.py +++ b/sklearn/earth/tests/test_forward.py @@ -3,8 +3,8 @@ @author: jasonrudy ''' -from pyearth._forward import ForwardPasser -from pyearth._basis import Basis, ConstantBasisFunction, HingeBasisFunction, LinearBasisFunction +from sklearn.earth._forward import ForwardPasser +from sklearn.earth._basis import Basis, ConstantBasisFunction, HingeBasisFunction, LinearBasisFunction import numpy import os from nose.tools import assert_true, assert_equal diff --git a/sklearn/earth/tests/test_record.py b/sklearn/earth/tests/test_record.py index 680454b3dc6ab..60583c1b7d8ca 100644 --- a/sklearn/earth/tests/test_record.py +++ b/sklearn/earth/tests/test_record.py @@ -1,5 +1,5 @@ -from pyearth._record import ForwardPassRecord, ForwardPassIteration, PruningPassRecord, PruningPassIteration -from pyearth._util import gcv +from sklearn.earth._record import ForwardPassRecord, ForwardPassIteration, PruningPassRecord, PruningPassIteration +from sklearn.earth._util import gcv from nose.tools import assert_true, assert_equal, assert_list_equal class TestForwardPassRecord(object): @@ -10,7 +10,7 @@ def __init__(self): self.num_variables = 10 self.penalty = 3.0 self.sst = 100.0 - self.record = ForwardPassRecord(self.num_samples, self.num_variables, self.penalty, self.sst) + self.record = ForwardPassRecord(self.num_samples, self.num_variables, self.penalty, self.sst, ['x'+str(i) for i in range(self.num_variables)]) self.record.append(ForwardPassIteration(0, 3, 3, 63.0, 3)) self.record.append(ForwardPassIteration(0, 3, 14, 34.0, 5)) self.record.append(ForwardPassIteration(3, 6, 12, 18.0, 7)) diff --git a/sklearn/earth/tests/test_util.py b/sklearn/earth/tests/test_util.py index 84df70454fd68..d354300f255e1 100644 --- a/sklearn/earth/tests/test_util.py +++ b/sklearn/earth/tests/test_util.py @@ -1,6 +1,6 @@ -class Test(object): +class TestUtil(object): def __init__(self): pass From 73ae7d32a44d9b3fed375e0b2790374aba98b0e7 Mon Sep 17 00:00:00 2001 From: Jason Rudy Date: Thu, 25 Jul 2013 23:29:24 -0700 Subject: [PATCH 07/19] Fixe imports and got tests working --- sklearn/earth/_basis.c | 2 +- sklearn/earth/_basis.pyx | 2 +- sklearn/earth/_forward.c | 2 +- sklearn/earth/_forward.pyx | 6 +- sklearn/earth/_pruning.c | 6 +- sklearn/earth/_pruning.pyx | 4 +- sklearn/earth/_record.c | 44 ++++++-- sklearn/earth/_record.pyx | 4 +- sklearn/earth/_util.c | 2 +- sklearn/earth/earth.py | 10 +- .../tests/pathological_data/issue_44.csv | 101 ++++++++++++++++++ .../tests/pathological_data/issue_44.txt | 8 ++ .../earth/tests/pathological_data/readme.txt | 8 ++ 13 files changed, 171 insertions(+), 28 deletions(-) create mode 100644 sklearn/earth/tests/pathological_data/issue_44.csv create mode 100644 sklearn/earth/tests/pathological_data/issue_44.txt create mode 100644 sklearn/earth/tests/pathological_data/readme.txt diff --git a/sklearn/earth/_basis.c b/sklearn/earth/_basis.c index 10a7708be48fe..a8d799b58d604 100644 --- a/sklearn/earth/_basis.c +++ b/sklearn/earth/_basis.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19.1 on Thu Jul 25 22:12:25 2013 */ +/* Generated by Cython 0.19.1 on Thu Jul 25 23:27:59 2013 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS diff --git a/sklearn/earth/_basis.pyx b/sklearn/earth/_basis.pyx index 64e61bf66bef0..988d8dd07090a 100644 --- a/sklearn/earth/_basis.pyx +++ b/sklearn/earth/_basis.pyx @@ -4,7 +4,7 @@ # cython: wraparound = False # cython: profile = False -from _util cimport log2, apply_weights_2d +from ._util cimport log2, apply_weights_2d from libc.math cimport log from libc.math cimport abs cdef FLOAT_t ZERO_TOL = 1e-16 diff --git a/sklearn/earth/_forward.c b/sklearn/earth/_forward.c index 7a4f81f55407b..245d545dc1b77 100644 --- a/sklearn/earth/_forward.c +++ b/sklearn/earth/_forward.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19.1 on Thu Jul 25 22:12:25 2013 */ +/* Generated by Cython 0.19.1 on Thu Jul 25 23:27:59 2013 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS diff --git a/sklearn/earth/_forward.pyx b/sklearn/earth/_forward.pyx index 8e1353afee138..3d33ae42779c8 100644 --- a/sklearn/earth/_forward.pyx +++ b/sklearn/earth/_forward.pyx @@ -4,9 +4,9 @@ # cython: wraparound = False # cython: profile = False -from _util cimport gcv_adjust, log2, apply_weights_1d -from _basis cimport Basis, BasisFunction, ConstantBasisFunction, HingeBasisFunction, LinearBasisFunction -from _record cimport ForwardPassIteration +from ._util cimport gcv_adjust, log2, apply_weights_1d +from ._basis cimport Basis, BasisFunction, ConstantBasisFunction, HingeBasisFunction, LinearBasisFunction +from ._record cimport ForwardPassIteration from libc.math cimport sqrt, abs, log import numpy as np diff --git a/sklearn/earth/_pruning.c b/sklearn/earth/_pruning.c index 523be93b499e1..b396bc3a63512 100644 --- a/sklearn/earth/_pruning.c +++ b/sklearn/earth/_pruning.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19.1 on Thu Jul 25 22:12:25 2013 */ +/* Generated by Cython 0.19.1 on Thu Jul 25 23:27:59 2013 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS @@ -6044,8 +6044,8 @@ PyMODINIT_FUNC PyInit__pruning(void) /*--- Execution code ---*/ /* "sklearn/earth/_pruning.pyx":9 - * from _record cimport PruningPassIteration - * from _util cimport gcv, apply_weights_1d + * from ._record cimport PruningPassIteration + * from ._util cimport gcv, apply_weights_1d * import numpy as np # <<<<<<<<<<<<<< * * cdef class PruningPasser: diff --git a/sklearn/earth/_pruning.pyx b/sklearn/earth/_pruning.pyx index 5581082fc7b73..f01a4f1a4393a 100644 --- a/sklearn/earth/_pruning.pyx +++ b/sklearn/earth/_pruning.pyx @@ -4,8 +4,8 @@ # cython: wraparound = False # cython: profile = False -from _record cimport PruningPassIteration -from _util cimport gcv, apply_weights_1d +from ._record cimport PruningPassIteration +from ._util cimport gcv, apply_weights_1d import numpy as np cdef class PruningPasser: diff --git a/sklearn/earth/_record.c b/sklearn/earth/_record.c index 7a2e437456dc6..46b8ac691c0ab 100644 --- a/sklearn/earth/_record.c +++ b/sklearn/earth/_record.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19.1 on Thu Jul 25 22:12:25 2013 */ +/* Generated by Cython 0.19.1 on Thu Jul 25 23:27:59 2013 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS @@ -1196,7 +1196,7 @@ static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_LinearBasisFunction *__py /* "sklearn/earth/_record.pyx":10 - * import _forward + * from . import _forward * * cdef class Record: # <<<<<<<<<<<<<< * @@ -1501,6 +1501,8 @@ static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ static void* __Pyx_GetVtable(PyObject *dict); /*proto*/ +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); /*proto*/ + static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/ static CYTHON_INLINE npy_ulonglong __Pyx_PyInt_from_py_npy_ulonglong(PyObject *); @@ -10974,6 +10976,7 @@ PyMODINIT_FUNC PyInit__record(void) { PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -11145,25 +11148,34 @@ PyMODINIT_FUNC PyInit__record(void) /* "sklearn/earth/_record.pyx":8 * - * from _util cimport gcv, ascii_table - * import _forward # <<<<<<<<<<<<<< + * from ._util cimport gcv, ascii_table + * from . import _forward # <<<<<<<<<<<<<< * * cdef class Record: */ - __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s___forward), 0, -1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_n_s___forward)); + PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s___forward)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s___forward)); + __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_kp_s_1), ((PyObject *)__pyx_t_2), 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s___forward); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (PyDict_SetItem(__pyx_d, __pyx_n_s___forward, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "sklearn/earth/_record.pyx":1 * # distutils: language = c # <<<<<<<<<<<<<< * # cython: cdivision = True * # cython: boundscheck = False */ - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - if (PyDict_SetItem(__pyx_d, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + if (PyDict_SetItem(__pyx_d, __pyx_n_s____test__, ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; /* "numpy.pxd":975 * arr.base = baseptr @@ -11176,6 +11188,7 @@ PyMODINIT_FUNC PyInit__record(void) __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); if (__pyx_m) { __Pyx_AddTraceback("init sklearn.earth._record", __pyx_clineno, __pyx_lineno, __pyx_filename); Py_DECREF(__pyx_m); __pyx_m = 0; @@ -11785,6 +11798,19 @@ static void* __Pyx_GetVtable(PyObject *dict) { return NULL; } +static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { + PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); + if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { + PyErr_Format(PyExc_ImportError, + #if PY_MAJOR_VERSION < 3 + "cannot import name %.230s", PyString_AS_STRING(name)); + #else + "cannot import name %S", name); + #endif + } + return value; +} + static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { PyObject *empty_list = 0; PyObject *module = 0; diff --git a/sklearn/earth/_record.pyx b/sklearn/earth/_record.pyx index d44a39451fc8f..64d2baac04720 100644 --- a/sklearn/earth/_record.pyx +++ b/sklearn/earth/_record.pyx @@ -4,8 +4,8 @@ # cython: wraparound = False # cython: profile = False -from _util cimport gcv, ascii_table -import _forward +from ._util cimport gcv, ascii_table +from . import _forward cdef class Record: diff --git a/sklearn/earth/_util.c b/sklearn/earth/_util.c index 060001d12bbcb..1631ae584aa18 100644 --- a/sklearn/earth/_util.c +++ b/sklearn/earth/_util.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19.1 on Thu Jul 25 22:12:25 2013 */ +/* Generated by Cython 0.19.1 on Thu Jul 25 23:27:59 2013 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS diff --git a/sklearn/earth/earth.py b/sklearn/earth/earth.py index 751fe2f3ed3e2..8710b2ae89e1c 100644 --- a/sklearn/earth/earth.py +++ b/sklearn/earth/earth.py @@ -1,8 +1,8 @@ -from pyearth._forward import ForwardPasser -from pyearth._pruning import PruningPasser -from pyearth._util import ascii_table, gcv, apply_weights_2d, apply_weights_1d -from sklearn.base import RegressorMixin, BaseEstimator, TransformerMixin -from sklearn.utils.validation import assert_all_finite, safe_asarray +from ._forward import ForwardPasser +from ._pruning import PruningPasser +from ._util import ascii_table, gcv, apply_weights_2d, apply_weights_1d +from ..base import RegressorMixin, BaseEstimator, TransformerMixin +from ..utils.validation import assert_all_finite, safe_asarray import numpy as np class Earth(BaseEstimator, RegressorMixin, TransformerMixin): diff --git a/sklearn/earth/tests/pathological_data/issue_44.csv b/sklearn/earth/tests/pathological_data/issue_44.csv new file mode 100644 index 0000000000000..b3a18d550528d --- /dev/null +++ b/sklearn/earth/tests/pathological_data/issue_44.csv @@ -0,0 +1,101 @@ +x,y +-3.7373737373737375,1.7991218849952073 +-0.50505050505050519,-0.91104074841082883 +2.3232323232323235,1.7489750942002336 +-9.3939393939393945,0.93746398352941285 +-1.9191919191919189,0.37906368380023697 +-4.5454545454545459,2.0671407475807846 +-2.3232323232323235,2.8903231496524264 +-2.1212121212121207,0.95421401743510981 +5.1515151515151523,-0.28835274505737712 +6.5656565656565631,2.4349616731309003 +8.3838383838383841,2.0015189624872649 +-4.3434343434343443,2.0839886262250777 +-5.1515151515151523,4.0035426047149203 +4.9494949494949498,1.0301181262384298 +10.0,2.0990912639096395 +5.9595959595959584,1.4837216429432181 +-4.1414141414141419,3.1115350771447017 +5.5555555555555554,-0.49432035860384549 +9.7979797979797993,2.2570162633565838 +2.9292929292929286,0.19922300098316129 +-4.7474747474747474,2.2411649234982853 +8.1818181818181817,3.8319133058008834 +0.10101010101010033,-1.1655342778993465 +-7.3737373737373728,1.5936860907276955 +0.50505050505050519,2.7824955819904238 +4.7474747474747474,0.37375342310356208 +-7.7777777777777777,1.3319391790079955 +0.70707070707070763,2.7447709715653392 +0.90909090909090795,1.2593630603714561 +-2.9292929292929286,1.4730041828646854 +1.5151515151515156,1.9517355390216784 +7.5757575757575744,2.5204906997403671 +3.737373737373737,0.82513781953866294 +1.7171717171717162,1.5521287384776057 +3.9393939393939386,0.41909788678935839 +8.787878787878789,0.83357749049159235 +2.5252525252525242,0.97158776816516124 +3.333333333333333,2.796727214906336 +1.9191919191919189,1.5770991785524595 +7.3737373737373728,2.812545924932186 +8.9898989898989896,2.3399323489969777 +-8.1818181818181817,0.22251629284196264 +-6.3636363636363633,0.65508003936260206 +-2.5252525252525246,1.1781202228906005 +7.7777777777777777,1.1361770487748726 +-6.9696969696969697,0.49658600871033542 +7.171717171717173,1.2870810571346567 +-1.1111111111111107,-0.92633728764534862 +-1.5151515151515156,-0.30285092335205799 +-6.1616161616161618,2.2600448186850697 +9.1919191919191903,2.0528078501883256 +9.5959595959595987,0.36719227705824703 +-5.5555555555555554,1.5554954537126158 +4.3434343434343443,-1.2471684340825608 +-0.10101010101010033,1.6055254760143964 +6.9696969696969688,1.9399379619451884 +4.545454545454545,0.86004045773468585 +-9.7979797979797958,2.8053907657933528 +-6.7676767676767682,-0.2256450948986943 +-3.9393939393939386,3.489343493164955 +-5.9595959595959593,2.5238295345305537 +-1.3131313131313131,0.23652412699589609 +-1.7171717171717178,-1.6686836205834381 +-9.1919191919191938,-0.55397857306368992 +-4.9494949494949498,1.0493231114754551 +-0.30303030303030282,-1.0878104111406399 +-9.5959595959595987,-0.55743666312264351 +-0.90909090909090995,1.8446458659377187 +5.3535353535353529,0.59548081377866657 +-7.1717171717171713,-0.46557755831965858 +0.30303030303030282,0.95943699775297564 +-5.7575757575757578,1.8185702673284407 +1.1111111111111107,2.1419245861795222 +2.7272727272727262,-1.3093855134880783 +-5.3535353535353538,1.6946451925769861 +3.1313131313131315,0.32016804097713369 +-3.333333333333333,2.2084032577385755 +9.3939393939393945,2.5342019954452182 +-7.9797979797979792,-0.48297953030589919 +8.5858585858585847,1.7297261905989889 +-2.7272727272727275,-0.9646357159778064 +-8.3838383838383841,-0.38537725554562052 +6.7676767676767682,3.3939003736405828 +6.1616161616161627,-0.077379083453575012 +6.3636363636363633,2.3902476491581792 +-8.5858585858585847,-0.19404572628702388 +2.1212121212121207,1.3602855988564588 +-3.5353535353535355,0.93983489736420145 +-10.0,2.3799875617530448 +-8.7878787878787872,-0.52460655837426085 +-7.5757575757575761,-0.28301040599130989 +5.7575757575757578,2.206172182722522 +4.1414141414141419,1.401220881354313 +7.9797979797979792,1.5959670945663329 +-6.5656565656565657,-0.45038856153592982 +-3.1313131313131315,2.1499146748068823 +-0.70707070707070763,-0.86787179551703342 +1.3131313131313131,0.1139238155075194 +-8.9898989898989896,0.19646334195105306 +3.5353535353535346,1.1596893484229858 diff --git a/sklearn/earth/tests/pathological_data/issue_44.txt b/sklearn/earth/tests/pathological_data/issue_44.txt new file mode 100644 index 0000000000000..6d6254296d88a --- /dev/null +++ b/sklearn/earth/tests/pathological_data/issue_44.txt @@ -0,0 +1,8 @@ +Earth Model +------------------------------------- +Basis Function Pruned Coefficient +------------------------------------- +(Intercept) No 1.13135 +x Yes None +------------------------------------- +MSE: 1.6432, GCV: 1.6765, RSQ: -0.0000, GRSQ: -0.0000 \ No newline at end of file diff --git a/sklearn/earth/tests/pathological_data/readme.txt b/sklearn/earth/tests/pathological_data/readme.txt new file mode 100644 index 0000000000000..5a23bdf5b77c0 --- /dev/null +++ b/sklearn/earth/tests/pathological_data/readme.txt @@ -0,0 +1,8 @@ +Pathological Data Sets + +The data sets contained in this folder have revealed bugs in the past. They now serve as +regression tests to prevent the same bugs from arising again in the future. + +issue_44: +This data set caused a segfault during fitting due to the use of a negative index in Cython +with wraparound = False. \ No newline at end of file From 0a693edd487f8d0f8c5db5f0a5f2af8b5638c3e8 Mon Sep 17 00:00:00 2001 From: Jason Rudy Date: Sat, 27 Jul 2013 17:30:56 -0700 Subject: [PATCH 08/19] Fixed imports again. Not really sure how they got un-fixed. I thought they were working before. Maybe I ran the wrong tests or something. --- sklearn/earth/_basis.c | 2 +- sklearn/earth/_forward.c | 68 ++++- sklearn/earth/_forward.pxd | 2 + sklearn/earth/_pruning.c | 2 +- sklearn/earth/_record.c | 497 +++++++++++++++++++++++-------------- sklearn/earth/_record.pyx | 4 +- sklearn/earth/_util.c | 2 +- 7 files changed, 381 insertions(+), 196 deletions(-) diff --git a/sklearn/earth/_basis.c b/sklearn/earth/_basis.c index a8d799b58d604..bc74800b6f9ec 100644 --- a/sklearn/earth/_basis.c +++ b/sklearn/earth/_basis.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19.1 on Thu Jul 25 23:27:59 2013 */ +/* Generated by Cython 0.19.1 on Sat Jul 27 17:29:30 2013 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS diff --git a/sklearn/earth/_forward.c b/sklearn/earth/_forward.c index 245d545dc1b77..d54d822c41a7a 100644 --- a/sklearn/earth/_forward.c +++ b/sklearn/earth/_forward.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19.1 on Thu Jul 25 23:27:59 2013 */ +/* Generated by Cython 0.19.1 on Sat Jul 27 17:29:30 2013 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS @@ -1096,8 +1096,8 @@ struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction { }; -/* "sklearn/earth/_forward.pxd":17 - * NOCAND=4 +/* "sklearn/earth/_forward.pxd":19 + * cdef dict stopping_conditions * * cdef class ForwardPasser: # <<<<<<<<<<<<<< * @@ -1862,6 +1862,25 @@ static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject * static int __Pyx_check_binary_version(void); +#if CYTHON_COMPILING_IN_CPYTHON +#define __Pyx_PyObject_DelAttrStr(o,n) __Pyx_PyObject_SetAttrStr(o,n,NULL) +static CYTHON_INLINE int __Pyx_PyObject_SetAttrStr(PyObject* obj, PyObject* attr_name, PyObject* value) { + PyTypeObject* tp = Py_TYPE(obj); + if (likely(tp->tp_setattro)) + return tp->tp_setattro(obj, attr_name, value); +#if PY_MAJOR_VERSION < 3 + if (likely(tp->tp_setattr)) + return tp->tp_setattr(obj, PyString_AS_STRING(attr_name), value); +#endif + return PyObject_SetAttr(obj, attr_name, value); +} +#else +#define __Pyx_PyObject_DelAttrStr(o,n) PyObject_DelAttr(o,n) +#define __Pyx_PyObject_SetAttrStr(o,n,v) PyObject_SetAttr(o,n,v) +#endif + +static int __Pyx_ExportVoidPtr(PyObject *name, void *p, const char *sig); /*proto*/ + #if !defined(__Pyx_PyIdentifier_FromString) #if PY_MAJOR_VERSION < 3 #define __Pyx_PyIdentifier_FromString(s) PyString_FromString(s) @@ -1949,6 +1968,7 @@ static __pyx_t_7sklearn_5earth_5_util_FLOAT_t (*__pyx_f_7sklearn_5earth_5_util_g /* Module declarations from 'sklearn.earth._forward' */ static PyTypeObject *__pyx_ptype_7sklearn_5earth_8_forward_ForwardPasser = 0; +static PyObject *__pyx_v_7sklearn_5earth_8_forward_stopping_conditions = 0; static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t = { "FLOAT_t", NULL, sizeof(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t), { 0 }, 0, 'R', 0, 0 }; static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_INT_t = { "INT_t", NULL, sizeof(__pyx_t_7sklearn_5earth_8_forward_INT_t), { 0 }, 0, IS_UNSIGNED(__pyx_t_7sklearn_5earth_8_forward_INT_t) ? 'U' : 'I', IS_UNSIGNED(__pyx_t_7sklearn_5earth_8_forward_INT_t), 0 }; #define __Pyx_MODULE_NAME "sklearn.earth._forward" @@ -2045,6 +2065,7 @@ static char __pyx_k____import__[] = "__import__"; static char __pyx_k__max_degree[] = "max_degree"; static char __pyx_k__check_every[] = "check_every"; static char __pyx_k__RuntimeError[] = "RuntimeError"; +static char __pyx_k____pyx_capi__[] = "__pyx_capi__"; static char __pyx_k__endspan_alpha[] = "endspan_alpha"; static char __pyx_k__minspan_alpha[] = "minspan_alpha"; static char __pyx_k__sample_weight[] = "sample_weight"; @@ -2078,6 +2099,7 @@ static PyObject *__pyx_n_s__X; static PyObject *__pyx_n_s____import__; static PyObject *__pyx_n_s____len__; static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____pyx_capi__; static PyObject *__pyx_n_s____pyx_getbuffer; static PyObject *__pyx_n_s____pyx_releasebuffer; static PyObject *__pyx_n_s____pyx_vtable__; @@ -10590,6 +10612,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s____import__, __pyx_k____import__, sizeof(__pyx_k____import__), 0, 0, 1, 1}, {&__pyx_n_s____len__, __pyx_k____len__, sizeof(__pyx_k____len__), 0, 0, 1, 1}, {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____pyx_capi__, __pyx_k____pyx_capi__, sizeof(__pyx_k____pyx_capi__), 0, 0, 1, 1}, {&__pyx_n_s____pyx_getbuffer, __pyx_k____pyx_getbuffer, sizeof(__pyx_k____pyx_getbuffer), 0, 0, 1, 1}, {&__pyx_n_s____pyx_releasebuffer, __pyx_k____pyx_releasebuffer, sizeof(__pyx_k____pyx_releasebuffer), 0, 0, 1, 1}, {&__pyx_n_s____pyx_vtable__, __pyx_k____pyx_vtable__, sizeof(__pyx_k____pyx_vtable__), 0, 0, 1, 1}, @@ -10965,7 +10988,9 @@ PyMODINIT_FUNC PyInit__forward(void) /*--- Constants init code ---*/ if (unlikely(__Pyx_InitCachedConstants() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Global init code ---*/ + __pyx_v_7sklearn_5earth_8_forward_stopping_conditions = ((PyObject*)Py_None); Py_INCREF(Py_None); /*--- Variable export code ---*/ + if (__Pyx_ExportVoidPtr(__pyx_n_s__stopping_conditions, (void *)&__pyx_v_7sklearn_5earth_8_forward_stopping_conditions, "PyObject *") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Function export code ---*/ /*--- Type init code ---*/ __pyx_vtabptr_7sklearn_5earth_8_forward_ForwardPasser = &__pyx_vtable_7sklearn_5earth_8_forward_ForwardPasser; @@ -11119,8 +11144,11 @@ PyMODINIT_FUNC PyInit__forward(void) __Pyx_GOTREF(__pyx_t_3); if (PyDict_SetItem(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_kp_s_39)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_d, __pyx_n_s__stopping_conditions, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_XGOTREF(((PyObject *)__pyx_v_7sklearn_5earth_8_forward_stopping_conditions)); + __Pyx_DECREF(((PyObject *)__pyx_v_7sklearn_5earth_8_forward_stopping_conditions)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_v_7sklearn_5earth_8_forward_stopping_conditions = ((PyObject*)__pyx_t_2); + __pyx_t_2 = 0; /* "sklearn/earth/_forward.pyx":1 * # distutils: language = c # <<<<<<<<<<<<<< @@ -13495,6 +13523,36 @@ static int __Pyx_check_binary_version(void) { return 0; } +static int __Pyx_ExportVoidPtr(PyObject *name, void *p, const char *sig) { + PyObject *d; + PyObject *cobj = 0; + d = PyDict_GetItem(__pyx_d, __pyx_n_s____pyx_capi__); + Py_XINCREF(d); + if (!d) { + d = PyDict_New(); + if (!d) + goto bad; + if (__Pyx_PyObject_SetAttrStr(__pyx_m, __pyx_n_s____pyx_capi__, d) < 0) + goto bad; + } +#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3 && PY_MINOR_VERSION==0) + cobj = PyCapsule_New(p, sig, 0); +#else + cobj = PyCObject_FromVoidPtrAndDesc(p, (void *)sig, 0); +#endif + if (!cobj) + goto bad; + if (PyDict_SetItem(d, name, cobj) < 0) + goto bad; + Py_DECREF(cobj); + Py_DECREF(d); + return 0; +bad: + Py_XDECREF(cobj); + Py_XDECREF(d); + return -1; +} + #ifndef __PYX_HAVE_RT_ImportModule #define __PYX_HAVE_RT_ImportModule static PyObject *__Pyx_ImportModule(const char *name) { diff --git a/sklearn/earth/_forward.pxd b/sklearn/earth/_forward.pxd index 35a1f15277bc7..1e769038ad6e5 100644 --- a/sklearn/earth/_forward.pxd +++ b/sklearn/earth/_forward.pxd @@ -14,6 +14,8 @@ ctypedef enum StoppingCondition: LOWGRSQ=3, NOCAND=4 +cdef dict stopping_conditions + cdef class ForwardPasser: #User selected parameters diff --git a/sklearn/earth/_pruning.c b/sklearn/earth/_pruning.c index b396bc3a63512..77e54e372ada2 100644 --- a/sklearn/earth/_pruning.c +++ b/sklearn/earth/_pruning.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19.1 on Thu Jul 25 23:27:59 2013 */ +/* Generated by Cython 0.19.1 on Sat Jul 27 17:29:30 2013 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS diff --git a/sklearn/earth/_record.c b/sklearn/earth/_record.c index 46b8ac691c0ab..1cc8a011b2449 100644 --- a/sklearn/earth/_record.c +++ b/sklearn/earth/_record.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19.1 on Thu Jul 25 23:27:59 2013 */ +/* Generated by Cython 0.19.1 on Sat Jul 27 17:29:30 2013 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS @@ -510,6 +510,7 @@ static const char *__pyx_f[] = { "numpy.pxd", "type.pxd", "_basis.pxd", + "_forward.pxd", }; /* "numpy.pxd":723 @@ -771,6 +772,42 @@ typedef __pyx_t_5numpy_ulong_t __pyx_t_7sklearn_5earth_5_util_INDEX_t; */ typedef __pyx_t_5numpy_uint8_t __pyx_t_7sklearn_5earth_5_util_BOOL_t; +/* "_forward.pxd":3 + * cimport numpy as cnp + * import numpy as np + * ctypedef cnp.float64_t FLOAT_t # <<<<<<<<<<<<<< + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t + */ +typedef __pyx_t_5numpy_float64_t __pyx_t_7sklearn_5earth_8_forward_FLOAT_t; + +/* "_forward.pxd":4 + * import numpy as np + * ctypedef cnp.float64_t FLOAT_t + * ctypedef cnp.intp_t INT_t # <<<<<<<<<<<<<< + * ctypedef cnp.ulong_t INDEX_t + * ctypedef cnp.uint8_t BOOL_t + */ +typedef __pyx_t_5numpy_intp_t __pyx_t_7sklearn_5earth_8_forward_INT_t; + +/* "_forward.pxd":5 + * ctypedef cnp.float64_t FLOAT_t + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t # <<<<<<<<<<<<<< + * ctypedef cnp.uint8_t BOOL_t + * from _basis cimport Basis + */ +typedef __pyx_t_5numpy_ulong_t __pyx_t_7sklearn_5earth_8_forward_INDEX_t; + +/* "_forward.pxd":6 + * ctypedef cnp.intp_t INT_t + * ctypedef cnp.ulong_t INDEX_t + * ctypedef cnp.uint8_t BOOL_t # <<<<<<<<<<<<<< + * from _basis cimport Basis + * from _record cimport ForwardPassRecord + */ +typedef __pyx_t_5numpy_uint8_t __pyx_t_7sklearn_5earth_8_forward_BOOL_t; + /* "sklearn/earth/_record.pxd":2 * cimport numpy as cnp * ctypedef cnp.float64_t FLOAT_t # <<<<<<<<<<<<<< @@ -835,11 +872,12 @@ struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction; struct __pyx_obj_7sklearn_5earth_7_record_Record; struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord; struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord; -struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction; +struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction; +struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser; struct __pyx_obj_7sklearn_5earth_7_record_PruningPassIteration; struct __pyx_obj_7sklearn_5earth_7_record_FirstPruningPassIteration; struct __pyx_obj_7sklearn_5earth_7_record_FirstForwardPassIteration; -struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction; +struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction; /* "numpy.pxd":762 * ctypedef npy_longdouble longdouble_t @@ -929,6 +967,22 @@ struct __pyx_opt_args_7sklearn_5earth_6_basis_19LinearBasisFunction_apply { int recurse; }; +/* "_forward.pxd":10 + * from _record cimport ForwardPassRecord + * + * ctypedef enum StoppingCondition: # <<<<<<<<<<<<<< + * MAXTERMS=0, + * MAXRSQ=1, + */ +enum __pyx_t_7sklearn_5earth_8_forward_StoppingCondition { + __pyx_e_7sklearn_5earth_8_forward_MAXTERMS = 0, + __pyx_e_7sklearn_5earth_8_forward_MAXRSQ = 1, + __pyx_e_7sklearn_5earth_8_forward_NOIMPRV = 2, + __pyx_e_7sklearn_5earth_8_forward_LOWGRSQ = 3, + __pyx_e_7sklearn_5earth_8_forward_NOCAND = 4 +}; +typedef enum __pyx_t_7sklearn_5earth_8_forward_StoppingCondition __pyx_t_7sklearn_5earth_8_forward_StoppingCondition; + /* "_basis.pxd":102 * * @@ -1051,20 +1105,68 @@ struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord { }; -/* "_basis.pxd":88 - * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) +/* "_basis.pxd":65 * - * cdef class LinearBasisFunction(BasisFunction): # <<<<<<<<<<<<<< - * cdef INDEX_t variable - * cdef str label + * + * cdef class HingeBasisFunction(BasisFunction): # <<<<<<<<<<<<<< + * cdef FLOAT_t knot + * cdef INDEX_t knot_idx */ -struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction { +struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction { struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction __pyx_base; + __pyx_t_7sklearn_5earth_6_basis_FLOAT_t knot; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t knot_idx; __pyx_t_7sklearn_5earth_6_basis_INDEX_t variable; + int reverse; PyObject *label; }; +/* "_forward.pxd":19 + * cdef dict stopping_conditions + * + * cdef class ForwardPasser: # <<<<<<<<<<<<<< + * + * #User selected parameters + */ +struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser { + PyObject_HEAD + struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *__pyx_vtab; + int endspan; + int minspan; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t endspan_alpha; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t minspan_alpha; + int max_terms; + int max_degree; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t thresh; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t penalty; + int check_every; + int min_search_points; + PyObject *xlabels; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t zero_tol; + PyArrayObject *X; + PyArrayObject *y; + PyArrayObject *sample_weight; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t m; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t n; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t sst; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t y_squared; + PyArrayObject *B; + PyArrayObject *B_orth; + PyArrayObject *c; + PyArrayObject *norms; + PyArrayObject *u; + PyArrayObject *B_orth_times_parent_cum; + __pyx_t_7sklearn_5earth_8_forward_FLOAT_t c_squared; + PyArrayObject *sort_tracker; + PyArrayObject *sorting; + PyArrayObject *mwork; + PyArrayObject *linear_variables; + struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *record; + struct __pyx_obj_7sklearn_5earth_6_basis_Basis *basis; +}; + + /* "sklearn/earth/_record.pxd":49 * cpdef INDEX_t get_size(Iteration self) * @@ -1101,19 +1203,16 @@ struct __pyx_obj_7sklearn_5earth_7_record_FirstForwardPassIteration { }; -/* "_basis.pxd":65 - * +/* "_basis.pxd":88 + * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) * - * cdef class HingeBasisFunction(BasisFunction): # <<<<<<<<<<<<<< - * cdef FLOAT_t knot - * cdef INDEX_t knot_idx + * cdef class LinearBasisFunction(BasisFunction): # <<<<<<<<<<<<<< + * cdef INDEX_t variable + * cdef str label */ -struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction { +struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction { struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction __pyx_base; - __pyx_t_7sklearn_5earth_6_basis_FLOAT_t knot; - __pyx_t_7sklearn_5earth_6_basis_INDEX_t knot_idx; __pyx_t_7sklearn_5earth_6_basis_INDEX_t variable; - int reverse; PyObject *label; }; @@ -1196,7 +1295,7 @@ static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_LinearBasisFunction *__py /* "sklearn/earth/_record.pyx":10 - * from . import _forward + * from ._forward cimport stopping_conditions * * cdef class Record: # <<<<<<<<<<<<<< * @@ -1213,19 +1312,42 @@ struct __pyx_vtabstruct_7sklearn_5earth_7_record_Record { static struct __pyx_vtabstruct_7sklearn_5earth_7_record_Record *__pyx_vtabptr_7sklearn_5earth_7_record_Record; -/* "sklearn/earth/_record.pyx":102 - * return result +/* "sklearn/earth/_record.pyx":50 + * return 1 - (gcv_/gcv0) * - * cdef class ForwardPassRecord(Record): # <<<<<<<<<<<<<< - * def __init__(ForwardPassRecord self, INDEX_t num_samples, INDEX_t num_variables, FLOAT_t penalty, FLOAT_t sst, list xlabels): + * cdef class PruningPassRecord(Record): # <<<<<<<<<<<<<< + * def __init__(PruningPassRecord self, INDEX_t num_samples, INDEX_t num_variables, FLOAT_t penalty, FLOAT_t sst, INDEX_t size, FLOAT_t mse): * self.num_samples = num_samples */ -struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord { +struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord { struct __pyx_vtabstruct_7sklearn_5earth_7_record_Record __pyx_base; - PyObject *(*set_stopping_condition)(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *, int, int __pyx_skip_dispatch); + PyObject *(*set_selected)(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *, __pyx_t_7sklearn_5earth_7_record_INDEX_t, int __pyx_skip_dispatch); + __pyx_t_7sklearn_5earth_7_record_INDEX_t (*get_selected)(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *, int __pyx_skip_dispatch); + PyObject *(*roll_back)(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *, struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, int __pyx_skip_dispatch); }; -static struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord *__pyx_vtabptr_7sklearn_5earth_7_record_ForwardPassRecord; +static struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord *__pyx_vtabptr_7sklearn_5earth_7_record_PruningPassRecord; + + +/* "_forward.pxd":19 + * cdef dict stopping_conditions + * + * cdef class ForwardPasser: # <<<<<<<<<<<<<< + * + * #User selected parameters + */ + +struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser { + struct __pyx_obj_7sklearn_5earth_6_basis_Basis *(*get_basis)(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *, int __pyx_skip_dispatch); + PyObject *(*init_linear_variables)(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *, int __pyx_skip_dispatch); + PyObject *(*run)(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *, int __pyx_skip_dispatch); + PyObject *(*stop_check)(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *); + int (*orthonormal_update)(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *, __pyx_t_7sklearn_5earth_8_forward_INDEX_t, int __pyx_skip_dispatch); + PyObject *(*orthonormal_downdate)(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *, __pyx_t_7sklearn_5earth_8_forward_INDEX_t, int __pyx_skip_dispatch); + PyObject *(*next_pair)(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *); + PyObject *(*best_knot)(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *, __pyx_t_7sklearn_5earth_8_forward_INDEX_t, __pyx_t_7sklearn_5earth_8_forward_INDEX_t, __pyx_t_7sklearn_5earth_8_forward_INDEX_t, PyArrayObject *, PyArrayObject *, __pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_t_7sklearn_5earth_8_forward_INDEX_t *); +}; +static struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *__pyx_vtabptr_7sklearn_5earth_8_forward_ForwardPasser; /* "_basis.pxd":65 @@ -1264,13 +1386,19 @@ struct __pyx_vtabstruct_7sklearn_5earth_6_basis_ConstantBasisFunction { static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_ConstantBasisFunction *__pyx_vtabptr_7sklearn_5earth_6_basis_ConstantBasisFunction; -struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord { +/* "sklearn/earth/_record.pyx":102 + * return result + * + * cdef class ForwardPassRecord(Record): # <<<<<<<<<<<<<< + * def __init__(ForwardPassRecord self, INDEX_t num_samples, INDEX_t num_variables, FLOAT_t penalty, FLOAT_t sst, list xlabels): + * self.num_samples = num_samples + */ + +struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord { struct __pyx_vtabstruct_7sklearn_5earth_7_record_Record __pyx_base; - PyObject *(*set_selected)(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *, __pyx_t_7sklearn_5earth_7_record_INDEX_t, int __pyx_skip_dispatch); - __pyx_t_7sklearn_5earth_7_record_INDEX_t (*get_selected)(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *, int __pyx_skip_dispatch); - PyObject *(*roll_back)(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *, struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, int __pyx_skip_dispatch); + PyObject *(*set_stopping_condition)(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *, int, int __pyx_skip_dispatch); }; -static struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord *__pyx_vtabptr_7sklearn_5earth_7_record_PruningPassRecord; +static struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord *__pyx_vtabptr_7sklearn_5earth_7_record_ForwardPassRecord; /* "sklearn/earth/_record.pyx":209 @@ -1463,8 +1591,6 @@ static PyObject *__Pyx_PyDict_GetItem(PyObject *d, PyObject* key) { #define __Pyx_PyDict_GetItem(d, key) PyObject_GetItem(d, key) #endif -static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name); /*proto*/ - #define __Pyx_GetItemInt(o, i, size, to_py_func, is_list, wraparound, boundscheck) \ (((size) <= sizeof(Py_ssize_t)) ? \ __Pyx_GetItemInt_Fast(o, i, is_list, wraparound, boundscheck) : \ @@ -1501,14 +1627,12 @@ static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ static void* __Pyx_GetVtable(PyObject *dict); /*proto*/ -static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name); /*proto*/ - -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/ - static CYTHON_INLINE npy_ulonglong __Pyx_PyInt_from_py_npy_ulonglong(PyObject *); static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_ulonglong(npy_ulonglong); +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); /*proto*/ + #if CYTHON_CCOMPLEX #ifdef __cplusplus #define __Pyx_CREAL(z) ((z).real()) @@ -1653,6 +1777,8 @@ static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, size_t size, int strict); /*proto*/ +static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig); /*proto*/ + static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig); /*proto*/ typedef struct { @@ -1713,6 +1839,11 @@ static PyTypeObject *__pyx_ptype_7sklearn_5earth_6_basis_Basis = 0; static __pyx_t_7sklearn_5earth_5_util_FLOAT_t (*__pyx_f_7sklearn_5earth_5_util_gcv)(__pyx_t_7sklearn_5earth_5_util_FLOAT_t, __pyx_t_7sklearn_5earth_5_util_INDEX_t, __pyx_t_7sklearn_5earth_5_util_INDEX_t, __pyx_t_7sklearn_5earth_5_util_FLOAT_t, int __pyx_skip_dispatch); /*proto*/ static PyObject *(*__pyx_f_7sklearn_5earth_5_util_ascii_table)(PyObject *, PyObject *, int __pyx_skip_dispatch); /*proto*/ +/* Module declarations from 'sklearn.earth._forward' */ +static PyTypeObject *__pyx_ptype_7sklearn_5earth_8_forward_ForwardPasser = 0; +static PyObject **__pyx_vp_7sklearn_5earth_8_forward_stopping_conditions = 0; +#define __pyx_v_7sklearn_5earth_8_forward_stopping_conditions (*__pyx_vp_7sklearn_5earth_8_forward_stopping_conditions) + /* Module declarations from 'sklearn.earth._record' */ static PyTypeObject *__pyx_ptype_7sklearn_5earth_7_record_Iteration = 0; static PyTypeObject *__pyx_ptype_7sklearn_5earth_7_record_ForwardPassIteration = 0; @@ -1854,7 +1985,6 @@ static char __pyx_k__unprune[] = "unprune"; static char __pyx_k__xlabels[] = "xlabels"; static char __pyx_k____main__[] = "__main__"; static char __pyx_k____test__[] = "__test__"; -static char __pyx_k___forward[] = "_forward"; static char __pyx_k__get_size[] = "get_size"; static char __pyx_k__selected[] = "selected"; static char __pyx_k__variable[] = "variable"; @@ -1874,7 +2004,6 @@ static char __pyx_k__num_variables[] = "num_variables"; static char __pyx_k__NotImplemented[] = "NotImplemented"; static char __pyx_k____pyx_vtable__[] = "__pyx_vtable__"; static char __pyx_k__set_no_candidates[] = "set_no_candidates"; -static char __pyx_k__stopping_conditions[] = "stopping_conditions"; static PyObject *__pyx_kp_s_1; static PyObject *__pyx_n_s_10; static PyObject *__pyx_kp_s_12; @@ -1907,7 +2036,6 @@ static PyObject *__pyx_n_s____main__; static PyObject *__pyx_n_s____pyx_vtable__; static PyObject *__pyx_n_s____test__; static PyObject *__pyx_n_s___eq; -static PyObject *__pyx_n_s___forward; static PyObject *__pyx_n_s___getstate; static PyObject *__pyx_n_s__append; static PyObject *__pyx_n_s__enumerate; @@ -1935,7 +2063,6 @@ static PyObject *__pyx_n_s__set_selected; static PyObject *__pyx_n_s__size; static PyObject *__pyx_n_s__split; static PyObject *__pyx_n_s__sst; -static PyObject *__pyx_n_s__stopping_conditions; static PyObject *__pyx_n_s__terms; static PyObject *__pyx_n_s__unprune; static PyObject *__pyx_n_s__var; @@ -5224,7 +5351,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_10__str__ * result = '' * result += 'Forward Pass\n' # <<<<<<<<<<<<<< * result += ascii_table(header, data) - * result += '\nStopping Condition %d: %s\n' % (self.stopping_condition, _forward.stopping_conditions[self.stopping_condition]) + * result += '\nStopping Condition %d: %s\n' % (self.stopping_condition, stopping_conditions[self.stopping_condition]) */ __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_14)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); @@ -5236,7 +5363,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_10__str__ * result = '' * result += 'Forward Pass\n' * result += ascii_table(header, data) # <<<<<<<<<<<<<< - * result += '\nStopping Condition %d: %s\n' % (self.stopping_condition, _forward.stopping_conditions[self.stopping_condition]) + * result += '\nStopping Condition %d: %s\n' % (self.stopping_condition, stopping_conditions[self.stopping_condition]) * return result */ __pyx_t_1 = __pyx_f_7sklearn_5earth_5_util_ascii_table(((PyObject *)__pyx_v_header), ((PyObject *)__pyx_v_data), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -5251,20 +5378,18 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_10__str__ /* "sklearn/earth/_record.pyx":141 * result += 'Forward Pass\n' * result += ascii_table(header, data) - * result += '\nStopping Condition %d: %s\n' % (self.stopping_condition, _forward.stopping_conditions[self.stopping_condition]) # <<<<<<<<<<<<<< + * result += '\nStopping Condition %d: %s\n' % (self.stopping_condition, stopping_conditions[self.stopping_condition]) # <<<<<<<<<<<<<< * return result * */ __pyx_t_2 = PyInt_FromLong(__pyx_v_self->stopping_condition); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s___forward); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__stopping_conditions); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_9, __pyx_v_self->stopping_condition, sizeof(int), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(((PyObject *)__pyx_v_7sklearn_5earth_8_forward_stopping_conditions) == Py_None)) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_7sklearn_5earth_8_forward_stopping_conditions), __pyx_v_self->stopping_condition, sizeof(int), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2); @@ -5285,7 +5410,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_10__str__ /* "sklearn/earth/_record.pyx":142 * result += ascii_table(header, data) - * result += '\nStopping Condition %d: %s\n' % (self.stopping_condition, _forward.stopping_conditions[self.stopping_condition]) + * result += '\nStopping Condition %d: %s\n' % (self.stopping_condition, stopping_conditions[self.stopping_condition]) * return result # <<<<<<<<<<<<<< * * cdef class Iteration: @@ -10795,7 +10920,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s____pyx_vtable__, __pyx_k____pyx_vtable__, sizeof(__pyx_k____pyx_vtable__), 0, 0, 1, 1}, {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, {&__pyx_n_s___eq, __pyx_k___eq, sizeof(__pyx_k___eq), 0, 0, 1, 1}, - {&__pyx_n_s___forward, __pyx_k___forward, sizeof(__pyx_k___forward), 0, 0, 1, 1}, {&__pyx_n_s___getstate, __pyx_k___getstate, sizeof(__pyx_k___getstate), 0, 0, 1, 1}, {&__pyx_n_s__append, __pyx_k__append, sizeof(__pyx_k__append), 0, 0, 1, 1}, {&__pyx_n_s__enumerate, __pyx_k__enumerate, sizeof(__pyx_k__enumerate), 0, 0, 1, 1}, @@ -10823,7 +10947,6 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s__size, __pyx_k__size, sizeof(__pyx_k__size), 0, 0, 1, 1}, {&__pyx_n_s__split, __pyx_k__split, sizeof(__pyx_k__split), 0, 0, 1, 1}, {&__pyx_n_s__sst, __pyx_k__sst, sizeof(__pyx_k__sst), 0, 0, 1, 1}, - {&__pyx_n_s__stopping_conditions, __pyx_k__stopping_conditions, sizeof(__pyx_k__stopping_conditions), 0, 0, 1, 1}, {&__pyx_n_s__terms, __pyx_k__terms, sizeof(__pyx_k__terms), 0, 0, 1, 1}, {&__pyx_n_s__unprune, __pyx_k__unprune, sizeof(__pyx_k__unprune), 0, 0, 1, 1}, {&__pyx_n_s__var, __pyx_k__var, sizeof(__pyx_k__var), 0, 0, 1, 1}, @@ -11138,35 +11261,19 @@ PyMODINIT_FUNC PyInit__record(void) __pyx_vtabptr_7sklearn_5earth_6_basis_LinearBasisFunction = (struct __pyx_vtabstruct_7sklearn_5earth_6_basis_LinearBasisFunction*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_6_basis_LinearBasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_6_basis_LinearBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_5earth_6_basis_Basis = __Pyx_ImportType("sklearn.earth._basis", "Basis", sizeof(struct __pyx_obj_7sklearn_5earth_6_basis_Basis), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_6_basis_Basis)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_vtabptr_7sklearn_5earth_6_basis_Basis = (struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_6_basis_Basis->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_6_basis_Basis)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_8_forward_ForwardPasser = __Pyx_ImportType("sklearn.earth._forward", "ForwardPasser", sizeof(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_8_forward_ForwardPasser)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5earth_8_forward_ForwardPasser = (struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_8_forward_ForwardPasser->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_8_forward_ForwardPasser)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Variable import code ---*/ - /*--- Function import code ---*/ - __pyx_t_1 = __Pyx_ImportModule("sklearn.earth._util"); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_ImportFunction(__pyx_t_1, "gcv", (void (**)(void))&__pyx_f_7sklearn_5earth_5_util_gcv, "__pyx_t_7sklearn_5earth_5_util_FLOAT_t (__pyx_t_7sklearn_5earth_5_util_FLOAT_t, __pyx_t_7sklearn_5earth_5_util_INDEX_t, __pyx_t_7sklearn_5earth_5_util_INDEX_t, __pyx_t_7sklearn_5earth_5_util_FLOAT_t, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_ImportFunction(__pyx_t_1, "ascii_table", (void (**)(void))&__pyx_f_7sklearn_5earth_5_util_ascii_table, "PyObject *(PyObject *, PyObject *, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_ImportModule("sklearn.earth._forward"); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportVoidPtr(__pyx_t_1, "stopping_conditions", (void **)&__pyx_vp_7sklearn_5earth_8_forward_stopping_conditions, "PyObject *") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_t_1); __pyx_t_1 = 0; + /*--- Function import code ---*/ + __pyx_t_2 = __Pyx_ImportModule("sklearn.earth._util"); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_t_2, "gcv", (void (**)(void))&__pyx_f_7sklearn_5earth_5_util_gcv, "__pyx_t_7sklearn_5earth_5_util_FLOAT_t (__pyx_t_7sklearn_5earth_5_util_FLOAT_t, __pyx_t_7sklearn_5earth_5_util_INDEX_t, __pyx_t_7sklearn_5earth_5_util_INDEX_t, __pyx_t_7sklearn_5earth_5_util_FLOAT_t, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_t_2, "ascii_table", (void (**)(void))&__pyx_f_7sklearn_5earth_5_util_ascii_table, "PyObject *(PyObject *, PyObject *, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + Py_DECREF(__pyx_t_2); __pyx_t_2 = 0; /*--- Execution code ---*/ - /* "sklearn/earth/_record.pyx":8 - * - * from ._util cimport gcv, ascii_table - * from . import _forward # <<<<<<<<<<<<<< - * - * cdef class Record: - */ - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(((PyObject *)__pyx_n_s___forward)); - PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s___forward)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s___forward)); - __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_kp_s_1), ((PyObject *)__pyx_t_2), 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_ImportFrom(__pyx_t_3, __pyx_n_s___forward); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s___forward, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/earth/_record.pyx":1 * # distutils: language = c # <<<<<<<<<<<<<< * # cython: cdivision = True @@ -11455,23 +11562,6 @@ static int __Pyx_ParseOptionalKeywords( return -1; } -static CYTHON_INLINE PyObject *__Pyx_GetModuleGlobalName(PyObject *name) { - PyObject *result; -#if CYTHON_COMPILING_IN_CPYTHON - result = PyDict_GetItem(__pyx_d, name); - if (result) { - Py_INCREF(result); - } else { -#else - result = PyObject_GetItem(__pyx_d, name); - if (!result) { - PyErr_Clear(); -#endif - result = __Pyx_GetBuiltinName(name); - } - return result; -} - static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; if (!j) return NULL; @@ -11798,17 +11888,86 @@ static void* __Pyx_GetVtable(PyObject *dict) { return NULL; } -static PyObject* __Pyx_ImportFrom(PyObject* module, PyObject* name) { - PyObject* value = __Pyx_PyObject_GetAttrStr(module, name); - if (unlikely(!value) && PyErr_ExceptionMatches(PyExc_AttributeError)) { - PyErr_Format(PyExc_ImportError, - #if PY_MAJOR_VERSION < 3 - "cannot import name %.230s", PyString_AS_STRING(name)); +static CYTHON_INLINE npy_ulonglong __Pyx_PyInt_from_py_npy_ulonglong(PyObject* x) { + const npy_ulonglong neg_one = (npy_ulonglong)-1, const_zero = (npy_ulonglong)0; + const int is_unsigned = const_zero < neg_one; + if (sizeof(npy_ulonglong) == sizeof(char)) { + if (is_unsigned) + return (npy_ulonglong)__Pyx_PyInt_AsUnsignedChar(x); + else + return (npy_ulonglong)__Pyx_PyInt_AsSignedChar(x); + } else if (sizeof(npy_ulonglong) == sizeof(short)) { + if (is_unsigned) + return (npy_ulonglong)__Pyx_PyInt_AsUnsignedShort(x); + else + return (npy_ulonglong)__Pyx_PyInt_AsSignedShort(x); + } else if (sizeof(npy_ulonglong) == sizeof(int)) { + if (is_unsigned) + return (npy_ulonglong)__Pyx_PyInt_AsUnsignedInt(x); + else + return (npy_ulonglong)__Pyx_PyInt_AsSignedInt(x); + } else if (sizeof(npy_ulonglong) == sizeof(long)) { + if (is_unsigned) + return (npy_ulonglong)__Pyx_PyInt_AsUnsignedLong(x); + else + return (npy_ulonglong)__Pyx_PyInt_AsSignedLong(x); + } else if (sizeof(npy_ulonglong) == sizeof(PY_LONG_LONG)) { + if (is_unsigned) + return (npy_ulonglong)__Pyx_PyInt_AsUnsignedLongLong(x); + else + return (npy_ulonglong)__Pyx_PyInt_AsSignedLongLong(x); + } else { + #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) + PyErr_SetString(PyExc_RuntimeError, + "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); #else - "cannot import name %S", name); + npy_ulonglong val; + PyObject *v = __Pyx_PyNumber_Int(x); + #if PY_MAJOR_VERSION < 3 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } + #endif + return (npy_ulonglong)-1; + } +} + +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_ulonglong(npy_ulonglong val) { + const npy_ulonglong neg_one = (npy_ulonglong)-1, const_zero = (npy_ulonglong)0; + const int is_unsigned = const_zero < neg_one; + if ((sizeof(npy_ulonglong) == sizeof(char)) || + (sizeof(npy_ulonglong) == sizeof(short))) { + return PyInt_FromLong((long)val); + } else if ((sizeof(npy_ulonglong) == sizeof(int)) || + (sizeof(npy_ulonglong) == sizeof(long))) { + if (is_unsigned) + return PyLong_FromUnsignedLong((unsigned long)val); + else + return PyInt_FromLong((long)val); + } else if (sizeof(npy_ulonglong) == sizeof(PY_LONG_LONG)) { + if (is_unsigned) + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); + else + return PyLong_FromLongLong((PY_LONG_LONG)val); + } else { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + return _PyLong_FromByteArray(bytes, sizeof(npy_ulonglong), + little, !is_unsigned); } - return value; } static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { @@ -11893,88 +12052,6 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level) { return module; } -static CYTHON_INLINE npy_ulonglong __Pyx_PyInt_from_py_npy_ulonglong(PyObject* x) { - const npy_ulonglong neg_one = (npy_ulonglong)-1, const_zero = (npy_ulonglong)0; - const int is_unsigned = const_zero < neg_one; - if (sizeof(npy_ulonglong) == sizeof(char)) { - if (is_unsigned) - return (npy_ulonglong)__Pyx_PyInt_AsUnsignedChar(x); - else - return (npy_ulonglong)__Pyx_PyInt_AsSignedChar(x); - } else if (sizeof(npy_ulonglong) == sizeof(short)) { - if (is_unsigned) - return (npy_ulonglong)__Pyx_PyInt_AsUnsignedShort(x); - else - return (npy_ulonglong)__Pyx_PyInt_AsSignedShort(x); - } else if (sizeof(npy_ulonglong) == sizeof(int)) { - if (is_unsigned) - return (npy_ulonglong)__Pyx_PyInt_AsUnsignedInt(x); - else - return (npy_ulonglong)__Pyx_PyInt_AsSignedInt(x); - } else if (sizeof(npy_ulonglong) == sizeof(long)) { - if (is_unsigned) - return (npy_ulonglong)__Pyx_PyInt_AsUnsignedLong(x); - else - return (npy_ulonglong)__Pyx_PyInt_AsSignedLong(x); - } else if (sizeof(npy_ulonglong) == sizeof(PY_LONG_LONG)) { - if (is_unsigned) - return (npy_ulonglong)__Pyx_PyInt_AsUnsignedLongLong(x); - else - return (npy_ulonglong)__Pyx_PyInt_AsSignedLongLong(x); - } else { - #if CYTHON_COMPILING_IN_PYPY && !defined(_PyLong_AsByteArray) - PyErr_SetString(PyExc_RuntimeError, - "_PyLong_AsByteArray() not available in PyPy, cannot convert large numbers"); - #else - npy_ulonglong val; - PyObject *v = __Pyx_PyNumber_Int(x); - #if PY_MAJOR_VERSION < 3 - if (likely(v) && !PyLong_Check(v)) { - PyObject *tmp = v; - v = PyNumber_Long(tmp); - Py_DECREF(tmp); - } - #endif - if (likely(v)) { - int one = 1; int is_little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - int ret = _PyLong_AsByteArray((PyLongObject *)v, - bytes, sizeof(val), - is_little, !is_unsigned); - Py_DECREF(v); - if (likely(!ret)) - return val; - } - #endif - return (npy_ulonglong)-1; - } -} - -static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_ulonglong(npy_ulonglong val) { - const npy_ulonglong neg_one = (npy_ulonglong)-1, const_zero = (npy_ulonglong)0; - const int is_unsigned = const_zero < neg_one; - if ((sizeof(npy_ulonglong) == sizeof(char)) || - (sizeof(npy_ulonglong) == sizeof(short))) { - return PyInt_FromLong((long)val); - } else if ((sizeof(npy_ulonglong) == sizeof(int)) || - (sizeof(npy_ulonglong) == sizeof(long))) { - if (is_unsigned) - return PyLong_FromUnsignedLong((unsigned long)val); - else - return PyInt_FromLong((long)val); - } else if (sizeof(npy_ulonglong) == sizeof(PY_LONG_LONG)) { - if (is_unsigned) - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); - else - return PyLong_FromLongLong((PY_LONG_LONG)val); - } else { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - return _PyLong_FromByteArray(bytes, sizeof(npy_ulonglong), - little, !is_unsigned); - } -} - #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { @@ -12875,6 +12952,54 @@ static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class } #endif +#ifndef __PYX_HAVE_RT_ImportVoidPtr +#define __PYX_HAVE_RT_ImportVoidPtr +static int __Pyx_ImportVoidPtr(PyObject *module, const char *name, void **p, const char *sig) { + PyObject *d = 0; + PyObject *cobj = 0; + d = PyObject_GetAttrString(module, (char *)"__pyx_capi__"); + if (!d) + goto bad; + cobj = PyDict_GetItemString(d, name); + if (!cobj) { + PyErr_Format(PyExc_ImportError, + "%s does not export expected C variable %s", + PyModule_GetName(module), name); + goto bad; + } +#if PY_VERSION_HEX >= 0x02070000 && !(PY_MAJOR_VERSION==3 && PY_MINOR_VERSION==0) + if (!PyCapsule_IsValid(cobj, sig)) { + PyErr_Format(PyExc_TypeError, + "C variable %s.%s has wrong signature (expected %s, got %s)", + PyModule_GetName(module), name, sig, PyCapsule_GetName(cobj)); + goto bad; + } + *p = PyCapsule_GetPointer(cobj, sig); +#else + {const char *desc, *s1, *s2; + desc = (const char *)PyCObject_GetDesc(cobj); + if (!desc) + goto bad; + s1 = desc; s2 = sig; + while (*s1 != '\0' && *s1 == *s2) { s1++; s2++; } + if (*s1 != *s2) { + PyErr_Format(PyExc_TypeError, + "C variable %s.%s has wrong signature (expected %s, got %s)", + PyModule_GetName(module), name, sig, desc); + goto bad; + } + *p = PyCObject_AsVoidPtr(cobj);} +#endif + if (!(*p)) + goto bad; + Py_DECREF(d); + return 0; +bad: + Py_XDECREF(d); + return -1; +} +#endif + #ifndef __PYX_HAVE_RT_ImportFunction #define __PYX_HAVE_RT_ImportFunction static int __Pyx_ImportFunction(PyObject *module, const char *funcname, void (**f)(void), const char *sig) { diff --git a/sklearn/earth/_record.pyx b/sklearn/earth/_record.pyx index 64d2baac04720..517bf5b95760e 100644 --- a/sklearn/earth/_record.pyx +++ b/sklearn/earth/_record.pyx @@ -5,7 +5,7 @@ # cython: profile = False from ._util cimport gcv, ascii_table -from . import _forward +from ._forward cimport stopping_conditions cdef class Record: @@ -138,7 +138,7 @@ cdef class ForwardPassRecord(Record): result = '' result += 'Forward Pass\n' result += ascii_table(header, data) - result += '\nStopping Condition %d: %s\n' % (self.stopping_condition, _forward.stopping_conditions[self.stopping_condition]) + result += '\nStopping Condition %d: %s\n' % (self.stopping_condition, stopping_conditions[self.stopping_condition]) return result cdef class Iteration: diff --git a/sklearn/earth/_util.c b/sklearn/earth/_util.c index 1631ae584aa18..df020ca6758a6 100644 --- a/sklearn/earth/_util.c +++ b/sklearn/earth/_util.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19.1 on Thu Jul 25 23:27:59 2013 */ +/* Generated by Cython 0.19.1 on Sat Jul 27 17:29:30 2013 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS From 8ad25217ea0da537cc162dd94813f3636b1f01a0 Mon Sep 17 00:00:00 2001 From: Jason Rudy Date: Sat, 27 Jul 2013 17:52:43 -0700 Subject: [PATCH 09/19] Made the tests use relative imports --- sklearn/earth/_basis.c | 2 +- sklearn/earth/_forward.c | 2 +- sklearn/earth/_pruning.c | 2 +- sklearn/earth/_record.c | 2 +- sklearn/earth/_util.c | 2 +- sklearn/earth/tests/test_basis.py | 2 +- sklearn/earth/tests/test_earth.py | 6 +++--- sklearn/earth/tests/test_forward.py | 4 ++-- sklearn/earth/tests/test_record.py | 4 ++-- 9 files changed, 13 insertions(+), 13 deletions(-) diff --git a/sklearn/earth/_basis.c b/sklearn/earth/_basis.c index bc74800b6f9ec..39c5b85532efe 100644 --- a/sklearn/earth/_basis.c +++ b/sklearn/earth/_basis.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19.1 on Sat Jul 27 17:29:30 2013 */ +/* Generated by Cython 0.19.1 on Sat Jul 27 17:46:22 2013 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS diff --git a/sklearn/earth/_forward.c b/sklearn/earth/_forward.c index d54d822c41a7a..72dc2e2ea7372 100644 --- a/sklearn/earth/_forward.c +++ b/sklearn/earth/_forward.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19.1 on Sat Jul 27 17:29:30 2013 */ +/* Generated by Cython 0.19.1 on Sat Jul 27 17:46:22 2013 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS diff --git a/sklearn/earth/_pruning.c b/sklearn/earth/_pruning.c index 77e54e372ada2..c190ca5ebf835 100644 --- a/sklearn/earth/_pruning.c +++ b/sklearn/earth/_pruning.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19.1 on Sat Jul 27 17:29:30 2013 */ +/* Generated by Cython 0.19.1 on Sat Jul 27 17:46:22 2013 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS diff --git a/sklearn/earth/_record.c b/sklearn/earth/_record.c index 1cc8a011b2449..63e7dcb2ce5e6 100644 --- a/sklearn/earth/_record.c +++ b/sklearn/earth/_record.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19.1 on Sat Jul 27 17:29:30 2013 */ +/* Generated by Cython 0.19.1 on Sat Jul 27 17:46:22 2013 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS diff --git a/sklearn/earth/_util.c b/sklearn/earth/_util.c index df020ca6758a6..a347b6e24394e 100644 --- a/sklearn/earth/_util.c +++ b/sklearn/earth/_util.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19.1 on Sat Jul 27 17:29:30 2013 */ +/* Generated by Cython 0.19.1 on Sat Jul 27 17:46:22 2013 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS diff --git a/sklearn/earth/tests/test_basis.py b/sklearn/earth/tests/test_basis.py index 7a3de7ea9348f..8f6688a94f27f 100644 --- a/sklearn/earth/tests/test_basis.py +++ b/sklearn/earth/tests/test_basis.py @@ -4,7 +4,7 @@ @author: jasonrudy ''' from nose.tools import assert_true, assert_false, assert_equal -from sklearn.earth._basis import Basis, ConstantBasisFunction, HingeBasisFunction, LinearBasisFunction +from .._basis import Basis, ConstantBasisFunction, HingeBasisFunction, LinearBasisFunction import numpy import pickle import os diff --git a/sklearn/earth/tests/test_earth.py b/sklearn/earth/tests/test_earth.py index 444c6318a1c39..b5f1dae02824f 100644 --- a/sklearn/earth/tests/test_earth.py +++ b/sklearn/earth/tests/test_earth.py @@ -4,12 +4,12 @@ @author: jasonrudy ''' import numpy -from sklearn.earth._basis import Basis, ConstantBasisFunction, HingeBasisFunction, LinearBasisFunction -from sklearn.earth import Earth +from .._basis import Basis, ConstantBasisFunction, HingeBasisFunction, LinearBasisFunction +from .. import Earth import pickle import copy import os -from testing_utils import if_statsmodels, if_pandas, if_patsy +from .testing_utils import if_statsmodels, if_pandas, if_patsy from nose.tools import assert_equal, assert_not_equal, assert_true, assert_false, \ assert_almost_equal, assert_list_equal diff --git a/sklearn/earth/tests/test_forward.py b/sklearn/earth/tests/test_forward.py index 7fce0db2465e9..e15a45076bf5f 100644 --- a/sklearn/earth/tests/test_forward.py +++ b/sklearn/earth/tests/test_forward.py @@ -3,8 +3,8 @@ @author: jasonrudy ''' -from sklearn.earth._forward import ForwardPasser -from sklearn.earth._basis import Basis, ConstantBasisFunction, HingeBasisFunction, LinearBasisFunction +from .._forward import ForwardPasser +from .._basis import Basis, ConstantBasisFunction, HingeBasisFunction, LinearBasisFunction import numpy import os from nose.tools import assert_true, assert_equal diff --git a/sklearn/earth/tests/test_record.py b/sklearn/earth/tests/test_record.py index 60583c1b7d8ca..b3eb0163dbb91 100644 --- a/sklearn/earth/tests/test_record.py +++ b/sklearn/earth/tests/test_record.py @@ -1,5 +1,5 @@ -from sklearn.earth._record import ForwardPassRecord, ForwardPassIteration, PruningPassRecord, PruningPassIteration -from sklearn.earth._util import gcv +from .._record import ForwardPassRecord, ForwardPassIteration, PruningPassRecord, PruningPassIteration +from .._util import gcv from nose.tools import assert_true, assert_equal, assert_list_equal class TestForwardPassRecord(object): From a328d075aff4a18f0cee47362231cb51ba648b29 Mon Sep 17 00:00:00 2001 From: Jason Rudy Date: Sat, 27 Jul 2013 21:53:00 -0700 Subject: [PATCH 10/19] Made Earth pass the common tests --- sklearn/earth/_basis.c | 957 ++++++++++++++++------------ sklearn/earth/_basis.pxd | 1 + sklearn/earth/_basis.pyx | 5 +- sklearn/earth/_forward.c | 21 +- sklearn/earth/_forward.pyx | 2 +- sklearn/earth/_pruning.c | 3 +- sklearn/earth/_record.c | 3 +- sklearn/earth/_util.c | 2 +- sklearn/earth/earth.py | 18 + sklearn/earth/tests/test_basis.py | 2 +- sklearn/earth/tests/test_earth.py | 2 +- sklearn/earth/tests/test_forward.py | 2 +- 12 files changed, 583 insertions(+), 435 deletions(-) diff --git a/sklearn/earth/_basis.c b/sklearn/earth/_basis.c index 39c5b85532efe..c03c8b0632468 100644 --- a/sklearn/earth/_basis.c +++ b/sklearn/earth/_basis.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19.1 on Sat Jul 27 17:46:22 2013 */ +/* Generated by Cython 0.19.1 on Sat Jul 27 21:13:14 2013 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS @@ -508,6 +508,7 @@ static const char *__pyx_filename; static const char *__pyx_f[] = { "_basis.pyx", + "_basis.pxd", "numpy.pxd", "type.pxd", }; @@ -934,6 +935,7 @@ struct __pyx_obj_7sklearn_5earth_6_basis_Basis { PyObject_HEAD struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *__pyx_vtab; PyObject *order; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t num_variables; }; @@ -980,7 +982,7 @@ struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction { }; -/* "sklearn/earth/_basis.pyx":507 +/* "sklearn/earth/_basis.pyx":508 * return self.__class__ is other.__class__ and self._getstate() == other._getstate() * * def piter(Basis self): # <<<<<<<<<<<<<< @@ -1335,6 +1337,8 @@ static int __Pyx_IternextUnpackEndCheck(PyObject *retval, Py_ssize_t expected); static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_ulonglong(npy_ulonglong); + typedef struct { Py_ssize_t shape, strides, suboffsets; } __Pyx_Buf_DimInfo; @@ -1364,8 +1368,6 @@ static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list, int level); / static CYTHON_INLINE npy_ulonglong __Pyx_PyInt_from_py_npy_ulonglong(PyObject *); -static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_ulonglong(npy_ulonglong); - #if CYTHON_CCOMPLEX #ifdef __cplusplus #define __Pyx_CREAL(z) ((z).real()) @@ -1672,7 +1674,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_10scale( static PyObject *__pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_12__str__(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_14get_variable(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_16apply(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_b, int __pyx_v_recurse); /* proto */ -static int __pyx_pf_7sklearn_5earth_6_basis_5Basis___init__(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self); /* proto */ +static int __pyx_pf_7sklearn_5earth_6_basis_5Basis___init__(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self, PyObject *__pyx_v_num_variables); /* proto */ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_2__reduce__(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_4_getstate(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_6__setstate__(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self, PyObject *__pyx_v_state); /* proto */ @@ -1691,6 +1693,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_31__getitem__(struct __ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_33plen(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self); /* proto */ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_35transform(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_B); /* proto */ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_37weighted_transform(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self, PyArrayObject *__pyx_v_X, PyArrayObject *__pyx_v_B, PyArrayObject *__pyx_v_weights); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_13num_variables___get__(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self); /* proto */ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ static PyObject *__pyx_tp_new_7sklearn_5earth_6_basis_Basis(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ @@ -1807,6 +1810,7 @@ static char __pyx_k__get_variable[] = "get_variable"; static char __pyx_k__variable_idx[] = "variable_idx"; static char __pyx_k__is_splittable[] = "is_splittable"; static char __pyx_k__minspan_alpha[] = "minspan_alpha"; +static char __pyx_k__num_variables[] = "num_variables"; static char __pyx_k__NotImplemented[] = "NotImplemented"; static char __pyx_k____pyx_vtable__[] = "__pyx_vtable__"; static char __pyx_k____pyx_getbuffer[] = "__pyx_getbuffer"; @@ -1890,6 +1894,7 @@ static PyObject *__pyx_n_s__minspan; static PyObject *__pyx_n_s__minspan_alpha; static PyObject *__pyx_n_s__n; static PyObject *__pyx_n_s__np; +static PyObject *__pyx_n_s__num_variables; static PyObject *__pyx_n_s__numpy; static PyObject *__pyx_n_s__order; static PyObject *__pyx_n_s__parent; @@ -11583,13 +11588,49 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_16apply( /* Python wrapper */ static int __pyx_pw_7sklearn_5earth_6_basis_5Basis_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pw_7sklearn_5earth_6_basis_5Basis_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyObject *__pyx_v_num_variables = 0; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; int __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__ (wrapper)", 0); - if (unlikely(PyTuple_GET_SIZE(__pyx_args) > 0)) { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 0, 0, PyTuple_GET_SIZE(__pyx_args)); return -1;} - if (unlikely(__pyx_kwds) && unlikely(PyDict_Size(__pyx_kwds) > 0) && unlikely(!__Pyx_CheckKeywordStrings(__pyx_kwds, "__init__", 0))) return -1; - __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_5Basis___init__(((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)__pyx_v_self)); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__num_variables,0}; + PyObject* values[1] = {0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__num_variables)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + } + __pyx_v_num_variables = values[0]; + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("sklearn.earth._basis.Basis.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return -1; + __pyx_L4_argument_unpacking_done:; + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_5Basis___init__(((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)__pyx_v_self), __pyx_v_num_variables); __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -11597,15 +11638,16 @@ static int __pyx_pw_7sklearn_5earth_6_basis_5Basis_1__init__(PyObject *__pyx_v_s /* "sklearn/earth/_basis.pyx":484 * added.''' * - * def __init__(Basis self): #@DuplicatedSignature # <<<<<<<<<<<<<< + * def __init__(Basis self, num_variables): #@DuplicatedSignature # <<<<<<<<<<<<<< * self.order = [] - * + * self.num_variables = num_variables */ -static int __pyx_pf_7sklearn_5earth_6_basis_5Basis___init__(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self) { +static int __pyx_pf_7sklearn_5earth_6_basis_5Basis___init__(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self, PyObject *__pyx_v_num_variables) { int __pyx_r; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_t_2; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -11613,10 +11655,10 @@ static int __pyx_pf_7sklearn_5earth_6_basis_5Basis___init__(struct __pyx_obj_7sk /* "sklearn/earth/_basis.pyx":485 * - * def __init__(Basis self): #@DuplicatedSignature + * def __init__(Basis self, num_variables): #@DuplicatedSignature * self.order = [] # <<<<<<<<<<<<<< + * self.num_variables = num_variables * - * def __reduce__(self): */ __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); @@ -11626,6 +11668,16 @@ static int __pyx_pf_7sklearn_5earth_6_basis_5Basis___init__(struct __pyx_obj_7sk __pyx_v_self->order = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; + /* "sklearn/earth/_basis.pyx":486 + * def __init__(Basis self, num_variables): #@DuplicatedSignature + * self.order = [] + * self.num_variables = num_variables # <<<<<<<<<<<<<< + * + * def __reduce__(self): + */ + __pyx_t_2 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_num_variables); if (unlikely((__pyx_t_2 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_self->num_variables = __pyx_t_2; + __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; @@ -11648,11 +11700,11 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_3__reduce__(PyObject *_ return __pyx_r; } -/* "sklearn/earth/_basis.pyx":487 - * self.order = [] +/* "sklearn/earth/_basis.pyx":488 + * self.num_variables = num_variables * * def __reduce__(self): # <<<<<<<<<<<<<< - * return (self.__class__, (), self._getstate()) + * return (self.__class__, (self.num_variables,), self._getstate()) * */ @@ -11662,37 +11714,45 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_2__reduce__(struct __py PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce__", 0); - /* "sklearn/earth/_basis.pyx":488 + /* "sklearn/earth/_basis.pyx":489 * * def __reduce__(self): - * return (self.__class__, (), self._getstate()) # <<<<<<<<<<<<<< + * return (self.__class__, (self.num_variables,), self._getstate()) # <<<<<<<<<<<<<< * * def _getstate(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->num_variables); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_empty_tuple)); - PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_empty_tuple)); - __Pyx_GIVEREF(((PyObject *)__pyx_empty_tuple)); - PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_t_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); __pyx_t_1 = 0; __pyx_t_3 = 0; + __pyx_t_4 = 0; __pyx_r = ((PyObject *)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; @@ -11703,6 +11763,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_2__reduce__(struct __py __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("sklearn.earth._basis.Basis.__reduce__", __pyx_clineno, __pyx_lineno, __pyx_filename); __pyx_r = NULL; __pyx_L0:; @@ -11722,8 +11783,8 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_5_getstate(PyObject *__ return __pyx_r; } -/* "sklearn/earth/_basis.pyx":490 - * return (self.__class__, (), self._getstate()) +/* "sklearn/earth/_basis.pyx":491 + * return (self.__class__, (self.num_variables,), self._getstate()) * * def _getstate(self): # <<<<<<<<<<<<<< * return {'order': self.order} @@ -11739,7 +11800,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_4_getstate(struct __pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_getstate", 0); - /* "sklearn/earth/_basis.pyx":491 + /* "sklearn/earth/_basis.pyx":492 * * def _getstate(self): * return {'order': self.order} # <<<<<<<<<<<<<< @@ -11747,9 +11808,9 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_4_getstate(struct __pyx * def __setstate__(self, state): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_v_self->order)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_v_self->order)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; @@ -11777,7 +11838,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_7__setstate__(PyObject return __pyx_r; } -/* "sklearn/earth/_basis.pyx":493 +/* "sklearn/earth/_basis.pyx":494 * return {'order': self.order} * * def __setstate__(self, state): # <<<<<<<<<<<<<< @@ -11794,16 +11855,16 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_6__setstate__(struct __ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate__", 0); - /* "sklearn/earth/_basis.pyx":494 + /* "sklearn/earth/_basis.pyx":495 * * def __setstate__(self, state): * self.order = state['order'] # <<<<<<<<<<<<<< * * def __richcmp__(self, other, method): */ - __pyx_t_1 = PyObject_GetItem(__pyx_v_state, ((PyObject *)__pyx_n_s__order)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(__pyx_v_state, ((PyObject *)__pyx_n_s__order)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->order); __Pyx_DECREF(((PyObject *)__pyx_v_self->order)); @@ -11832,7 +11893,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_9__richcmp__(PyObject * PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0); - __pyx_v_method = PyInt_FromLong(__pyx_arg_method); if (unlikely(!__pyx_v_method)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_method = PyInt_FromLong(__pyx_arg_method); if (unlikely(!__pyx_v_method)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __Pyx_GOTREF(__pyx_v_method); goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -11846,7 +11907,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_9__richcmp__(PyObject * return __pyx_r; } -/* "sklearn/earth/_basis.pyx":496 +/* "sklearn/earth/_basis.pyx":497 * self.order = state['order'] * * def __richcmp__(self, other, method): # <<<<<<<<<<<<<< @@ -11866,19 +11927,19 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_8__richcmp__(PyObject * int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__richcmp__", 0); - /* "sklearn/earth/_basis.pyx":497 + /* "sklearn/earth/_basis.pyx":498 * * def __richcmp__(self, other, method): * if method == 2: # <<<<<<<<<<<<<< * return self._eq(other) * elif method == 3: */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_method, __pyx_int_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_v_method, __pyx_int_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "sklearn/earth/_basis.pyx":498 + /* "sklearn/earth/_basis.pyx":499 * def __richcmp__(self, other, method): * if method == 2: * return self._eq(other) # <<<<<<<<<<<<<< @@ -11886,14 +11947,14 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_8__richcmp__(PyObject * * return not self._eq(other) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s___eq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s___eq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_other); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_other); __Pyx_GIVEREF(__pyx_v_other); - __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; @@ -11903,19 +11964,19 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_8__richcmp__(PyObject * goto __pyx_L3; } - /* "sklearn/earth/_basis.pyx":499 + /* "sklearn/earth/_basis.pyx":500 * if method == 2: * return self._eq(other) * elif method == 3: # <<<<<<<<<<<<<< * return not self._eq(other) * else: */ - __pyx_t_4 = PyObject_RichCompare(__pyx_v_method, __pyx_int_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_RichCompare(__pyx_v_method, __pyx_int_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_2) { - /* "sklearn/earth/_basis.pyx":500 + /* "sklearn/earth/_basis.pyx":501 * return self._eq(other) * elif method == 3: * return not self._eq(other) # <<<<<<<<<<<<<< @@ -11923,20 +11984,20 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_8__richcmp__(PyObject * * return NotImplemented */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s___eq); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s___eq); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_other); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_other); __Pyx_GIVEREF(__pyx_v_other); - __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyBool_FromLong((!__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong((!__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -11945,7 +12006,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_8__richcmp__(PyObject * } /*else*/ { - /* "sklearn/earth/_basis.pyx":502 + /* "sklearn/earth/_basis.pyx":503 * return not self._eq(other) * else: * return NotImplemented # <<<<<<<<<<<<<< @@ -11984,7 +12045,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_11_eq(PyObject *__pyx_v return __pyx_r; } -/* "sklearn/earth/_basis.pyx":504 +/* "sklearn/earth/_basis.pyx":505 * return NotImplemented * * def _eq(self, other): # <<<<<<<<<<<<<< @@ -12005,7 +12066,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_10_eq(struct __pyx_obj_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_eq", 0); - /* "sklearn/earth/_basis.pyx":505 + /* "sklearn/earth/_basis.pyx":506 * * def _eq(self, other): * return self.__class__ is other.__class__ and self._getstate() == other._getstate() # <<<<<<<<<<<<<< @@ -12013,29 +12074,29 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_10_eq(struct __pyx_obj_ * def piter(Basis self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = (__pyx_t_1 == __pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_3) { __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __pyx_t_1; @@ -12075,7 +12136,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_13piter(PyObject *__pyx return __pyx_r; } -/* "sklearn/earth/_basis.pyx":507 +/* "sklearn/earth/_basis.pyx":508 * return self.__class__ is other.__class__ and self._getstate() == other._getstate() * * def piter(Basis self): # <<<<<<<<<<<<<< @@ -12101,7 +12162,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_12piter(struct __pyx_ob __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); { - __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_7sklearn_5earth_6_basis_5Basis_14generator, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_7sklearn_5earth_6_basis_5Basis_14generator, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -12142,9 +12203,9 @@ static PyObject *__pyx_gb_7sklearn_5earth_6_basis_5Basis_14generator(__pyx_Gener return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/earth/_basis.pyx":508 + /* "sklearn/earth/_basis.pyx":509 * * def piter(Basis self): * for bf in self.order: # <<<<<<<<<<<<<< @@ -12153,15 +12214,15 @@ static PyObject *__pyx_gb_7sklearn_5earth_6_basis_5Basis_14generator(__pyx_Gener */ if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_self->order) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_1 = ((PyObject *)__pyx_cur_scope->__pyx_v_self->order); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_bf); __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_bf); @@ -12169,24 +12230,24 @@ static PyObject *__pyx_gb_7sklearn_5earth_6_basis_5Basis_14generator(__pyx_Gener __pyx_cur_scope->__pyx_v_bf = __pyx_t_3; __pyx_t_3 = 0; - /* "sklearn/earth/_basis.pyx":509 + /* "sklearn/earth/_basis.pyx":510 * def piter(Basis self): * for bf in self.order: * if not bf.is_pruned(): # <<<<<<<<<<<<<< * yield bf * */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_bf, __pyx_n_s__is_pruned); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_bf, __pyx_n_s__is_pruned); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = ((!__pyx_t_5) != 0); if (__pyx_t_6) { - /* "sklearn/earth/_basis.pyx":510 + /* "sklearn/earth/_basis.pyx":511 * for bf in self.order: * if not bf.is_pruned(): * yield bf # <<<<<<<<<<<<<< @@ -12208,7 +12269,7 @@ static PyObject *__pyx_gb_7sklearn_5earth_6_basis_5Basis_14generator(__pyx_Gener __pyx_cur_scope->__pyx_t_0 = 0; __Pyx_XGOTREF(__pyx_t_1); __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; @@ -12240,7 +12301,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_16__str__(PyObject *__p return __pyx_r; } -/* "sklearn/earth/_basis.pyx":512 +/* "sklearn/earth/_basis.pyx":513 * yield bf * * def __str__(Basis self): # <<<<<<<<<<<<<< @@ -12264,17 +12325,17 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_15__str__(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - /* "sklearn/earth/_basis.pyx":514 + /* "sklearn/earth/_basis.pyx":515 * def __str__(Basis self): * cdef INDEX_t i * cdef INDEX_t n = len(self) # <<<<<<<<<<<<<< * result = '' * for i in range(n): */ - __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_n = __pyx_t_1; - /* "sklearn/earth/_basis.pyx":515 + /* "sklearn/earth/_basis.pyx":516 * cdef INDEX_t i * cdef INDEX_t n = len(self) * result = '' # <<<<<<<<<<<<<< @@ -12284,7 +12345,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_15__str__(struct __pyx_ __Pyx_INCREF(((PyObject *)__pyx_kp_s_2)); __pyx_v_result = ((PyObject *)__pyx_kp_s_2); - /* "sklearn/earth/_basis.pyx":516 + /* "sklearn/earth/_basis.pyx":517 * cdef INDEX_t n = len(self) * result = '' * for i in range(n): # <<<<<<<<<<<<<< @@ -12295,45 +12356,45 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_15__str__(struct __pyx_ for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "sklearn/earth/_basis.pyx":517 + /* "sklearn/earth/_basis.pyx":518 * result = '' * for i in range(n): * result += str(self[i]) # <<<<<<<<<<<<<< * result += '\n' * return result */ - __pyx_t_4 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self), __pyx_v_i, sizeof(__pyx_t_7sklearn_5earth_6_basis_INDEX_t)+1, __Pyx_PyInt_to_py_npy_ulonglong, 0, 0, 0); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self), __pyx_v_i, sizeof(__pyx_t_7sklearn_5earth_6_basis_INDEX_t)+1, __Pyx_PyInt_to_py_npy_ulonglong, 0, 0, 0); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_result, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_result, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_v_result); __pyx_v_result = __pyx_t_5; __pyx_t_5 = 0; - /* "sklearn/earth/_basis.pyx":518 + /* "sklearn/earth/_basis.pyx":519 * for i in range(n): * result += str(self[i]) * result += '\n' # <<<<<<<<<<<<<< * return result * */ - __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_8)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_8)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_v_result); __pyx_v_result = __pyx_t_5; __pyx_t_5 = 0; } - /* "sklearn/earth/_basis.pyx":519 + /* "sklearn/earth/_basis.pyx":520 * result += str(self[i]) * result += '\n' * return result # <<<<<<<<<<<<<< @@ -12359,7 +12420,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_15__str__(struct __pyx_ return __pyx_r; } -/* "sklearn/earth/_basis.pyx":521 +/* "sklearn/earth/_basis.pyx":522 * return result * * cpdef translate(Basis self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): # <<<<<<<<<<<<<< @@ -12397,23 +12458,23 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_translate(struct __pyx_o __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__translate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__translate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_5Basis_18translate)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_slopes)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_slopes)); @@ -12421,7 +12482,7 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_translate(struct __pyx_o __Pyx_INCREF(((PyObject *)__pyx_v_intercepts)); PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_intercepts)); __Pyx_GIVEREF(((PyObject *)__pyx_v_intercepts)); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; @@ -12432,17 +12493,17 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_translate(struct __pyx_o __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_basis.pyx":522 + /* "sklearn/earth/_basis.pyx":523 * * cpdef translate(Basis self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): * cdef INDEX_t n = len(self) # <<<<<<<<<<<<<< * cdef INDEX_t i #@DuplicatedSignature * for i in range(n): */ - __pyx_t_4 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_n = __pyx_t_4; - /* "sklearn/earth/_basis.pyx":524 + /* "sklearn/earth/_basis.pyx":525 * cdef INDEX_t n = len(self) * cdef INDEX_t i #@DuplicatedSignature * for i in range(n): # <<<<<<<<<<<<<< @@ -12453,7 +12514,7 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_translate(struct __pyx_o for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "sklearn/earth/_basis.pyx":525 + /* "sklearn/earth/_basis.pyx":526 * cdef INDEX_t i #@DuplicatedSignature * for i in range(n): * self.order[i].translate(slopes,intercepts,False) # <<<<<<<<<<<<<< @@ -12462,13 +12523,13 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_translate(struct __pyx_o */ if (unlikely(((PyObject *)__pyx_v_self->order) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i), __pyx_n_s__translate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i), __pyx_n_s__translate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_slopes)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_slopes)); @@ -12479,7 +12540,7 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_translate(struct __pyx_o PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 525; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; @@ -12540,11 +12601,11 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_18translate(PyObject *_ case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__intercepts)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("translate", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("translate", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "translate") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "translate") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -12557,14 +12618,14 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_18translate(PyObject *_ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("translate", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("translate", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.earth._basis.Basis.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_slopes), __pyx_ptype_5numpy_ndarray, 1, "slopes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercepts), __pyx_ptype_5numpy_ndarray, 1, "intercepts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_slopes), __pyx_ptype_5numpy_ndarray, 1, "slopes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercepts), __pyx_ptype_5numpy_ndarray, 1, "intercepts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_5Basis_17translate(((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)__pyx_v_self), __pyx_v_slopes, __pyx_v_intercepts); goto __pyx_L0; __pyx_L1_error:; @@ -12574,7 +12635,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_18translate(PyObject *_ return __pyx_r; } -/* "sklearn/earth/_basis.pyx":521 +/* "sklearn/earth/_basis.pyx":522 * return result * * cpdef translate(Basis self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): # <<<<<<<<<<<<<< @@ -12604,16 +12665,16 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_17translate(struct __py __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->translate(__pyx_v_self, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 521; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->translate(__pyx_v_self, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -12640,7 +12701,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_17translate(struct __py return __pyx_r; } -/* "sklearn/earth/_basis.pyx":527 +/* "sklearn/earth/_basis.pyx":528 * self.order[i].translate(slopes,intercepts,False) * * cpdef scale(Basis self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, cnp.ndarray[FLOAT_t,ndim=1] beta): # <<<<<<<<<<<<<< @@ -12688,28 +12749,28 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_scale(struct __pyx_obj_7 __pyx_pybuffernd_beta.rcbuffer = &__pyx_pybuffer_beta; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_beta.rcbuffer->pybuffer, (PyObject*)__pyx_v_beta, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_beta.rcbuffer->pybuffer, (PyObject*)__pyx_v_beta, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_beta.diminfo[0].strides = __pyx_pybuffernd_beta.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_beta.diminfo[0].shape = __pyx_pybuffernd_beta.rcbuffer->pybuffer.shape[0]; /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__scale); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__scale); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_5Basis_20scale)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_slopes)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_slopes)); @@ -12720,7 +12781,7 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_scale(struct __pyx_obj_7 __Pyx_INCREF(((PyObject *)__pyx_v_beta)); PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_beta)); __Pyx_GIVEREF(((PyObject *)__pyx_v_beta)); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; @@ -12731,17 +12792,17 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_scale(struct __pyx_obj_7 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_basis.pyx":528 + /* "sklearn/earth/_basis.pyx":529 * * cpdef scale(Basis self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, cnp.ndarray[FLOAT_t,ndim=1] beta): * cdef INDEX_t n = len(self) #@DuplicatedSignature # <<<<<<<<<<<<<< * cdef INDEX_t i #@DuplicatedSignature * cdef INDEX_t j = 0 */ - __pyx_t_4 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_n = __pyx_t_4; - /* "sklearn/earth/_basis.pyx":530 + /* "sklearn/earth/_basis.pyx":531 * cdef INDEX_t n = len(self) #@DuplicatedSignature * cdef INDEX_t i #@DuplicatedSignature * cdef INDEX_t j = 0 # <<<<<<<<<<<<<< @@ -12750,7 +12811,7 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_scale(struct __pyx_obj_7 */ __pyx_v_j = 0; - /* "sklearn/earth/_basis.pyx":531 + /* "sklearn/earth/_basis.pyx":532 * cdef INDEX_t i #@DuplicatedSignature * cdef INDEX_t j = 0 * for i in range(n): # <<<<<<<<<<<<<< @@ -12761,7 +12822,7 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_scale(struct __pyx_obj_7 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "sklearn/earth/_basis.pyx":532 + /* "sklearn/earth/_basis.pyx":533 * cdef INDEX_t j = 0 * for i in range(n): * if self.order[i].is_pruned(): # <<<<<<<<<<<<<< @@ -12770,18 +12831,18 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_scale(struct __pyx_obj_7 */ if (unlikely(((PyObject *)__pyx_v_self->order) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i), __pyx_n_s__is_pruned); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i), __pyx_n_s__is_pruned); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { - /* "sklearn/earth/_basis.pyx":533 + /* "sklearn/earth/_basis.pyx":534 * for i in range(n): * if self.order[i].is_pruned(): * continue # <<<<<<<<<<<<<< @@ -12793,7 +12854,7 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_scale(struct __pyx_obj_7 } __pyx_L5:; - /* "sklearn/earth/_basis.pyx":534 + /* "sklearn/earth/_basis.pyx":535 * if self.order[i].is_pruned(): * continue * beta[j] *= self.order[i].scale(slopes,intercepts) # <<<<<<<<<<<<<< @@ -12802,11 +12863,11 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_scale(struct __pyx_obj_7 */ if (unlikely(((PyObject *)__pyx_v_self->order) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i), __pyx_n_s__scale); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i), __pyx_n_s__scale); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_slopes)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_slopes)); @@ -12814,16 +12875,16 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_scale(struct __pyx_obj_7 __Pyx_INCREF(((PyObject *)__pyx_v_intercepts)); PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_intercepts)); __Pyx_GIVEREF(((PyObject *)__pyx_v_intercepts)); - __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_8 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_8 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_9 = __pyx_v_j; *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_FLOAT_t *, __pyx_pybuffernd_beta.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_beta.diminfo[0].strides) *= __pyx_t_8; - /* "sklearn/earth/_basis.pyx":535 + /* "sklearn/earth/_basis.pyx":536 * continue * beta[j] *= self.order[i].scale(slopes,intercepts) * j += 1 # <<<<<<<<<<<<<< @@ -12892,16 +12953,16 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_20scale(PyObject *__pyx case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__intercepts)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("scale", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("scale", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__beta)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("scale", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("scale", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scale") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scale") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -12916,15 +12977,15 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_20scale(PyObject *__pyx } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("scale", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("scale", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.earth._basis.Basis.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_slopes), __pyx_ptype_5numpy_ndarray, 1, "slopes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercepts), __pyx_ptype_5numpy_ndarray, 1, "intercepts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_beta), __pyx_ptype_5numpy_ndarray, 1, "beta", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_slopes), __pyx_ptype_5numpy_ndarray, 1, "slopes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercepts), __pyx_ptype_5numpy_ndarray, 1, "intercepts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_beta), __pyx_ptype_5numpy_ndarray, 1, "beta", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_5Basis_19scale(((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)__pyx_v_self), __pyx_v_slopes, __pyx_v_intercepts, __pyx_v_beta); goto __pyx_L0; __pyx_L1_error:; @@ -12934,7 +12995,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_20scale(PyObject *__pyx return __pyx_r; } -/* "sklearn/earth/_basis.pyx":527 +/* "sklearn/earth/_basis.pyx":528 * self.order[i].translate(slopes,intercepts,False) * * cpdef scale(Basis self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, cnp.ndarray[FLOAT_t,ndim=1] beta): # <<<<<<<<<<<<<< @@ -12970,21 +13031,21 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_19scale(struct __pyx_ob __pyx_pybuffernd_beta.rcbuffer = &__pyx_pybuffer_beta; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_beta.rcbuffer->pybuffer, (PyObject*)__pyx_v_beta, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_beta.rcbuffer->pybuffer, (PyObject*)__pyx_v_beta, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_beta.diminfo[0].strides = __pyx_pybuffernd_beta.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_beta.diminfo[0].shape = __pyx_pybuffernd_beta.rcbuffer->pybuffer.shape[0]; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->scale(__pyx_v_self, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), ((PyArrayObject *)__pyx_v_beta), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->scale(__pyx_v_self, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), ((PyArrayObject *)__pyx_v_beta), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -13013,7 +13074,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_19scale(struct __pyx_ob return __pyx_r; } -/* "sklearn/earth/_basis.pyx":537 +/* "sklearn/earth/_basis.pyx":538 * j += 1 * * cpdef BasisFunction get_root(Basis self): # <<<<<<<<<<<<<< @@ -13035,13 +13096,13 @@ static struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_f_7sklearn_ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_root); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_root); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_5Basis_22get_root)) { __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -13050,7 +13111,7 @@ static struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_f_7sklearn_ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_basis.pyx":538 + /* "sklearn/earth/_basis.pyx":539 * * cpdef BasisFunction get_root(Basis self): * return self.root # <<<<<<<<<<<<<< @@ -13058,9 +13119,9 @@ static struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_f_7sklearn_ * cpdef append(Basis self, BasisFunction basis_function): */ __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__root); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__root); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; @@ -13089,7 +13150,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_22get_root(PyObject *__ return __pyx_r; } -/* "sklearn/earth/_basis.pyx":537 +/* "sklearn/earth/_basis.pyx":538 * j += 1 * * cpdef BasisFunction get_root(Basis self): # <<<<<<<<<<<<<< @@ -13106,7 +13167,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_21get_root(struct __pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_root", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->get_root(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 537; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->get_root(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -13124,7 +13185,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_21get_root(struct __pyx return __pyx_r; } -/* "sklearn/earth/_basis.pyx":540 +/* "sklearn/earth/_basis.pyx":541 * return self.root * * cpdef append(Basis self, BasisFunction basis_function): # <<<<<<<<<<<<<< @@ -13148,16 +13209,16 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_append(struct __pyx_obj_ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__append); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__append); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_5Basis_24append)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_basis_function)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_basis_function)); __Pyx_GIVEREF(((PyObject *)__pyx_v_basis_function)); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; @@ -13168,7 +13229,7 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_append(struct __pyx_obj_ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_basis.pyx":541 + /* "sklearn/earth/_basis.pyx":542 * * cpdef append(Basis self, BasisFunction basis_function): * self.order.append(basis_function) # <<<<<<<<<<<<<< @@ -13177,9 +13238,9 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_append(struct __pyx_obj_ */ if (unlikely(((PyObject *)__pyx_v_self->order) == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_self->order, ((PyObject *)__pyx_v_basis_function)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_self->order, ((PyObject *)__pyx_v_basis_function)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; @@ -13204,7 +13265,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_24append(PyObject *__py PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("append (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_basis_function), __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction, 1, "basis_function", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_basis_function), __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction, 1, "basis_function", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_5Basis_23append(((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)__pyx_v_self), ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_basis_function)); goto __pyx_L0; __pyx_L1_error:; @@ -13214,7 +13275,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_24append(PyObject *__py return __pyx_r; } -/* "sklearn/earth/_basis.pyx":540 +/* "sklearn/earth/_basis.pyx":541 * return self.root * * cpdef append(Basis self, BasisFunction basis_function): # <<<<<<<<<<<<<< @@ -13231,7 +13292,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_23append(struct __pyx_o int __pyx_clineno = 0; __Pyx_RefNannySetupContext("append", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->append(__pyx_v_self, __pyx_v_basis_function, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->append(__pyx_v_self, __pyx_v_basis_function, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -13260,7 +13321,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_26__iter__(PyObject *__ return __pyx_r; } -/* "sklearn/earth/_basis.pyx":543 +/* "sklearn/earth/_basis.pyx":544 * self.order.append(basis_function) * * def __iter__(Basis self): # <<<<<<<<<<<<<< @@ -13278,7 +13339,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_25__iter__(struct __pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__iter__", 0); - /* "sklearn/earth/_basis.pyx":544 + /* "sklearn/earth/_basis.pyx":545 * * def __iter__(Basis self): * return self.order.__iter__() # <<<<<<<<<<<<<< @@ -13286,9 +13347,9 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_25__iter__(struct __pyx * def __len__(Basis self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->order), __pyx_n_s____iter__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->order), __pyx_n_s____iter__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; @@ -13319,7 +13380,7 @@ static Py_ssize_t __pyx_pw_7sklearn_5earth_6_basis_5Basis_28__len__(PyObject *__ return __pyx_r; } -/* "sklearn/earth/_basis.pyx":546 +/* "sklearn/earth/_basis.pyx":547 * return self.order.__iter__() * * def __len__(Basis self): # <<<<<<<<<<<<<< @@ -13338,19 +13399,19 @@ static Py_ssize_t __pyx_pf_7sklearn_5earth_6_basis_5Basis_27__len__(struct __pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__len__", 0); - /* "sklearn/earth/_basis.pyx":547 + /* "sklearn/earth/_basis.pyx":548 * * def __len__(Basis self): * return self.order.__len__() # <<<<<<<<<<<<<< * * cpdef BasisFunction get(Basis self, INDEX_t i): */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->order), __pyx_n_s____len__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->order), __pyx_n_s____len__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_3 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_3 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; goto __pyx_L0; @@ -13367,7 +13428,7 @@ static Py_ssize_t __pyx_pf_7sklearn_5earth_6_basis_5Basis_27__len__(struct __pyx return __pyx_r; } -/* "sklearn/earth/_basis.pyx":549 +/* "sklearn/earth/_basis.pyx":550 * return self.order.__len__() * * cpdef BasisFunction get(Basis self, INDEX_t i): # <<<<<<<<<<<<<< @@ -13390,21 +13451,21 @@ static struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_f_7sklearn_ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_5Basis_30get)) { __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -13413,7 +13474,7 @@ static struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_f_7sklearn_ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_basis.pyx":550 + /* "sklearn/earth/_basis.pyx":551 * * cpdef BasisFunction get(Basis self, INDEX_t i): * return self.order[i] # <<<<<<<<<<<<<< @@ -13423,9 +13484,9 @@ static struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_f_7sklearn_ __Pyx_XDECREF(((PyObject *)__pyx_r)); if (unlikely(((PyObject *)__pyx_v_self->order) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - if (!(likely(((PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i)) == Py_None) || likely(__Pyx_TypeTest(PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i), __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i)) == Py_None) || likely(__Pyx_TypeTest(PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i), __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_INCREF(PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i)); __pyx_r = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i)); goto __pyx_L0; @@ -13455,7 +13516,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_30get(PyObject *__pyx_v __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get (wrapper)", 0); assert(__pyx_arg_i); { - __pyx_v_i = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_arg_i); if (unlikely((__pyx_v_i == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_i = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_arg_i); if (unlikely((__pyx_v_i == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -13468,7 +13529,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_30get(PyObject *__pyx_v return __pyx_r; } -/* "sklearn/earth/_basis.pyx":549 +/* "sklearn/earth/_basis.pyx":550 * return self.order.__len__() * * cpdef BasisFunction get(Basis self, INDEX_t i): # <<<<<<<<<<<<<< @@ -13485,7 +13546,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_29get(struct __pyx_obj_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->get(__pyx_v_self, __pyx_v_i, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 549; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->get(__pyx_v_self, __pyx_v_i, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -13514,7 +13575,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_32__getitem__(PyObject __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); assert(__pyx_arg_i); { - __pyx_v_i = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_arg_i); if (unlikely((__pyx_v_i == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 552; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_i = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_arg_i); if (unlikely((__pyx_v_i == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -13527,7 +13588,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_32__getitem__(PyObject return __pyx_r; } -/* "sklearn/earth/_basis.pyx":552 +/* "sklearn/earth/_basis.pyx":553 * return self.order[i] * * def __getitem__(Basis self, INDEX_t i): # <<<<<<<<<<<<<< @@ -13544,7 +13605,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_31__getitem__(struct __ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getitem__", 0); - /* "sklearn/earth/_basis.pyx":553 + /* "sklearn/earth/_basis.pyx":554 * * def __getitem__(Basis self, INDEX_t i): * return self.get(i) # <<<<<<<<<<<<<< @@ -13552,7 +13613,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_31__getitem__(struct __ * cpdef INDEX_t plen(Basis self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->get(__pyx_v_self, __pyx_v_i, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->get(__pyx_v_self, __pyx_v_i, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -13570,7 +13631,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_31__getitem__(struct __ return __pyx_r; } -/* "sklearn/earth/_basis.pyx":555 +/* "sklearn/earth/_basis.pyx":556 * return self.get(i) * * cpdef INDEX_t plen(Basis self): # <<<<<<<<<<<<<< @@ -13600,12 +13661,12 @@ static __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_f_7sklearn_5earth_6_basis_5 if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__plen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__plen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_5Basis_34plen)) { - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -13614,7 +13675,7 @@ static __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_f_7sklearn_5earth_6_basis_5 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_basis.pyx":556 + /* "sklearn/earth/_basis.pyx":557 * * cpdef INDEX_t plen(Basis self): * cdef INDEX_t length = 0 # <<<<<<<<<<<<<< @@ -13623,7 +13684,7 @@ static __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_f_7sklearn_5earth_6_basis_5 */ __pyx_v_length = 0; - /* "sklearn/earth/_basis.pyx":558 + /* "sklearn/earth/_basis.pyx":559 * cdef INDEX_t length = 0 * cdef INDEX_t i * cdef INDEX_t n = len(self.order) # <<<<<<<<<<<<<< @@ -13634,13 +13695,13 @@ static __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_f_7sklearn_5earth_6_basis_5 __Pyx_INCREF(__pyx_t_1); if (unlikely(__pyx_t_1 == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_4 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_n = __pyx_t_4; - /* "sklearn/earth/_basis.pyx":559 + /* "sklearn/earth/_basis.pyx":560 * cdef INDEX_t i * cdef INDEX_t n = len(self.order) * for i in range(n): # <<<<<<<<<<<<<< @@ -13651,7 +13712,7 @@ static __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_f_7sklearn_5earth_6_basis_5 for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_3; __pyx_t_5+=1) { __pyx_v_i = __pyx_t_5; - /* "sklearn/earth/_basis.pyx":560 + /* "sklearn/earth/_basis.pyx":561 * cdef INDEX_t n = len(self.order) * for i in range(n): * if not self.order[i].is_pruned(): # <<<<<<<<<<<<<< @@ -13660,19 +13721,19 @@ static __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_f_7sklearn_5earth_6_basis_5 */ if (unlikely(((PyObject *)__pyx_v_self->order) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i), __pyx_n_s__is_pruned); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i), __pyx_n_s__is_pruned); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_7 = ((!__pyx_t_6) != 0); if (__pyx_t_7) { - /* "sklearn/earth/_basis.pyx":561 + /* "sklearn/earth/_basis.pyx":562 * for i in range(n): * if not self.order[i].is_pruned(): * length += 1 # <<<<<<<<<<<<<< @@ -13685,7 +13746,7 @@ static __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_f_7sklearn_5earth_6_basis_5 __pyx_L5:; } - /* "sklearn/earth/_basis.pyx":562 + /* "sklearn/earth/_basis.pyx":563 * if not self.order[i].is_pruned(): * length += 1 * return length # <<<<<<<<<<<<<< @@ -13718,7 +13779,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_34plen(PyObject *__pyx_ return __pyx_r; } -/* "sklearn/earth/_basis.pyx":555 +/* "sklearn/earth/_basis.pyx":556 * return self.get(i) * * cpdef INDEX_t plen(Basis self): # <<<<<<<<<<<<<< @@ -13735,7 +13796,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_33plen(struct __pyx_obj int __pyx_clineno = 0; __Pyx_RefNannySetupContext("plen", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->plen(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->plen(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -13753,7 +13814,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_33plen(struct __pyx_obj return __pyx_r; } -/* "sklearn/earth/_basis.pyx":564 +/* "sklearn/earth/_basis.pyx":565 * return length * * cpdef transform(Basis self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=2] B): # <<<<<<<<<<<<<< @@ -13794,23 +13855,23 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_transform(struct __pyx_o __pyx_pybuffernd_B.rcbuffer = &__pyx_pybuffer_B; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_v_B, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_v_B, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_B.diminfo[0].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B.diminfo[0].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B.diminfo[1].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B.diminfo[1].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[1]; /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__transform); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__transform); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_5Basis_36transform)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_X)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_X)); @@ -13818,7 +13879,7 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_transform(struct __pyx_o __Pyx_INCREF(((PyObject *)__pyx_v_B)); PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_B)); __Pyx_GIVEREF(((PyObject *)__pyx_v_B)); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; @@ -13829,23 +13890,23 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_transform(struct __pyx_o __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_basis.pyx":566 + /* "sklearn/earth/_basis.pyx":567 * cpdef transform(Basis self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=2] B): * cdef INDEX_t i #@DuplicatedSignature * cdef INDEX_t n = self.__len__() # <<<<<<<<<<<<<< * cdef BasisFunction bf * cdef INDEX_t col = 0 */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____len__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____len__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_3); if (unlikely((__pyx_t_4 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_3); if (unlikely((__pyx_t_4 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_n = __pyx_t_4; - /* "sklearn/earth/_basis.pyx":568 + /* "sklearn/earth/_basis.pyx":569 * cdef INDEX_t n = self.__len__() * cdef BasisFunction bf * cdef INDEX_t col = 0 # <<<<<<<<<<<<<< @@ -13854,7 +13915,7 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_transform(struct __pyx_o */ __pyx_v_col = 0; - /* "sklearn/earth/_basis.pyx":569 + /* "sklearn/earth/_basis.pyx":570 * cdef BasisFunction bf * cdef INDEX_t col = 0 * for i in range(n): # <<<<<<<<<<<<<< @@ -13865,7 +13926,7 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_transform(struct __pyx_o for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { __pyx_v_i = __pyx_t_5; - /* "sklearn/earth/_basis.pyx":570 + /* "sklearn/earth/_basis.pyx":571 * cdef INDEX_t col = 0 * for i in range(n): * bf = self.order[i] # <<<<<<<<<<<<<< @@ -13874,16 +13935,16 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_transform(struct __pyx_o */ if (unlikely(((PyObject *)__pyx_v_self->order) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - if (!(likely(((PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i)) == Py_None) || likely(__Pyx_TypeTest(PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i), __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i)) == Py_None) || likely(__Pyx_TypeTest(PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i), __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_3 = PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i); __Pyx_INCREF(__pyx_t_3); __Pyx_XDECREF(((PyObject *)__pyx_v_bf)); __pyx_v_bf = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/earth/_basis.pyx":571 + /* "sklearn/earth/_basis.pyx":572 * for i in range(n): * bf = self.order[i] * if bf.is_pruned(): # <<<<<<<<<<<<<< @@ -13893,7 +13954,7 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_transform(struct __pyx_o __pyx_t_6 = (((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_bf->__pyx_vtab)->is_pruned(__pyx_v_bf, 0) != 0); if (__pyx_t_6) { - /* "sklearn/earth/_basis.pyx":572 + /* "sklearn/earth/_basis.pyx":573 * bf = self.order[i] * if bf.is_pruned(): * continue # <<<<<<<<<<<<<< @@ -13905,16 +13966,16 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_transform(struct __pyx_o } __pyx_L5:; - /* "sklearn/earth/_basis.pyx":573 + /* "sklearn/earth/_basis.pyx":574 * if bf.is_pruned(): * continue * bf.apply(X,B[:,col],recurse=True) # <<<<<<<<<<<<<< * col += 1 * */ - __pyx_t_3 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_col); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_col); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_k_slice_9); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_k_slice_9); @@ -13922,18 +13983,18 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_transform(struct __pyx_o PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_1)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_1)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_7.__pyx_n = 1; __pyx_t_7.recurse = 1; - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_bf->__pyx_vtab)->apply(__pyx_v_bf, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_t_3), 0, &__pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_bf->__pyx_vtab)->apply(__pyx_v_bf, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_t_3), 0, &__pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_basis.pyx":574 + /* "sklearn/earth/_basis.pyx":575 * continue * bf.apply(X,B[:,col],recurse=True) * col += 1 # <<<<<<<<<<<<<< @@ -13999,11 +14060,11 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_36transform(PyObject *_ case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__B)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("transform", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("transform", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "transform") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "transform") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -14016,14 +14077,14 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_36transform(PyObject *_ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("transform", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("transform", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.earth._basis.Basis.transform", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_B), __pyx_ptype_5numpy_ndarray, 1, "B", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_B), __pyx_ptype_5numpy_ndarray, 1, "B", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_5Basis_35transform(((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)__pyx_v_self), __pyx_v_X, __pyx_v_B); goto __pyx_L0; __pyx_L1_error:; @@ -14033,7 +14094,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_36transform(PyObject *_ return __pyx_r; } -/* "sklearn/earth/_basis.pyx":564 +/* "sklearn/earth/_basis.pyx":565 * return length * * cpdef transform(Basis self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=2] B): # <<<<<<<<<<<<<< @@ -14063,16 +14124,16 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_35transform(struct __py __pyx_pybuffernd_B.rcbuffer = &__pyx_pybuffer_B; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_v_B, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_v_B, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_B.diminfo[0].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B.diminfo[0].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B.diminfo[1].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B.diminfo[1].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[1]; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->transform(__pyx_v_self, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_B), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->transform(__pyx_v_self, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_B), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -14099,7 +14160,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_35transform(struct __py return __pyx_r; } -/* "sklearn/earth/_basis.pyx":576 +/* "sklearn/earth/_basis.pyx":577 * col += 1 * * cpdef weighted_transform(Basis self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=2] B, cnp.ndarray[FLOAT_t,ndim=1] weights): # <<<<<<<<<<<<<< @@ -14140,28 +14201,28 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_weighted_transform(struc __pyx_pybuffernd_weights.rcbuffer = &__pyx_pybuffer_weights; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_v_B, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_v_B, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_B.diminfo[0].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B.diminfo[0].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B.diminfo[1].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B.diminfo[1].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_weights.diminfo[0].strides = __pyx_pybuffernd_weights.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weights.diminfo[0].shape = __pyx_pybuffernd_weights.rcbuffer->pybuffer.shape[0]; /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__weighted_transform); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__weighted_transform); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_5Basis_38weighted_transform)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_X)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_X)); @@ -14172,7 +14233,7 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_weighted_transform(struc __Pyx_INCREF(((PyObject *)__pyx_v_weights)); PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_weights)); __Pyx_GIVEREF(((PyObject *)__pyx_v_weights)); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; @@ -14183,40 +14244,40 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_weighted_transform(struc __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_basis.pyx":578 + /* "sklearn/earth/_basis.pyx":579 * cpdef weighted_transform(Basis self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=2] B, cnp.ndarray[FLOAT_t,ndim=1] weights): * cdef INDEX_t i #@DuplicatedSignature * cdef INDEX_t n = self.__len__() # <<<<<<<<<<<<<< * * self.transform(X,B) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____len__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____len__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_3); if (unlikely((__pyx_t_4 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 578; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_3); if (unlikely((__pyx_t_4 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_n = __pyx_t_4; - /* "sklearn/earth/_basis.pyx":580 + /* "sklearn/earth/_basis.pyx":581 * cdef INDEX_t n = self.__len__() * * self.transform(X,B) # <<<<<<<<<<<<<< * apply_weights_2d(B,weights) * */ - __pyx_t_3 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->transform(__pyx_v_self, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_B), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 580; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->transform(__pyx_v_self, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_B), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/earth/_basis.pyx":581 + /* "sklearn/earth/_basis.pyx":582 * * self.transform(X,B) * apply_weights_2d(B,weights) # <<<<<<<<<<<<<< * */ - __pyx_t_3 = __pyx_f_7sklearn_5earth_5_util_apply_weights_2d(((PyArrayObject *)__pyx_v_B), ((PyArrayObject *)__pyx_v_weights), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_f_7sklearn_5earth_5_util_apply_weights_2d(((PyArrayObject *)__pyx_v_B), ((PyArrayObject *)__pyx_v_weights), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -14278,16 +14339,16 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_38weighted_transform(Py case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__B)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("weighted_transform", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("weighted_transform", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weights)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("weighted_transform", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("weighted_transform", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "weighted_transform") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "weighted_transform") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -14302,15 +14363,15 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_38weighted_transform(Py } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("weighted_transform", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("weighted_transform", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.earth._basis.Basis.weighted_transform", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_B), __pyx_ptype_5numpy_ndarray, 1, "B", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weights), __pyx_ptype_5numpy_ndarray, 1, "weights", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_B), __pyx_ptype_5numpy_ndarray, 1, "B", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weights), __pyx_ptype_5numpy_ndarray, 1, "weights", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_5Basis_37weighted_transform(((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)__pyx_v_self), __pyx_v_X, __pyx_v_B, __pyx_v_weights); goto __pyx_L0; __pyx_L1_error:; @@ -14320,7 +14381,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_38weighted_transform(Py return __pyx_r; } -/* "sklearn/earth/_basis.pyx":576 +/* "sklearn/earth/_basis.pyx":577 * col += 1 * * cpdef weighted_transform(Basis self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=2] B, cnp.ndarray[FLOAT_t,ndim=1] weights): # <<<<<<<<<<<<<< @@ -14356,21 +14417,21 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_37weighted_transform(st __pyx_pybuffernd_weights.rcbuffer = &__pyx_pybuffer_weights; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_v_B, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_v_B, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_B.diminfo[0].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B.diminfo[0].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B.diminfo[1].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B.diminfo[1].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_weights.diminfo[0].strides = __pyx_pybuffernd_weights.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weights.diminfo[0].shape = __pyx_pybuffernd_weights.rcbuffer->pybuffer.shape[0]; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->weighted_transform(__pyx_v_self, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_B), ((PyArrayObject *)__pyx_v_weights), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->weighted_transform(__pyx_v_self, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_B), ((PyArrayObject *)__pyx_v_weights), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -14399,6 +14460,52 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_37weighted_transform(st return __pyx_r; } +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_13num_variables_1__get__(PyObject *__pyx_v_self); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_13num_variables_1__get__(PyObject *__pyx_v_self) { + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("__get__ (wrapper)", 0); + __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_5Basis_13num_variables___get__(((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)__pyx_v_self)); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/earth/_basis.pxd":108 + * + * cdef list order + * cdef readonly INDEX_t num_variables # <<<<<<<<<<<<<< + * + * cpdef translate(Basis self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts) + */ + +static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_13num_variables___get__(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("__get__", 0); + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->num_variables); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("sklearn.earth._basis.Basis.num_variables.__get__", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + /* Python wrapper */ static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /*proto*/ static CYTHON_UNUSED int __pyx_pw_5numpy_7ndarray_1__getbuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags) { @@ -14555,11 +14662,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; @@ -14595,11 +14702,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * * info.buf = PyArray_DATA(self) */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; @@ -14869,11 +14976,11 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_15), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_15), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L12; } __pyx_L12:; @@ -15082,22 +15189,22 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * info.format = f * return */ - __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_16), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_16), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_8)); __Pyx_GIVEREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_Raise(__pyx_t_8, 0, 0, 0); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} break; } @@ -15157,7 +15264,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * f[0] = c'\0' # Terminate format string * */ - __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 283; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_9; /* "numpy.pxd":286 @@ -15288,7 +15395,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__ * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -15331,7 +15438,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__ * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -15374,7 +15481,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__ * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -15417,7 +15524,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__ * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -15460,7 +15567,7 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__ * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -15540,15 +15647,15 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ if (unlikely(((PyObject *)__pyx_v_descr->names) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_1 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif __Pyx_XDECREF(__pyx_v_childname); __pyx_v_childname = __pyx_t_3; @@ -15561,9 +15668,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * child, new_offset = fields * */ - __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); __pyx_v_fields = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; @@ -15585,7 +15692,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON __pyx_t_3 = PyTuple_GET_ITEM(sequence, 0); @@ -15593,24 +15700,24 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __Pyx_INCREF(__pyx_t_3); __Pyx_INCREF(__pyx_t_4); #else - __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); #endif } else if (1) { - __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_RaiseNoneNotIterableError(); {__pyx_filename = __pyx_f[2]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else { Py_ssize_t index = -1; - __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_fields)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetIter(((PyObject *)__pyx_v_fields)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_t_6 = Py_TYPE(__pyx_t_5)->tp_iternext; index = 0; __pyx_t_3 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_3)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_3); index = 1; __pyx_t_4 = __pyx_t_6(__pyx_t_5); if (unlikely(!__pyx_t_4)) goto __pyx_L5_unpacking_failed; __Pyx_GOTREF(__pyx_t_4); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_IternextUnpackEndCheck(__pyx_t_6(__pyx_t_5), 2) < 0) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = NULL; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; goto __pyx_L6_unpacking_done; @@ -15618,10 +15725,10 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_6 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L6_unpacking_done:; } - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(((PyObject *)__pyx_v_child)); __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); __pyx_t_3 = 0; @@ -15636,20 +15743,20 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ - __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { @@ -15660,11 +15767,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_18), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L7; } __pyx_L7:; @@ -15711,11 +15818,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_19), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_19), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L8; } __pyx_L8:; @@ -15728,11 +15835,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * f += 1 */ while (1) { - __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!__pyx_t_7) break; @@ -15792,7 +15899,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") */ - __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_XDECREF(__pyx_v_t); __pyx_v_t = __pyx_t_3; @@ -15815,11 +15922,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_21), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_21), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L12; } __pyx_L12:; @@ -15831,11 +15938,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ - __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 98; @@ -15849,11 +15956,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ - __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 66; @@ -15867,11 +15974,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ - __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 104; @@ -15885,11 +15992,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ - __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 72; @@ -15903,11 +16010,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ - __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 830; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 105; @@ -15921,11 +16028,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ - __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 73; @@ -15939,11 +16046,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ - __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 108; @@ -15957,11 +16064,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ - __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 76; @@ -15975,11 +16082,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ - __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 113; @@ -15993,11 +16100,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ - __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 81; @@ -16011,11 +16118,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ - __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 102; @@ -16029,11 +16136,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ - __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 100; @@ -16047,11 +16154,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ - __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 103; @@ -16065,11 +16172,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ - __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 90; @@ -16085,11 +16192,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ - __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 840; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 90; @@ -16105,11 +16212,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ - __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 90; @@ -16125,11 +16232,11 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ - __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_7) { (__pyx_v_f[0]) = 79; @@ -16144,19 +16251,19 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * f += 1 * else: */ - __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_16), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_16), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_5)); __Pyx_GIVEREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[2]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L13:; @@ -16179,7 +16286,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * return f * */ - __pyx_t_12 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_12 == NULL)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_12; } __pyx_L11:; @@ -16396,6 +16503,10 @@ static PyObject *__pyx_sq_item_7sklearn_5earth_6_basis_Basis(PyObject *o, Py_ssi return r; } +static PyObject *__pyx_getprop_7sklearn_5earth_6_basis_5Basis_num_variables(PyObject *o, CYTHON_UNUSED void *x) { + return __pyx_pw_7sklearn_5earth_6_basis_5Basis_13num_variables_1__get__(o); +} + static PyMethodDef __pyx_methods_7sklearn_5earth_6_basis_Basis[] = { {__Pyx_NAMESTR("__reduce__"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_5Basis_3__reduce__, METH_NOARGS, __Pyx_DOCSTR(0)}, {__Pyx_NAMESTR("_getstate"), (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_5Basis_5_getstate, METH_NOARGS, __Pyx_DOCSTR(0)}, @@ -16413,6 +16524,11 @@ static PyMethodDef __pyx_methods_7sklearn_5earth_6_basis_Basis[] = { {0, 0, 0, 0} }; +static struct PyGetSetDef __pyx_getsets_7sklearn_5earth_6_basis_Basis[] = { + {(char *)"num_variables", __pyx_getprop_7sklearn_5earth_6_basis_5Basis_num_variables, 0, 0, 0}, + {0, 0, 0, 0, 0} +}; + static PySequenceMethods __pyx_tp_as_sequence_Basis = { __pyx_pw_7sklearn_5earth_6_basis_5Basis_28__len__, /*sq_length*/ 0, /*sq_concat*/ @@ -16466,7 +16582,7 @@ static PyTypeObject __pyx_type_7sklearn_5earth_6_basis_Basis = { 0, /*tp_iternext*/ __pyx_methods_7sklearn_5earth_6_basis_Basis, /*tp_methods*/ 0, /*tp_members*/ - 0, /*tp_getset*/ + __pyx_getsets_7sklearn_5earth_6_basis_Basis, /*tp_getset*/ 0, /*tp_base*/ 0, /*tp_dict*/ 0, /*tp_descr_get*/ @@ -17211,6 +17327,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s__minspan_alpha, __pyx_k__minspan_alpha, sizeof(__pyx_k__minspan_alpha), 0, 0, 1, 1}, {&__pyx_n_s__n, __pyx_k__n, sizeof(__pyx_k__n), 0, 0, 1, 1}, {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, + {&__pyx_n_s__num_variables, __pyx_k__num_variables, sizeof(__pyx_k__num_variables), 0, 0, 1, 1}, {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, {&__pyx_n_s__order, __pyx_k__order, sizeof(__pyx_k__order), 0, 0, 1, 1}, {&__pyx_n_s__parent, __pyx_k__parent, sizeof(__pyx_k__parent), 0, 0, 1, 1}, @@ -17249,8 +17366,8 @@ static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s__NotImplementedError); if (!__pyx_builtin_NotImplementedError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s__super); if (!__pyx_builtin_super) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; @@ -17260,14 +17377,14 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "sklearn/earth/_basis.pyx":573 + /* "sklearn/earth/_basis.pyx":574 * if bf.is_pruned(): * continue * bf.apply(X,B[:,col],recurse=True) # <<<<<<<<<<<<<< * col += 1 * */ - __pyx_k_slice_9 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_9 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_9); __Pyx_GIVEREF(__pyx_k_slice_9); @@ -17278,7 +17395,7 @@ static int __Pyx_InitCachedConstants(void) { * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_k_tuple_11 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_10)); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_11 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_10)); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_11); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11)); @@ -17289,7 +17406,7 @@ static int __Pyx_InitCachedConstants(void) { * * info.buf = PyArray_DATA(self) */ - __pyx_k_tuple_13 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_12)); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_13 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_12)); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_13); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13)); @@ -17300,7 +17417,7 @@ static int __Pyx_InitCachedConstants(void) { * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_k_tuple_15 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_14)); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_15 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_14)); if (unlikely(!__pyx_k_tuple_15)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_15); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_15)); @@ -17311,7 +17428,7 @@ static int __Pyx_InitCachedConstants(void) { * * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_k_tuple_18 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_17)); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_18 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_17)); if (unlikely(!__pyx_k_tuple_18)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_18); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_18)); @@ -17322,7 +17439,7 @@ static int __Pyx_InitCachedConstants(void) { * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_k_tuple_19 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_14)); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_19 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_14)); if (unlikely(!__pyx_k_tuple_19)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_19); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_19)); @@ -17333,7 +17450,7 @@ static int __Pyx_InitCachedConstants(void) { * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_k_tuple_21 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_20)); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_21 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_20)); if (unlikely(!__pyx_k_tuple_21)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_21); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_21)); __Pyx_RefNannyFinishContext(); @@ -17489,7 +17606,7 @@ PyMODINIT_FUNC PyInit__basis(void) if (__Pyx_SetVtable(__pyx_type_7sklearn_5earth_6_basis_ConstantBasisFunction.tp_dict, __pyx_vtabptr_7sklearn_5earth_6_basis_ConstantBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetAttrString(__pyx_m, "ConstantBasisFunction", (PyObject *)&__pyx_type_7sklearn_5earth_6_basis_ConstantBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_5earth_6_basis_ConstantBasisFunction = &__pyx_type_7sklearn_5earth_6_basis_ConstantBasisFunction; - if (PyType_Ready(&__pyx_type_7sklearn_5earth_6_basis___pyx_scope_struct__piter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_5earth_6_basis___pyx_scope_struct__piter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_5earth_6_basis___pyx_scope_struct__piter = &__pyx_type_7sklearn_5earth_6_basis___pyx_scope_struct__piter; __pyx_vtabptr_7sklearn_5earth_6_basis_HingeBasisFunction = &__pyx_vtable_7sklearn_5earth_6_basis_HingeBasisFunction; __pyx_vtable_7sklearn_5earth_6_basis_HingeBasisFunction.__pyx_base = *__pyx_vtabptr_7sklearn_5earth_6_basis_BasisFunction; @@ -17524,12 +17641,12 @@ PyMODINIT_FUNC PyInit__basis(void) #else sizeof(PyHeapTypeObject), #endif - 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + 0); if (unlikely(!__pyx_ptype_7cpython_4type_type)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 861; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Variable import code ---*/ /*--- Function import code ---*/ __pyx_t_1 = __Pyx_ImportModule("sklearn.earth._util"); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -18831,6 +18948,31 @@ static int __Pyx_SetVtable(PyObject *dict, void *vtable) { return -1; } +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_ulonglong(npy_ulonglong val) { + const npy_ulonglong neg_one = (npy_ulonglong)-1, const_zero = (npy_ulonglong)0; + const int is_unsigned = const_zero < neg_one; + if ((sizeof(npy_ulonglong) == sizeof(char)) || + (sizeof(npy_ulonglong) == sizeof(short))) { + return PyInt_FromLong((long)val); + } else if ((sizeof(npy_ulonglong) == sizeof(int)) || + (sizeof(npy_ulonglong) == sizeof(long))) { + if (is_unsigned) + return PyLong_FromUnsignedLong((unsigned long)val); + else + return PyInt_FromLong((long)val); + } else if (sizeof(npy_ulonglong) == sizeof(PY_LONG_LONG)) { + if (is_unsigned) + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); + else + return PyLong_FromLongLong((PY_LONG_LONG)val); + } else { + int one = 1; int little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + return _PyLong_FromByteArray(bytes, sizeof(npy_ulonglong), + little, !is_unsigned); + } +} + #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { #if PY_VERSION_HEX >= 0x02060000 @@ -19035,31 +19177,6 @@ static CYTHON_INLINE npy_ulonglong __Pyx_PyInt_from_py_npy_ulonglong(PyObject* x } } -static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_ulonglong(npy_ulonglong val) { - const npy_ulonglong neg_one = (npy_ulonglong)-1, const_zero = (npy_ulonglong)0; - const int is_unsigned = const_zero < neg_one; - if ((sizeof(npy_ulonglong) == sizeof(char)) || - (sizeof(npy_ulonglong) == sizeof(short))) { - return PyInt_FromLong((long)val); - } else if ((sizeof(npy_ulonglong) == sizeof(int)) || - (sizeof(npy_ulonglong) == sizeof(long))) { - if (is_unsigned) - return PyLong_FromUnsignedLong((unsigned long)val); - else - return PyInt_FromLong((long)val); - } else if (sizeof(npy_ulonglong) == sizeof(PY_LONG_LONG)) { - if (is_unsigned) - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); - else - return PyLong_FromLongLong((PY_LONG_LONG)val); - } else { - int one = 1; int little = (int)*(unsigned char *)&one; - unsigned char *bytes = (unsigned char *)&val; - return _PyLong_FromByteArray(bytes, sizeof(npy_ulonglong), - little, !is_unsigned); - } -} - #if CYTHON_CCOMPLEX #ifdef __cplusplus static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { diff --git a/sklearn/earth/_basis.pxd b/sklearn/earth/_basis.pxd index 7a6a9e87c751f..ac19c3d6b5514 100644 --- a/sklearn/earth/_basis.pxd +++ b/sklearn/earth/_basis.pxd @@ -105,6 +105,7 @@ cdef class Basis: added.''' cdef list order + cdef readonly INDEX_t num_variables cpdef translate(Basis self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts) diff --git a/sklearn/earth/_basis.pyx b/sklearn/earth/_basis.pyx index 988d8dd07090a..56da782250dc1 100644 --- a/sklearn/earth/_basis.pyx +++ b/sklearn/earth/_basis.pyx @@ -481,11 +481,12 @@ cdef class Basis: common ConstantBasisFunction ancestor. Retains the order in which BasisFunctions are added.''' - def __init__(Basis self): #@DuplicatedSignature + def __init__(Basis self, num_variables): #@DuplicatedSignature self.order = [] + self.num_variables = num_variables def __reduce__(self): - return (self.__class__, (), self._getstate()) + return (self.__class__, (self.num_variables,), self._getstate()) def _getstate(self): return {'order': self.order} diff --git a/sklearn/earth/_forward.c b/sklearn/earth/_forward.c index 72dc2e2ea7372..fde328a93ca34 100644 --- a/sklearn/earth/_forward.c +++ b/sklearn/earth/_forward.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19.1 on Sat Jul 27 17:46:22 2013 */ +/* Generated by Cython 0.19.1 on Sat Jul 27 21:13:14 2013 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS @@ -1030,6 +1030,7 @@ struct __pyx_obj_7sklearn_5earth_6_basis_Basis { PyObject_HEAD struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *__pyx_vtab; PyObject *order; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t num_variables; }; @@ -2829,7 +2830,7 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ * self.sst = (np.dot(self.y,self.y) - (np.dot(np.sqrt(self.sample_weight),self.y) / np.sqrt(np.sum(self.sample_weight)))**2) / self.m * self.y_squared = np.dot(self.y,self.y) # <<<<<<<<<<<<<< * self.record = ForwardPassRecord(self.m,self.n,self.penalty,self.sst,self.xlabels) - * self.basis = Basis() + * self.basis = Basis(self.n) */ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); @@ -2856,7 +2857,7 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ * self.sst = (np.dot(self.y,self.y) - (np.dot(np.sqrt(self.sample_weight),self.y) / np.sqrt(np.sum(self.sample_weight)))**2) / self.m * self.y_squared = np.dot(self.y,self.y) * self.record = ForwardPassRecord(self.m,self.n,self.penalty,self.sst,self.xlabels) # <<<<<<<<<<<<<< - * self.basis = Basis() + * self.basis = Basis(self.n) * self.basis.append(ConstantBasisFunction()) */ __pyx_t_3 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -2896,12 +2897,20 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ /* "sklearn/earth/_forward.pyx":51 * self.y_squared = np.dot(self.y,self.y) * self.record = ForwardPassRecord(self.m,self.n,self.penalty,self.sst,self.xlabels) - * self.basis = Basis() # <<<<<<<<<<<<<< + * self.basis = Basis(self.n) # <<<<<<<<<<<<<< * self.basis.append(ConstantBasisFunction()) * */ - __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_Basis)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->n); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + __pyx_t_12 = 0; + __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_Basis)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_GIVEREF(__pyx_t_12); __Pyx_GOTREF(__pyx_v_self->basis); __Pyx_DECREF(((PyObject *)__pyx_v_self->basis)); @@ -2910,7 +2919,7 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ /* "sklearn/earth/_forward.pyx":52 * self.record = ForwardPassRecord(self.m,self.n,self.penalty,self.sst,self.xlabels) - * self.basis = Basis() + * self.basis = Basis(self.n) * self.basis.append(ConstantBasisFunction()) # <<<<<<<<<<<<<< * * self.sorting = np.empty(shape=self.m, dtype=np.int) diff --git a/sklearn/earth/_forward.pyx b/sklearn/earth/_forward.pyx index 3d33ae42779c8..7625c88e6bbbc 100644 --- a/sklearn/earth/_forward.pyx +++ b/sklearn/earth/_forward.pyx @@ -48,7 +48,7 @@ cdef class ForwardPasser: self.sst = (np.dot(self.y,self.y) - (np.dot(np.sqrt(self.sample_weight),self.y) / np.sqrt(np.sum(self.sample_weight)))**2) / self.m self.y_squared = np.dot(self.y,self.y) self.record = ForwardPassRecord(self.m,self.n,self.penalty,self.sst,self.xlabels) - self.basis = Basis() + self.basis = Basis(self.n) self.basis.append(ConstantBasisFunction()) self.sorting = np.empty(shape=self.m, dtype=np.int) diff --git a/sklearn/earth/_pruning.c b/sklearn/earth/_pruning.c index c190ca5ebf835..8fd45d57e9d30 100644 --- a/sklearn/earth/_pruning.c +++ b/sklearn/earth/_pruning.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19.1 on Sat Jul 27 17:46:22 2013 */ +/* Generated by Cython 0.19.1 on Sat Jul 27 21:13:14 2013 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS @@ -1012,6 +1012,7 @@ struct __pyx_obj_7sklearn_5earth_6_basis_Basis { PyObject_HEAD struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *__pyx_vtab; PyObject *order; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t num_variables; }; diff --git a/sklearn/earth/_record.c b/sklearn/earth/_record.c index 63e7dcb2ce5e6..267f164edbdcf 100644 --- a/sklearn/earth/_record.c +++ b/sklearn/earth/_record.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19.1 on Sat Jul 27 17:46:22 2013 */ +/* Generated by Cython 0.19.1 on Sat Jul 27 21:13:14 2013 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS @@ -994,6 +994,7 @@ struct __pyx_obj_7sklearn_5earth_6_basis_Basis { PyObject_HEAD struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *__pyx_vtab; PyObject *order; + __pyx_t_7sklearn_5earth_6_basis_INDEX_t num_variables; }; diff --git a/sklearn/earth/_util.c b/sklearn/earth/_util.c index a347b6e24394e..fe1a83a50ce71 100644 --- a/sklearn/earth/_util.c +++ b/sklearn/earth/_util.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19.1 on Sat Jul 27 17:46:22 2013 */ +/* Generated by Cython 0.19.1 on Sat Jul 27 21:13:14 2013 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS diff --git a/sklearn/earth/earth.py b/sklearn/earth/earth.py index 8710b2ae89e1c..e81720bbd7c23 100644 --- a/sklearn/earth/earth.py +++ b/sklearn/earth/earth.py @@ -4,6 +4,7 @@ from ..base import RegressorMixin, BaseEstimator, TransformerMixin from ..utils.validation import assert_all_finite, safe_asarray import numpy as np +from scipy import sparse class Earth(BaseEstimator, RegressorMixin, TransformerMixin): ''' @@ -216,18 +217,35 @@ def _scrub_x(self, X, **kwargs): ''' Sanitize input predictors and extract column names if appropriate. ''' + #Check for sparseness + if sparse.issparse(X): + raise TypeError('A sparse matrix was passed, but dense data ' + 'is required. Use X.toarray() to convert to dense.') #Convert to internally used data type X = safe_asarray(X,dtype=np.float64) if len(X.shape) == 1: X = X.reshape((X.shape[0], 1)) + #Ensure correct number of columns + if hasattr(self,'basis_') and self.basis_ is not None: + if X.shape[1] != self.basis_.num_variables: + raise ValueError('Wrong number of columns in X') + return X def _scrub(self, X, y, sample_weight, **kwargs): ''' Sanitize input data. ''' + #Check for sparseness + if sparse.issparse(y): + raise TypeError('A sparse matrix was passed, but dense data ' + 'is required. Use y.toarray() to convert to dense.') + if sparse.issparse(sample_weight): + raise TypeError('A sparse matrix was passed, but dense data ' + 'is required. Use sample_weight.toarray() to convert to dense.') + #Check whether X is the output of patsy.dmatrices if y is None and type(X) is tuple: y, X = X diff --git a/sklearn/earth/tests/test_basis.py b/sklearn/earth/tests/test_basis.py index 8f6688a94f27f..4051acd18ca62 100644 --- a/sklearn/earth/tests/test_basis.py +++ b/sklearn/earth/tests/test_basis.py @@ -83,7 +83,7 @@ def test_pickle_compatibility(self): class TestBasis(BaseTestClass): def __init__(self): super(self.__class__,self).__init__() - self.basis = Basis() + self.basis = Basis(self.X.shape[1]) self.parent = ConstantBasisFunction() self.bf = HingeBasisFunction(self.parent,1.0,10,1,False) self.basis.append(self.parent) diff --git a/sklearn/earth/tests/test_earth.py b/sklearn/earth/tests/test_earth.py index b5f1dae02824f..c0f44b6091e44 100644 --- a/sklearn/earth/tests/test_earth.py +++ b/sklearn/earth/tests/test_earth.py @@ -17,7 +17,7 @@ class TestEarth(object): def __init__(self): numpy.random.seed(0) - self.basis = Basis() + self.basis = Basis(10) constant = ConstantBasisFunction() self.basis.append(constant) bf1 = HingeBasisFunction(constant,0.1,10,1,False,'x1') diff --git a/sklearn/earth/tests/test_forward.py b/sklearn/earth/tests/test_forward.py index e15a45076bf5f..4fd0141b1e403 100644 --- a/sklearn/earth/tests/test_forward.py +++ b/sklearn/earth/tests/test_forward.py @@ -12,7 +12,7 @@ class TestForwardPasser(object): def __init__(self): numpy.random.seed(0) - self.basis = Basis() + self.basis = Basis(10) constant = ConstantBasisFunction() self.basis.append(constant) bf1 = HingeBasisFunction(constant,0.1,10,1,False,'x1') From f0484157c1d6252ff9f3b0ac8667e76b0e3aae6f Mon Sep 17 00:00:00 2001 From: Jason Rudy Date: Sat, 27 Jul 2013 22:38:28 -0700 Subject: [PATCH 11/19] removed unused gcv --- sklearn/earth/earth.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sklearn/earth/earth.py b/sklearn/earth/earth.py index e81720bbd7c23..ea7089f6a4ef1 100644 --- a/sklearn/earth/earth.py +++ b/sklearn/earth/earth.py @@ -1,6 +1,6 @@ from ._forward import ForwardPasser from ._pruning import PruningPasser -from ._util import ascii_table, gcv, apply_weights_2d, apply_weights_1d +from ._util import ascii_table, apply_weights_2d, apply_weights_1d from ..base import RegressorMixin, BaseEstimator, TransformerMixin from ..utils.validation import assert_all_finite, safe_asarray import numpy as np From 7e63062c05c79d5f958b63a4a3a0c81c245d854f Mon Sep 17 00:00:00 2001 From: Jason Rudy Date: Sat, 27 Jul 2013 23:00:38 -0700 Subject: [PATCH 12/19] autopep8 on everything --- examples/earth/classifier_comp.py | 12 +- examples/earth/pyearth_vs_earth.py | 129 +- examples/earth/sine_wave.py | 23 +- examples/earth/v_function.py | 21 +- sklearn/earth/__init__.py | 4 +- sklearn/earth/_basis.c | 2238 +++++++++---------- sklearn/earth/_basis.pxd | 135 +- sklearn/earth/_basis.pyx | 354 +-- sklearn/earth/_forward.c | 3061 ++++++++++++++------------ sklearn/earth/_forward.pxd | 53 +- sklearn/earth/_forward.pyx | 534 ++--- sklearn/earth/_pruning.c | 688 +++--- sklearn/earth/_pruning.pxd | 6 +- sklearn/earth/_pruning.pyx | 89 +- sklearn/earth/_record.c | 1594 +++++++------- sklearn/earth/_record.pxd | 40 +- sklearn/earth/_record.pyx | 157 +- sklearn/earth/_util.c | 83 +- sklearn/earth/_util.pxd | 4 +- sklearn/earth/_util.pyx | 28 +- sklearn/earth/earth.py | 540 ++--- sklearn/earth/setup.py | 1 + sklearn/earth/tests/test_basis.py | 123 +- sklearn/earth/tests/test_earth.py | 159 +- sklearn/earth/tests/test_forward.py | 51 +- sklearn/earth/tests/test_pruning.py | 2 +- sklearn/earth/tests/test_record.py | 68 +- sklearn/earth/tests/test_util.py | 2 +- sklearn/earth/tests/testing_utils.py | 3 + 29 files changed, 5320 insertions(+), 4882 deletions(-) diff --git a/examples/earth/classifier_comp.py b/examples/earth/classifier_comp.py index 935b8e20e5970..e0593a6ffc8a8 100644 --- a/examples/earth/classifier_comp.py +++ b/examples/earth/classifier_comp.py @@ -13,7 +13,7 @@ # Andreas Mueller # Modified for Documentation merge by Jaques Grobler # License: BSD 3 clause -# Modified to include Earth by Jason Rudy +# Modified to include Earth by Jason Rudy from __future__ import print_function import numpy as np @@ -41,9 +41,9 @@ np.random.seed(1) -#Combine Earth with LogisticRegression in a pipeline to do classification -earth_classifier = Pipeline([('earth',Earth(max_degree=3,penalty=1.5)), - ('logistic',LogisticRegression())]) +# Combine Earth with LogisticRegression in a pipeline to do classification +earth_classifier = Pipeline([('earth', Earth(max_degree=3, penalty=1.5)), + ('logistic', LogisticRegression())]) names = ["Nearest Neighbors", "Linear SVM", "RBF SVM", "Decision Tree", "Random Forest", "Naive Bayes", "LDA", "QDA", "Earth"] @@ -130,5 +130,5 @@ i += 1 figure.subplots_adjust(left=.02, right=.98) -pl.savefig('classifier_comp.pdf',transparent=True) -pl.show() \ No newline at end of file +pl.savefig('classifier_comp.pdf', transparent=True) +pl.show() diff --git a/examples/earth/pyearth_vs_earth.py b/examples/earth/pyearth_vs_earth.py index f98910816099c..48792e4141293 100644 --- a/examples/earth/pyearth_vs_earth.py +++ b/examples/earth/pyearth_vs_earth.py @@ -4,9 +4,9 @@ ============================= -This script randomly generates earth-style models, then randomly generates data from those models and +This script randomly generates earth-style models, then randomly generates data from those models and fits earth models to those data using both the python (:class:`Earth`) and R implementations. It records the sample size, -m, the number of input dimensions, n, the number of forward pass iterations, the runtime, and the r^2 +m, the number of input dimensions, n, the number of forward pass iterations, the runtime, and the r^2 statistic for each fit and writes the result to a CSV file. This script requires pandas, rpy2, and a functioning R installation with the earth package installed. ''' @@ -20,78 +20,93 @@ print(__doc__) + class DataGenerator(object): + def __init__(self): pass + def generate(self, m): pass + class NoiseGenerator(DataGenerator): + def __init__(self, n): self.n = n - + def generate(self, m): - X = numpy.random.normal(size=(m,self.n)) + X = numpy.random.normal(size=(m, self.n)) y = numpy.random.normal(size=m) return X, y - + + class LinearGenerator(DataGenerator): + def __init__(self, n): self.n = n - + def generate(self, m): - X = numpy.random.normal(size=(m,self.n)) + X = numpy.random.normal(size=(m, self.n)) beta = numpy.random.normal(size=self.n) - y = numpy.dot(X,beta) + numpy.random.normal(m) + y = numpy.dot(X, beta) + numpy.random.normal(m) return X, y + class VFunctionGenerator(DataGenerator): + def __init__(self, n): self.n = n - + def generate(self, m): - X = numpy.random.normal(size=(m,self.n)) + X = numpy.random.normal(size=(m, self.n)) var = numpy.random.randint(self.n) - y = 10*abs(X[:,var]) + numpy.random.normal(m) + y = 10 * abs(X[:, var]) + numpy.random.normal(m) return X, y - + + class UFunctionGenerator(DataGenerator): + def __init__(self, n): self.n = n - + def generate(self, m): - X = numpy.random.normal(size=(m,self.n)) + X = numpy.random.normal(size=(m, self.n)) var = numpy.random.randint(self.n) - y = 10*(X[:,var]**2) + numpy.random.normal(m) + y = 10 * (X[:, var] ** 2) + numpy.random.normal(m) return X, y - + + class RandomComplexityGenerator(DataGenerator): + def __init__(self, n, max_terms=10, max_degree=2): self.n = n self.max_terms = max_terms self.max_degree = max_degree - + def generate(self, m): - X = numpy.random.normal(size=(m,self.n)) - num_terms = numpy.random.randint(2,self.max_terms) #Including the intercept - coef = 10*numpy.random.normal(size=num_terms) - B = numpy.ones(shape=(m,num_terms)) - B[:,0] += coef[0] - for i in range(1,num_terms): - degree = numpy.random.randint(1,self.max_degree) + X = numpy.random.normal(size=(m, self.n)) + #Including the intercept + num_terms = numpy.random.randint(2, self.max_terms) + coef = 10 * numpy.random.normal(size=num_terms) + B = numpy.ones(shape=(m, num_terms)) + B[:, 0] += coef[0] + for i in range(1, num_terms): + degree = numpy.random.randint(1, self.max_degree) for bf in range(degree): knot = numpy.random.normal() - dir = 1 - 2*numpy.random.binomial(1,.5) - var = numpy.random.randint(0,self.n) - B[:,i] *= (dir*(X[:,var] - knot)) * (dir*(X[:,var] - knot) > 0) - y = numpy.dot(B,coef) + numpy.random.normal(size=m) + dir = 1 - 2 * numpy.random.binomial(1, .5) + var = numpy.random.randint(0, self.n) + B[:, i] *= (dir * (X[:, var] - knot)) * \ + (dir * (X[:, var] - knot) > 0) + y = numpy.dot(B, coef) + numpy.random.normal(size=m) return X, y - - + + def run_earth(X, y, **kwargs): '''Run with the R package earth. Return prediction value, training time, and number of forward pass iterations.''' r = robjects.r - m,n = X.shape + m, n = X.shape data = pandas.DataFrame(X) data['y'] = y r_data = com.convert_to_r_dataframe(data) @@ -106,46 +121,66 @@ def run_earth(X, y, **kwargs): ''' r(r_func) run = r('run') - r_list = run(**{'data':r_data,'degree':kwargs['max_degree'],'fast.k':0,'penalty':kwargs['penalty']}) + r_list = run( + **{'data': r_data, + 'degree': kwargs['max_degree'], + 'fast.k': 0, + 'penalty': kwargs['penalty']}) y_pred = numpy.array(r_list[0]).reshape(m) time = r_list[1][0] forward_terms = r_list[2][0] return y_pred, time, (forward_terms - 1) / 2 - + + def run_pyearth(X, y, **kwargs): '''Run with pyearth. Return prediction value, training time, and number of forward pass iterations.''' model = Earth(**kwargs) t0 = time.time() - model.fit(X,y) + model.fit(X, y) t1 = time.time() y_pred = model.predict(X) forward_iterations = len(model.forward_trace()) - 1 - return y_pred, t1-t0, forward_iterations - + return y_pred, t1 - t0, forward_iterations + + def compare(generator_class, sample_sizes, dimensions, repetitions, **kwargs): '''Return a data table that includes m, n, pyearth or earth, training time, and number of forward pass iterations.''' - header = ['m','n','pyearth','earth','time','forward_iterations','rsq'] + header = [ + 'm', + 'n', + 'pyearth', + 'earth', + 'time', + 'forward_iterations', + 'rsq'] data = [] for n in dimensions: generator = generator_class(n=n) for m in sample_sizes: for rep in range(repetitions): X, y = generator.generate(m=m) - y_pred_r, time_r, iter_r = run_earth(X,y,**kwargs) - rsq_r = 1 - (numpy.sum((y-y_pred_r)**2))/(numpy.sum((y-numpy.mean(y))**2)) - data.append([m,n,0,1,time_r,iter_r,rsq_r]) - y_pred_py, time_py, iter_py = run_pyearth(X,y,**kwargs) - rsq_py = 1 - (numpy.sum((y-y_pred_py)**2))/(numpy.sum((y-numpy.mean(y))**2)) - data.append([m,n,1,0,time_py,iter_py,rsq_py]) - return pandas.DataFrame(data,columns=header) + y_pred_r, time_r, iter_r = run_earth(X, y, **kwargs) + rsq_r = 1 - (numpy.sum((y - y_pred_r) ** 2)) / ( + numpy.sum((y - numpy.mean(y)) ** 2)) + data.append([m, n, 0, 1, time_r, iter_r, rsq_r]) + y_pred_py, time_py, iter_py = run_pyearth(X, y, **kwargs) + rsq_py = 1 - \ + (numpy.sum((y - y_pred_py) ** 2)) / ( + numpy.sum((y - numpy.mean(y)) ** 2)) + data.append([m, n, 1, 0, time_py, iter_py, rsq_py]) + return pandas.DataFrame(data, columns=header) if __name__ == '__main__': sample_sizes = [100, 200, 300, 500] dimensions = [10, 20, 30] rep = 5 numpy.random.seed(1) - data = compare(RandomComplexityGenerator,sample_sizes,dimensions,rep,max_degree=2,penalty=3.0) + data = compare( + RandomComplexityGenerator, + sample_sizes, + dimensions, + rep, + max_degree=2, + penalty=3.0) print(data) data.to_csv('comparison.csv') - - \ No newline at end of file diff --git a/examples/earth/sine_wave.py b/examples/earth/sine_wave.py index 417479d3eba76..7c3d0aa6e9766 100644 --- a/examples/earth/sine_wave.py +++ b/examples/earth/sine_wave.py @@ -15,25 +15,26 @@ print(__doc__) -#Create some fake data +# Create some fake data numpy.random.seed(2) m = 10000 n = 10 -X = 80*numpy.random.uniform(size=(m,n)) - 40 -y = 100*numpy.abs(numpy.sin((X[:,6])/10) - 4.0) + 20*numpy.random.normal(size=m) +X = 80 * numpy.random.uniform(size=(m, n)) - 40 +y = 100 * \ + numpy.abs(numpy.sin((X[:, 6]) / 10) - 4.0) + \ + 20 * numpy.random.normal(size=m) -#Fit an Earth model -model = Earth(max_degree = 3,minspan_alpha=.5) -model.fit(X,y) +# Fit an Earth model +model = Earth(max_degree=3, minspan_alpha=.5) +model.fit(X, y) -#Print the model +# Print the model print(model.trace()) print(model.summary()) -#Plot the model +# Plot the model y_hat = model.predict(X) pyplot.figure() -pyplot.plot(X[:,6],y,'r.') -pyplot.plot(X[:,6],y_hat,'b.') +pyplot.plot(X[:, 6], y, 'r.') +pyplot.plot(X[:, 6], y_hat, 'b.') pyplot.show() - diff --git a/examples/earth/v_function.py b/examples/earth/v_function.py index bda0867314e65..7533059c356f4 100644 --- a/examples/earth/v_function.py +++ b/examples/earth/v_function.py @@ -15,25 +15,24 @@ print(__doc__) -#Create some fake data +# Create some fake data numpy.random.seed(2) m = 1000 n = 10 -X = 80*numpy.random.uniform(size=(m,n)) - 40 -y = numpy.abs(X[:,6] - 4.0) + 5*numpy.random.normal(size=m) +X = 80 * numpy.random.uniform(size=(m, n)) - 40 +y = numpy.abs(X[:, 6] - 4.0) + 5 * numpy.random.normal(size=m) -#Fit an Earth model -model = Earth(max_degree = 1) -model.fit(X,y) +# Fit an Earth model +model = Earth(max_degree=1) +model.fit(X, y) -#Print the model +# Print the model print(model.trace()) print(model.summary()) -#Plot the model +# Plot the model y_hat = model.predict(X) pyplot.figure() -pyplot.plot(X[:,6],y,'r.') -pyplot.plot(X[:,6],y_hat,'b.') +pyplot.plot(X[:, 6], y, 'r.') +pyplot.plot(X[:, 6], y_hat, 'b.') pyplot.show() - diff --git a/sklearn/earth/__init__.py b/sklearn/earth/__init__.py index 7b7657d5a554f..b7c88f1725b9b 100644 --- a/sklearn/earth/__init__.py +++ b/sklearn/earth/__init__.py @@ -1,8 +1,8 @@ """ -The :mod:`sklearn.earth` module contains the the Earth class for multivariate +The :mod:`sklearn.earth` module contains the the Earth class for multivariate adaptive regression splines. """ from .earth import Earth -__all__ = ['Earth'] \ No newline at end of file +__all__ = ['Earth'] diff --git a/sklearn/earth/_basis.c b/sklearn/earth/_basis.c index c03c8b0632468..daf52366492b8 100644 --- a/sklearn/earth/_basis.c +++ b/sklearn/earth/_basis.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19.1 on Sat Jul 27 21:13:14 2013 */ +/* Generated by Cython 0.19.1 on Sat Jul 27 22:55:34 2013 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS @@ -879,9 +879,9 @@ struct __pyx_opt_args_7sklearn_5earth_6_basis_19LinearBasisFunction_apply; /* "sklearn/earth/_basis.pxd":45 * cpdef INDEX_t degree(BasisFunction self) * - * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) # <<<<<<<<<<<<<< + * cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse= ?) # <<<<<<<<<<<<<< * - * cpdef cnp.ndarray[INT_t, ndim=1] valid_knots(BasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] values, cnp.ndarray[FLOAT_t,ndim=1] variable, int variable_idx, INDEX_t check_every, int endspan, int minspan, FLOAT_t minspan_alpha, INDEX_t n, cnp.ndarray[INT_t,ndim=1] workspace) + * cpdef cnp.ndarray[INT_t, ndim = 1] valid_knots(BasisFunction self, cnp.ndarray[FLOAT_t, ndim=1] values, cnp.ndarray[FLOAT_t, ndim=1] variable, int variable_idx, INDEX_t check_every, int endspan, int minspan, FLOAT_t minspan_alpha, INDEX_t n, cnp.ndarray[INT_t, ndim=1] workspace) */ struct __pyx_opt_args_7sklearn_5earth_6_basis_13BasisFunction_apply { int __pyx_n; @@ -891,7 +891,7 @@ struct __pyx_opt_args_7sklearn_5earth_6_basis_13BasisFunction_apply { /* "sklearn/earth/_basis.pxd":62 * cpdef BasisFunction get_parent(self) * - * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) # <<<<<<<<<<<<<< + * cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse= ?) # <<<<<<<<<<<<<< * * */ @@ -903,7 +903,7 @@ struct __pyx_opt_args_7sklearn_5earth_6_basis_21ConstantBasisFunction_apply { /* "sklearn/earth/_basis.pxd":86 * cpdef INDEX_t get_knot_idx(self) * - * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) # <<<<<<<<<<<<<< + * cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse= ?) # <<<<<<<<<<<<<< * * cdef class LinearBasisFunction(BasisFunction): */ @@ -915,7 +915,7 @@ struct __pyx_opt_args_7sklearn_5earth_6_basis_18HingeBasisFunction_apply { /* "sklearn/earth/_basis.pxd":98 * cpdef INDEX_t get_variable(self) * - * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) # <<<<<<<<<<<<<< + * cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse= ?) # <<<<<<<<<<<<<< * * */ @@ -924,7 +924,7 @@ struct __pyx_opt_args_7sklearn_5earth_6_basis_19LinearBasisFunction_apply { int recurse; }; -/* "sklearn/earth/_basis.pxd":102 +/* "sklearn/earth/_basis.pxd":101 * * * cdef class Basis: # <<<<<<<<<<<<<< @@ -958,7 +958,7 @@ struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction { }; -/* "sklearn/earth/_basis.pyx":281 +/* "sklearn/earth/_basis.pyx":282 * return result * * cdef class PicklePlaceHolderBasisFunction(BasisFunction): # <<<<<<<<<<<<<< @@ -982,7 +982,7 @@ struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction { }; -/* "sklearn/earth/_basis.pyx":508 +/* "sklearn/earth/_basis.pyx":513 * return self.__class__ is other.__class__ and self._getstate() == other._getstate() * * def piter(Basis self): # <<<<<<<<<<<<<< @@ -1016,7 +1016,7 @@ struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction { /* "sklearn/earth/_basis.pxd":88 - * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) + * cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse= ?) * * cdef class LinearBasisFunction(BasisFunction): # <<<<<<<<<<<<<< * cdef INDEX_t variable @@ -1059,12 +1059,12 @@ struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction { static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *__pyx_vtabptr_7sklearn_5earth_6_basis_BasisFunction; -/* "sklearn/earth/_basis.pyx":427 +/* "sklearn/earth/_basis.pyx":431 * b[i] *= tmp * * cdef class LinearBasisFunction(BasisFunction): # <<<<<<<<<<<<<< - * def __init__(self, BasisFunction parent, INDEX_t variable, label=None): #@DuplicatedSignature - * self.variable = variable + * #@DuplicatedSignature + * def __init__(self, BasisFunction parent, INDEX_t variable, label=None): */ struct __pyx_vtabstruct_7sklearn_5earth_6_basis_LinearBasisFunction { @@ -1076,12 +1076,12 @@ struct __pyx_vtabstruct_7sklearn_5earth_6_basis_LinearBasisFunction { static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_LinearBasisFunction *__pyx_vtabptr_7sklearn_5earth_6_basis_LinearBasisFunction; -/* "sklearn/earth/_basis.pyx":330 +/* "sklearn/earth/_basis.pyx":331 * return '(Intercept)' * * cdef class HingeBasisFunction(BasisFunction): # <<<<<<<<<<<<<< * - * def __init__(self, BasisFunction parent, FLOAT_t knot, INDEX_t knot_idx, INDEX_t variable, bint reverse, label=None): #@DuplicatedSignature + * #@DuplicatedSignature */ struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction { @@ -1096,11 +1096,11 @@ struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction { static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction *__pyx_vtabptr_7sklearn_5earth_6_basis_HingeBasisFunction; -/* "sklearn/earth/_basis.pyx":286 +/* "sklearn/earth/_basis.pyx":287 * pickle_place_holder = PicklePlaceHolderBasisFunction() * * cdef class ConstantBasisFunction(BasisFunction): # <<<<<<<<<<<<<< - * def __init__(self): #@DuplicatedSignature + * def __init__(self): # @DuplicatedSignature * self.prunable = False */ @@ -1112,8 +1112,8 @@ struct __pyx_vtabstruct_7sklearn_5earth_6_basis_ConstantBasisFunction { static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_ConstantBasisFunction *__pyx_vtabptr_7sklearn_5earth_6_basis_ConstantBasisFunction; -/* "sklearn/earth/_basis.pyx":479 - * b[i] *= X[i,self.variable] +/* "sklearn/earth/_basis.pyx":484 + * b[i] *= X[i, self.variable] * * cdef class Basis: # <<<<<<<<<<<<<< * '''A container that provides functionality related to a set of BasisFunctions with a @@ -1133,7 +1133,7 @@ struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis { static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *__pyx_vtabptr_7sklearn_5earth_6_basis_Basis; -/* "sklearn/earth/_basis.pyx":281 +/* "sklearn/earth/_basis.pyx":282 * return result * * cdef class PicklePlaceHolderBasisFunction(BasisFunction): # <<<<<<<<<<<<<< @@ -2186,7 +2186,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_7_getstate(PyO * * def _getstate(self): # <<<<<<<<<<<<<< * result = {'pruned': self.pruned, - * 'children': self.children, + * 'children': self.children, */ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_6_getstate(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_v_self) { @@ -2205,8 +2205,8 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_6_getstate(str * * def _getstate(self): * result = {'pruned': self.pruned, # <<<<<<<<<<<<<< - * 'children': self.children, - * 'prunable': self.prunable, + * 'children': self.children, + * 'prunable': self.prunable, */ __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); @@ -2218,18 +2218,18 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_6_getstate(str /* "sklearn/earth/_basis.pyx":30 * def _getstate(self): * result = {'pruned': self.pruned, - * 'children': self.children, # <<<<<<<<<<<<<< - * 'prunable': self.prunable, - * 'child_map': self.child_map, + * 'children': self.children, # <<<<<<<<<<<<<< + * 'prunable': self.prunable, + * 'child_map': self.child_map, */ if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__children), ((PyObject *)__pyx_v_self->children)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "sklearn/earth/_basis.pyx":31 * result = {'pruned': self.pruned, - * 'children': self.children, - * 'prunable': self.prunable, # <<<<<<<<<<<<<< - * 'child_map': self.child_map, - * 'splittable': self.splittable} + * 'children': self.children, + * 'prunable': self.prunable, # <<<<<<<<<<<<<< + * 'child_map': self.child_map, + * 'splittable': self.splittable} */ __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_self->prunable); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -2237,18 +2237,18 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_6_getstate(str __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "sklearn/earth/_basis.pyx":32 - * 'children': self.children, - * 'prunable': self.prunable, - * 'child_map': self.child_map, # <<<<<<<<<<<<<< - * 'splittable': self.splittable} + * 'children': self.children, + * 'prunable': self.prunable, + * 'child_map': self.child_map, # <<<<<<<<<<<<<< + * 'splittable': self.splittable} * result.update(self._get_parent_state()) */ if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__child_map), ((PyObject *)__pyx_v_self->child_map)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "sklearn/earth/_basis.pyx":33 - * 'prunable': self.prunable, - * 'child_map': self.child_map, - * 'splittable': self.splittable} # <<<<<<<<<<<<<< + * 'prunable': self.prunable, + * 'child_map': self.child_map, + * 'splittable': self.splittable} # <<<<<<<<<<<<<< * result.update(self._get_parent_state()) * return result */ @@ -2260,8 +2260,8 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_6_getstate(str __pyx_t_1 = 0; /* "sklearn/earth/_basis.pyx":34 - * 'child_map': self.child_map, - * 'splittable': self.splittable} + * 'child_map': self.child_map, + * 'splittable': self.splittable} * result.update(self._get_parent_state()) # <<<<<<<<<<<<<< * return result * @@ -2285,7 +2285,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_6_getstate(str __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "sklearn/earth/_basis.pyx":35 - * 'splittable': self.splittable} + * 'splittable': self.splittable} * result.update(self._get_parent_state()) * return result # <<<<<<<<<<<<<< * @@ -3520,7 +3520,7 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_get_children(st * cdef list get_children(BasisFunction self): * return self.children # <<<<<<<<<<<<<< * - * cpdef _set_parent(self,BasisFunction parent): + * cpdef _set_parent(self, BasisFunction parent): */ __Pyx_XDECREF(((PyObject *)__pyx_r)); __Pyx_INCREF(((PyObject *)__pyx_v_self->children)); @@ -3537,7 +3537,7 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_get_children(st /* "sklearn/earth/_basis.pyx":91 * return self.children * - * cpdef _set_parent(self,BasisFunction parent): # <<<<<<<<<<<<<< + * cpdef _set_parent(self, BasisFunction parent): # <<<<<<<<<<<<<< * '''Calls _add_child.''' * self.parent = parent */ @@ -3578,7 +3578,7 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction__set_parent(str } /* "sklearn/earth/_basis.pyx":93 - * cpdef _set_parent(self,BasisFunction parent): + * cpdef _set_parent(self, BasisFunction parent): * '''Calls _add_child.''' * self.parent = parent # <<<<<<<<<<<<<< * self.parent._add_child(self) @@ -3595,7 +3595,7 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction__set_parent(str * self.parent = parent * self.parent._add_child(self) # <<<<<<<<<<<<<< * - * cpdef _add_child(self,BasisFunction child): + * cpdef _add_child(self, BasisFunction child): */ __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self->parent->__pyx_vtab)->_add_child(__pyx_v_self->parent, __pyx_v_self, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); @@ -3638,7 +3638,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_31_set_parent( /* "sklearn/earth/_basis.pyx":91 * return self.children * - * cpdef _set_parent(self,BasisFunction parent): # <<<<<<<<<<<<<< + * cpdef _set_parent(self, BasisFunction parent): # <<<<<<<<<<<<<< * '''Calls _add_child.''' * self.parent = parent */ @@ -3673,7 +3673,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_30_set_parent( /* "sklearn/earth/_basis.pyx":96 * self.parent._add_child(self) * - * cpdef _add_child(self,BasisFunction child): # <<<<<<<<<<<<<< + * cpdef _add_child(self, BasisFunction child): # <<<<<<<<<<<<<< * '''Called by _set_parent.''' * cdef INDEX_t n = len(self.children) */ @@ -3721,7 +3721,7 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction__add_child(stru } /* "sklearn/earth/_basis.pyx":98 - * cpdef _add_child(self,BasisFunction child): + * cpdef _add_child(self, BasisFunction child): * '''Called by _set_parent.''' * cdef INDEX_t n = len(self.children) # <<<<<<<<<<<<<< * self.children.append(child) @@ -3868,7 +3868,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_33_add_child(P /* "sklearn/earth/_basis.pyx":96 * self.parent._add_child(self) * - * cpdef _add_child(self,BasisFunction child): # <<<<<<<<<<<<<< + * cpdef _add_child(self, BasisFunction child): # <<<<<<<<<<<<<< * '''Called by _set_parent.''' * cdef INDEX_t n = len(self.children) */ @@ -4559,7 +4559,7 @@ static __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_f_7sklearn_5earth_6_basis_1 * cpdef INDEX_t degree(BasisFunction self): * return self.parent.degree() + 1 # <<<<<<<<<<<<<< * - * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = True): + * cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse=True): */ __pyx_r = (((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self->parent->__pyx_vtab)->degree(__pyx_v_self->parent, 0) + 1); goto __pyx_L0; @@ -4625,7 +4625,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_42degree(struc /* "sklearn/earth/_basis.pyx":137 * return self.parent.degree() + 1 * - * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = True): # <<<<<<<<<<<<<< + * cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse=True): # <<<<<<<<<<<<<< * ''' * X - Data matrix */ @@ -4704,7 +4704,7 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_apply(CYTHON_UN /* "sklearn/earth/_basis.pyx":145 * ''' * - * cpdef cnp.ndarray[INT_t, ndim=1] valid_knots(BasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] values, cnp.ndarray[FLOAT_t,ndim=1] variable, int variable_idx, INDEX_t check_every, int endspan, int minspan, FLOAT_t minspan_alpha, INDEX_t n, cnp.ndarray[INT_t,ndim=1] workspace): # <<<<<<<<<<<<<< + * cpdef cnp.ndarray[INT_t, ndim = 1] valid_knots(BasisFunction self, cnp.ndarray[FLOAT_t, ndim=1] values, cnp.ndarray[FLOAT_t, ndim=1] variable, int variable_idx, INDEX_t check_every, int endspan, int minspan, FLOAT_t minspan_alpha, INDEX_t n, cnp.ndarray[INT_t, ndim=1] workspace): # <<<<<<<<<<<<<< * ''' * values - The unsorted values of self in the data set */ @@ -4795,7 +4795,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_45apply(PyObje /* "sklearn/earth/_basis.pyx":137 * return self.parent.degree() + 1 * - * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = True): # <<<<<<<<<<<<<< + * cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse=True): # <<<<<<<<<<<<<< * ''' * X - Data matrix */ @@ -4885,7 +4885,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_13BasisFunction_44apply(struct /* "sklearn/earth/_basis.pyx":145 * ''' * - * cpdef cnp.ndarray[INT_t, ndim=1] valid_knots(BasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] values, cnp.ndarray[FLOAT_t,ndim=1] variable, int variable_idx, INDEX_t check_every, int endspan, int minspan, FLOAT_t minspan_alpha, INDEX_t n, cnp.ndarray[INT_t,ndim=1] workspace): # <<<<<<<<<<<<<< + * cpdef cnp.ndarray[INT_t, ndim = 1] valid_knots(BasisFunction self, cnp.ndarray[FLOAT_t, ndim=1] values, cnp.ndarray[FLOAT_t, ndim=1] variable, int variable_idx, INDEX_t check_every, int endspan, int minspan, FLOAT_t minspan_alpha, INDEX_t n, cnp.ndarray[INT_t, ndim=1] workspace): # <<<<<<<<<<<<<< * ''' * values - The unsorted values of self in the data set */ @@ -5072,8 +5072,8 @@ static PyArrayObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_valid_knot /* "sklearn/earth/_basis.pyx":166 * cdef int idx * cdef int last_idx - * cdef FLOAT_t first_var_value = variable[m-1] # <<<<<<<<<<<<<< - * cdef FLOAT_t last_var_value = variable[m-1] + * cdef FLOAT_t first_var_value = variable[m - 1] # <<<<<<<<<<<<<< + * cdef FLOAT_t last_var_value = variable[m - 1] * */ __pyx_t_9 = (__pyx_v_m - 1); @@ -5081,17 +5081,17 @@ static PyArrayObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_valid_knot /* "sklearn/earth/_basis.pyx":167 * cdef int last_idx - * cdef FLOAT_t first_var_value = variable[m-1] - * cdef FLOAT_t last_var_value = variable[m-1] # <<<<<<<<<<<<<< + * cdef FLOAT_t first_var_value = variable[m - 1] + * cdef FLOAT_t last_var_value = variable[m - 1] # <<<<<<<<<<<<<< * - * #Calculate the used knots + * # Calculate the used knots */ __pyx_t_10 = (__pyx_v_m - 1); __pyx_v_last_var_value = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_FLOAT_t *, __pyx_pybuffernd_variable.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_variable.diminfo[0].strides)); /* "sklearn/earth/_basis.pyx":170 * - * #Calculate the used knots + * # Calculate the used knots * cdef list used_knots = self.knots(variable_idx) # <<<<<<<<<<<<<< * used_knots.sort() * @@ -5103,11 +5103,11 @@ static PyArrayObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_valid_knot __pyx_t_1 = 0; /* "sklearn/earth/_basis.pyx":171 - * #Calculate the used knots + * # Calculate the used knots * cdef list used_knots = self.knots(variable_idx) * used_knots.sort() # <<<<<<<<<<<<<< * - * #Initialize workspace to 1 where value is nonzero + * # Initialize workspace to 1 where value is nonzero */ if (unlikely(((PyObject *)__pyx_v_used_knots) == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "sort"); @@ -5116,8 +5116,8 @@ static PyArrayObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_valid_knot __pyx_t_11 = PyList_Sort(((PyObject *)__pyx_v_used_knots)); if (unlikely(__pyx_t_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /* "sklearn/earth/_basis.pyx":177 - * #where value is nonzero and last_var_value to the - * #minimum variable where value is nonzero + * # where value is nonzero and last_var_value to the + * # minimum variable where value is nonzero * count = 0 # <<<<<<<<<<<<<< * for i in range(m): * if abs(values[i]) > ZERO_TOL: @@ -5125,7 +5125,7 @@ static PyArrayObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_valid_knot __pyx_v_count = 0; /* "sklearn/earth/_basis.pyx":178 - * #minimum variable where value is nonzero + * # minimum variable where value is nonzero * count = 0 * for i in range(m): # <<<<<<<<<<<<<< * if abs(values[i]) > ZERO_TOL: @@ -5207,7 +5207,7 @@ static PyArrayObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_valid_knot * else: * workspace[i] = 0 # <<<<<<<<<<<<<< * - * #Calculate minspan + * # Calculate minspan */ __pyx_t_20 = __pyx_v_i; *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_workspace.diminfo[0].strides) = 0; @@ -5217,18 +5217,18 @@ static PyArrayObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_valid_knot /* "sklearn/earth/_basis.pyx":189 * - * #Calculate minspan + * # Calculate minspan * if minspan < 0: # <<<<<<<<<<<<<< - * minspan_ = (-log2(-(1.0/(n*count))*log(1.0-minspan_alpha)) / 2.5) + * minspan_ = (-log2(-(1.0 / (n * count)) * log(1.0 - minspan_alpha)) / 2.5) * else: */ __pyx_t_15 = ((__pyx_v_minspan < 0) != 0); if (__pyx_t_15) { /* "sklearn/earth/_basis.pyx":190 - * #Calculate minspan + * # Calculate minspan * if minspan < 0: - * minspan_ = (-log2(-(1.0/(n*count))*log(1.0-minspan_alpha)) / 2.5) # <<<<<<<<<<<<<< + * minspan_ = (-log2(-(1.0 / (n * count)) * log(1.0 - minspan_alpha)) / 2.5) # <<<<<<<<<<<<<< * else: * minspan_ = minspan */ @@ -5238,11 +5238,11 @@ static PyArrayObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_valid_knot /*else*/ { /* "sklearn/earth/_basis.pyx":192 - * minspan_ = (-log2(-(1.0/(n*count))*log(1.0-minspan_alpha)) / 2.5) + * minspan_ = (-log2(-(1.0 / (n * count)) * log(1.0 - minspan_alpha)) / 2.5) * else: * minspan_ = minspan # <<<<<<<<<<<<<< * - * #Take out the used points and apply minspan + * # Take out the used points and apply minspan */ __pyx_v_minspan_ = __pyx_v_minspan; } @@ -5250,7 +5250,7 @@ static PyArrayObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_valid_knot /* "sklearn/earth/_basis.pyx":195 * - * #Take out the used points and apply minspan + * # Take out the used points and apply minspan * num_used = len(used_knots) # <<<<<<<<<<<<<< * prev = 0 * last_idx = -1 @@ -5263,7 +5263,7 @@ static PyArrayObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_valid_knot __pyx_v_num_used = __pyx_t_21; /* "sklearn/earth/_basis.pyx":196 - * #Take out the used points and apply minspan + * # Take out the used points and apply minspan * num_used = len(used_knots) * prev = 0 # <<<<<<<<<<<<<< * last_idx = -1 @@ -5351,7 +5351,7 @@ static PyArrayObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_valid_knot * j = idx * k = 0 # <<<<<<<<<<<<<< * while j > prev + 1 and k < minspan_: - * if workspace[j-1]: + * if workspace[j - 1]: */ __pyx_v_k = 0; @@ -5359,8 +5359,8 @@ static PyArrayObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_valid_knot * j = idx * k = 0 * while j > prev + 1 and k < minspan_: # <<<<<<<<<<<<<< - * if workspace[j-1]: - * workspace[j-1] = False + * if workspace[j - 1]: + * workspace[j - 1] = False */ while (1) { __pyx_t_15 = ((__pyx_v_j > (__pyx_v_prev + 1)) != 0); @@ -5375,8 +5375,8 @@ static PyArrayObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_valid_knot /* "sklearn/earth/_basis.pyx":206 * k = 0 * while j > prev + 1 and k < minspan_: - * if workspace[j-1]: # <<<<<<<<<<<<<< - * workspace[j-1] = False + * if workspace[j - 1]: # <<<<<<<<<<<<<< + * workspace[j - 1] = False * k += 1 */ __pyx_t_25 = (__pyx_v_j - 1); @@ -5385,8 +5385,8 @@ static PyArrayObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_valid_knot /* "sklearn/earth/_basis.pyx":207 * while j > prev + 1 and k < minspan_: - * if workspace[j-1]: - * workspace[j-1] = False # <<<<<<<<<<<<<< + * if workspace[j - 1]: + * workspace[j - 1] = False # <<<<<<<<<<<<<< * k += 1 * j -= 1 */ @@ -5394,8 +5394,8 @@ static PyArrayObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_valid_knot *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_workspace.diminfo[0].strides) = 0; /* "sklearn/earth/_basis.pyx":208 - * if workspace[j-1]: - * workspace[j-1] = False + * if workspace[j - 1]: + * workspace[j - 1] = False * k += 1 # <<<<<<<<<<<<<< * j -= 1 * j = idx + 1 @@ -5406,7 +5406,7 @@ static PyArrayObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_valid_knot __pyx_L13:; /* "sklearn/earth/_basis.pyx":209 - * workspace[j-1] = False + * workspace[j - 1] = False * k += 1 * j -= 1 # <<<<<<<<<<<<<< * j = idx + 1 @@ -5507,7 +5507,7 @@ static PyArrayObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_valid_knot * prev = idx * last_idx = idx # <<<<<<<<<<<<<< * - * #Apply endspan + * # Apply endspan */ __pyx_v_last_idx = __pyx_v_idx; __pyx_L8_continue:; @@ -5515,7 +5515,7 @@ static PyArrayObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_valid_knot /* "sklearn/earth/_basis.pyx":221 * - * #Apply endspan + * # Apply endspan * i = 0 # <<<<<<<<<<<<<< * j = 0 * while i < endspan: @@ -5523,7 +5523,7 @@ static PyArrayObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_valid_knot __pyx_v_i = 0; /* "sklearn/earth/_basis.pyx":222 - * #Apply endspan + * # Apply endspan * i = 0 * j = 0 # <<<<<<<<<<<<<< * while i < endspan: @@ -5697,7 +5697,7 @@ static PyArrayObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_valid_knot * break * j -= 1 # <<<<<<<<<<<<<< * - * #Implement check_every + * # Implement check_every */ __pyx_v_j = (__pyx_v_j - 1); } @@ -5705,7 +5705,7 @@ static PyArrayObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_valid_knot /* "sklearn/earth/_basis.pyx":241 * - * #Implement check_every + * # Implement check_every * int_tmp = 0 # <<<<<<<<<<<<<< * count = 0 * for i in range(m): @@ -5713,7 +5713,7 @@ static PyArrayObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_valid_knot __pyx_v_int_tmp = 0; /* "sklearn/earth/_basis.pyx":242 - * #Implement check_every + * # Implement check_every * int_tmp = 0 * count = 0 # <<<<<<<<<<<<<< * for i in range(m): @@ -5794,16 +5794,16 @@ static PyArrayObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_valid_knot * else: * int_tmp = 0 # <<<<<<<<<<<<<< * - * #Make sure the greatest value is not a candidate (this can happen if the first endspan+1 values are the same) + * # Make sure the greatest value is not a candidate (this can happen if */ __pyx_v_int_tmp = 0; } __pyx_L27:; } - /* "sklearn/earth/_basis.pyx":254 - * - * #Make sure the greatest value is not a candidate (this can happen if the first endspan+1 values are the same) + /* "sklearn/earth/_basis.pyx":255 + * # Make sure the greatest value is not a candidate (this can happen if + * # the first endspan+1 values are the same) * for i in range(m): # <<<<<<<<<<<<<< * if workspace[i]: * if variable[i] == first_var_value: @@ -5812,8 +5812,8 @@ static PyArrayObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_valid_knot for (__pyx_t_32 = 0; __pyx_t_32 < __pyx_t_31; __pyx_t_32+=1) { __pyx_v_i = __pyx_t_32; - /* "sklearn/earth/_basis.pyx":255 - * #Make sure the greatest value is not a candidate (this can happen if the first endspan+1 values are the same) + /* "sklearn/earth/_basis.pyx":256 + * # the first endspan+1 values are the same) * for i in range(m): * if workspace[i]: # <<<<<<<<<<<<<< * if variable[i] == first_var_value: @@ -5823,7 +5823,7 @@ static PyArrayObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_valid_knot __pyx_t_23 = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_workspace.diminfo[0].strides)) != 0); if (__pyx_t_23) { - /* "sklearn/earth/_basis.pyx":256 + /* "sklearn/earth/_basis.pyx":257 * for i in range(m): * if workspace[i]: * if variable[i] == first_var_value: # <<<<<<<<<<<<<< @@ -5834,7 +5834,7 @@ static PyArrayObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_valid_knot __pyx_t_23 = (((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_FLOAT_t *, __pyx_pybuffernd_variable.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_variable.diminfo[0].strides)) == __pyx_v_first_var_value) != 0); if (__pyx_t_23) { - /* "sklearn/earth/_basis.pyx":257 + /* "sklearn/earth/_basis.pyx":258 * if workspace[i]: * if variable[i] == first_var_value: * workspace[i] = 0 # <<<<<<<<<<<<<< @@ -5844,7 +5844,7 @@ static PyArrayObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_valid_knot __pyx_t_37 = __pyx_v_i; *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_workspace.diminfo[0].strides) = 0; - /* "sklearn/earth/_basis.pyx":258 + /* "sklearn/earth/_basis.pyx":259 * if variable[i] == first_var_value: * workspace[i] = 0 * count -= 1 # <<<<<<<<<<<<<< @@ -5856,12 +5856,12 @@ static PyArrayObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_valid_knot } /*else*/ { - /* "sklearn/earth/_basis.pyx":260 + /* "sklearn/earth/_basis.pyx":261 * count -= 1 * else: * break # <<<<<<<<<<<<<< * - * #Also make sure the least value is not a candidate + * # Also make sure the least value is not a candidate */ goto __pyx_L30_break; } @@ -5872,52 +5872,52 @@ static PyArrayObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_valid_knot } __pyx_L30_break:; - /* "sklearn/earth/_basis.pyx":263 + /* "sklearn/earth/_basis.pyx":264 * - * #Also make sure the least value is not a candidate + * # Also make sure the least value is not a candidate * for i in range(m): # <<<<<<<<<<<<<< - * if workspace[m-i-1]: - * if variable[m-i-1] == last_var_value: + * if workspace[m - i - 1]: + * if variable[m - i - 1] == last_var_value: */ __pyx_t_31 = __pyx_v_m; for (__pyx_t_32 = 0; __pyx_t_32 < __pyx_t_31; __pyx_t_32+=1) { __pyx_v_i = __pyx_t_32; - /* "sklearn/earth/_basis.pyx":264 - * #Also make sure the least value is not a candidate + /* "sklearn/earth/_basis.pyx":265 + * # Also make sure the least value is not a candidate * for i in range(m): - * if workspace[m-i-1]: # <<<<<<<<<<<<<< - * if variable[m-i-1] == last_var_value: - * workspace[m-i-1] = 0 + * if workspace[m - i - 1]: # <<<<<<<<<<<<<< + * if variable[m - i - 1] == last_var_value: + * workspace[m - i - 1] = 0 */ __pyx_t_38 = ((__pyx_v_m - __pyx_v_i) - 1); __pyx_t_23 = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_workspace.diminfo[0].strides)) != 0); if (__pyx_t_23) { - /* "sklearn/earth/_basis.pyx":265 + /* "sklearn/earth/_basis.pyx":266 * for i in range(m): - * if workspace[m-i-1]: - * if variable[m-i-1] == last_var_value: # <<<<<<<<<<<<<< - * workspace[m-i-1] = 0 + * if workspace[m - i - 1]: + * if variable[m - i - 1] == last_var_value: # <<<<<<<<<<<<<< + * workspace[m - i - 1] = 0 * count -= 1 */ __pyx_t_39 = ((__pyx_v_m - __pyx_v_i) - 1); __pyx_t_23 = (((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_FLOAT_t *, __pyx_pybuffernd_variable.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_variable.diminfo[0].strides)) == __pyx_v_last_var_value) != 0); if (__pyx_t_23) { - /* "sklearn/earth/_basis.pyx":266 - * if workspace[m-i-1]: - * if variable[m-i-1] == last_var_value: - * workspace[m-i-1] = 0 # <<<<<<<<<<<<<< + /* "sklearn/earth/_basis.pyx":267 + * if workspace[m - i - 1]: + * if variable[m - i - 1] == last_var_value: + * workspace[m - i - 1] = 0 # <<<<<<<<<<<<<< * count -= 1 * else: */ __pyx_t_40 = ((__pyx_v_m - __pyx_v_i) - 1); *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_workspace.diminfo[0].strides) = 0; - /* "sklearn/earth/_basis.pyx":267 - * if variable[m-i-1] == last_var_value: - * workspace[m-i-1] = 0 + /* "sklearn/earth/_basis.pyx":268 + * if variable[m - i - 1] == last_var_value: + * workspace[m - i - 1] = 0 * count -= 1 # <<<<<<<<<<<<<< * else: * break @@ -5927,12 +5927,12 @@ static PyArrayObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_valid_knot } /*else*/ { - /* "sklearn/earth/_basis.pyx":269 + /* "sklearn/earth/_basis.pyx":270 * count -= 1 * else: * break # <<<<<<<<<<<<<< * - * #Create result array and return + * # Create result array and return */ goto __pyx_L34_break; } @@ -5943,30 +5943,30 @@ static PyArrayObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_valid_knot } __pyx_L34_break:; - /* "sklearn/earth/_basis.pyx":272 + /* "sklearn/earth/_basis.pyx":273 * - * #Create result array and return - * result = np.empty(shape=count,dtype=int) # <<<<<<<<<<<<<< + * # Create result array and return + * result = np.empty(shape=count, dtype=int) # <<<<<<<<<<<<<< * j = 0 * for i in range(m): */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_8 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_count); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_count); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__shape), __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__shape), __pyx_t_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)(&PyInt_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)(&PyInt_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_t_7, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_8) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_8, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_41 = ((PyArrayObject *)__pyx_t_8); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -5982,23 +5982,23 @@ static PyArrayObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_valid_knot } } __pyx_pybuffernd_result.diminfo[0].strides = __pyx_pybuffernd_result.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_result.diminfo[0].shape = __pyx_pybuffernd_result.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_42 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_42 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_41 = 0; __pyx_v_result = ((PyArrayObject *)__pyx_t_8); __pyx_t_8 = 0; - /* "sklearn/earth/_basis.pyx":273 - * #Create result array and return - * result = np.empty(shape=count,dtype=int) + /* "sklearn/earth/_basis.pyx":274 + * # Create result array and return + * result = np.empty(shape=count, dtype=int) * j = 0 # <<<<<<<<<<<<<< * for i in range(m): * if workspace[i]: */ __pyx_v_j = 0; - /* "sklearn/earth/_basis.pyx":274 - * result = np.empty(shape=count,dtype=int) + /* "sklearn/earth/_basis.pyx":275 + * result = np.empty(shape=count, dtype=int) * j = 0 * for i in range(m): # <<<<<<<<<<<<<< * if workspace[i]: @@ -6008,7 +6008,7 @@ static PyArrayObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_valid_knot for (__pyx_t_32 = 0; __pyx_t_32 < __pyx_t_31; __pyx_t_32+=1) { __pyx_v_i = __pyx_t_32; - /* "sklearn/earth/_basis.pyx":275 + /* "sklearn/earth/_basis.pyx":276 * j = 0 * for i in range(m): * if workspace[i]: # <<<<<<<<<<<<<< @@ -6019,7 +6019,7 @@ static PyArrayObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_valid_knot __pyx_t_23 = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_INT_t *, __pyx_pybuffernd_workspace.rcbuffer->pybuffer.buf, __pyx_t_46, __pyx_pybuffernd_workspace.diminfo[0].strides)) != 0); if (__pyx_t_23) { - /* "sklearn/earth/_basis.pyx":276 + /* "sklearn/earth/_basis.pyx":277 * for i in range(m): * if workspace[i]: * result[j] = i # <<<<<<<<<<<<<< @@ -6029,7 +6029,7 @@ static PyArrayObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_valid_knot __pyx_t_47 = __pyx_v_j; *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_INT_t *, __pyx_pybuffernd_result.rcbuffer->pybuffer.buf, __pyx_t_47, __pyx_pybuffernd_result.diminfo[0].strides) = __pyx_v_i; - /* "sklearn/earth/_basis.pyx":277 + /* "sklearn/earth/_basis.pyx":278 * if workspace[i]: * result[j] = i * j += 1 # <<<<<<<<<<<<<< @@ -6042,7 +6042,7 @@ static PyArrayObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_valid_knot __pyx_L39:; } - /* "sklearn/earth/_basis.pyx":279 + /* "sklearn/earth/_basis.pyx":280 * j += 1 * * return result # <<<<<<<<<<<<<< @@ -6221,7 +6221,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_13BasisFunction_47valid_knots( /* "sklearn/earth/_basis.pyx":145 * ''' * - * cpdef cnp.ndarray[INT_t, ndim=1] valid_knots(BasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] values, cnp.ndarray[FLOAT_t,ndim=1] variable, int variable_idx, INDEX_t check_every, int endspan, int minspan, FLOAT_t minspan_alpha, INDEX_t n, cnp.ndarray[INT_t,ndim=1] workspace): # <<<<<<<<<<<<<< + * cpdef cnp.ndarray[INT_t, ndim = 1] valid_knots(BasisFunction self, cnp.ndarray[FLOAT_t, ndim=1] values, cnp.ndarray[FLOAT_t, ndim=1] variable, int variable_idx, INDEX_t check_every, int endspan, int minspan, FLOAT_t minspan_alpha, INDEX_t n, cnp.ndarray[INT_t, ndim=1] workspace): # <<<<<<<<<<<<<< * ''' * values - The unsorted values of self in the data set */ @@ -6311,10 +6311,10 @@ static int __pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_1__init__(Py return __pyx_r; } -/* "sklearn/earth/_basis.pyx":287 +/* "sklearn/earth/_basis.pyx":288 * * cdef class ConstantBasisFunction(BasisFunction): - * def __init__(self): #@DuplicatedSignature # <<<<<<<<<<<<<< + * def __init__(self): # @DuplicatedSignature # <<<<<<<<<<<<<< * self.prunable = False * */ @@ -6324,9 +6324,9 @@ static int __pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction___init__(str __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); - /* "sklearn/earth/_basis.pyx":288 + /* "sklearn/earth/_basis.pyx":289 * cdef class ConstantBasisFunction(BasisFunction): - * def __init__(self): #@DuplicatedSignature + * def __init__(self): # @DuplicatedSignature * self.prunable = False # <<<<<<<<<<<<<< * * def _get_root(self): @@ -6349,7 +6349,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_3_get_ return __pyx_r; } -/* "sklearn/earth/_basis.pyx":290 +/* "sklearn/earth/_basis.pyx":291 * self.prunable = False * * def _get_root(self): # <<<<<<<<<<<<<< @@ -6362,7 +6362,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_2_get_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_get_root", 0); - /* "sklearn/earth/_basis.pyx":291 + /* "sklearn/earth/_basis.pyx":292 * * def _get_root(self): * return self # <<<<<<<<<<<<<< @@ -6392,7 +6392,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_5_get_ return __pyx_r; } -/* "sklearn/earth/_basis.pyx":293 +/* "sklearn/earth/_basis.pyx":294 * return self * * def _get_parent_state(self): # <<<<<<<<<<<<<< @@ -6409,7 +6409,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_4_get_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_get_parent_state", 0); - /* "sklearn/earth/_basis.pyx":294 + /* "sklearn/earth/_basis.pyx":295 * * def _get_parent_state(self): * return {} # <<<<<<<<<<<<<< @@ -6417,7 +6417,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_4_get_ * def _set_parent_state(self, state): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 294; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 295; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __pyx_r = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; @@ -6446,7 +6446,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_7_set_ return __pyx_r; } -/* "sklearn/earth/_basis.pyx":296 +/* "sklearn/earth/_basis.pyx":297 * return {} * * def _set_parent_state(self, state): # <<<<<<<<<<<<<< @@ -6465,7 +6465,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_6_set_ return __pyx_r; } -/* "sklearn/earth/_basis.pyx":299 +/* "sklearn/earth/_basis.pyx":300 * pass * * cpdef INDEX_t degree(ConstantBasisFunction self): # <<<<<<<<<<<<<< @@ -6488,12 +6488,12 @@ static __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_f_7sklearn_5earth_6_basis_2 if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__degree); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__degree); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_9degree)) { - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -6502,12 +6502,12 @@ static __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_f_7sklearn_5earth_6_basis_2 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_basis.pyx":300 + /* "sklearn/earth/_basis.pyx":301 * * cpdef INDEX_t degree(ConstantBasisFunction self): * return 0 # <<<<<<<<<<<<<< * - * cpdef translate(ConstantBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse): + * cpdef translate(ConstantBasisFunctionself, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts, bint recurse): */ __pyx_r = 0; goto __pyx_L0; @@ -6535,7 +6535,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_9degre return __pyx_r; } -/* "sklearn/earth/_basis.pyx":299 +/* "sklearn/earth/_basis.pyx":300 * pass * * cpdef INDEX_t degree(ConstantBasisFunction self): # <<<<<<<<<<<<<< @@ -6552,7 +6552,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_8degre int __pyx_clineno = 0; __Pyx_RefNannySetupContext("degree", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_ConstantBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.degree(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 299; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_ConstantBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.degree(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -6570,10 +6570,10 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_8degre return __pyx_r; } -/* "sklearn/earth/_basis.pyx":302 +/* "sklearn/earth/_basis.pyx":303 * return 0 * - * cpdef translate(ConstantBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse): # <<<<<<<<<<<<<< + * cpdef translate(ConstantBasisFunctionself, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts, bint recurse): # <<<<<<<<<<<<<< * pass * */ @@ -6603,25 +6603,25 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_21ConstantBasisFunction_transla __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_ConstantBasisFunctionself))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_ConstantBasisFunctionself), __pyx_n_s__translate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_ConstantBasisFunctionself), __pyx_n_s__translate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_11translate)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_recurse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_recurse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_slopes)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_slopes)); @@ -6632,7 +6632,7 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_21ConstantBasisFunction_transla PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; @@ -6643,12 +6643,12 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_21ConstantBasisFunction_transla __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_basis.pyx":303 + /* "sklearn/earth/_basis.pyx":304 * - * cpdef translate(ConstantBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse): + * cpdef translate(ConstantBasisFunctionself, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts, bint recurse): * pass # <<<<<<<<<<<<<< * - * cpdef FLOAT_t scale(ConstantBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): + * cpdef FLOAT_t scale(ConstantBasisFunctionself, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts): */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -6707,16 +6707,16 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_11tran case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__intercepts)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("translate", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("translate", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__recurse)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("translate", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("translate", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "translate") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "translate") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -6727,18 +6727,18 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_11tran } __pyx_v_slopes = ((PyArrayObject *)values[0]); __pyx_v_intercepts = ((PyArrayObject *)values[1]); - __pyx_v_recurse = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_recurse == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_recurse = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_recurse == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("translate", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("translate", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.earth._basis.ConstantBasisFunction.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_slopes), __pyx_ptype_5numpy_ndarray, 1, "slopes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercepts), __pyx_ptype_5numpy_ndarray, 1, "intercepts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_slopes), __pyx_ptype_5numpy_ndarray, 1, "slopes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercepts), __pyx_ptype_5numpy_ndarray, 1, "intercepts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_10translate(((struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *)__pyx_v_ConstantBasisFunctionself), __pyx_v_slopes, __pyx_v_intercepts, __pyx_v_recurse); goto __pyx_L0; __pyx_L1_error:; @@ -6748,10 +6748,10 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_11tran return __pyx_r; } -/* "sklearn/earth/_basis.pyx":302 +/* "sklearn/earth/_basis.pyx":303 * return 0 * - * cpdef translate(ConstantBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse): # <<<<<<<<<<<<<< + * cpdef translate(ConstantBasisFunctionself, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts, bint recurse): # <<<<<<<<<<<<<< * pass * */ @@ -6778,16 +6778,16 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_10tran __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_ConstantBasisFunction *)__pyx_v_ConstantBasisFunctionself->__pyx_base.__pyx_vtab)->translate(__pyx_v_ConstantBasisFunctionself, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), __pyx_v_recurse, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_ConstantBasisFunction *)__pyx_v_ConstantBasisFunctionself->__pyx_base.__pyx_vtab)->translate(__pyx_v_ConstantBasisFunctionself, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), __pyx_v_recurse, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 303; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -6814,11 +6814,11 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_10tran return __pyx_r; } -/* "sklearn/earth/_basis.pyx":305 +/* "sklearn/earth/_basis.pyx":306 * pass * - * cpdef FLOAT_t scale(ConstantBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): # <<<<<<<<<<<<<< - * return 1.0 + * cpdef FLOAT_t scale(ConstantBasisFunctionself, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts): # <<<<<<<<<<<<<< + * return < FLOAT_t > 1.0 * */ @@ -6848,22 +6848,22 @@ static __pyx_t_7sklearn_5earth_6_basis_FLOAT_t __pyx_f_7sklearn_5earth_6_basis_2 __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_ConstantBasisFunctionself))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_ConstantBasisFunctionself), __pyx_n_s__scale); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_ConstantBasisFunctionself), __pyx_n_s__scale); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_13scale)) { - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_slopes)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_slopes)); @@ -6871,10 +6871,10 @@ static __pyx_t_7sklearn_5earth_6_basis_FLOAT_t __pyx_f_7sklearn_5earth_6_basis_2 __Pyx_INCREF(((PyObject *)__pyx_v_intercepts)); PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_intercepts)); __Pyx_GIVEREF(((PyObject *)__pyx_v_intercepts)); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_4; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -6883,12 +6883,12 @@ static __pyx_t_7sklearn_5earth_6_basis_FLOAT_t __pyx_f_7sklearn_5earth_6_basis_2 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_basis.pyx":306 + /* "sklearn/earth/_basis.pyx":307 * - * cpdef FLOAT_t scale(ConstantBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): - * return 1.0 # <<<<<<<<<<<<<< + * cpdef FLOAT_t scale(ConstantBasisFunctionself, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts): + * return < FLOAT_t > 1.0 # <<<<<<<<<<<<<< * - * cpdef _set_parent(self,BasisFunction parent): + * cpdef _set_parent(self, BasisFunction parent): */ __pyx_r = ((__pyx_t_7sklearn_5earth_6_basis_FLOAT_t)1.0); goto __pyx_L0; @@ -6946,11 +6946,11 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_13scal case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__intercepts)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("scale", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("scale", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scale") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scale") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -6963,14 +6963,14 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_13scal } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("scale", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("scale", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.earth._basis.ConstantBasisFunction.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_slopes), __pyx_ptype_5numpy_ndarray, 1, "slopes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercepts), __pyx_ptype_5numpy_ndarray, 1, "intercepts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_slopes), __pyx_ptype_5numpy_ndarray, 1, "slopes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercepts), __pyx_ptype_5numpy_ndarray, 1, "intercepts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_12scale(((struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *)__pyx_v_ConstantBasisFunctionself), __pyx_v_slopes, __pyx_v_intercepts); goto __pyx_L0; __pyx_L1_error:; @@ -6980,11 +6980,11 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_13scal return __pyx_r; } -/* "sklearn/earth/_basis.pyx":305 +/* "sklearn/earth/_basis.pyx":306 * pass * - * cpdef FLOAT_t scale(ConstantBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): # <<<<<<<<<<<<<< - * return 1.0 + * cpdef FLOAT_t scale(ConstantBasisFunctionself, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts): # <<<<<<<<<<<<<< + * return < FLOAT_t > 1.0 * */ @@ -7010,16 +7010,16 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_12scal __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_ConstantBasisFunction *)__pyx_v_ConstantBasisFunctionself->__pyx_base.__pyx_vtab)->scale(__pyx_v_ConstantBasisFunctionself, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_ConstantBasisFunction *)__pyx_v_ConstantBasisFunctionself->__pyx_base.__pyx_vtab)->scale(__pyx_v_ConstantBasisFunctionself, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 306; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -7046,10 +7046,10 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_12scal return __pyx_r; } -/* "sklearn/earth/_basis.pyx":308 - * return 1.0 +/* "sklearn/earth/_basis.pyx":309 + * return < FLOAT_t > 1.0 * - * cpdef _set_parent(self,BasisFunction parent): # <<<<<<<<<<<<<< + * cpdef _set_parent(self, BasisFunction parent): # <<<<<<<<<<<<<< * raise NotImplementedError * */ @@ -7069,16 +7069,16 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_21ConstantBasisFunction__set_pa if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___set_parent); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___set_parent); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_15_set_parent)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_parent)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_parent)); __Pyx_GIVEREF(((PyObject *)__pyx_v_parent)); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; @@ -7089,15 +7089,15 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_21ConstantBasisFunction__set_pa __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_basis.pyx":309 + /* "sklearn/earth/_basis.pyx":310 * - * cpdef _set_parent(self,BasisFunction parent): + * cpdef _set_parent(self, BasisFunction parent): * raise NotImplementedError # <<<<<<<<<<<<<< * * cpdef BasisFunction get_parent(self): */ __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; @@ -7122,7 +7122,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_15_set PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("_set_parent (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parent), __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction, 1, "parent", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parent), __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction, 1, "parent", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_14_set_parent(((struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *)__pyx_v_self), ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_parent)); goto __pyx_L0; __pyx_L1_error:; @@ -7132,10 +7132,10 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_15_set return __pyx_r; } -/* "sklearn/earth/_basis.pyx":308 - * return 1.0 +/* "sklearn/earth/_basis.pyx":309 + * return < FLOAT_t > 1.0 * - * cpdef _set_parent(self,BasisFunction parent): # <<<<<<<<<<<<<< + * cpdef _set_parent(self, BasisFunction parent): # <<<<<<<<<<<<<< * raise NotImplementedError * */ @@ -7149,7 +7149,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_14_set int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_set_parent", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_ConstantBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._set_parent(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self), __pyx_v_parent, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_ConstantBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._set_parent(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self), __pyx_v_parent, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -7167,7 +7167,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_14_set return __pyx_r; } -/* "sklearn/earth/_basis.pyx":311 +/* "sklearn/earth/_basis.pyx":312 * raise NotImplementedError * * cpdef BasisFunction get_parent(self): # <<<<<<<<<<<<<< @@ -7189,13 +7189,13 @@ static struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_f_7sklearn_ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_parent); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_parent); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_17get_parent)) { __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -7204,15 +7204,15 @@ static struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_f_7sklearn_ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_basis.pyx":312 + /* "sklearn/earth/_basis.pyx":313 * * cpdef BasisFunction get_parent(self): * raise NotImplementedError # <<<<<<<<<<<<<< * - * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = False): + * cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse=False): */ __Pyx_Raise(__pyx_builtin_NotImplementedError, 0, 0, 0); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)Py_None); __Pyx_INCREF(Py_None); goto __pyx_L0; @@ -7238,7 +7238,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_17get_ return __pyx_r; } -/* "sklearn/earth/_basis.pyx":311 +/* "sklearn/earth/_basis.pyx":312 * raise NotImplementedError * * cpdef BasisFunction get_parent(self): # <<<<<<<<<<<<<< @@ -7255,7 +7255,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_16get_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_parent", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_ConstantBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_parent(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_ConstantBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.get_parent(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 312; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -7273,10 +7273,10 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_16get_ return __pyx_r; } -/* "sklearn/earth/_basis.pyx":314 +/* "sklearn/earth/_basis.pyx":315 * raise NotImplementedError * - * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = False): # <<<<<<<<<<<<<< + * cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse=False): # <<<<<<<<<<<<<< * ''' * X - Data matrix */ @@ -7318,25 +7318,25 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_21ConstantBasisFunction_apply(C __pyx_pybuffernd_b.rcbuffer = &__pyx_pybuffer_b; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)__pyx_v_b, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)__pyx_v_b, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_b.diminfo[0].strides = __pyx_pybuffernd_b.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_b.diminfo[0].shape = __pyx_pybuffernd_b.rcbuffer->pybuffer.shape[0]; /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__apply); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__apply); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_19apply)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_recurse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_recurse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_X)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_X)); @@ -7347,7 +7347,7 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_21ConstantBasisFunction_apply(C PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; @@ -7358,31 +7358,31 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_21ConstantBasisFunction_apply(C __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_basis.pyx":323 + /* "sklearn/earth/_basis.pyx":324 * ''' - * cdef INDEX_t i #@DuplicatedSignature + * cdef INDEX_t i # @DuplicatedSignature * cdef INDEX_t m = len(b) # <<<<<<<<<<<<<< * for i in range(m): - * b[i] = 1.0 + * b[i] = 1.0 */ - __pyx_t_4 = PyObject_Length(((PyObject *)__pyx_v_b)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 323; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Length(((PyObject *)__pyx_v_b)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 324; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_m = __pyx_t_4; - /* "sklearn/earth/_basis.pyx":324 - * cdef INDEX_t i #@DuplicatedSignature + /* "sklearn/earth/_basis.pyx":325 + * cdef INDEX_t i # @DuplicatedSignature * cdef INDEX_t m = len(b) * for i in range(m): # <<<<<<<<<<<<<< - * b[i] = 1.0 + * b[i] = 1.0 * */ __pyx_t_5 = __pyx_v_m; for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "sklearn/earth/_basis.pyx":325 + /* "sklearn/earth/_basis.pyx":326 * cdef INDEX_t m = len(b) * for i in range(m): - * b[i] = 1.0 # <<<<<<<<<<<<<< + * b[i] = 1.0 # <<<<<<<<<<<<<< * * def __str__(self): */ @@ -7415,7 +7415,7 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_21ConstantBasisFunction_apply(C /* Python wrapper */ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_19apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_7sklearn_5earth_6_basis_21ConstantBasisFunction_18apply[] = "\n X - Data matrix\n b - parent vector\n recurse - The ConstantBasisFunction is the parent of all BasisFunctions and never has a parent. \n Therefore the recurse argument is ignored. This spares child BasisFunctions from \n having to know whether their parents have parents.\n "; +static char __pyx_doc_7sklearn_5earth_6_basis_21ConstantBasisFunction_18apply[] = "\n X - Data matrix\n b - parent vector\n recurse - The ConstantBasisFunction is the parent of all BasisFunctions and never has a parent.\n Therefore the recurse argument is ignored. This spares child BasisFunctions from\n having to know whether their parents have parents.\n "; static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_19apply(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_X = 0; PyArrayObject *__pyx_v_b = 0; @@ -7447,7 +7447,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_19appl case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__b)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("apply", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("apply", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (kw_args > 0) { @@ -7456,7 +7456,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_19appl } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -7470,13 +7470,13 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_19appl __pyx_v_X = ((PyArrayObject *)values[0]); __pyx_v_b = ((PyArrayObject *)values[1]); if (values[2]) { - __pyx_v_recurse = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_recurse == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_recurse = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_recurse == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - /* "sklearn/earth/_basis.pyx":314 + /* "sklearn/earth/_basis.pyx":315 * raise NotImplementedError * - * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = False): # <<<<<<<<<<<<<< + * cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse=False): # <<<<<<<<<<<<<< * ''' * X - Data matrix */ @@ -7485,14 +7485,14 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_19appl } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("apply", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("apply", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.earth._basis.ConstantBasisFunction.apply", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_5numpy_ndarray, 1, "b", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_5numpy_ndarray, 1, "b", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_18apply(((struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *)__pyx_v_self), __pyx_v_X, __pyx_v_b, __pyx_v_recurse); goto __pyx_L0; __pyx_L1_error:; @@ -7525,18 +7525,18 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_18appl __pyx_pybuffernd_b.rcbuffer = &__pyx_pybuffer_b; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)__pyx_v_b, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)__pyx_v_b, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_b.diminfo[0].strides = __pyx_pybuffernd_b.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_b.diminfo[0].shape = __pyx_pybuffernd_b.rcbuffer->pybuffer.shape[0]; __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 1; __pyx_t_2.recurse = __pyx_v_recurse; - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_ConstantBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.apply(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self), ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_b), 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 314; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_ConstantBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.apply(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self), ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_b), 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -7574,8 +7574,8 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_21ConstantBasisFunction_21__st return __pyx_r; } -/* "sklearn/earth/_basis.pyx":327 - * b[i] = 1.0 +/* "sklearn/earth/_basis.pyx":328 + * b[i] = 1.0 * * def __str__(self): # <<<<<<<<<<<<<< * return '(Intercept)' @@ -7587,7 +7587,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_21ConstantBasisFunction_20__st __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__str__", 0); - /* "sklearn/earth/_basis.pyx":328 + /* "sklearn/earth/_basis.pyx":329 * * def __str__(self): * return '(Intercept)' # <<<<<<<<<<<<<< @@ -7625,10 +7625,10 @@ static int __pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_1__init__(PyObj static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__parent,&__pyx_n_s__knot,&__pyx_n_s__knot_idx,&__pyx_n_s__variable,&__pyx_n_s__reverse,&__pyx_n_s__label,0}; PyObject* values[6] = {0,0,0,0,0,0}; - /* "sklearn/earth/_basis.pyx":332 - * cdef class HingeBasisFunction(BasisFunction): + /* "sklearn/earth/_basis.pyx":334 * - * def __init__(self, BasisFunction parent, FLOAT_t knot, INDEX_t knot_idx, INDEX_t variable, bint reverse, label=None): #@DuplicatedSignature # <<<<<<<<<<<<<< + * #@DuplicatedSignature + * def __init__(self, BasisFunction parent, FLOAT_t knot, INDEX_t knot_idx, INDEX_t variable, bint reverse, label=None): # <<<<<<<<<<<<<< * self.knot = knot * self.knot_idx = knot_idx */ @@ -7654,22 +7654,22 @@ static int __pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_1__init__(PyObj case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__knot)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__knot_idx)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__variable)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__reverse)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: if (kw_args > 0) { @@ -7678,7 +7678,7 @@ static int __pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_1__init__(PyObj } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -7693,21 +7693,21 @@ static int __pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_1__init__(PyObj } } __pyx_v_parent = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)values[0]); - __pyx_v_knot = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_knot == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_knot_idx = __Pyx_PyInt_from_py_npy_ulonglong(values[2]); if (unlikely((__pyx_v_knot_idx == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_variable = __Pyx_PyInt_from_py_npy_ulonglong(values[3]); if (unlikely((__pyx_v_variable == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_reverse = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_reverse == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_knot = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_knot == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_knot_idx = __Pyx_PyInt_from_py_npy_ulonglong(values[2]); if (unlikely((__pyx_v_knot_idx == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_variable = __Pyx_PyInt_from_py_npy_ulonglong(values[3]); if (unlikely((__pyx_v_variable == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_reverse = __Pyx_PyObject_IsTrue(values[4]); if (unlikely((__pyx_v_reverse == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_label = values[5]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 0, 5, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.earth._basis.HingeBasisFunction.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parent), __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction, 1, "parent", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parent), __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction, 1, "parent", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 334; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction___init__(((struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self), __pyx_v_parent, __pyx_v_knot, __pyx_v_knot_idx, __pyx_v_variable, __pyx_v_reverse, __pyx_v_label); goto __pyx_L0; __pyx_L1_error:; @@ -7729,17 +7729,17 @@ static int __pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction___init__(struct int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "sklearn/earth/_basis.pyx":333 - * - * def __init__(self, BasisFunction parent, FLOAT_t knot, INDEX_t knot_idx, INDEX_t variable, bint reverse, label=None): #@DuplicatedSignature + /* "sklearn/earth/_basis.pyx":335 + * #@DuplicatedSignature + * def __init__(self, BasisFunction parent, FLOAT_t knot, INDEX_t knot_idx, INDEX_t variable, bint reverse, label=None): * self.knot = knot # <<<<<<<<<<<<<< * self.knot_idx = knot_idx * self.variable = variable */ __pyx_v_self->knot = __pyx_v_knot; - /* "sklearn/earth/_basis.pyx":334 - * def __init__(self, BasisFunction parent, FLOAT_t knot, INDEX_t knot_idx, INDEX_t variable, bint reverse, label=None): #@DuplicatedSignature + /* "sklearn/earth/_basis.pyx":336 + * def __init__(self, BasisFunction parent, FLOAT_t knot, INDEX_t knot_idx, INDEX_t variable, bint reverse, label=None): * self.knot = knot * self.knot_idx = knot_idx # <<<<<<<<<<<<<< * self.variable = variable @@ -7747,28 +7747,28 @@ static int __pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction___init__(struct */ __pyx_v_self->knot_idx = __pyx_v_knot_idx; - /* "sklearn/earth/_basis.pyx":335 + /* "sklearn/earth/_basis.pyx":337 * self.knot = knot * self.knot_idx = knot_idx * self.variable = variable # <<<<<<<<<<<<<< * self.reverse = reverse - * self.label = label if label is not None else 'x'+str(variable) + * self.label = label if label is not None else 'x' + str(variable) */ __pyx_v_self->variable = __pyx_v_variable; - /* "sklearn/earth/_basis.pyx":336 + /* "sklearn/earth/_basis.pyx":338 * self.knot_idx = knot_idx * self.variable = variable * self.reverse = reverse # <<<<<<<<<<<<<< - * self.label = label if label is not None else 'x'+str(variable) + * self.label = label if label is not None else 'x' + str(variable) * self._set_parent(parent) */ __pyx_v_self->reverse = __pyx_v_reverse; - /* "sklearn/earth/_basis.pyx":337 + /* "sklearn/earth/_basis.pyx":339 * self.variable = variable * self.reverse = reverse - * self.label = label if label is not None else 'x'+str(variable) # <<<<<<<<<<<<<< + * self.label = label if label is not None else 'x' + str(variable) # <<<<<<<<<<<<<< * self._set_parent(parent) * */ @@ -7777,37 +7777,37 @@ static int __pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction___init__(struct __Pyx_INCREF(__pyx_v_label); __pyx_t_1 = __pyx_v_label; } else { - __pyx_t_3 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_n_s__x), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_n_s__x), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_1 = __pyx_t_4; __pyx_t_4 = 0; } - if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->label); __Pyx_DECREF(((PyObject *)__pyx_v_self->label)); __pyx_v_self->label = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_basis.pyx":338 + /* "sklearn/earth/_basis.pyx":340 * self.reverse = reverse - * self.label = label if label is not None else 'x'+str(variable) + * self.label = label if label is not None else 'x' + str(variable) * self._set_parent(parent) # <<<<<<<<<<<<<< * * def __reduce__(self): */ - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._set_parent(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self), __pyx_v_parent, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._set_parent(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self), __pyx_v_parent, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -7835,7 +7835,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_3__reduce return __pyx_r; } -/* "sklearn/earth/_basis.pyx":340 +/* "sklearn/earth/_basis.pyx":342 * self._set_parent(parent) * * def __reduce__(self): # <<<<<<<<<<<<<< @@ -7856,7 +7856,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_2__reduce int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce__", 0); - /* "sklearn/earth/_basis.pyx":341 + /* "sklearn/earth/_basis.pyx":343 * * def __reduce__(self): * return (self.__class__, (pickle_place_holder, 1.0, 1, 1, True, ''), self._getstate()) # <<<<<<<<<<<<<< @@ -7864,15 +7864,15 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_2__reduce * def _getstate(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__pickle_place_holder); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__pickle_place_holder); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); @@ -7892,12 +7892,12 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_2__reduce __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); @@ -7939,7 +7939,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_5_getstat return __pyx_r; } -/* "sklearn/earth/_basis.pyx":343 +/* "sklearn/earth/_basis.pyx":345 * return (self.__class__, (pickle_place_holder, 1.0, 1, 1, True, ''), self._getstate()) * * def _getstate(self): # <<<<<<<<<<<<<< @@ -7959,14 +7959,14 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_4_getstat int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_getstate", 0); - /* "sklearn/earth/_basis.pyx":344 + /* "sklearn/earth/_basis.pyx":346 * * def _getstate(self): * result = super(HingeBasisFunction, self)._getstate() # <<<<<<<<<<<<<< * result.update({'knot': self.knot, * 'knot_idx': self.knot_idx, */ - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_HingeBasisFunction))); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_HingeBasisFunction))); @@ -7974,90 +7974,90 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_4_getstat __Pyx_INCREF(((PyObject *)__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - __pyx_t_2 = PyObject_Call(__pyx_builtin_super, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_builtin_super, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_result = __pyx_t_2; __pyx_t_2 = 0; - /* "sklearn/earth/_basis.pyx":345 + /* "sklearn/earth/_basis.pyx":347 * def _getstate(self): * result = super(HingeBasisFunction, self)._getstate() * result.update({'knot': self.knot, # <<<<<<<<<<<<<< * 'knot_idx': self.knot_idx, * 'variable': self.variable, */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_n_s__update); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_n_s__update); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->knot); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->knot); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__knot), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__knot), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/earth/_basis.pyx":346 + /* "sklearn/earth/_basis.pyx":348 * result = super(HingeBasisFunction, self)._getstate() * result.update({'knot': self.knot, * 'knot_idx': self.knot_idx, # <<<<<<<<<<<<<< * 'variable': self.variable, * 'reverse': self.reverse, */ - __pyx_t_3 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->knot_idx); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->knot_idx); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__knot_idx), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__knot_idx), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/earth/_basis.pyx":347 + /* "sklearn/earth/_basis.pyx":349 * result.update({'knot': self.knot, * 'knot_idx': self.knot_idx, * 'variable': self.variable, # <<<<<<<<<<<<<< * 'reverse': self.reverse, * 'label': self.label}) */ - __pyx_t_3 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->variable); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->variable); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__variable), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__variable), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/earth/_basis.pyx":348 + /* "sklearn/earth/_basis.pyx":350 * 'knot_idx': self.knot_idx, * 'variable': self.variable, * 'reverse': self.reverse, # <<<<<<<<<<<<<< * 'label': self.label}) * return result */ - __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_self->reverse); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 348; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyBool_FromLong(__pyx_v_self->reverse); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 350; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__reverse), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__reverse), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/earth/_basis.pyx":349 + /* "sklearn/earth/_basis.pyx":351 * 'variable': self.variable, * 'reverse': self.reverse, * 'label': self.label}) # <<<<<<<<<<<<<< * return result * */ - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__label), ((PyObject *)__pyx_v_self->label)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__label), ((PyObject *)__pyx_v_self->label)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 345; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_basis.pyx":350 + /* "sklearn/earth/_basis.pyx":352 * 'reverse': self.reverse, * 'label': self.label}) * return result # <<<<<<<<<<<<<< @@ -8095,7 +8095,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_7__setsta return __pyx_r; } -/* "sklearn/earth/_basis.pyx":352 +/* "sklearn/earth/_basis.pyx":354 * return result * * def __setstate__(self, state): # <<<<<<<<<<<<<< @@ -8117,82 +8117,82 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_6__setsta int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate__", 0); - /* "sklearn/earth/_basis.pyx":353 + /* "sklearn/earth/_basis.pyx":355 * * def __setstate__(self, state): * self.knot = state['knot'] # <<<<<<<<<<<<<< * self.knot_idx = state['knot_idx'] * self.variable = state['variable'] */ - __pyx_t_1 = PyObject_GetItem(__pyx_v_state, ((PyObject *)__pyx_n_s__knot)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(__pyx_v_state, ((PyObject *)__pyx_n_s__knot)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->knot = __pyx_t_2; - /* "sklearn/earth/_basis.pyx":354 + /* "sklearn/earth/_basis.pyx":356 * def __setstate__(self, state): * self.knot = state['knot'] * self.knot_idx = state['knot_idx'] # <<<<<<<<<<<<<< * self.variable = state['variable'] * self.reverse = state['reverse'] */ - __pyx_t_1 = PyObject_GetItem(__pyx_v_state, ((PyObject *)__pyx_n_s__knot_idx)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(__pyx_v_state, ((PyObject *)__pyx_n_s__knot_idx)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->knot_idx = __pyx_t_3; - /* "sklearn/earth/_basis.pyx":355 + /* "sklearn/earth/_basis.pyx":357 * self.knot = state['knot'] * self.knot_idx = state['knot_idx'] * self.variable = state['variable'] # <<<<<<<<<<<<<< * self.reverse = state['reverse'] * self.label = state['label'] */ - __pyx_t_1 = PyObject_GetItem(__pyx_v_state, ((PyObject *)__pyx_n_s__variable)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(__pyx_v_state, ((PyObject *)__pyx_n_s__variable)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->variable = __pyx_t_3; - /* "sklearn/earth/_basis.pyx":356 + /* "sklearn/earth/_basis.pyx":358 * self.knot_idx = state['knot_idx'] * self.variable = state['variable'] * self.reverse = state['reverse'] # <<<<<<<<<<<<<< * self.label = state['label'] * super(HingeBasisFunction, self).__setstate__(state) */ - __pyx_t_1 = PyObject_GetItem(__pyx_v_state, ((PyObject *)__pyx_n_s__reverse)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(__pyx_v_state, ((PyObject *)__pyx_n_s__reverse)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 356; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->reverse = __pyx_t_4; - /* "sklearn/earth/_basis.pyx":357 + /* "sklearn/earth/_basis.pyx":359 * self.variable = state['variable'] * self.reverse = state['reverse'] * self.label = state['label'] # <<<<<<<<<<<<<< * super(HingeBasisFunction, self).__setstate__(state) * */ - __pyx_t_1 = PyObject_GetItem(__pyx_v_state, ((PyObject *)__pyx_n_s__label)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(__pyx_v_state, ((PyObject *)__pyx_n_s__label)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->label); __Pyx_DECREF(((PyObject *)__pyx_v_self->label)); __pyx_v_self->label = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_basis.pyx":358 + /* "sklearn/earth/_basis.pyx":360 * self.reverse = state['reverse'] * self.label = state['label'] * super(HingeBasisFunction, self).__setstate__(state) # <<<<<<<<<<<<<< * * cpdef bint has_knot(HingeBasisFunction self): */ - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_HingeBasisFunction))); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_HingeBasisFunction))); @@ -8200,18 +8200,18 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_6__setsta __Pyx_INCREF(((PyObject *)__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_super, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_super, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s____setstate__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_5, __pyx_n_s____setstate__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_state); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_state); __Pyx_GIVEREF(__pyx_v_state); - __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; @@ -8231,7 +8231,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_6__setsta return __pyx_r; } -/* "sklearn/earth/_basis.pyx":360 +/* "sklearn/earth/_basis.pyx":362 * super(HingeBasisFunction, self).__setstate__(state) * * cpdef bint has_knot(HingeBasisFunction self): # <<<<<<<<<<<<<< @@ -8254,12 +8254,12 @@ static int __pyx_f_7sklearn_5earth_6_basis_18HingeBasisFunction_has_knot(CYTHON_ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__has_knot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__has_knot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_9has_knot)) { - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -8268,12 +8268,12 @@ static int __pyx_f_7sklearn_5earth_6_basis_18HingeBasisFunction_has_knot(CYTHON_ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_basis.pyx":361 + /* "sklearn/earth/_basis.pyx":363 * * cpdef bint has_knot(HingeBasisFunction self): * return True # <<<<<<<<<<<<<< * - * cpdef translate(HingeBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse): + * cpdef translate(HingeBasisFunction self, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts, bint recurse): */ __pyx_r = 1; goto __pyx_L0; @@ -8301,7 +8301,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_9has_knot return __pyx_r; } -/* "sklearn/earth/_basis.pyx":360 +/* "sklearn/earth/_basis.pyx":362 * super(HingeBasisFunction, self).__setstate__(state) * * cpdef bint has_knot(HingeBasisFunction self): # <<<<<<<<<<<<<< @@ -8318,7 +8318,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_8has_knot int __pyx_clineno = 0; __Pyx_RefNannySetupContext("has_knot", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.has_knot(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.has_knot(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -8336,12 +8336,12 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_8has_knot return __pyx_r; } -/* "sklearn/earth/_basis.pyx":363 +/* "sklearn/earth/_basis.pyx":365 * return True * - * cpdef translate(HingeBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse): # <<<<<<<<<<<<<< - * self.knot = slopes[self.variable]*self.knot + intercepts[self.variable] - * if slopes[self.variable] < 0: + * cpdef translate(HingeBasisFunction self, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts, bint recurse): # <<<<<<<<<<<<<< + * self.knot = slopes[self.variable] * \ + * self.knot + intercepts[self.variable] */ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_11translate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ @@ -8373,25 +8373,25 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_18HingeBasisFunction_translate( __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__translate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__translate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_11translate)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_recurse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_recurse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_slopes)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_slopes)); @@ -8402,7 +8402,7 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_18HingeBasisFunction_translate( PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; @@ -8413,20 +8413,36 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_18HingeBasisFunction_translate( __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_basis.pyx":364 + /* "sklearn/earth/_basis.pyx":366 * - * cpdef translate(HingeBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse): - * self.knot = slopes[self.variable]*self.knot + intercepts[self.variable] # <<<<<<<<<<<<<< + * cpdef translate(HingeBasisFunction self, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts, bint recurse): + * self.knot = slopes[self.variable] * \ # <<<<<<<<<<<<<< + * self.knot + intercepts[self.variable] * if slopes[self.variable] < 0: - * self.reverse = not self.reverse */ __pyx_t_4 = __pyx_v_self->variable; + + /* "sklearn/earth/_basis.pyx":367 + * cpdef translate(HingeBasisFunction self, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts, bint recurse): + * self.knot = slopes[self.variable] * \ + * self.knot + intercepts[self.variable] # <<<<<<<<<<<<<< + * if slopes[self.variable] < 0: + * self.reverse = not self.reverse + */ __pyx_t_5 = __pyx_v_self->variable; + + /* "sklearn/earth/_basis.pyx":366 + * + * cpdef translate(HingeBasisFunction self, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts, bint recurse): + * self.knot = slopes[self.variable] * \ # <<<<<<<<<<<<<< + * self.knot + intercepts[self.variable] + * if slopes[self.variable] < 0: + */ __pyx_v_self->knot = (((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_FLOAT_t *, __pyx_pybuffernd_slopes.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_slopes.diminfo[0].strides)) * __pyx_v_self->knot) + (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_FLOAT_t *, __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_intercepts.diminfo[0].strides))); - /* "sklearn/earth/_basis.pyx":365 - * cpdef translate(HingeBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse): - * self.knot = slopes[self.variable]*self.knot + intercepts[self.variable] + /* "sklearn/earth/_basis.pyx":368 + * self.knot = slopes[self.variable] * \ + * self.knot + intercepts[self.variable] * if slopes[self.variable] < 0: # <<<<<<<<<<<<<< * self.reverse = not self.reverse * if recurse: @@ -8435,38 +8451,38 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_18HingeBasisFunction_translate( __pyx_t_7 = (((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_FLOAT_t *, __pyx_pybuffernd_slopes.rcbuffer->pybuffer.buf, __pyx_t_6, __pyx_pybuffernd_slopes.diminfo[0].strides)) < 0.0) != 0); if (__pyx_t_7) { - /* "sklearn/earth/_basis.pyx":366 - * self.knot = slopes[self.variable]*self.knot + intercepts[self.variable] + /* "sklearn/earth/_basis.pyx":369 + * self.knot + intercepts[self.variable] * if slopes[self.variable] < 0: * self.reverse = not self.reverse # <<<<<<<<<<<<<< * if recurse: - * self.parent.translate(slopes,intercepts) + * self.parent.translate(slopes, intercepts) */ __pyx_v_self->reverse = (!(__pyx_v_self->reverse != 0)); goto __pyx_L3; } __pyx_L3:; - /* "sklearn/earth/_basis.pyx":367 + /* "sklearn/earth/_basis.pyx":370 * if slopes[self.variable] < 0: * self.reverse = not self.reverse * if recurse: # <<<<<<<<<<<<<< - * self.parent.translate(slopes,intercepts) + * self.parent.translate(slopes, intercepts) * */ __pyx_t_7 = (__pyx_v_recurse != 0); if (__pyx_t_7) { - /* "sklearn/earth/_basis.pyx":368 + /* "sklearn/earth/_basis.pyx":371 * self.reverse = not self.reverse * if recurse: - * self.parent.translate(slopes,intercepts) # <<<<<<<<<<<<<< + * self.parent.translate(slopes, intercepts) # <<<<<<<<<<<<<< * - * cpdef FLOAT_t scale(HingeBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): + * cpdef FLOAT_t scale(HingeBasisFunction self, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts): */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx_base.parent), __pyx_n_s__translate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx_base.parent), __pyx_n_s__translate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_slopes)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_slopes)); @@ -8474,7 +8490,7 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_18HingeBasisFunction_translate( __Pyx_INCREF(((PyObject *)__pyx_v_intercepts)); PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_intercepts)); __Pyx_GIVEREF(((PyObject *)__pyx_v_intercepts)); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; @@ -8539,16 +8555,16 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_11transla case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__intercepts)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("translate", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("translate", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__recurse)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("translate", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("translate", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "translate") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "translate") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -8559,18 +8575,18 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_11transla } __pyx_v_slopes = ((PyArrayObject *)values[0]); __pyx_v_intercepts = ((PyArrayObject *)values[1]); - __pyx_v_recurse = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_recurse == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_recurse = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_recurse == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("translate", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("translate", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.earth._basis.HingeBasisFunction.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_slopes), __pyx_ptype_5numpy_ndarray, 1, "slopes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercepts), __pyx_ptype_5numpy_ndarray, 1, "intercepts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_slopes), __pyx_ptype_5numpy_ndarray, 1, "slopes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercepts), __pyx_ptype_5numpy_ndarray, 1, "intercepts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_10translate(((struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self), __pyx_v_slopes, __pyx_v_intercepts, __pyx_v_recurse); goto __pyx_L0; __pyx_L1_error:; @@ -8580,12 +8596,12 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_11transla return __pyx_r; } -/* "sklearn/earth/_basis.pyx":363 +/* "sklearn/earth/_basis.pyx":365 * return True * - * cpdef translate(HingeBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse): # <<<<<<<<<<<<<< - * self.knot = slopes[self.variable]*self.knot + intercepts[self.variable] - * if slopes[self.variable] < 0: + * cpdef translate(HingeBasisFunction self, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts, bint recurse): # <<<<<<<<<<<<<< + * self.knot = slopes[self.variable] * \ + * self.knot + intercepts[self.variable] */ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_10translate(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts, int __pyx_v_recurse) { @@ -8610,16 +8626,16 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_10transla __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->translate(__pyx_v_self, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), __pyx_v_recurse, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->translate(__pyx_v_self, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), __pyx_v_recurse, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -8646,11 +8662,11 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_10transla return __pyx_r; } -/* "sklearn/earth/_basis.pyx":370 - * self.parent.translate(slopes,intercepts) +/* "sklearn/earth/_basis.pyx":373 + * self.parent.translate(slopes, intercepts) * - * cpdef FLOAT_t scale(HingeBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): # <<<<<<<<<<<<<< - * result = self.parent.scale(slopes,intercepts) + * cpdef FLOAT_t scale(HingeBasisFunction self, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts): # <<<<<<<<<<<<<< + * result = self.parent.scale(slopes, intercepts) * result /= slopes[self.variable] */ @@ -8682,22 +8698,22 @@ static __pyx_t_7sklearn_5earth_6_basis_FLOAT_t __pyx_f_7sklearn_5earth_6_basis_1 __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__scale); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__scale); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_13scale)) { - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_slopes)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_slopes)); @@ -8705,10 +8721,10 @@ static __pyx_t_7sklearn_5earth_6_basis_FLOAT_t __pyx_f_7sklearn_5earth_6_basis_1 __Pyx_INCREF(((PyObject *)__pyx_v_intercepts)); PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_intercepts)); __Pyx_GIVEREF(((PyObject *)__pyx_v_intercepts)); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_4; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -8717,16 +8733,16 @@ static __pyx_t_7sklearn_5earth_6_basis_FLOAT_t __pyx_f_7sklearn_5earth_6_basis_1 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_basis.pyx":371 + /* "sklearn/earth/_basis.pyx":374 * - * cpdef FLOAT_t scale(HingeBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): - * result = self.parent.scale(slopes,intercepts) # <<<<<<<<<<<<<< + * cpdef FLOAT_t scale(HingeBasisFunction self, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts): + * result = self.parent.scale(slopes, intercepts) # <<<<<<<<<<<<<< * result /= slopes[self.variable] * return result */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx_base.parent), __pyx_n_s__scale); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx_base.parent), __pyx_n_s__scale); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_slopes)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_slopes)); @@ -8734,38 +8750,38 @@ static __pyx_t_7sklearn_5earth_6_basis_FLOAT_t __pyx_f_7sklearn_5earth_6_basis_1 __Pyx_INCREF(((PyObject *)__pyx_v_intercepts)); PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_intercepts)); __Pyx_GIVEREF(((PyObject *)__pyx_v_intercepts)); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 374; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_v_result = __pyx_t_2; __pyx_t_2 = 0; - /* "sklearn/earth/_basis.pyx":372 - * cpdef FLOAT_t scale(HingeBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): - * result = self.parent.scale(slopes,intercepts) + /* "sklearn/earth/_basis.pyx":375 + * cpdef FLOAT_t scale(HingeBasisFunction self, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts): + * result = self.parent.scale(slopes, intercepts) * result /= slopes[self.variable] # <<<<<<<<<<<<<< * return result * */ __pyx_t_5 = __pyx_v_self->variable; - __pyx_t_2 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_FLOAT_t *, __pyx_pybuffernd_slopes.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_slopes.diminfo[0].strides))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_FLOAT_t *, __pyx_pybuffernd_slopes.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_slopes.diminfo[0].strides))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyNumber_InPlaceDivide(__pyx_v_result, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyNumber_InPlaceDivide(__pyx_v_result, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_v_result); __pyx_v_result = __pyx_t_3; __pyx_t_3 = 0; - /* "sklearn/earth/_basis.pyx":373 - * result = self.parent.scale(slopes,intercepts) + /* "sklearn/earth/_basis.pyx":376 + * result = self.parent.scale(slopes, intercepts) * result /= slopes[self.variable] * return result # <<<<<<<<<<<<<< * * def __str__(self): */ - __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_result); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_result); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_t_4; goto __pyx_L0; @@ -8823,11 +8839,11 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_13scale(P case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__intercepts)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("scale", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("scale", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scale") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scale") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -8840,14 +8856,14 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_13scale(P } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("scale", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("scale", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.earth._basis.HingeBasisFunction.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_slopes), __pyx_ptype_5numpy_ndarray, 1, "slopes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercepts), __pyx_ptype_5numpy_ndarray, 1, "intercepts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_slopes), __pyx_ptype_5numpy_ndarray, 1, "slopes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercepts), __pyx_ptype_5numpy_ndarray, 1, "intercepts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_12scale(((struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self), __pyx_v_slopes, __pyx_v_intercepts); goto __pyx_L0; __pyx_L1_error:; @@ -8857,11 +8873,11 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_13scale(P return __pyx_r; } -/* "sklearn/earth/_basis.pyx":370 - * self.parent.translate(slopes,intercepts) +/* "sklearn/earth/_basis.pyx":373 + * self.parent.translate(slopes, intercepts) * - * cpdef FLOAT_t scale(HingeBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): # <<<<<<<<<<<<<< - * result = self.parent.scale(slopes,intercepts) + * cpdef FLOAT_t scale(HingeBasisFunction self, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts): # <<<<<<<<<<<<<< + * result = self.parent.scale(slopes, intercepts) * result /= slopes[self.variable] */ @@ -8887,16 +8903,16 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_12scale(s __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->scale(__pyx_v_self, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->scale(__pyx_v_self, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 373; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -8934,7 +8950,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_15__str__ return __pyx_r; } -/* "sklearn/earth/_basis.pyx":375 +/* "sklearn/earth/_basis.pyx":378 * return result * * def __str__(self): # <<<<<<<<<<<<<< @@ -8957,7 +8973,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_14__str__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - /* "sklearn/earth/_basis.pyx":376 + /* "sklearn/earth/_basis.pyx":379 * * def __str__(self): * result = '' # <<<<<<<<<<<<<< @@ -8967,50 +8983,50 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_14__str__ __Pyx_INCREF(((PyObject *)__pyx_kp_s_2)); __pyx_v_result = ((PyObject *)__pyx_kp_s_2); - /* "sklearn/earth/_basis.pyx":377 + /* "sklearn/earth/_basis.pyx":380 * def __str__(self): * result = '' * if self.variable is not None: # <<<<<<<<<<<<<< * if not self.reverse: * if self.knot >= 0: */ - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->variable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->variable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = (__pyx_t_1 != Py_None); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = (__pyx_t_2 != 0); if (__pyx_t_3) { - /* "sklearn/earth/_basis.pyx":378 + /* "sklearn/earth/_basis.pyx":381 * result = '' * if self.variable is not None: * if not self.reverse: # <<<<<<<<<<<<<< * if self.knot >= 0: - * result = 'h(%s-%G)' % (self.label,self.knot) + * result = 'h(%s-%G)' % (self.label, self.knot) */ __pyx_t_3 = ((!(__pyx_v_self->reverse != 0)) != 0); if (__pyx_t_3) { - /* "sklearn/earth/_basis.pyx":379 + /* "sklearn/earth/_basis.pyx":382 * if self.variable is not None: * if not self.reverse: * if self.knot >= 0: # <<<<<<<<<<<<<< - * result = 'h(%s-%G)' % (self.label,self.knot) + * result = 'h(%s-%G)' % (self.label, self.knot) * else: */ __pyx_t_3 = ((__pyx_v_self->knot >= 0.0) != 0); if (__pyx_t_3) { - /* "sklearn/earth/_basis.pyx":380 + /* "sklearn/earth/_basis.pyx":383 * if not self.reverse: * if self.knot >= 0: - * result = 'h(%s-%G)' % (self.label,self.knot) # <<<<<<<<<<<<<< + * result = 'h(%s-%G)' % (self.label, self.knot) # <<<<<<<<<<<<<< * else: - * result = 'h(%s+%G)' % (self.label,-self.knot) + * result = 'h(%s+%G)' % (self.label, -self.knot) */ - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->knot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->knot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(((PyObject *)__pyx_v_self->label)); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_self->label)); @@ -9018,7 +9034,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_14__str__ PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_3), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_3), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_v_result); @@ -9028,16 +9044,16 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_14__str__ } /*else*/ { - /* "sklearn/earth/_basis.pyx":382 - * result = 'h(%s-%G)' % (self.label,self.knot) + /* "sklearn/earth/_basis.pyx":385 + * result = 'h(%s-%G)' % (self.label, self.knot) * else: - * result = 'h(%s+%G)' % (self.label,-self.knot) # <<<<<<<<<<<<<< + * result = 'h(%s+%G)' % (self.label, -self.knot) # <<<<<<<<<<<<<< * else: - * result = 'h(%G-%s)' % (self.knot,self.label) + * result = 'h(%G-%s)' % (self.knot, self.label) */ - __pyx_t_1 = PyFloat_FromDouble((-__pyx_v_self->knot)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble((-__pyx_v_self->knot)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(((PyObject *)__pyx_v_self->label)); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_self->label)); @@ -9045,7 +9061,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_14__str__ PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_4), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_4), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_v_result); @@ -9057,16 +9073,16 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_14__str__ } /*else*/ { - /* "sklearn/earth/_basis.pyx":384 - * result = 'h(%s+%G)' % (self.label,-self.knot) + /* "sklearn/earth/_basis.pyx":387 + * result = 'h(%s+%G)' % (self.label, -self.knot) * else: - * result = 'h(%G-%s)' % (self.knot,self.label) # <<<<<<<<<<<<<< - * parent = str(self.parent) if not self.parent.__class__ is ConstantBasisFunction else '' - * if parent != '': + * result = 'h(%G-%s)' % (self.knot, self.label) # <<<<<<<<<<<<<< + * parent = str( + * self.parent) if not self.parent.__class__ is ConstantBasisFunction else '' */ - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->knot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->knot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); @@ -9074,7 +9090,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_14__str__ PyTuple_SET_ITEM(__pyx_t_4, 1, ((PyObject *)__pyx_v_self->label)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self->label)); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_v_result); @@ -9086,24 +9102,32 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_14__str__ } __pyx_L3:; - /* "sklearn/earth/_basis.pyx":385 - * else: - * result = 'h(%G-%s)' % (self.knot,self.label) - * parent = str(self.parent) if not self.parent.__class__ is ConstantBasisFunction else '' # <<<<<<<<<<<<<< + /* "sklearn/earth/_basis.pyx":389 + * result = 'h(%G-%s)' % (self.knot, self.label) + * parent = str( + * self.parent) if not self.parent.__class__ is ConstantBasisFunction else '' # <<<<<<<<<<<<<< * if parent != '': * result += '*%s' % (str(self.parent),) */ - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx_base.parent), __pyx_n_s____class__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx_base.parent), __pyx_n_s____class__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = (__pyx_t_4 == ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_ConstantBasisFunction))); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (((!(__pyx_t_3 != 0)) != 0)) { - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/earth/_basis.pyx":388 + * else: + * result = 'h(%G-%s)' % (self.knot, self.label) + * parent = str( # <<<<<<<<<<<<<< + * self.parent) if not self.parent.__class__ is ConstantBasisFunction else '' + * if parent != '': + */ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.parent)); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_self->__pyx_base.parent)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.parent)); - __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 388; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __pyx_t_1 = __pyx_t_5; @@ -9115,42 +9139,42 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_14__str__ __pyx_v_parent = __pyx_t_1; __pyx_t_1 = 0; - /* "sklearn/earth/_basis.pyx":386 - * result = 'h(%G-%s)' % (self.knot,self.label) - * parent = str(self.parent) if not self.parent.__class__ is ConstantBasisFunction else '' + /* "sklearn/earth/_basis.pyx":390 + * parent = str( + * self.parent) if not self.parent.__class__ is ConstantBasisFunction else '' * if parent != '': # <<<<<<<<<<<<<< * result += '*%s' % (str(self.parent),) * return result */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_parent, ((PyObject *)__pyx_kp_s_2), Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_v_parent, ((PyObject *)__pyx_kp_s_2), Py_NE); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_3) { - /* "sklearn/earth/_basis.pyx":387 - * parent = str(self.parent) if not self.parent.__class__ is ConstantBasisFunction else '' + /* "sklearn/earth/_basis.pyx":391 + * self.parent) if not self.parent.__class__ is ConstantBasisFunction else '' * if parent != '': * result += '*%s' % (str(self.parent),) # <<<<<<<<<<<<<< * return result * */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.parent)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self->__pyx_base.parent)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.parent)); - __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_6), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_6), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_v_result); @@ -9160,7 +9184,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_14__str__ } __pyx_L6:; - /* "sklearn/earth/_basis.pyx":388 + /* "sklearn/earth/_basis.pyx":392 * if parent != '': * result += '*%s' % (str(self.parent),) * return result # <<<<<<<<<<<<<< @@ -9188,7 +9212,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_14__str__ return __pyx_r; } -/* "sklearn/earth/_basis.pyx":390 +/* "sklearn/earth/_basis.pyx":394 * return result * * cpdef INDEX_t get_variable(self): # <<<<<<<<<<<<<< @@ -9211,12 +9235,12 @@ static __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_f_7sklearn_5earth_6_basis_1 if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_variable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_variable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_17get_variable)) { - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -9225,7 +9249,7 @@ static __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_f_7sklearn_5earth_6_basis_1 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_basis.pyx":391 + /* "sklearn/earth/_basis.pyx":395 * * cpdef INDEX_t get_variable(self): * return self.variable # <<<<<<<<<<<<<< @@ -9258,7 +9282,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_17get_var return __pyx_r; } -/* "sklearn/earth/_basis.pyx":390 +/* "sklearn/earth/_basis.pyx":394 * return result * * cpdef INDEX_t get_variable(self): # <<<<<<<<<<<<<< @@ -9275,7 +9299,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_16get_var int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_variable", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_variable(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_variable(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 394; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -9293,7 +9317,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_16get_var return __pyx_r; } -/* "sklearn/earth/_basis.pyx":393 +/* "sklearn/earth/_basis.pyx":397 * return self.variable * * cpdef FLOAT_t get_knot(self): # <<<<<<<<<<<<<< @@ -9316,12 +9340,12 @@ static __pyx_t_7sklearn_5earth_6_basis_FLOAT_t __pyx_f_7sklearn_5earth_6_basis_1 if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_knot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_knot); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_19get_knot)) { - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -9330,7 +9354,7 @@ static __pyx_t_7sklearn_5earth_6_basis_FLOAT_t __pyx_f_7sklearn_5earth_6_basis_1 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_basis.pyx":394 + /* "sklearn/earth/_basis.pyx":398 * * cpdef FLOAT_t get_knot(self): * return self.knot # <<<<<<<<<<<<<< @@ -9363,7 +9387,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_19get_kno return __pyx_r; } -/* "sklearn/earth/_basis.pyx":393 +/* "sklearn/earth/_basis.pyx":397 * return self.variable * * cpdef FLOAT_t get_knot(self): # <<<<<<<<<<<<<< @@ -9380,7 +9404,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_18get_kno int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_knot", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_knot(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_knot(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -9398,7 +9422,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_18get_kno return __pyx_r; } -/* "sklearn/earth/_basis.pyx":396 +/* "sklearn/earth/_basis.pyx":400 * return self.knot * * cpdef bint get_reverse(self): # <<<<<<<<<<<<<< @@ -9421,12 +9445,12 @@ static int __pyx_f_7sklearn_5earth_6_basis_18HingeBasisFunction_get_reverse(stru if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_reverse); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_reverse); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_21get_reverse)) { - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -9435,7 +9459,7 @@ static int __pyx_f_7sklearn_5earth_6_basis_18HingeBasisFunction_get_reverse(stru __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_basis.pyx":397 + /* "sklearn/earth/_basis.pyx":401 * * cpdef bint get_reverse(self): * return self.reverse # <<<<<<<<<<<<<< @@ -9468,7 +9492,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_21get_rev return __pyx_r; } -/* "sklearn/earth/_basis.pyx":396 +/* "sklearn/earth/_basis.pyx":400 * return self.knot * * cpdef bint get_reverse(self): # <<<<<<<<<<<<<< @@ -9485,7 +9509,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_20get_rev int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_reverse", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_reverse(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 396; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_reverse(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -9503,7 +9527,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_20get_rev return __pyx_r; } -/* "sklearn/earth/_basis.pyx":399 +/* "sklearn/earth/_basis.pyx":403 * return self.reverse * * cpdef INDEX_t get_knot_idx(self): # <<<<<<<<<<<<<< @@ -9526,12 +9550,12 @@ static __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_f_7sklearn_5earth_6_basis_1 if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_knot_idx); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_knot_idx); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_23get_knot_idx)) { - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -9540,12 +9564,12 @@ static __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_f_7sklearn_5earth_6_basis_1 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_basis.pyx":400 + /* "sklearn/earth/_basis.pyx":404 * * cpdef INDEX_t get_knot_idx(self): * return self.knot_idx # <<<<<<<<<<<<<< * - * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = True): + * cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse=True): */ __pyx_r = __pyx_v_self->knot_idx; goto __pyx_L0; @@ -9573,7 +9597,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_23get_kno return __pyx_r; } -/* "sklearn/earth/_basis.pyx":399 +/* "sklearn/earth/_basis.pyx":403 * return self.reverse * * cpdef INDEX_t get_knot_idx(self): # <<<<<<<<<<<<<< @@ -9590,7 +9614,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_22get_kno int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_knot_idx", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_knot_idx(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_knot_idx(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 403; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -9608,10 +9632,10 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_22get_kno return __pyx_r; } -/* "sklearn/earth/_basis.pyx":402 +/* "sklearn/earth/_basis.pyx":406 * return self.knot_idx * - * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = True): # <<<<<<<<<<<<<< + * cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse=True): # <<<<<<<<<<<<<< * ''' * X - Data matrix */ @@ -9661,25 +9685,25 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_18HingeBasisFunction_apply(stru __pyx_pybuffernd_b.rcbuffer = &__pyx_pybuffer_b; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)__pyx_v_b, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)__pyx_v_b, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_b.diminfo[0].strides = __pyx_pybuffernd_b.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_b.diminfo[0].shape = __pyx_pybuffernd_b.rcbuffer->pybuffer.shape[0]; /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__apply); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__apply); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_25apply)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_recurse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_recurse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_X)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_X)); @@ -9690,7 +9714,7 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_18HingeBasisFunction_apply(stru PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; @@ -9701,88 +9725,88 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_18HingeBasisFunction_apply(stru __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_basis.pyx":409 + /* "sklearn/earth/_basis.pyx":413 * parent function. * ''' * if recurse: # <<<<<<<<<<<<<< - * self.parent.apply(X,b,recurse=True) - * cdef INDEX_t i #@DuplicatedSignature + * self.parent.apply(X, b, recurse=True) + * cdef INDEX_t i # @DuplicatedSignature */ __pyx_t_4 = (__pyx_v_recurse != 0); if (__pyx_t_4) { - /* "sklearn/earth/_basis.pyx":410 + /* "sklearn/earth/_basis.pyx":414 * ''' * if recurse: - * self.parent.apply(X,b,recurse=True) # <<<<<<<<<<<<<< - * cdef INDEX_t i #@DuplicatedSignature - * cdef INDEX_t m = len(b) #@DuplicatedSignature + * self.parent.apply(X, b, recurse=True) # <<<<<<<<<<<<<< + * cdef INDEX_t i # @DuplicatedSignature + * cdef INDEX_t m = len(b) # @DuplicatedSignature */ __pyx_t_5.__pyx_n = 1; __pyx_t_5.recurse = 1; - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self->__pyx_base.parent->__pyx_vtab)->apply(__pyx_v_self->__pyx_base.parent, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_b), 0, &__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self->__pyx_base.parent->__pyx_vtab)->apply(__pyx_v_self->__pyx_base.parent, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_b), 0, &__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L3; } __pyx_L3:; - /* "sklearn/earth/_basis.pyx":412 - * self.parent.apply(X,b,recurse=True) - * cdef INDEX_t i #@DuplicatedSignature - * cdef INDEX_t m = len(b) #@DuplicatedSignature # <<<<<<<<<<<<<< + /* "sklearn/earth/_basis.pyx":416 + * self.parent.apply(X, b, recurse=True) + * cdef INDEX_t i # @DuplicatedSignature + * cdef INDEX_t m = len(b) # @DuplicatedSignature # <<<<<<<<<<<<<< * cdef FLOAT_t tmp * if self.reverse: */ - __pyx_t_6 = PyObject_Length(((PyObject *)__pyx_v_b)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Length(((PyObject *)__pyx_v_b)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_m = __pyx_t_6; - /* "sklearn/earth/_basis.pyx":414 - * cdef INDEX_t m = len(b) #@DuplicatedSignature + /* "sklearn/earth/_basis.pyx":418 + * cdef INDEX_t m = len(b) # @DuplicatedSignature * cdef FLOAT_t tmp * if self.reverse: # <<<<<<<<<<<<<< * for i in range(m): - * tmp = self.knot - X[i,self.variable] + * tmp = self.knot - X[i, self.variable] */ __pyx_t_4 = (__pyx_v_self->reverse != 0); if (__pyx_t_4) { - /* "sklearn/earth/_basis.pyx":415 + /* "sklearn/earth/_basis.pyx":419 * cdef FLOAT_t tmp * if self.reverse: * for i in range(m): # <<<<<<<<<<<<<< - * tmp = self.knot - X[i,self.variable] + * tmp = self.knot - X[i, self.variable] * if tmp < 0: */ __pyx_t_7 = __pyx_v_m; for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { __pyx_v_i = __pyx_t_8; - /* "sklearn/earth/_basis.pyx":416 + /* "sklearn/earth/_basis.pyx":420 * if self.reverse: * for i in range(m): - * tmp = self.knot - X[i,self.variable] # <<<<<<<<<<<<<< + * tmp = self.knot - X[i, self.variable] # <<<<<<<<<<<<<< * if tmp < 0: - * tmp = 0.0 + * tmp = 0.0 */ __pyx_t_9 = __pyx_v_i; __pyx_t_10 = __pyx_v_self->variable; __pyx_v_tmp = (__pyx_v_self->knot - (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_6_basis_FLOAT_t *, __pyx_pybuffernd_X.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_X.diminfo[0].strides, __pyx_t_10, __pyx_pybuffernd_X.diminfo[1].strides))); - /* "sklearn/earth/_basis.pyx":417 + /* "sklearn/earth/_basis.pyx":421 * for i in range(m): - * tmp = self.knot - X[i,self.variable] + * tmp = self.knot - X[i, self.variable] * if tmp < 0: # <<<<<<<<<<<<<< - * tmp = 0.0 + * tmp = 0.0 * b[i] *= tmp */ __pyx_t_4 = ((__pyx_v_tmp < 0.0) != 0); if (__pyx_t_4) { - /* "sklearn/earth/_basis.pyx":418 - * tmp = self.knot - X[i,self.variable] + /* "sklearn/earth/_basis.pyx":422 + * tmp = self.knot - X[i, self.variable] * if tmp < 0: - * tmp = 0.0 # <<<<<<<<<<<<<< + * tmp = 0.0 # <<<<<<<<<<<<<< * b[i] *= tmp * else: */ @@ -9791,9 +9815,9 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_18HingeBasisFunction_apply(stru } __pyx_L7:; - /* "sklearn/earth/_basis.pyx":419 + /* "sklearn/earth/_basis.pyx":423 * if tmp < 0: - * tmp = 0.0 + * tmp = 0.0 * b[i] *= tmp # <<<<<<<<<<<<<< * else: * for i in range(m): @@ -9805,42 +9829,42 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_18HingeBasisFunction_apply(stru } /*else*/ { - /* "sklearn/earth/_basis.pyx":421 + /* "sklearn/earth/_basis.pyx":425 * b[i] *= tmp * else: * for i in range(m): # <<<<<<<<<<<<<< - * tmp = X[i,self.variable] - self.knot + * tmp = X[i, self.variable] - self.knot * if tmp < 0: */ __pyx_t_7 = __pyx_v_m; for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { __pyx_v_i = __pyx_t_8; - /* "sklearn/earth/_basis.pyx":422 + /* "sklearn/earth/_basis.pyx":426 * else: * for i in range(m): - * tmp = X[i,self.variable] - self.knot # <<<<<<<<<<<<<< + * tmp = X[i, self.variable] - self.knot # <<<<<<<<<<<<<< * if tmp < 0: - * tmp = 0.0 + * tmp = 0.0 */ __pyx_t_12 = __pyx_v_i; __pyx_t_13 = __pyx_v_self->variable; __pyx_v_tmp = ((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_6_basis_FLOAT_t *, __pyx_pybuffernd_X.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_X.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_X.diminfo[1].strides)) - __pyx_v_self->knot); - /* "sklearn/earth/_basis.pyx":423 + /* "sklearn/earth/_basis.pyx":427 * for i in range(m): - * tmp = X[i,self.variable] - self.knot + * tmp = X[i, self.variable] - self.knot * if tmp < 0: # <<<<<<<<<<<<<< - * tmp = 0.0 + * tmp = 0.0 * b[i] *= tmp */ __pyx_t_4 = ((__pyx_v_tmp < 0.0) != 0); if (__pyx_t_4) { - /* "sklearn/earth/_basis.pyx":424 - * tmp = X[i,self.variable] - self.knot + /* "sklearn/earth/_basis.pyx":428 + * tmp = X[i, self.variable] - self.knot * if tmp < 0: - * tmp = 0.0 # <<<<<<<<<<<<<< + * tmp = 0.0 # <<<<<<<<<<<<<< * b[i] *= tmp * */ @@ -9849,9 +9873,9 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_18HingeBasisFunction_apply(stru } __pyx_L10:; - /* "sklearn/earth/_basis.pyx":425 + /* "sklearn/earth/_basis.pyx":429 * if tmp < 0: - * tmp = 0.0 + * tmp = 0.0 * b[i] *= tmp # <<<<<<<<<<<<<< * * cdef class LinearBasisFunction(BasisFunction): @@ -9919,7 +9943,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_25apply(P case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__b)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("apply", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("apply", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (kw_args > 0) { @@ -9928,7 +9952,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_25apply(P } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -9942,13 +9966,13 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_25apply(P __pyx_v_X = ((PyArrayObject *)values[0]); __pyx_v_b = ((PyArrayObject *)values[1]); if (values[2]) { - __pyx_v_recurse = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_recurse == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_recurse = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_recurse == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - /* "sklearn/earth/_basis.pyx":402 + /* "sklearn/earth/_basis.pyx":406 * return self.knot_idx * - * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = True): # <<<<<<<<<<<<<< + * cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse=True): # <<<<<<<<<<<<<< * ''' * X - Data matrix */ @@ -9957,14 +9981,14 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_18HingeBasisFunction_25apply(P } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("apply", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("apply", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.earth._basis.HingeBasisFunction.apply", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_5numpy_ndarray, 1, "b", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_5numpy_ndarray, 1, "b", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_24apply(((struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self), __pyx_v_X, __pyx_v_b, __pyx_v_recurse); goto __pyx_L0; __pyx_L1_error:; @@ -9997,18 +10021,18 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_24apply(s __pyx_pybuffernd_b.rcbuffer = &__pyx_pybuffer_b; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)__pyx_v_b, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)__pyx_v_b, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_b.diminfo[0].strides = __pyx_pybuffernd_b.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_b.diminfo[0].shape = __pyx_pybuffernd_b.rcbuffer->pybuffer.shape[0]; __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 1; __pyx_t_2.recurse = __pyx_v_recurse; - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.apply(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self), ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_b), 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.apply(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self), ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_b), 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -10051,12 +10075,12 @@ static int __pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_1__init__(PyOb static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__parent,&__pyx_n_s__variable,&__pyx_n_s__label,0}; PyObject* values[3] = {0,0,0}; - /* "sklearn/earth/_basis.pyx":428 - * + /* "sklearn/earth/_basis.pyx":433 * cdef class LinearBasisFunction(BasisFunction): - * def __init__(self, BasisFunction parent, INDEX_t variable, label=None): #@DuplicatedSignature # <<<<<<<<<<<<<< + * #@DuplicatedSignature + * def __init__(self, BasisFunction parent, INDEX_t variable, label=None): # <<<<<<<<<<<<<< * self.variable = variable - * self.label = label if label is not None else 'x'+str(variable) + * self.label = label if label is not None else 'x' + str(variable) */ values[2] = ((PyObject *)Py_None); if (unlikely(__pyx_kwds)) { @@ -10077,7 +10101,7 @@ static int __pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_1__init__(PyOb case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__variable)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (kw_args > 0) { @@ -10086,7 +10110,7 @@ static int __pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_1__init__(PyOb } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -10098,18 +10122,18 @@ static int __pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_1__init__(PyOb } } __pyx_v_parent = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)values[0]); - __pyx_v_variable = __Pyx_PyInt_from_py_npy_ulonglong(values[1]); if (unlikely((__pyx_v_variable == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_variable = __Pyx_PyInt_from_py_npy_ulonglong(values[1]); if (unlikely((__pyx_v_variable == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_label = values[2]; } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.earth._basis.LinearBasisFunction.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parent), __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction, 1, "parent", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 428; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_parent), __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction, 1, "parent", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 433; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction___init__(((struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *)__pyx_v_self), __pyx_v_parent, __pyx_v_variable, __pyx_v_label); goto __pyx_L0; __pyx_L1_error:; @@ -10131,19 +10155,19 @@ static int __pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction___init__(struc int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "sklearn/earth/_basis.pyx":429 - * cdef class LinearBasisFunction(BasisFunction): - * def __init__(self, BasisFunction parent, INDEX_t variable, label=None): #@DuplicatedSignature + /* "sklearn/earth/_basis.pyx":434 + * #@DuplicatedSignature + * def __init__(self, BasisFunction parent, INDEX_t variable, label=None): * self.variable = variable # <<<<<<<<<<<<<< - * self.label = label if label is not None else 'x'+str(variable) + * self.label = label if label is not None else 'x' + str(variable) * self._set_parent(parent) */ __pyx_v_self->variable = __pyx_v_variable; - /* "sklearn/earth/_basis.pyx":430 - * def __init__(self, BasisFunction parent, INDEX_t variable, label=None): #@DuplicatedSignature + /* "sklearn/earth/_basis.pyx":435 + * def __init__(self, BasisFunction parent, INDEX_t variable, label=None): * self.variable = variable - * self.label = label if label is not None else 'x'+str(variable) # <<<<<<<<<<<<<< + * self.label = label if label is not None else 'x' + str(variable) # <<<<<<<<<<<<<< * self._set_parent(parent) * */ @@ -10152,37 +10176,37 @@ static int __pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction___init__(struc __Pyx_INCREF(__pyx_v_label); __pyx_t_1 = __pyx_v_label; } else { - __pyx_t_3 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_n_s__x), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_n_s__x), __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_1 = __pyx_t_4; __pyx_t_4 = 0; } - if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 430; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 435; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->label); __Pyx_DECREF(((PyObject *)__pyx_v_self->label)); __pyx_v_self->label = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_basis.pyx":431 + /* "sklearn/earth/_basis.pyx":436 * self.variable = variable - * self.label = label if label is not None else 'x'+str(variable) + * self.label = label if label is not None else 'x' + str(variable) * self._set_parent(parent) # <<<<<<<<<<<<<< * * def __reduce__(self): */ - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_LinearBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._set_parent(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self), __pyx_v_parent, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_LinearBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base._set_parent(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self), __pyx_v_parent, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -10210,7 +10234,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_3__reduc return __pyx_r; } -/* "sklearn/earth/_basis.pyx":433 +/* "sklearn/earth/_basis.pyx":438 * self._set_parent(parent) * * def __reduce__(self): # <<<<<<<<<<<<<< @@ -10230,7 +10254,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_2__reduc int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce__", 0); - /* "sklearn/earth/_basis.pyx":434 + /* "sklearn/earth/_basis.pyx":439 * * def __reduce__(self): * return (self.__class__, (pickle_place_holder, 1, ''), self._getstate()) # <<<<<<<<<<<<<< @@ -10238,11 +10262,11 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_2__reduc * def _getstate(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__pickle_place_holder); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__pickle_place_holder); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); @@ -10253,12 +10277,12 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_2__reduc PyTuple_SET_ITEM(__pyx_t_3, 2, ((PyObject *)__pyx_kp_s_2)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2)); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 434; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 439; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); @@ -10299,7 +10323,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_5_getsta return __pyx_r; } -/* "sklearn/earth/_basis.pyx":436 +/* "sklearn/earth/_basis.pyx":441 * return (self.__class__, (pickle_place_holder, 1, ''), self._getstate()) * * def _getstate(self): # <<<<<<<<<<<<<< @@ -10319,14 +10343,14 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_4_getsta int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_getstate", 0); - /* "sklearn/earth/_basis.pyx":437 + /* "sklearn/earth/_basis.pyx":442 * * def _getstate(self): * result = super(LinearBasisFunction, self)._getstate() # <<<<<<<<<<<<<< * result.update({'variable': self.variable, * 'label': self.label}) */ - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_LinearBasisFunction))); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_LinearBasisFunction))); @@ -10334,54 +10358,54 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_4_getsta __Pyx_INCREF(((PyObject *)__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - __pyx_t_2 = PyObject_Call(__pyx_builtin_super, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_builtin_super, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 437; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 442; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_result = __pyx_t_2; __pyx_t_2 = 0; - /* "sklearn/earth/_basis.pyx":438 + /* "sklearn/earth/_basis.pyx":443 * def _getstate(self): * result = super(LinearBasisFunction, self)._getstate() * result.update({'variable': self.variable, # <<<<<<<<<<<<<< * 'label': self.label}) * return result */ - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_n_s__update); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_result, __pyx_n_s__update); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_3 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->variable); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->variable); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__variable), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__variable), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/earth/_basis.pyx":439 + /* "sklearn/earth/_basis.pyx":444 * result = super(LinearBasisFunction, self)._getstate() * result.update({'variable': self.variable, * 'label': self.label}) # <<<<<<<<<<<<<< * return result * */ - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__label), ((PyObject *)__pyx_v_self->label)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__label), ((PyObject *)__pyx_v_self->label)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 438; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_basis.pyx":440 + /* "sklearn/earth/_basis.pyx":445 * result.update({'variable': self.variable, * 'label': self.label}) * return result # <<<<<<<<<<<<<< @@ -10419,7 +10443,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_7__setst return __pyx_r; } -/* "sklearn/earth/_basis.pyx":442 +/* "sklearn/earth/_basis.pyx":447 * return result * * def __setstate__(self, state): # <<<<<<<<<<<<<< @@ -10439,43 +10463,43 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_6__setst int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate__", 0); - /* "sklearn/earth/_basis.pyx":443 + /* "sklearn/earth/_basis.pyx":448 * * def __setstate__(self, state): * self.variable = state['variable'] # <<<<<<<<<<<<<< * self.label = state['label'] * super(LinearBasisFunction, self).__setstate__(state) */ - __pyx_t_1 = PyObject_GetItem(__pyx_v_state, ((PyObject *)__pyx_n_s__variable)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(__pyx_v_state, ((PyObject *)__pyx_n_s__variable)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 443; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 448; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->variable = __pyx_t_2; - /* "sklearn/earth/_basis.pyx":444 + /* "sklearn/earth/_basis.pyx":449 * def __setstate__(self, state): * self.variable = state['variable'] * self.label = state['label'] # <<<<<<<<<<<<<< * super(LinearBasisFunction, self).__setstate__(state) * */ - __pyx_t_1 = PyObject_GetItem(__pyx_v_state, ((PyObject *)__pyx_n_s__label)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(__pyx_v_state, ((PyObject *)__pyx_n_s__label)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 444; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(PyString_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected str, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 449; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->label); __Pyx_DECREF(((PyObject *)__pyx_v_self->label)); __pyx_v_self->label = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_basis.pyx":445 + /* "sklearn/earth/_basis.pyx":450 * self.variable = state['variable'] * self.label = state['label'] * super(LinearBasisFunction, self).__setstate__(state) # <<<<<<<<<<<<<< * - * cpdef translate(LinearBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse): + * cpdef translate(LinearBasisFunctionself, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts, bint recurse): */ - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_LinearBasisFunction))); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_LinearBasisFunction))); @@ -10483,18 +10507,18 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_6__setst __Pyx_INCREF(((PyObject *)__pyx_v_self)); PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self)); - __pyx_t_3 = PyObject_Call(__pyx_builtin_super, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_super, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s____setstate__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s____setstate__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_state); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_state); __Pyx_GIVEREF(__pyx_v_state); - __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 445; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; @@ -10514,10 +10538,10 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_6__setst return __pyx_r; } -/* "sklearn/earth/_basis.pyx":447 +/* "sklearn/earth/_basis.pyx":452 * super(LinearBasisFunction, self).__setstate__(state) * - * cpdef translate(LinearBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse): # <<<<<<<<<<<<<< + * cpdef translate(LinearBasisFunctionself, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts, bint recurse): # <<<<<<<<<<<<<< * pass * */ @@ -10547,25 +10571,25 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_19LinearBasisFunction_translate __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_LinearBasisFunctionself))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_LinearBasisFunctionself), __pyx_n_s__translate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_LinearBasisFunctionself), __pyx_n_s__translate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_9translate)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_recurse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_recurse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_slopes)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_slopes)); @@ -10576,7 +10600,7 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_19LinearBasisFunction_translate PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; @@ -10587,12 +10611,12 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_19LinearBasisFunction_translate __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_basis.pyx":448 + /* "sklearn/earth/_basis.pyx":453 * - * cpdef translate(LinearBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse): + * cpdef translate(LinearBasisFunctionself, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts, bint recurse): * pass # <<<<<<<<<<<<<< * - * cpdef FLOAT_t scale(LinearBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): + * cpdef FLOAT_t scale(LinearBasisFunction self, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts): */ __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -10651,16 +10675,16 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_9transla case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__intercepts)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("translate", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("translate", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__recurse)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("translate", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("translate", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "translate") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "translate") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -10671,18 +10695,18 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_9transla } __pyx_v_slopes = ((PyArrayObject *)values[0]); __pyx_v_intercepts = ((PyArrayObject *)values[1]); - __pyx_v_recurse = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_recurse == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_recurse = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_recurse == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("translate", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("translate", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.earth._basis.LinearBasisFunction.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_slopes), __pyx_ptype_5numpy_ndarray, 1, "slopes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercepts), __pyx_ptype_5numpy_ndarray, 1, "intercepts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_slopes), __pyx_ptype_5numpy_ndarray, 1, "slopes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercepts), __pyx_ptype_5numpy_ndarray, 1, "intercepts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_8translate(((struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *)__pyx_v_LinearBasisFunctionself), __pyx_v_slopes, __pyx_v_intercepts, __pyx_v_recurse); goto __pyx_L0; __pyx_L1_error:; @@ -10692,10 +10716,10 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_9transla return __pyx_r; } -/* "sklearn/earth/_basis.pyx":447 +/* "sklearn/earth/_basis.pyx":452 * super(LinearBasisFunction, self).__setstate__(state) * - * cpdef translate(LinearBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse): # <<<<<<<<<<<<<< + * cpdef translate(LinearBasisFunctionself, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts, bint recurse): # <<<<<<<<<<<<<< * pass * */ @@ -10722,16 +10746,16 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_8transla __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_LinearBasisFunction *)__pyx_v_LinearBasisFunctionself->__pyx_base.__pyx_vtab)->translate(__pyx_v_LinearBasisFunctionself, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), __pyx_v_recurse, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 447; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_LinearBasisFunction *)__pyx_v_LinearBasisFunctionself->__pyx_base.__pyx_vtab)->translate(__pyx_v_LinearBasisFunctionself, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), __pyx_v_recurse, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -10758,11 +10782,11 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_8transla return __pyx_r; } -/* "sklearn/earth/_basis.pyx":450 +/* "sklearn/earth/_basis.pyx":455 * pass * - * cpdef FLOAT_t scale(LinearBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): # <<<<<<<<<<<<<< - * result = self.parent.scale(slopes,intercepts) + * cpdef FLOAT_t scale(LinearBasisFunction self, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts): # <<<<<<<<<<<<<< + * result = self.parent.scale(slopes, intercepts) * result /= slopes[self.variable] */ @@ -10794,22 +10818,22 @@ static __pyx_t_7sklearn_5earth_6_basis_FLOAT_t __pyx_f_7sklearn_5earth_6_basis_1 __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__scale); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__scale); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_11scale)) { - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_slopes)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_slopes)); @@ -10817,10 +10841,10 @@ static __pyx_t_7sklearn_5earth_6_basis_FLOAT_t __pyx_f_7sklearn_5earth_6_basis_1 __Pyx_INCREF(((PyObject *)__pyx_v_intercepts)); PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_intercepts)); __Pyx_GIVEREF(((PyObject *)__pyx_v_intercepts)); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_4; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -10829,16 +10853,16 @@ static __pyx_t_7sklearn_5earth_6_basis_FLOAT_t __pyx_f_7sklearn_5earth_6_basis_1 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_basis.pyx":451 + /* "sklearn/earth/_basis.pyx":456 * - * cpdef FLOAT_t scale(LinearBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): - * result = self.parent.scale(slopes,intercepts) # <<<<<<<<<<<<<< + * cpdef FLOAT_t scale(LinearBasisFunction self, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts): + * result = self.parent.scale(slopes, intercepts) # <<<<<<<<<<<<<< * result /= slopes[self.variable] * return result */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx_base.parent), __pyx_n_s__scale); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx_base.parent), __pyx_n_s__scale); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_slopes)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_slopes)); @@ -10846,38 +10870,38 @@ static __pyx_t_7sklearn_5earth_6_basis_FLOAT_t __pyx_f_7sklearn_5earth_6_basis_1 __Pyx_INCREF(((PyObject *)__pyx_v_intercepts)); PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_intercepts)); __Pyx_GIVEREF(((PyObject *)__pyx_v_intercepts)); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_v_result = __pyx_t_2; __pyx_t_2 = 0; - /* "sklearn/earth/_basis.pyx":452 - * cpdef FLOAT_t scale(LinearBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): - * result = self.parent.scale(slopes,intercepts) + /* "sklearn/earth/_basis.pyx":457 + * cpdef FLOAT_t scale(LinearBasisFunction self, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts): + * result = self.parent.scale(slopes, intercepts) * result /= slopes[self.variable] # <<<<<<<<<<<<<< * return result * */ __pyx_t_5 = __pyx_v_self->variable; - __pyx_t_2 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_FLOAT_t *, __pyx_pybuffernd_slopes.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_slopes.diminfo[0].strides))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_FLOAT_t *, __pyx_pybuffernd_slopes.rcbuffer->pybuffer.buf, __pyx_t_5, __pyx_pybuffernd_slopes.diminfo[0].strides))); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyNumber_InPlaceDivide(__pyx_v_result, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 452; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyNumber_InPlaceDivide(__pyx_v_result, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_v_result); __pyx_v_result = __pyx_t_3; __pyx_t_3 = 0; - /* "sklearn/earth/_basis.pyx":453 - * result = self.parent.scale(slopes,intercepts) + /* "sklearn/earth/_basis.pyx":458 + * result = self.parent.scale(slopes, intercepts) * result /= slopes[self.variable] * return result # <<<<<<<<<<<<<< * * def __str__(LinearBasisFunction self): */ - __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_result); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_v_result); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_t_4; goto __pyx_L0; @@ -10935,11 +10959,11 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_11scale( case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__intercepts)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("scale", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("scale", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scale") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scale") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -10952,14 +10976,14 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_11scale( } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("scale", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("scale", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.earth._basis.LinearBasisFunction.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_slopes), __pyx_ptype_5numpy_ndarray, 1, "slopes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercepts), __pyx_ptype_5numpy_ndarray, 1, "intercepts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_slopes), __pyx_ptype_5numpy_ndarray, 1, "slopes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercepts), __pyx_ptype_5numpy_ndarray, 1, "intercepts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_10scale(((struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *)__pyx_v_self), __pyx_v_slopes, __pyx_v_intercepts); goto __pyx_L0; __pyx_L1_error:; @@ -10969,11 +10993,11 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_11scale( return __pyx_r; } -/* "sklearn/earth/_basis.pyx":450 +/* "sklearn/earth/_basis.pyx":455 * pass * - * cpdef FLOAT_t scale(LinearBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): # <<<<<<<<<<<<<< - * result = self.parent.scale(slopes,intercepts) + * cpdef FLOAT_t scale(LinearBasisFunction self, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts): # <<<<<<<<<<<<<< + * result = self.parent.scale(slopes, intercepts) * result /= slopes[self.variable] */ @@ -10999,16 +11023,16 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_10scale( __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_LinearBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->scale(__pyx_v_self, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 450; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_LinearBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->scale(__pyx_v_self, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 455; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -11046,7 +11070,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_13__str_ return __pyx_r; } -/* "sklearn/earth/_basis.pyx":455 +/* "sklearn/earth/_basis.pyx":460 * return result * * def __str__(LinearBasisFunction self): # <<<<<<<<<<<<<< @@ -11068,7 +11092,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_12__str_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - /* "sklearn/earth/_basis.pyx":456 + /* "sklearn/earth/_basis.pyx":461 * * def __str__(LinearBasisFunction self): * result = self.label # <<<<<<<<<<<<<< @@ -11080,48 +11104,48 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_12__str_ __pyx_v_result = __pyx_t_1; __pyx_t_1 = 0; - /* "sklearn/earth/_basis.pyx":457 + /* "sklearn/earth/_basis.pyx":462 * def __str__(LinearBasisFunction self): * result = self.label * if not self.parent.__class__ is ConstantBasisFunction: # <<<<<<<<<<<<<< * parent = str(self.parent) - * result += '*'+parent + * result += '*' + parent */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx_base.parent), __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->__pyx_base.parent), __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = (__pyx_t_1 == ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_ConstantBasisFunction))); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = ((!(__pyx_t_2 != 0)) != 0); if (__pyx_t_3) { - /* "sklearn/earth/_basis.pyx":458 + /* "sklearn/earth/_basis.pyx":463 * result = self.label * if not self.parent.__class__ is ConstantBasisFunction: * parent = str(self.parent) # <<<<<<<<<<<<<< - * result += '*'+parent + * result += '*' + parent * return result */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_self->__pyx_base.parent)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self->__pyx_base.parent)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self->__pyx_base.parent)); - __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 463; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_v_parent = __pyx_t_4; __pyx_t_4 = 0; - /* "sklearn/earth/_basis.pyx":459 + /* "sklearn/earth/_basis.pyx":464 * if not self.parent.__class__ is ConstantBasisFunction: * parent = str(self.parent) - * result += '*'+parent # <<<<<<<<<<<<<< + * result += '*' + parent # <<<<<<<<<<<<<< * return result * */ - __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_kp_s_7), __pyx_v_parent); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Add(((PyObject *)__pyx_kp_s_7), __pyx_v_parent); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_result, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 459; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_result, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_v_result); @@ -11131,9 +11155,9 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_12__str_ } __pyx_L3:; - /* "sklearn/earth/_basis.pyx":460 + /* "sklearn/earth/_basis.pyx":465 * parent = str(self.parent) - * result += '*'+parent + * result += '*' + parent * return result # <<<<<<<<<<<<<< * * cpdef INDEX_t get_variable(self): @@ -11158,7 +11182,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_12__str_ return __pyx_r; } -/* "sklearn/earth/_basis.pyx":462 +/* "sklearn/earth/_basis.pyx":467 * return result * * cpdef INDEX_t get_variable(self): # <<<<<<<<<<<<<< @@ -11181,12 +11205,12 @@ static __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_f_7sklearn_5earth_6_basis_1 if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_variable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_variable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_15get_variable)) { - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -11195,12 +11219,12 @@ static __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_f_7sklearn_5earth_6_basis_1 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_basis.pyx":463 + /* "sklearn/earth/_basis.pyx":468 * * cpdef INDEX_t get_variable(self): * return self.variable # <<<<<<<<<<<<<< * - * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = True): + * cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse=True): */ __pyx_r = __pyx_v_self->variable; goto __pyx_L0; @@ -11228,7 +11252,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_15get_va return __pyx_r; } -/* "sklearn/earth/_basis.pyx":462 +/* "sklearn/earth/_basis.pyx":467 * return result * * cpdef INDEX_t get_variable(self): # <<<<<<<<<<<<<< @@ -11245,7 +11269,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_14get_va int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_variable", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_LinearBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_variable(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_LinearBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_variable(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -11263,10 +11287,10 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_14get_va return __pyx_r; } -/* "sklearn/earth/_basis.pyx":465 +/* "sklearn/earth/_basis.pyx":470 * return self.variable * - * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = True): # <<<<<<<<<<<<<< + * cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse=True): # <<<<<<<<<<<<<< * ''' * X - Data matrix */ @@ -11312,25 +11336,25 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_19LinearBasisFunction_apply(str __pyx_pybuffernd_b.rcbuffer = &__pyx_pybuffer_b; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)__pyx_v_b, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)__pyx_v_b, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_b.diminfo[0].strides = __pyx_pybuffernd_b.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_b.diminfo[0].shape = __pyx_pybuffernd_b.rcbuffer->pybuffer.shape[0]; /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__apply); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__apply); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_17apply)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_recurse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_recurse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_X)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_X)); @@ -11341,7 +11365,7 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_19LinearBasisFunction_apply(str PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; @@ -11352,57 +11376,57 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_19LinearBasisFunction_apply(str __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_basis.pyx":472 + /* "sklearn/earth/_basis.pyx":477 * parent function. * ''' * if recurse: # <<<<<<<<<<<<<< - * self.parent.apply(X,b,recurse=True) - * cdef INDEX_t i #@DuplicatedSignature + * self.parent.apply(X, b, recurse=True) + * cdef INDEX_t i # @DuplicatedSignature */ __pyx_t_4 = (__pyx_v_recurse != 0); if (__pyx_t_4) { - /* "sklearn/earth/_basis.pyx":473 + /* "sklearn/earth/_basis.pyx":478 * ''' * if recurse: - * self.parent.apply(X,b,recurse=True) # <<<<<<<<<<<<<< - * cdef INDEX_t i #@DuplicatedSignature - * cdef INDEX_t m = len(b) #@DuplicatedSignature + * self.parent.apply(X, b, recurse=True) # <<<<<<<<<<<<<< + * cdef INDEX_t i # @DuplicatedSignature + * cdef INDEX_t m = len(b) # @DuplicatedSignature */ __pyx_t_5.__pyx_n = 1; __pyx_t_5.recurse = 1; - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self->__pyx_base.parent->__pyx_vtab)->apply(__pyx_v_self->__pyx_base.parent, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_b), 0, &__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 473; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self->__pyx_base.parent->__pyx_vtab)->apply(__pyx_v_self->__pyx_base.parent, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_b), 0, &__pyx_t_5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L3; } __pyx_L3:; - /* "sklearn/earth/_basis.pyx":475 - * self.parent.apply(X,b,recurse=True) - * cdef INDEX_t i #@DuplicatedSignature - * cdef INDEX_t m = len(b) #@DuplicatedSignature # <<<<<<<<<<<<<< + /* "sklearn/earth/_basis.pyx":480 + * self.parent.apply(X, b, recurse=True) + * cdef INDEX_t i # @DuplicatedSignature + * cdef INDEX_t m = len(b) # @DuplicatedSignature # <<<<<<<<<<<<<< * for i in range(m): - * b[i] *= X[i,self.variable] + * b[i] *= X[i, self.variable] */ - __pyx_t_6 = PyObject_Length(((PyObject *)__pyx_v_b)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 475; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Length(((PyObject *)__pyx_v_b)); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_m = __pyx_t_6; - /* "sklearn/earth/_basis.pyx":476 - * cdef INDEX_t i #@DuplicatedSignature - * cdef INDEX_t m = len(b) #@DuplicatedSignature + /* "sklearn/earth/_basis.pyx":481 + * cdef INDEX_t i # @DuplicatedSignature + * cdef INDEX_t m = len(b) # @DuplicatedSignature * for i in range(m): # <<<<<<<<<<<<<< - * b[i] *= X[i,self.variable] + * b[i] *= X[i, self.variable] * */ __pyx_t_7 = __pyx_v_m; for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { __pyx_v_i = __pyx_t_8; - /* "sklearn/earth/_basis.pyx":477 - * cdef INDEX_t m = len(b) #@DuplicatedSignature + /* "sklearn/earth/_basis.pyx":482 + * cdef INDEX_t m = len(b) # @DuplicatedSignature * for i in range(m): - * b[i] *= X[i,self.variable] # <<<<<<<<<<<<<< + * b[i] *= X[i, self.variable] # <<<<<<<<<<<<<< * * cdef class Basis: */ @@ -11469,7 +11493,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_17apply( case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__b)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("apply", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("apply", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (kw_args > 0) { @@ -11478,7 +11502,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_17apply( } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else { switch (PyTuple_GET_SIZE(__pyx_args)) { @@ -11492,13 +11516,13 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_17apply( __pyx_v_X = ((PyArrayObject *)values[0]); __pyx_v_b = ((PyArrayObject *)values[1]); if (values[2]) { - __pyx_v_recurse = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_recurse == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_recurse = __Pyx_PyObject_IsTrue(values[2]); if (unlikely((__pyx_v_recurse == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - /* "sklearn/earth/_basis.pyx":465 + /* "sklearn/earth/_basis.pyx":470 * return self.variable * - * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = True): # <<<<<<<<<<<<<< + * cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse=True): # <<<<<<<<<<<<<< * ''' * X - Data matrix */ @@ -11507,14 +11531,14 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_19LinearBasisFunction_17apply( } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("apply", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("apply", 0, 2, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.earth._basis.LinearBasisFunction.apply", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_5numpy_ndarray, 1, "b", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_b), __pyx_ptype_5numpy_ndarray, 1, "b", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_16apply(((struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *)__pyx_v_self), __pyx_v_X, __pyx_v_b, __pyx_v_recurse); goto __pyx_L0; __pyx_L1_error:; @@ -11547,18 +11571,18 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_16apply( __pyx_pybuffernd_b.rcbuffer = &__pyx_pybuffer_b; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)__pyx_v_b, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)__pyx_v_b, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_b.diminfo[0].strides = __pyx_pybuffernd_b.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_b.diminfo[0].shape = __pyx_pybuffernd_b.rcbuffer->pybuffer.shape[0]; __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 1; __pyx_t_2.recurse = __pyx_v_recurse; - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_LinearBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.apply(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self), ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_b), 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 465; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_LinearBasisFunction *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.apply(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_self), ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_b), 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 470; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -11613,7 +11637,7 @@ static int __pyx_pw_7sklearn_5earth_6_basis_5Basis_1__init__(PyObject *__pyx_v_s else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; @@ -11624,7 +11648,7 @@ static int __pyx_pw_7sklearn_5earth_6_basis_5Basis_1__init__(PyObject *__pyx_v_s } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.earth._basis.Basis.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -11635,10 +11659,10 @@ static int __pyx_pw_7sklearn_5earth_6_basis_5Basis_1__init__(PyObject *__pyx_v_s return __pyx_r; } -/* "sklearn/earth/_basis.pyx":484 +/* "sklearn/earth/_basis.pyx":489 * added.''' * - * def __init__(Basis self, num_variables): #@DuplicatedSignature # <<<<<<<<<<<<<< + * def __init__(Basis self, num_variables): # @DuplicatedSignature # <<<<<<<<<<<<<< * self.order = [] * self.num_variables = num_variables */ @@ -11653,14 +11677,14 @@ static int __pyx_pf_7sklearn_5earth_6_basis_5Basis___init__(struct __pyx_obj_7sk int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "sklearn/earth/_basis.pyx":485 + /* "sklearn/earth/_basis.pyx":490 * - * def __init__(Basis self, num_variables): #@DuplicatedSignature + * def __init__(Basis self, num_variables): # @DuplicatedSignature * self.order = [] # <<<<<<<<<<<<<< * self.num_variables = num_variables * */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 485; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __Pyx_GOTREF(__pyx_v_self->order); @@ -11668,14 +11692,14 @@ static int __pyx_pf_7sklearn_5earth_6_basis_5Basis___init__(struct __pyx_obj_7sk __pyx_v_self->order = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_basis.pyx":486 - * def __init__(Basis self, num_variables): #@DuplicatedSignature + /* "sklearn/earth/_basis.pyx":491 + * def __init__(Basis self, num_variables): # @DuplicatedSignature * self.order = [] * self.num_variables = num_variables # <<<<<<<<<<<<<< * * def __reduce__(self): */ - __pyx_t_2 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_num_variables); if (unlikely((__pyx_t_2 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_num_variables); if (unlikely((__pyx_t_2 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_self->num_variables = __pyx_t_2; __pyx_r = 0; @@ -11700,7 +11724,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_3__reduce__(PyObject *_ return __pyx_r; } -/* "sklearn/earth/_basis.pyx":488 +/* "sklearn/earth/_basis.pyx":493 * self.num_variables = num_variables * * def __reduce__(self): # <<<<<<<<<<<<<< @@ -11720,7 +11744,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_2__reduce__(struct __py int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce__", 0); - /* "sklearn/earth/_basis.pyx":489 + /* "sklearn/earth/_basis.pyx":494 * * def __reduce__(self): * return (self.__class__, (self.num_variables,), self._getstate()) # <<<<<<<<<<<<<< @@ -11728,21 +11752,21 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_2__reduce__(struct __py * def _getstate(self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->num_variables); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->num_variables); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); @@ -11783,7 +11807,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_5_getstate(PyObject *__ return __pyx_r; } -/* "sklearn/earth/_basis.pyx":491 +/* "sklearn/earth/_basis.pyx":496 * return (self.__class__, (self.num_variables,), self._getstate()) * * def _getstate(self): # <<<<<<<<<<<<<< @@ -11800,7 +11824,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_4_getstate(struct __pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_getstate", 0); - /* "sklearn/earth/_basis.pyx":492 + /* "sklearn/earth/_basis.pyx":497 * * def _getstate(self): * return {'order': self.order} # <<<<<<<<<<<<<< @@ -11808,9 +11832,9 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_4_getstate(struct __pyx * def __setstate__(self, state): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_v_self->order)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_v_self->order)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; @@ -11838,7 +11862,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_7__setstate__(PyObject return __pyx_r; } -/* "sklearn/earth/_basis.pyx":494 +/* "sklearn/earth/_basis.pyx":499 * return {'order': self.order} * * def __setstate__(self, state): # <<<<<<<<<<<<<< @@ -11855,16 +11879,16 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_6__setstate__(struct __ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate__", 0); - /* "sklearn/earth/_basis.pyx":495 + /* "sklearn/earth/_basis.pyx":500 * * def __setstate__(self, state): * self.order = state['order'] # <<<<<<<<<<<<<< * * def __richcmp__(self, other, method): */ - __pyx_t_1 = PyObject_GetItem(__pyx_v_state, ((PyObject *)__pyx_n_s__order)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(__pyx_v_state, ((PyObject *)__pyx_n_s__order)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->order); __Pyx_DECREF(((PyObject *)__pyx_v_self->order)); @@ -11893,7 +11917,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_9__richcmp__(PyObject * PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0); - __pyx_v_method = PyInt_FromLong(__pyx_arg_method); if (unlikely(!__pyx_v_method)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_method = PyInt_FromLong(__pyx_arg_method); if (unlikely(!__pyx_v_method)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __Pyx_GOTREF(__pyx_v_method); goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -11907,7 +11931,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_9__richcmp__(PyObject * return __pyx_r; } -/* "sklearn/earth/_basis.pyx":497 +/* "sklearn/earth/_basis.pyx":502 * self.order = state['order'] * * def __richcmp__(self, other, method): # <<<<<<<<<<<<<< @@ -11927,19 +11951,19 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_8__richcmp__(PyObject * int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__richcmp__", 0); - /* "sklearn/earth/_basis.pyx":498 + /* "sklearn/earth/_basis.pyx":503 * * def __richcmp__(self, other, method): * if method == 2: # <<<<<<<<<<<<<< * return self._eq(other) * elif method == 3: */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_method, __pyx_int_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_v_method, __pyx_int_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "sklearn/earth/_basis.pyx":499 + /* "sklearn/earth/_basis.pyx":504 * def __richcmp__(self, other, method): * if method == 2: * return self._eq(other) # <<<<<<<<<<<<<< @@ -11947,14 +11971,14 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_8__richcmp__(PyObject * * return not self._eq(other) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s___eq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s___eq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_other); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_other); __Pyx_GIVEREF(__pyx_v_other); - __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; @@ -11964,19 +11988,19 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_8__richcmp__(PyObject * goto __pyx_L3; } - /* "sklearn/earth/_basis.pyx":500 + /* "sklearn/earth/_basis.pyx":505 * if method == 2: * return self._eq(other) * elif method == 3: # <<<<<<<<<<<<<< * return not self._eq(other) * else: */ - __pyx_t_4 = PyObject_RichCompare(__pyx_v_method, __pyx_int_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_RichCompare(__pyx_v_method, __pyx_int_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_2) { - /* "sklearn/earth/_basis.pyx":501 + /* "sklearn/earth/_basis.pyx":506 * return self._eq(other) * elif method == 3: * return not self._eq(other) # <<<<<<<<<<<<<< @@ -11984,20 +12008,20 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_8__richcmp__(PyObject * * return NotImplemented */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s___eq); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s___eq); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_other); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_other); __Pyx_GIVEREF(__pyx_v_other); - __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyBool_FromLong((!__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 501; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong((!__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -12006,7 +12030,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_8__richcmp__(PyObject * } /*else*/ { - /* "sklearn/earth/_basis.pyx":503 + /* "sklearn/earth/_basis.pyx":508 * return not self._eq(other) * else: * return NotImplemented # <<<<<<<<<<<<<< @@ -12045,7 +12069,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_11_eq(PyObject *__pyx_v return __pyx_r; } -/* "sklearn/earth/_basis.pyx":505 +/* "sklearn/earth/_basis.pyx":510 * return NotImplemented * * def _eq(self, other): # <<<<<<<<<<<<<< @@ -12066,7 +12090,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_10_eq(struct __pyx_obj_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_eq", 0); - /* "sklearn/earth/_basis.pyx":506 + /* "sklearn/earth/_basis.pyx":511 * * def _eq(self, other): * return self.__class__ is other.__class__ and self._getstate() == other._getstate() # <<<<<<<<<<<<<< @@ -12074,29 +12098,29 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_10_eq(struct __pyx_obj_ * def piter(Basis self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = (__pyx_t_1 == __pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_3) { __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __pyx_t_1; @@ -12136,7 +12160,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_13piter(PyObject *__pyx return __pyx_r; } -/* "sklearn/earth/_basis.pyx":508 +/* "sklearn/earth/_basis.pyx":513 * return self.__class__ is other.__class__ and self._getstate() == other._getstate() * * def piter(Basis self): # <<<<<<<<<<<<<< @@ -12162,7 +12186,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_12piter(struct __pyx_ob __Pyx_INCREF((PyObject *)__pyx_cur_scope->__pyx_v_self); __Pyx_GIVEREF((PyObject *)__pyx_cur_scope->__pyx_v_self); { - __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_7sklearn_5earth_6_basis_5Basis_14generator, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_GeneratorObject *gen = __Pyx_Generator_New((__pyx_generator_body_t) __pyx_gb_7sklearn_5earth_6_basis_5Basis_14generator, (PyObject *) __pyx_cur_scope); if (unlikely(!gen)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_cur_scope); __Pyx_RefNannyFinishContext(); return (PyObject *) gen; @@ -12203,9 +12227,9 @@ static PyObject *__pyx_gb_7sklearn_5earth_6_basis_5Basis_14generator(__pyx_Gener return NULL; } __pyx_L3_first_run:; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/earth/_basis.pyx":509 + /* "sklearn/earth/_basis.pyx":514 * * def piter(Basis self): * for bf in self.order: # <<<<<<<<<<<<<< @@ -12214,15 +12238,15 @@ static PyObject *__pyx_gb_7sklearn_5earth_6_basis_5Basis_14generator(__pyx_Gener */ if (unlikely(((PyObject *)__pyx_cur_scope->__pyx_v_self->order) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_1 = ((PyObject *)__pyx_cur_scope->__pyx_v_self->order); __Pyx_INCREF(__pyx_t_1); __pyx_t_2 = 0; for (;;) { if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_2); __Pyx_INCREF(__pyx_t_3); __pyx_t_2++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_bf); __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_bf); @@ -12230,24 +12254,24 @@ static PyObject *__pyx_gb_7sklearn_5earth_6_basis_5Basis_14generator(__pyx_Gener __pyx_cur_scope->__pyx_v_bf = __pyx_t_3; __pyx_t_3 = 0; - /* "sklearn/earth/_basis.pyx":510 + /* "sklearn/earth/_basis.pyx":515 * def piter(Basis self): * for bf in self.order: * if not bf.is_pruned(): # <<<<<<<<<<<<<< * yield bf * */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_bf, __pyx_n_s__is_pruned); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_cur_scope->__pyx_v_bf, __pyx_n_s__is_pruned); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 510; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_6 = ((!__pyx_t_5) != 0); if (__pyx_t_6) { - /* "sklearn/earth/_basis.pyx":511 + /* "sklearn/earth/_basis.pyx":516 * for bf in self.order: * if not bf.is_pruned(): * yield bf # <<<<<<<<<<<<<< @@ -12269,7 +12293,7 @@ static PyObject *__pyx_gb_7sklearn_5earth_6_basis_5Basis_14generator(__pyx_Gener __pyx_cur_scope->__pyx_t_0 = 0; __Pyx_XGOTREF(__pyx_t_1); __pyx_t_2 = __pyx_cur_scope->__pyx_t_1; - if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_sent_value)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; @@ -12301,7 +12325,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_16__str__(PyObject *__p return __pyx_r; } -/* "sklearn/earth/_basis.pyx":513 +/* "sklearn/earth/_basis.pyx":518 * yield bf * * def __str__(Basis self): # <<<<<<<<<<<<<< @@ -12325,17 +12349,17 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_15__str__(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - /* "sklearn/earth/_basis.pyx":515 + /* "sklearn/earth/_basis.pyx":520 * def __str__(Basis self): * cdef INDEX_t i * cdef INDEX_t n = len(self) # <<<<<<<<<<<<<< * result = '' * for i in range(n): */ - __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 515; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 520; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_n = __pyx_t_1; - /* "sklearn/earth/_basis.pyx":516 + /* "sklearn/earth/_basis.pyx":521 * cdef INDEX_t i * cdef INDEX_t n = len(self) * result = '' # <<<<<<<<<<<<<< @@ -12345,7 +12369,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_15__str__(struct __pyx_ __Pyx_INCREF(((PyObject *)__pyx_kp_s_2)); __pyx_v_result = ((PyObject *)__pyx_kp_s_2); - /* "sklearn/earth/_basis.pyx":517 + /* "sklearn/earth/_basis.pyx":522 * cdef INDEX_t n = len(self) * result = '' * for i in range(n): # <<<<<<<<<<<<<< @@ -12356,50 +12380,50 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_15__str__(struct __pyx_ for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { __pyx_v_i = __pyx_t_3; - /* "sklearn/earth/_basis.pyx":518 + /* "sklearn/earth/_basis.pyx":523 * result = '' * for i in range(n): * result += str(self[i]) # <<<<<<<<<<<<<< * result += '\n' * return result */ - __pyx_t_4 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self), __pyx_v_i, sizeof(__pyx_t_7sklearn_5earth_6_basis_INDEX_t)+1, __Pyx_PyInt_to_py_npy_ulonglong, 0, 0, 0); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self), __pyx_v_i, sizeof(__pyx_t_7sklearn_5earth_6_basis_INDEX_t)+1, __Pyx_PyInt_to_py_npy_ulonglong, 0, 0, 0); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_result, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_result, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_v_result); __pyx_v_result = __pyx_t_5; __pyx_t_5 = 0; - /* "sklearn/earth/_basis.pyx":519 + /* "sklearn/earth/_basis.pyx":524 * for i in range(n): * result += str(self[i]) * result += '\n' # <<<<<<<<<<<<<< * return result * */ - __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_8)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 519; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_8)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_v_result); __pyx_v_result = __pyx_t_5; __pyx_t_5 = 0; } - /* "sklearn/earth/_basis.pyx":520 + /* "sklearn/earth/_basis.pyx":525 * result += str(self[i]) * result += '\n' * return result # <<<<<<<<<<<<<< * - * cpdef translate(Basis self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): + * cpdef translate(Basis self, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts): */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_result); @@ -12420,12 +12444,12 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_15__str__(struct __pyx_ return __pyx_r; } -/* "sklearn/earth/_basis.pyx":522 +/* "sklearn/earth/_basis.pyx":527 * return result * - * cpdef translate(Basis self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): # <<<<<<<<<<<<<< + * cpdef translate(Basis self, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts): # <<<<<<<<<<<<<< * cdef INDEX_t n = len(self) - * cdef INDEX_t i #@DuplicatedSignature + * cdef INDEX_t i # @DuplicatedSignature */ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_18translate(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ @@ -12458,23 +12482,23 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_translate(struct __pyx_o __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__translate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__translate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_5Basis_18translate)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_slopes)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_slopes)); @@ -12482,7 +12506,7 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_translate(struct __pyx_o __Pyx_INCREF(((PyObject *)__pyx_v_intercepts)); PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_intercepts)); __Pyx_GIVEREF(((PyObject *)__pyx_v_intercepts)); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; @@ -12493,43 +12517,43 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_translate(struct __pyx_o __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_basis.pyx":523 + /* "sklearn/earth/_basis.pyx":528 * - * cpdef translate(Basis self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): + * cpdef translate(Basis self, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts): * cdef INDEX_t n = len(self) # <<<<<<<<<<<<<< - * cdef INDEX_t i #@DuplicatedSignature + * cdef INDEX_t i # @DuplicatedSignature * for i in range(n): */ - __pyx_t_4 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_n = __pyx_t_4; - /* "sklearn/earth/_basis.pyx":525 + /* "sklearn/earth/_basis.pyx":530 * cdef INDEX_t n = len(self) - * cdef INDEX_t i #@DuplicatedSignature + * cdef INDEX_t i # @DuplicatedSignature * for i in range(n): # <<<<<<<<<<<<<< - * self.order[i].translate(slopes,intercepts,False) + * self.order[i].translate(slopes, intercepts, False) * */ __pyx_t_5 = __pyx_v_n; for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "sklearn/earth/_basis.pyx":526 - * cdef INDEX_t i #@DuplicatedSignature + /* "sklearn/earth/_basis.pyx":531 + * cdef INDEX_t i # @DuplicatedSignature * for i in range(n): - * self.order[i].translate(slopes,intercepts,False) # <<<<<<<<<<<<<< + * self.order[i].translate(slopes, intercepts, False) # <<<<<<<<<<<<<< * - * cpdef scale(Basis self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, cnp.ndarray[FLOAT_t,ndim=1] beta): + * cpdef scale(Basis self, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts, cnp.ndarray[FLOAT_t, ndim=1] beta): */ if (unlikely(((PyObject *)__pyx_v_self->order) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i), __pyx_n_s__translate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i), __pyx_n_s__translate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_slopes)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_slopes)); @@ -12540,7 +12564,7 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_translate(struct __pyx_o PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 526; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; @@ -12601,11 +12625,11 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_18translate(PyObject *_ case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__intercepts)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("translate", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("translate", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "translate") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "translate") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -12618,14 +12642,14 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_18translate(PyObject *_ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("translate", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("translate", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.earth._basis.Basis.translate", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_slopes), __pyx_ptype_5numpy_ndarray, 1, "slopes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercepts), __pyx_ptype_5numpy_ndarray, 1, "intercepts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_slopes), __pyx_ptype_5numpy_ndarray, 1, "slopes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercepts), __pyx_ptype_5numpy_ndarray, 1, "intercepts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_5Basis_17translate(((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)__pyx_v_self), __pyx_v_slopes, __pyx_v_intercepts); goto __pyx_L0; __pyx_L1_error:; @@ -12635,12 +12659,12 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_18translate(PyObject *_ return __pyx_r; } -/* "sklearn/earth/_basis.pyx":522 +/* "sklearn/earth/_basis.pyx":527 * return result * - * cpdef translate(Basis self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): # <<<<<<<<<<<<<< + * cpdef translate(Basis self, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts): # <<<<<<<<<<<<<< * cdef INDEX_t n = len(self) - * cdef INDEX_t i #@DuplicatedSignature + * cdef INDEX_t i # @DuplicatedSignature */ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_17translate(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts) { @@ -12665,16 +12689,16 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_17translate(struct __py __pyx_pybuffernd_intercepts.rcbuffer = &__pyx_pybuffer_intercepts; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->translate(__pyx_v_self, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->translate(__pyx_v_self, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -12701,12 +12725,12 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_17translate(struct __py return __pyx_r; } -/* "sklearn/earth/_basis.pyx":528 - * self.order[i].translate(slopes,intercepts,False) +/* "sklearn/earth/_basis.pyx":533 + * self.order[i].translate(slopes, intercepts, False) * - * cpdef scale(Basis self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, cnp.ndarray[FLOAT_t,ndim=1] beta): # <<<<<<<<<<<<<< - * cdef INDEX_t n = len(self) #@DuplicatedSignature - * cdef INDEX_t i #@DuplicatedSignature + * cpdef scale(Basis self, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts, cnp.ndarray[FLOAT_t, ndim=1] beta): # <<<<<<<<<<<<<< + * cdef INDEX_t n = len(self) # @DuplicatedSignature + * cdef INDEX_t i # @DuplicatedSignature */ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_20scale(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ @@ -12749,28 +12773,28 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_scale(struct __pyx_obj_7 __pyx_pybuffernd_beta.rcbuffer = &__pyx_pybuffer_beta; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_beta.rcbuffer->pybuffer, (PyObject*)__pyx_v_beta, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_beta.rcbuffer->pybuffer, (PyObject*)__pyx_v_beta, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_beta.diminfo[0].strides = __pyx_pybuffernd_beta.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_beta.diminfo[0].shape = __pyx_pybuffernd_beta.rcbuffer->pybuffer.shape[0]; /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__scale); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__scale); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_5Basis_20scale)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_slopes)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_slopes)); @@ -12781,7 +12805,7 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_scale(struct __pyx_obj_7 __Pyx_INCREF(((PyObject *)__pyx_v_beta)); PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_beta)); __Pyx_GIVEREF(((PyObject *)__pyx_v_beta)); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; @@ -12792,27 +12816,27 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_scale(struct __pyx_obj_7 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_basis.pyx":529 + /* "sklearn/earth/_basis.pyx":534 * - * cpdef scale(Basis self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, cnp.ndarray[FLOAT_t,ndim=1] beta): - * cdef INDEX_t n = len(self) #@DuplicatedSignature # <<<<<<<<<<<<<< - * cdef INDEX_t i #@DuplicatedSignature + * cpdef scale(Basis self, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts, cnp.ndarray[FLOAT_t, ndim=1] beta): + * cdef INDEX_t n = len(self) # @DuplicatedSignature # <<<<<<<<<<<<<< + * cdef INDEX_t i # @DuplicatedSignature * cdef INDEX_t j = 0 */ - __pyx_t_4 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Length(((PyObject *)__pyx_v_self)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_n = __pyx_t_4; - /* "sklearn/earth/_basis.pyx":531 - * cdef INDEX_t n = len(self) #@DuplicatedSignature - * cdef INDEX_t i #@DuplicatedSignature + /* "sklearn/earth/_basis.pyx":536 + * cdef INDEX_t n = len(self) # @DuplicatedSignature + * cdef INDEX_t i # @DuplicatedSignature * cdef INDEX_t j = 0 # <<<<<<<<<<<<<< * for i in range(n): * if self.order[i].is_pruned(): */ __pyx_v_j = 0; - /* "sklearn/earth/_basis.pyx":532 - * cdef INDEX_t i #@DuplicatedSignature + /* "sklearn/earth/_basis.pyx":537 + * cdef INDEX_t i # @DuplicatedSignature * cdef INDEX_t j = 0 * for i in range(n): # <<<<<<<<<<<<<< * if self.order[i].is_pruned(): @@ -12822,31 +12846,31 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_scale(struct __pyx_obj_7 for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "sklearn/earth/_basis.pyx":533 + /* "sklearn/earth/_basis.pyx":538 * cdef INDEX_t j = 0 * for i in range(n): * if self.order[i].is_pruned(): # <<<<<<<<<<<<<< * continue - * beta[j] *= self.order[i].scale(slopes,intercepts) + * beta[j] *= self.order[i].scale(slopes, intercepts) */ if (unlikely(((PyObject *)__pyx_v_self->order) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i), __pyx_n_s__is_pruned); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i), __pyx_n_s__is_pruned); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_7) { - /* "sklearn/earth/_basis.pyx":534 + /* "sklearn/earth/_basis.pyx":539 * for i in range(n): * if self.order[i].is_pruned(): * continue # <<<<<<<<<<<<<< - * beta[j] *= self.order[i].scale(slopes,intercepts) + * beta[j] *= self.order[i].scale(slopes, intercepts) * j += 1 */ goto __pyx_L3_continue; @@ -12854,20 +12878,20 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_scale(struct __pyx_obj_7 } __pyx_L5:; - /* "sklearn/earth/_basis.pyx":535 + /* "sklearn/earth/_basis.pyx":540 * if self.order[i].is_pruned(): * continue - * beta[j] *= self.order[i].scale(slopes,intercepts) # <<<<<<<<<<<<<< + * beta[j] *= self.order[i].scale(slopes, intercepts) # <<<<<<<<<<<<<< * j += 1 * */ if (unlikely(((PyObject *)__pyx_v_self->order) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i), __pyx_n_s__scale); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i), __pyx_n_s__scale); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_slopes)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_slopes)); @@ -12875,18 +12899,18 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_scale(struct __pyx_obj_7 __Pyx_INCREF(((PyObject *)__pyx_v_intercepts)); PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_intercepts)); __Pyx_GIVEREF(((PyObject *)__pyx_v_intercepts)); - __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_8 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 535; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_8 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 540; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_9 = __pyx_v_j; *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_6_basis_FLOAT_t *, __pyx_pybuffernd_beta.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_beta.diminfo[0].strides) *= __pyx_t_8; - /* "sklearn/earth/_basis.pyx":536 + /* "sklearn/earth/_basis.pyx":541 * continue - * beta[j] *= self.order[i].scale(slopes,intercepts) + * beta[j] *= self.order[i].scale(slopes, intercepts) * j += 1 # <<<<<<<<<<<<<< * * cpdef BasisFunction get_root(Basis self): @@ -12953,16 +12977,16 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_20scale(PyObject *__pyx case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__intercepts)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("scale", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("scale", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__beta)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("scale", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("scale", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scale") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "scale") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -12977,15 +13001,15 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_20scale(PyObject *__pyx } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("scale", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("scale", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.earth._basis.Basis.scale", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_slopes), __pyx_ptype_5numpy_ndarray, 1, "slopes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercepts), __pyx_ptype_5numpy_ndarray, 1, "intercepts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_beta), __pyx_ptype_5numpy_ndarray, 1, "beta", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_slopes), __pyx_ptype_5numpy_ndarray, 1, "slopes", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_intercepts), __pyx_ptype_5numpy_ndarray, 1, "intercepts", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_beta), __pyx_ptype_5numpy_ndarray, 1, "beta", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_5Basis_19scale(((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)__pyx_v_self), __pyx_v_slopes, __pyx_v_intercepts, __pyx_v_beta); goto __pyx_L0; __pyx_L1_error:; @@ -12995,12 +13019,12 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_20scale(PyObject *__pyx return __pyx_r; } -/* "sklearn/earth/_basis.pyx":528 - * self.order[i].translate(slopes,intercepts,False) +/* "sklearn/earth/_basis.pyx":533 + * self.order[i].translate(slopes, intercepts, False) * - * cpdef scale(Basis self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, cnp.ndarray[FLOAT_t,ndim=1] beta): # <<<<<<<<<<<<<< - * cdef INDEX_t n = len(self) #@DuplicatedSignature - * cdef INDEX_t i #@DuplicatedSignature + * cpdef scale(Basis self, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts, cnp.ndarray[FLOAT_t, ndim=1] beta): # <<<<<<<<<<<<<< + * cdef INDEX_t n = len(self) # @DuplicatedSignature + * cdef INDEX_t i # @DuplicatedSignature */ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_19scale(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self, PyArrayObject *__pyx_v_slopes, PyArrayObject *__pyx_v_intercepts, PyArrayObject *__pyx_v_beta) { @@ -13031,21 +13055,21 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_19scale(struct __pyx_ob __pyx_pybuffernd_beta.rcbuffer = &__pyx_pybuffer_beta; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_slopes.rcbuffer->pybuffer, (PyObject*)__pyx_v_slopes, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_slopes.diminfo[0].strides = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_slopes.diminfo[0].shape = __pyx_pybuffernd_slopes.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_intercepts.rcbuffer->pybuffer, (PyObject*)__pyx_v_intercepts, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_intercepts.diminfo[0].strides = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_intercepts.diminfo[0].shape = __pyx_pybuffernd_intercepts.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_beta.rcbuffer->pybuffer, (PyObject*)__pyx_v_beta, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_beta.rcbuffer->pybuffer, (PyObject*)__pyx_v_beta, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_beta.diminfo[0].strides = __pyx_pybuffernd_beta.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_beta.diminfo[0].shape = __pyx_pybuffernd_beta.rcbuffer->pybuffer.shape[0]; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->scale(__pyx_v_self, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), ((PyArrayObject *)__pyx_v_beta), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 528; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->scale(__pyx_v_self, ((PyArrayObject *)__pyx_v_slopes), ((PyArrayObject *)__pyx_v_intercepts), ((PyArrayObject *)__pyx_v_beta), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -13074,7 +13098,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_19scale(struct __pyx_ob return __pyx_r; } -/* "sklearn/earth/_basis.pyx":538 +/* "sklearn/earth/_basis.pyx":543 * j += 1 * * cpdef BasisFunction get_root(Basis self): # <<<<<<<<<<<<<< @@ -13096,13 +13120,13 @@ static struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_f_7sklearn_ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_root); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_root); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_5Basis_22get_root)) { __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -13111,7 +13135,7 @@ static struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_f_7sklearn_ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_basis.pyx":539 + /* "sklearn/earth/_basis.pyx":544 * * cpdef BasisFunction get_root(Basis self): * return self.root # <<<<<<<<<<<<<< @@ -13119,9 +13143,9 @@ static struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_f_7sklearn_ * cpdef append(Basis self, BasisFunction basis_function): */ __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__root); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__root); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 544; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; @@ -13150,7 +13174,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_22get_root(PyObject *__ return __pyx_r; } -/* "sklearn/earth/_basis.pyx":538 +/* "sklearn/earth/_basis.pyx":543 * j += 1 * * cpdef BasisFunction get_root(Basis self): # <<<<<<<<<<<<<< @@ -13167,7 +13191,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_21get_root(struct __pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_root", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->get_root(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->get_root(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 543; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -13185,7 +13209,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_21get_root(struct __pyx return __pyx_r; } -/* "sklearn/earth/_basis.pyx":541 +/* "sklearn/earth/_basis.pyx":546 * return self.root * * cpdef append(Basis self, BasisFunction basis_function): # <<<<<<<<<<<<<< @@ -13209,16 +13233,16 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_append(struct __pyx_obj_ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__append); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__append); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_5Basis_24append)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_basis_function)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_basis_function)); __Pyx_GIVEREF(((PyObject *)__pyx_v_basis_function)); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; @@ -13229,7 +13253,7 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_append(struct __pyx_obj_ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_basis.pyx":542 + /* "sklearn/earth/_basis.pyx":547 * * cpdef append(Basis self, BasisFunction basis_function): * self.order.append(basis_function) # <<<<<<<<<<<<<< @@ -13238,9 +13262,9 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_append(struct __pyx_obj_ */ if (unlikely(((PyObject *)__pyx_v_self->order) == Py_None)) { PyErr_Format(PyExc_AttributeError, "'NoneType' object has no attribute '%s'", "append"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_self->order, ((PyObject *)__pyx_v_basis_function)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 542; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyList_Append(__pyx_v_self->order, ((PyObject *)__pyx_v_basis_function)); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 547; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; @@ -13265,7 +13289,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_24append(PyObject *__py PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("append (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_basis_function), __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction, 1, "basis_function", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_basis_function), __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction, 1, "basis_function", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_5Basis_23append(((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)__pyx_v_self), ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_basis_function)); goto __pyx_L0; __pyx_L1_error:; @@ -13275,7 +13299,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_24append(PyObject *__py return __pyx_r; } -/* "sklearn/earth/_basis.pyx":541 +/* "sklearn/earth/_basis.pyx":546 * return self.root * * cpdef append(Basis self, BasisFunction basis_function): # <<<<<<<<<<<<<< @@ -13292,7 +13316,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_23append(struct __pyx_o int __pyx_clineno = 0; __Pyx_RefNannySetupContext("append", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->append(__pyx_v_self, __pyx_v_basis_function, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 541; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->append(__pyx_v_self, __pyx_v_basis_function, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 546; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -13321,7 +13345,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_26__iter__(PyObject *__ return __pyx_r; } -/* "sklearn/earth/_basis.pyx":544 +/* "sklearn/earth/_basis.pyx":549 * self.order.append(basis_function) * * def __iter__(Basis self): # <<<<<<<<<<<<<< @@ -13339,7 +13363,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_25__iter__(struct __pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__iter__", 0); - /* "sklearn/earth/_basis.pyx":545 + /* "sklearn/earth/_basis.pyx":550 * * def __iter__(Basis self): * return self.order.__iter__() # <<<<<<<<<<<<<< @@ -13347,9 +13371,9 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_25__iter__(struct __pyx * def __len__(Basis self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->order), __pyx_n_s____iter__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->order), __pyx_n_s____iter__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = __pyx_t_2; @@ -13380,7 +13404,7 @@ static Py_ssize_t __pyx_pw_7sklearn_5earth_6_basis_5Basis_28__len__(PyObject *__ return __pyx_r; } -/* "sklearn/earth/_basis.pyx":547 +/* "sklearn/earth/_basis.pyx":552 * return self.order.__iter__() * * def __len__(Basis self): # <<<<<<<<<<<<<< @@ -13399,19 +13423,19 @@ static Py_ssize_t __pyx_pf_7sklearn_5earth_6_basis_5Basis_27__len__(struct __pyx int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__len__", 0); - /* "sklearn/earth/_basis.pyx":548 + /* "sklearn/earth/_basis.pyx":553 * * def __len__(Basis self): * return self.order.__len__() # <<<<<<<<<<<<<< * * cpdef BasisFunction get(Basis self, INDEX_t i): */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->order), __pyx_n_s____len__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->order), __pyx_n_s____len__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_3 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 548; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyIndex_AsSsize_t(__pyx_t_2); if (unlikely((__pyx_t_3 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; goto __pyx_L0; @@ -13428,7 +13452,7 @@ static Py_ssize_t __pyx_pf_7sklearn_5earth_6_basis_5Basis_27__len__(struct __pyx return __pyx_r; } -/* "sklearn/earth/_basis.pyx":550 +/* "sklearn/earth/_basis.pyx":555 * return self.order.__len__() * * cpdef BasisFunction get(Basis self, INDEX_t i): # <<<<<<<<<<<<<< @@ -13451,21 +13475,21 @@ static struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_f_7sklearn_ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_5Basis_30get)) { __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -13474,7 +13498,7 @@ static struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_f_7sklearn_ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_basis.pyx":551 + /* "sklearn/earth/_basis.pyx":556 * * cpdef BasisFunction get(Basis self, INDEX_t i): * return self.order[i] # <<<<<<<<<<<<<< @@ -13484,9 +13508,9 @@ static struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *__pyx_f_7sklearn_ __Pyx_XDECREF(((PyObject *)__pyx_r)); if (unlikely(((PyObject *)__pyx_v_self->order) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - if (!(likely(((PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i)) == Py_None) || likely(__Pyx_TypeTest(PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i), __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 551; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i)) == Py_None) || likely(__Pyx_TypeTest(PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i), __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_INCREF(PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i)); __pyx_r = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i)); goto __pyx_L0; @@ -13516,7 +13540,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_30get(PyObject *__pyx_v __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get (wrapper)", 0); assert(__pyx_arg_i); { - __pyx_v_i = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_arg_i); if (unlikely((__pyx_v_i == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_i = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_arg_i); if (unlikely((__pyx_v_i == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -13529,7 +13553,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_30get(PyObject *__pyx_v return __pyx_r; } -/* "sklearn/earth/_basis.pyx":550 +/* "sklearn/earth/_basis.pyx":555 * return self.order.__len__() * * cpdef BasisFunction get(Basis self, INDEX_t i): # <<<<<<<<<<<<<< @@ -13546,7 +13570,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_29get(struct __pyx_obj_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->get(__pyx_v_self, __pyx_v_i, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 550; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->get(__pyx_v_self, __pyx_v_i, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 555; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -13575,7 +13599,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_32__getitem__(PyObject __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__getitem__ (wrapper)", 0); assert(__pyx_arg_i); { - __pyx_v_i = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_arg_i); if (unlikely((__pyx_v_i == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 553; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_i = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_arg_i); if (unlikely((__pyx_v_i == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -13588,7 +13612,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_32__getitem__(PyObject return __pyx_r; } -/* "sklearn/earth/_basis.pyx":553 +/* "sklearn/earth/_basis.pyx":558 * return self.order[i] * * def __getitem__(Basis self, INDEX_t i): # <<<<<<<<<<<<<< @@ -13605,7 +13629,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_31__getitem__(struct __ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__getitem__", 0); - /* "sklearn/earth/_basis.pyx":554 + /* "sklearn/earth/_basis.pyx":559 * * def __getitem__(Basis self, INDEX_t i): * return self.get(i) # <<<<<<<<<<<<<< @@ -13613,7 +13637,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_31__getitem__(struct __ * cpdef INDEX_t plen(Basis self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->get(__pyx_v_self, __pyx_v_i, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 554; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->get(__pyx_v_self, __pyx_v_i, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -13631,7 +13655,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_31__getitem__(struct __ return __pyx_r; } -/* "sklearn/earth/_basis.pyx":556 +/* "sklearn/earth/_basis.pyx":561 * return self.get(i) * * cpdef INDEX_t plen(Basis self): # <<<<<<<<<<<<<< @@ -13661,12 +13685,12 @@ static __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_f_7sklearn_5earth_6_basis_5 if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__plen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__plen); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_5Basis_34plen)) { - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -13675,7 +13699,7 @@ static __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_f_7sklearn_5earth_6_basis_5 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_basis.pyx":557 + /* "sklearn/earth/_basis.pyx":562 * * cpdef INDEX_t plen(Basis self): * cdef INDEX_t length = 0 # <<<<<<<<<<<<<< @@ -13684,7 +13708,7 @@ static __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_f_7sklearn_5earth_6_basis_5 */ __pyx_v_length = 0; - /* "sklearn/earth/_basis.pyx":559 + /* "sklearn/earth/_basis.pyx":564 * cdef INDEX_t length = 0 * cdef INDEX_t i * cdef INDEX_t n = len(self.order) # <<<<<<<<<<<<<< @@ -13695,13 +13719,13 @@ static __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_f_7sklearn_5earth_6_basis_5 __Pyx_INCREF(__pyx_t_1); if (unlikely(__pyx_t_1 == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_4 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_n = __pyx_t_4; - /* "sklearn/earth/_basis.pyx":560 + /* "sklearn/earth/_basis.pyx":565 * cdef INDEX_t i * cdef INDEX_t n = len(self.order) * for i in range(n): # <<<<<<<<<<<<<< @@ -13712,7 +13736,7 @@ static __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_f_7sklearn_5earth_6_basis_5 for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_3; __pyx_t_5+=1) { __pyx_v_i = __pyx_t_5; - /* "sklearn/earth/_basis.pyx":561 + /* "sklearn/earth/_basis.pyx":566 * cdef INDEX_t n = len(self.order) * for i in range(n): * if not self.order[i].is_pruned(): # <<<<<<<<<<<<<< @@ -13721,19 +13745,19 @@ static __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_f_7sklearn_5earth_6_basis_5 */ if (unlikely(((PyObject *)__pyx_v_self->order) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i), __pyx_n_s__is_pruned); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i), __pyx_n_s__is_pruned); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_7 = ((!__pyx_t_6) != 0); if (__pyx_t_7) { - /* "sklearn/earth/_basis.pyx":562 + /* "sklearn/earth/_basis.pyx":567 * for i in range(n): * if not self.order[i].is_pruned(): * length += 1 # <<<<<<<<<<<<<< @@ -13746,12 +13770,12 @@ static __pyx_t_7sklearn_5earth_6_basis_INDEX_t __pyx_f_7sklearn_5earth_6_basis_5 __pyx_L5:; } - /* "sklearn/earth/_basis.pyx":563 + /* "sklearn/earth/_basis.pyx":568 * if not self.order[i].is_pruned(): * length += 1 * return length # <<<<<<<<<<<<<< * - * cpdef transform(Basis self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=2] B): + * cpdef transform(Basis self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=2] B): */ __pyx_r = __pyx_v_length; goto __pyx_L0; @@ -13779,7 +13803,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_34plen(PyObject *__pyx_ return __pyx_r; } -/* "sklearn/earth/_basis.pyx":556 +/* "sklearn/earth/_basis.pyx":561 * return self.get(i) * * cpdef INDEX_t plen(Basis self): # <<<<<<<<<<<<<< @@ -13796,7 +13820,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_33plen(struct __pyx_obj int __pyx_clineno = 0; __Pyx_RefNannySetupContext("plen", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->plen(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 556; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->plen(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -13814,11 +13838,11 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_33plen(struct __pyx_obj return __pyx_r; } -/* "sklearn/earth/_basis.pyx":565 +/* "sklearn/earth/_basis.pyx":570 * return length * - * cpdef transform(Basis self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=2] B): # <<<<<<<<<<<<<< - * cdef INDEX_t i #@DuplicatedSignature + * cpdef transform(Basis self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=2] B): # <<<<<<<<<<<<<< + * cdef INDEX_t i # @DuplicatedSignature * cdef INDEX_t n = self.__len__() */ @@ -13855,23 +13879,23 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_transform(struct __pyx_o __pyx_pybuffernd_B.rcbuffer = &__pyx_pybuffer_B; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_v_B, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_v_B, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_B.diminfo[0].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B.diminfo[0].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B.diminfo[1].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B.diminfo[1].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[1]; /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__transform); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__transform); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_5Basis_36transform)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_X)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_X)); @@ -13879,7 +13903,7 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_transform(struct __pyx_o __Pyx_INCREF(((PyObject *)__pyx_v_B)); PyTuple_SET_ITEM(__pyx_t_2, 1, ((PyObject *)__pyx_v_B)); __Pyx_GIVEREF(((PyObject *)__pyx_v_B)); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; @@ -13890,23 +13914,23 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_transform(struct __pyx_o __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_basis.pyx":567 - * cpdef transform(Basis self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=2] B): - * cdef INDEX_t i #@DuplicatedSignature + /* "sklearn/earth/_basis.pyx":572 + * cpdef transform(Basis self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=2] B): + * cdef INDEX_t i # @DuplicatedSignature * cdef INDEX_t n = self.__len__() # <<<<<<<<<<<<<< * cdef BasisFunction bf * cdef INDEX_t col = 0 */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____len__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____len__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_3); if (unlikely((__pyx_t_4 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_3); if (unlikely((__pyx_t_4 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_n = __pyx_t_4; - /* "sklearn/earth/_basis.pyx":569 + /* "sklearn/earth/_basis.pyx":574 * cdef INDEX_t n = self.__len__() * cdef BasisFunction bf * cdef INDEX_t col = 0 # <<<<<<<<<<<<<< @@ -13915,7 +13939,7 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_transform(struct __pyx_o */ __pyx_v_col = 0; - /* "sklearn/earth/_basis.pyx":570 + /* "sklearn/earth/_basis.pyx":575 * cdef BasisFunction bf * cdef INDEX_t col = 0 * for i in range(n): # <<<<<<<<<<<<<< @@ -13926,7 +13950,7 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_transform(struct __pyx_o for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { __pyx_v_i = __pyx_t_5; - /* "sklearn/earth/_basis.pyx":571 + /* "sklearn/earth/_basis.pyx":576 * cdef INDEX_t col = 0 * for i in range(n): * bf = self.order[i] # <<<<<<<<<<<<<< @@ -13935,30 +13959,30 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_transform(struct __pyx_o */ if (unlikely(((PyObject *)__pyx_v_self->order) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - if (!(likely(((PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i)) == Py_None) || likely(__Pyx_TypeTest(PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i), __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i)) == Py_None) || likely(__Pyx_TypeTest(PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i), __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_3 = PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i); __Pyx_INCREF(__pyx_t_3); __Pyx_XDECREF(((PyObject *)__pyx_v_bf)); __pyx_v_bf = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/earth/_basis.pyx":572 + /* "sklearn/earth/_basis.pyx":577 * for i in range(n): * bf = self.order[i] * if bf.is_pruned(): # <<<<<<<<<<<<<< * continue - * bf.apply(X,B[:,col],recurse=True) + * bf.apply(X, B[:, col], recurse=True) */ __pyx_t_6 = (((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_bf->__pyx_vtab)->is_pruned(__pyx_v_bf, 0) != 0); if (__pyx_t_6) { - /* "sklearn/earth/_basis.pyx":573 + /* "sklearn/earth/_basis.pyx":578 * bf = self.order[i] * if bf.is_pruned(): * continue # <<<<<<<<<<<<<< - * bf.apply(X,B[:,col],recurse=True) + * bf.apply(X, B[:, col], recurse=True) * col += 1 */ goto __pyx_L3_continue; @@ -13966,16 +13990,16 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_transform(struct __pyx_o } __pyx_L5:; - /* "sklearn/earth/_basis.pyx":574 + /* "sklearn/earth/_basis.pyx":579 * if bf.is_pruned(): * continue - * bf.apply(X,B[:,col],recurse=True) # <<<<<<<<<<<<<< + * bf.apply(X, B[:, col], recurse=True) # <<<<<<<<<<<<<< * col += 1 * */ - __pyx_t_3 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_col); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_col); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_k_slice_9); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_k_slice_9); @@ -13983,23 +14007,23 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_transform(struct __pyx_o PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_1)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_1)); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_7.__pyx_n = 1; __pyx_t_7.recurse = 1; - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_bf->__pyx_vtab)->apply(__pyx_v_bf, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_t_3), 0, &__pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_bf->__pyx_vtab)->apply(__pyx_v_bf, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_t_3), 0, &__pyx_t_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_basis.pyx":575 + /* "sklearn/earth/_basis.pyx":580 * continue - * bf.apply(X,B[:,col],recurse=True) + * bf.apply(X, B[:, col], recurse=True) * col += 1 # <<<<<<<<<<<<<< * - * cpdef weighted_transform(Basis self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=2] B, cnp.ndarray[FLOAT_t,ndim=1] weights): + * cpdef weighted_transform(Basis self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=2] B, cnp.ndarray[FLOAT_t, ndim=1] weights): */ __pyx_v_col = (__pyx_v_col + 1); __pyx_L3_continue:; @@ -14060,11 +14084,11 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_36transform(PyObject *_ case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__B)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("transform", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("transform", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "transform") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "transform") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -14077,14 +14101,14 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_36transform(PyObject *_ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("transform", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("transform", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.earth._basis.Basis.transform", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_B), __pyx_ptype_5numpy_ndarray, 1, "B", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_B), __pyx_ptype_5numpy_ndarray, 1, "B", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_5Basis_35transform(((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)__pyx_v_self), __pyx_v_X, __pyx_v_B); goto __pyx_L0; __pyx_L1_error:; @@ -14094,11 +14118,11 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_36transform(PyObject *_ return __pyx_r; } -/* "sklearn/earth/_basis.pyx":565 +/* "sklearn/earth/_basis.pyx":570 * return length * - * cpdef transform(Basis self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=2] B): # <<<<<<<<<<<<<< - * cdef INDEX_t i #@DuplicatedSignature + * cpdef transform(Basis self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=2] B): # <<<<<<<<<<<<<< + * cdef INDEX_t i # @DuplicatedSignature * cdef INDEX_t n = self.__len__() */ @@ -14124,16 +14148,16 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_35transform(struct __py __pyx_pybuffernd_B.rcbuffer = &__pyx_pybuffer_B; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_v_B, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_v_B, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_B.diminfo[0].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B.diminfo[0].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B.diminfo[1].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B.diminfo[1].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[1]; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->transform(__pyx_v_self, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_B), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->transform(__pyx_v_self, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_B), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -14160,11 +14184,11 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_35transform(struct __py return __pyx_r; } -/* "sklearn/earth/_basis.pyx":577 +/* "sklearn/earth/_basis.pyx":582 * col += 1 * - * cpdef weighted_transform(Basis self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=2] B, cnp.ndarray[FLOAT_t,ndim=1] weights): # <<<<<<<<<<<<<< - * cdef INDEX_t i #@DuplicatedSignature + * cpdef weighted_transform(Basis self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=2] B, cnp.ndarray[FLOAT_t, ndim=1] weights): # <<<<<<<<<<<<<< + * cdef INDEX_t i # @DuplicatedSignature * cdef INDEX_t n = self.__len__() */ @@ -14201,28 +14225,28 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_weighted_transform(struc __pyx_pybuffernd_weights.rcbuffer = &__pyx_pybuffer_weights; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_v_B, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_v_B, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_B.diminfo[0].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B.diminfo[0].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B.diminfo[1].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B.diminfo[1].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_weights.diminfo[0].strides = __pyx_pybuffernd_weights.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weights.diminfo[0].shape = __pyx_pybuffernd_weights.rcbuffer->pybuffer.shape[0]; /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__weighted_transform); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__weighted_transform); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_6_basis_5Basis_38weighted_transform)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_X)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_X)); @@ -14233,7 +14257,7 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_weighted_transform(struc __Pyx_INCREF(((PyObject *)__pyx_v_weights)); PyTuple_SET_ITEM(__pyx_t_2, 2, ((PyObject *)__pyx_v_weights)); __Pyx_GIVEREF(((PyObject *)__pyx_v_weights)); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; @@ -14244,40 +14268,38 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_weighted_transform(struc __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_basis.pyx":579 - * cpdef weighted_transform(Basis self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=2] B, cnp.ndarray[FLOAT_t,ndim=1] weights): - * cdef INDEX_t i #@DuplicatedSignature + /* "sklearn/earth/_basis.pyx":584 + * cpdef weighted_transform(Basis self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=2] B, cnp.ndarray[FLOAT_t, ndim=1] weights): + * cdef INDEX_t i # @DuplicatedSignature * cdef INDEX_t n = self.__len__() # <<<<<<<<<<<<<< * - * self.transform(X,B) + * self.transform(X, B) */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____len__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____len__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_3); if (unlikely((__pyx_t_4 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_3); if (unlikely((__pyx_t_4 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 584; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_n = __pyx_t_4; - /* "sklearn/earth/_basis.pyx":581 + /* "sklearn/earth/_basis.pyx":586 * cdef INDEX_t n = self.__len__() * - * self.transform(X,B) # <<<<<<<<<<<<<< - * apply_weights_2d(B,weights) - * + * self.transform(X, B) # <<<<<<<<<<<<<< + * apply_weights_2d(B, weights) */ - __pyx_t_3 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->transform(__pyx_v_self, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_B), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 581; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->transform(__pyx_v_self, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_B), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 586; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/earth/_basis.pyx":582 - * - * self.transform(X,B) - * apply_weights_2d(B,weights) # <<<<<<<<<<<<<< + /* "sklearn/earth/_basis.pyx":587 * + * self.transform(X, B) + * apply_weights_2d(B, weights) # <<<<<<<<<<<<<< */ - __pyx_t_3 = __pyx_f_7sklearn_5earth_5_util_apply_weights_2d(((PyArrayObject *)__pyx_v_B), ((PyArrayObject *)__pyx_v_weights), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_f_7sklearn_5earth_5_util_apply_weights_2d(((PyArrayObject *)__pyx_v_B), ((PyArrayObject *)__pyx_v_weights), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -14339,16 +14361,16 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_38weighted_transform(Py case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__B)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("weighted_transform", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("weighted_transform", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weights)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("weighted_transform", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("weighted_transform", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "weighted_transform") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "weighted_transform") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -14363,15 +14385,15 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_38weighted_transform(Py } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("weighted_transform", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("weighted_transform", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.earth._basis.Basis.weighted_transform", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_B), __pyx_ptype_5numpy_ndarray, 1, "B", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weights), __pyx_ptype_5numpy_ndarray, 1, "weights", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_5numpy_ndarray, 1, "X", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_B), __pyx_ptype_5numpy_ndarray, 1, "B", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weights), __pyx_ptype_5numpy_ndarray, 1, "weights", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_5earth_6_basis_5Basis_37weighted_transform(((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)__pyx_v_self), __pyx_v_X, __pyx_v_B, __pyx_v_weights); goto __pyx_L0; __pyx_L1_error:; @@ -14381,11 +14403,11 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_38weighted_transform(Py return __pyx_r; } -/* "sklearn/earth/_basis.pyx":577 +/* "sklearn/earth/_basis.pyx":582 * col += 1 * - * cpdef weighted_transform(Basis self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=2] B, cnp.ndarray[FLOAT_t,ndim=1] weights): # <<<<<<<<<<<<<< - * cdef INDEX_t i #@DuplicatedSignature + * cpdef weighted_transform(Basis self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=2] B, cnp.ndarray[FLOAT_t, ndim=1] weights): # <<<<<<<<<<<<<< + * cdef INDEX_t i # @DuplicatedSignature * cdef INDEX_t n = self.__len__() */ @@ -14417,21 +14439,21 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_37weighted_transform(st __pyx_pybuffernd_weights.rcbuffer = &__pyx_pybuffer_weights; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_v_X, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_v_B, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_v_B, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_B.diminfo[0].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B.diminfo[0].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B.diminfo[1].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B.diminfo[1].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[1]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_6_basis_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_weights.diminfo[0].strides = __pyx_pybuffernd_weights.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weights.diminfo[0].shape = __pyx_pybuffernd_weights.rcbuffer->pybuffer.shape[0]; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->weighted_transform(__pyx_v_self, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_B), ((PyArrayObject *)__pyx_v_weights), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 577; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->__pyx_vtab)->weighted_transform(__pyx_v_self, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_B), ((PyArrayObject *)__pyx_v_weights), 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 582; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -14471,12 +14493,12 @@ static PyObject *__pyx_pw_7sklearn_5earth_6_basis_5Basis_13num_variables_1__get_ return __pyx_r; } -/* "sklearn/earth/_basis.pxd":108 +/* "sklearn/earth/_basis.pxd":107 * * cdef list order * cdef readonly INDEX_t num_variables # <<<<<<<<<<<<<< * - * cpdef translate(Basis self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts) + * cpdef translate(Basis self, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts) */ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_13num_variables___get__(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_v_self) { @@ -14488,7 +14510,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_13num_variables___get__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__get__", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->num_variables); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->num_variables); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -16573,7 +16595,7 @@ static PyTypeObject __pyx_type_7sklearn_5earth_6_basis_Basis = { 0, /*tp_setattro*/ 0, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_HAVE_VERSION_TAG|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - __Pyx_DOCSTR("A container that provides functionality related to a set of BasisFunctions with a \n common ConstantBasisFunction ancestor. Retains the order in which BasisFunctions are \n added."), /*tp_doc*/ + __Pyx_DOCSTR("A container that provides functionality related to a set of BasisFunctions with a\n common ConstantBasisFunction ancestor. Retains the order in which BasisFunctions are\n added."), /*tp_doc*/ __pyx_tp_traverse_7sklearn_5earth_6_basis_Basis, /*tp_traverse*/ __pyx_tp_clear_7sklearn_5earth_6_basis_Basis, /*tp_clear*/ __pyx_pw_7sklearn_5earth_6_basis_5Basis_9__richcmp__, /*tp_richcompare*/ @@ -17364,8 +17386,8 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_NotImplemented = __Pyx_GetBuiltinName(__pyx_n_s__NotImplemented); if (!__pyx_builtin_NotImplemented) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s__NotImplementedError); if (!__pyx_builtin_NotImplementedError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 309; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s__super); if (!__pyx_builtin_super) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_NotImplementedError = __Pyx_GetBuiltinName(__pyx_n_s__NotImplementedError); if (!__pyx_builtin_NotImplementedError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_super = __Pyx_GetBuiltinName(__pyx_n_s__super); if (!__pyx_builtin_super) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 346; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; @@ -17377,14 +17399,14 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "sklearn/earth/_basis.pyx":574 + /* "sklearn/earth/_basis.pyx":579 * if bf.is_pruned(): * continue - * bf.apply(X,B[:,col],recurse=True) # <<<<<<<<<<<<<< + * bf.apply(X, B[:, col], recurse=True) # <<<<<<<<<<<<<< * col += 1 * */ - __pyx_k_slice_9 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_9 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 579; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_9); __Pyx_GIVEREF(__pyx_k_slice_9); @@ -17561,9 +17583,9 @@ PyMODINIT_FUNC PyInit__basis(void) __pyx_vtable_7sklearn_5earth_6_basis_Basis.get = (struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *(*)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, __pyx_t_7sklearn_5earth_6_basis_INDEX_t, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_5Basis_get; __pyx_vtable_7sklearn_5earth_6_basis_Basis.transform = (PyObject *(*)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_5Basis_transform; __pyx_vtable_7sklearn_5earth_6_basis_Basis.weighted_transform = (PyObject *(*)(struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, PyArrayObject *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_5Basis_weighted_transform; - if (PyType_Ready(&__pyx_type_7sklearn_5earth_6_basis_Basis) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_5earth_6_basis_Basis.tp_dict, __pyx_vtabptr_7sklearn_5earth_6_basis_Basis) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "Basis", (PyObject *)&__pyx_type_7sklearn_5earth_6_basis_Basis) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_5earth_6_basis_Basis) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_5earth_6_basis_Basis.tp_dict, __pyx_vtabptr_7sklearn_5earth_6_basis_Basis) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "Basis", (PyObject *)&__pyx_type_7sklearn_5earth_6_basis_Basis) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_5earth_6_basis_Basis = &__pyx_type_7sklearn_5earth_6_basis_Basis; __pyx_vtabptr_7sklearn_5earth_6_basis_BasisFunction = &__pyx_vtable_7sklearn_5earth_6_basis_BasisFunction; __pyx_vtable_7sklearn_5earth_6_basis_BasisFunction.has_knot = (int (*)(struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_has_knot; @@ -17589,9 +17611,9 @@ PyMODINIT_FUNC PyInit__basis(void) __pyx_vtabptr_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction = &__pyx_vtable_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction; __pyx_vtable_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction.__pyx_base = *__pyx_vtabptr_7sklearn_5earth_6_basis_BasisFunction; __pyx_type_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction.tp_base = __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction; - if (PyType_Ready(&__pyx_type_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction.tp_dict, __pyx_vtabptr_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "PicklePlaceHolderBasisFunction", (PyObject *)&__pyx_type_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 281; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction.tp_dict, __pyx_vtabptr_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "PicklePlaceHolderBasisFunction", (PyObject *)&__pyx_type_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 282; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction = &__pyx_type_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction; __pyx_vtabptr_7sklearn_5earth_6_basis_ConstantBasisFunction = &__pyx_vtable_7sklearn_5earth_6_basis_ConstantBasisFunction; __pyx_vtable_7sklearn_5earth_6_basis_ConstantBasisFunction.__pyx_base = *__pyx_vtabptr_7sklearn_5earth_6_basis_BasisFunction; @@ -17602,11 +17624,11 @@ PyMODINIT_FUNC PyInit__basis(void) __pyx_vtable_7sklearn_5earth_6_basis_ConstantBasisFunction.translate = (PyObject *(*)(struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *, PyArrayObject *, PyArrayObject *, int, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_21ConstantBasisFunction_translate; __pyx_vtable_7sklearn_5earth_6_basis_ConstantBasisFunction.scale = (__pyx_t_7sklearn_5earth_6_basis_FLOAT_t (*)(struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_21ConstantBasisFunction_scale; __pyx_type_7sklearn_5earth_6_basis_ConstantBasisFunction.tp_base = __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction; - if (PyType_Ready(&__pyx_type_7sklearn_5earth_6_basis_ConstantBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_5earth_6_basis_ConstantBasisFunction.tp_dict, __pyx_vtabptr_7sklearn_5earth_6_basis_ConstantBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "ConstantBasisFunction", (PyObject *)&__pyx_type_7sklearn_5earth_6_basis_ConstantBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_5earth_6_basis_ConstantBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_5earth_6_basis_ConstantBasisFunction.tp_dict, __pyx_vtabptr_7sklearn_5earth_6_basis_ConstantBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "ConstantBasisFunction", (PyObject *)&__pyx_type_7sklearn_5earth_6_basis_ConstantBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 287; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_5earth_6_basis_ConstantBasisFunction = &__pyx_type_7sklearn_5earth_6_basis_ConstantBasisFunction; - if (PyType_Ready(&__pyx_type_7sklearn_5earth_6_basis___pyx_scope_struct__piter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_5earth_6_basis___pyx_scope_struct__piter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_5earth_6_basis___pyx_scope_struct__piter = &__pyx_type_7sklearn_5earth_6_basis___pyx_scope_struct__piter; __pyx_vtabptr_7sklearn_5earth_6_basis_HingeBasisFunction = &__pyx_vtable_7sklearn_5earth_6_basis_HingeBasisFunction; __pyx_vtable_7sklearn_5earth_6_basis_HingeBasisFunction.__pyx_base = *__pyx_vtabptr_7sklearn_5earth_6_basis_BasisFunction; @@ -17619,9 +17641,9 @@ PyMODINIT_FUNC PyInit__basis(void) __pyx_vtable_7sklearn_5earth_6_basis_HingeBasisFunction.get_reverse = (int (*)(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_18HingeBasisFunction_get_reverse; __pyx_vtable_7sklearn_5earth_6_basis_HingeBasisFunction.get_knot_idx = (__pyx_t_7sklearn_5earth_6_basis_INDEX_t (*)(struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_18HingeBasisFunction_get_knot_idx; __pyx_type_7sklearn_5earth_6_basis_HingeBasisFunction.tp_base = __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction; - if (PyType_Ready(&__pyx_type_7sklearn_5earth_6_basis_HingeBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_5earth_6_basis_HingeBasisFunction.tp_dict, __pyx_vtabptr_7sklearn_5earth_6_basis_HingeBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "HingeBasisFunction", (PyObject *)&__pyx_type_7sklearn_5earth_6_basis_HingeBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_5earth_6_basis_HingeBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_5earth_6_basis_HingeBasisFunction.tp_dict, __pyx_vtabptr_7sklearn_5earth_6_basis_HingeBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "HingeBasisFunction", (PyObject *)&__pyx_type_7sklearn_5earth_6_basis_HingeBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_5earth_6_basis_HingeBasisFunction = &__pyx_type_7sklearn_5earth_6_basis_HingeBasisFunction; __pyx_vtabptr_7sklearn_5earth_6_basis_LinearBasisFunction = &__pyx_vtable_7sklearn_5earth_6_basis_LinearBasisFunction; __pyx_vtable_7sklearn_5earth_6_basis_LinearBasisFunction.__pyx_base = *__pyx_vtabptr_7sklearn_5earth_6_basis_BasisFunction; @@ -17630,9 +17652,9 @@ PyMODINIT_FUNC PyInit__basis(void) __pyx_vtable_7sklearn_5earth_6_basis_LinearBasisFunction.scale = (__pyx_t_7sklearn_5earth_6_basis_FLOAT_t (*)(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *, PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_19LinearBasisFunction_scale; __pyx_vtable_7sklearn_5earth_6_basis_LinearBasisFunction.get_variable = (__pyx_t_7sklearn_5earth_6_basis_INDEX_t (*)(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_6_basis_19LinearBasisFunction_get_variable; __pyx_type_7sklearn_5earth_6_basis_LinearBasisFunction.tp_base = __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction; - if (PyType_Ready(&__pyx_type_7sklearn_5earth_6_basis_LinearBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_5earth_6_basis_LinearBasisFunction.tp_dict, __pyx_vtabptr_7sklearn_5earth_6_basis_LinearBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "LinearBasisFunction", (PyObject *)&__pyx_type_7sklearn_5earth_6_basis_LinearBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_5earth_6_basis_LinearBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_5earth_6_basis_LinearBasisFunction.tp_dict, __pyx_vtabptr_7sklearn_5earth_6_basis_LinearBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "LinearBasisFunction", (PyObject *)&__pyx_type_7sklearn_5earth_6_basis_LinearBasisFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_5earth_6_basis_LinearBasisFunction = &__pyx_type_7sklearn_5earth_6_basis_LinearBasisFunction; /*--- Type import code ---*/ __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", @@ -17676,16 +17698,16 @@ PyMODINIT_FUNC PyInit__basis(void) if (PyDict_SetItem(__pyx_d, __pyx_n_s__np, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 11; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_basis.pyx":284 + /* "sklearn/earth/_basis.pyx":285 * '''This is a place holder for unpickling the basis function tree.''' * * pickle_place_holder = PicklePlaceHolderBasisFunction() # <<<<<<<<<<<<<< * * cdef class ConstantBasisFunction(BasisFunction): */ - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_d, __pyx_n_s__pickle_place_holder, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 284; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_d, __pyx_n_s__pickle_place_holder, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; /* "sklearn/earth/_basis.pyx":1 diff --git a/sklearn/earth/_basis.pxd b/sklearn/earth/_basis.pxd index ac19c3d6b5514..1d3dc1a93237f 100644 --- a/sklearn/earth/_basis.pxd +++ b/sklearn/earth/_basis.pxd @@ -6,123 +6,118 @@ ctypedef cnp.uint8_t BOOL_t cdef class BasisFunction: '''Abstract. Subclasses must implement the apply, translate, scale, and __init__ methods.''' - + cdef BasisFunction parent cdef dict child_map cdef list children cdef bint pruned cdef bint prunable cdef bint splittable - + cpdef bint has_knot(BasisFunction self) - + cpdef bint is_prunable(BasisFunction self) - + cpdef bint is_pruned(BasisFunction self) - + cpdef bint is_splittable(BasisFunction self) - + cpdef bint make_splittable(BasisFunction self) - + cpdef bint make_unsplittable(BasisFunction self) - + cdef list get_children(BasisFunction self) - - cpdef _set_parent(self,BasisFunction parent) - - cpdef _add_child(self,BasisFunction child) - + + cpdef _set_parent(self, BasisFunction parent) + + cpdef _add_child(self, BasisFunction child) + cpdef BasisFunction get_parent(self) - + cpdef prune(self) - + cpdef unprune(self) - + cpdef knots(BasisFunction self, INDEX_t variable) - + cpdef INDEX_t degree(BasisFunction self) - - cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) - - cpdef cnp.ndarray[INT_t, ndim=1] valid_knots(BasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] values, cnp.ndarray[FLOAT_t,ndim=1] variable, int variable_idx, INDEX_t check_every, int endspan, int minspan, FLOAT_t minspan_alpha, INDEX_t n, cnp.ndarray[INT_t,ndim=1] workspace) - + + cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse= ?) + + cpdef cnp.ndarray[INT_t, ndim = 1] valid_knots(BasisFunction self, cnp.ndarray[FLOAT_t, ndim=1] values, cnp.ndarray[FLOAT_t, ndim=1] variable, int variable_idx, INDEX_t check_every, int endspan, int minspan, FLOAT_t minspan_alpha, INDEX_t n, cnp.ndarray[INT_t, ndim=1] workspace) + cdef class ConstantBasisFunction(BasisFunction): - + cpdef INDEX_t degree(ConstantBasisFunction self) - - cpdef translate(ConstantBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse) - - cpdef FLOAT_t scale(ConstantBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts) - - cpdef _set_parent(self,BasisFunction parent) - + + cpdef translate(ConstantBasisFunctionself, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts, bint recurse) + + cpdef FLOAT_t scale(ConstantBasisFunctionself, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts) + + cpdef _set_parent(self, BasisFunction parent) + cpdef BasisFunction get_parent(self) - cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) - - + cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse= ?) + + cdef class HingeBasisFunction(BasisFunction): cdef FLOAT_t knot cdef INDEX_t knot_idx cdef INDEX_t variable cdef bint reverse cdef str label - + cpdef bint has_knot(HingeBasisFunction self) - - cpdef translate(HingeBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse) - - cpdef FLOAT_t scale(HingeBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts) - + + cpdef translate(HingeBasisFunction self, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts, bint recurse) + + cpdef FLOAT_t scale(HingeBasisFunction self, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts) + cpdef INDEX_t get_variable(self) - + cpdef FLOAT_t get_knot(self) - + cpdef bint get_reverse(self) - + cpdef INDEX_t get_knot_idx(self) - - cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) + + cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse= ?) cdef class LinearBasisFunction(BasisFunction): cdef INDEX_t variable cdef str label - - cpdef translate(LinearBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse) - - cpdef FLOAT_t scale(LinearBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts) - + + cpdef translate(LinearBasisFunction self, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts, bint recurse) + + cpdef FLOAT_t scale(LinearBasisFunction self, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts) + cpdef INDEX_t get_variable(self) - - cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) + cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse= ?) cdef class Basis: - '''A wrapper that provides functionality related to a set of BasisFunctions with a - common ConstantBasisFunction ancestor. Retains the order in which BasisFunctions are + '''A wrapper that provides functionality related to a set of BasisFunctions with a + common ConstantBasisFunction ancestor. Retains the order in which BasisFunctions are added.''' - + cdef list order cdef readonly INDEX_t num_variables - - cpdef translate(Basis self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts) - - cpdef scale(Basis self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, cnp.ndarray[FLOAT_t,ndim=1] beta) - + + cpdef translate(Basis self, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts) + + cpdef scale(Basis self, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts, cnp.ndarray[FLOAT_t, ndim=1] beta) + cpdef BasisFunction get_root(Basis self) - + cpdef append(Basis self, BasisFunction basis_function) - + cpdef INDEX_t plen(Basis self) - + cpdef BasisFunction get(Basis self, INDEX_t i) - - cpdef transform(Basis self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=2] B) - - cpdef weighted_transform(Basis self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=2] B, cnp.ndarray[FLOAT_t,ndim=1] weights) - - - - \ No newline at end of file + + cpdef transform(Basis self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=2] B) + + cpdef weighted_transform(Basis self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=2] B, cnp.ndarray[FLOAT_t, ndim=1] weights) diff --git a/sklearn/earth/_basis.pyx b/sklearn/earth/_basis.pyx index 56da782250dc1..622db3eed3f2f 100644 --- a/sklearn/earth/_basis.pyx +++ b/sklearn/earth/_basis.pyx @@ -11,35 +11,35 @@ cdef FLOAT_t ZERO_TOL = 1e-16 import numpy as np cdef class BasisFunction: - + def __cinit__(BasisFunction self): self.pruned = False self.children = [] self.prunable = True self.child_map = {} self.splittable = True - + def __reduce__(self): return (self.__class__, (), self._getstate()) - + def _get_root(self): return self.parent._get_root() - + def _getstate(self): result = {'pruned': self.pruned, - 'children': self.children, - 'prunable': self.prunable, - 'child_map': self.child_map, - 'splittable': self.splittable} + 'children': self.children, + 'prunable': self.prunable, + 'child_map': self.child_map, + 'splittable': self.splittable} result.update(self._get_parent_state()) return result - + def _get_parent_state(self): return {'parent': self.parent} - + def _set_parent_state(self, state): self.parent = state['parent'] - + def __setstate__(self, state): self.pruned = state['pruned'] self.children = state['children'] @@ -47,18 +47,18 @@ cdef class BasisFunction: self.child_map = state['child_map'] self.splittable = state['splittable'] self._set_parent_state(state) - + def _eq(self, other): if self.__class__ is not other.__class__: return False - self_state = self._getstate() + self_state = self._getstate() other_state = other._getstate() del self_state['children'] del self_state['child_map'] del other_state['children'] del other_state['child_map'] return self_state == other_state - + def __richcmp__(self, other, method): if method == 2: return self._eq(other) @@ -66,34 +66,34 @@ cdef class BasisFunction: return not self._eq(other) else: return NotImplemented - + cpdef bint has_knot(BasisFunction self): return False - + cpdef bint is_prunable(BasisFunction self): return self.prunable - + cpdef bint is_pruned(BasisFunction self): return self.pruned - + cpdef bint is_splittable(BasisFunction self): return self.splittable - + cpdef bint make_splittable(BasisFunction self): self.splittable = True - + cpdef bint make_unsplittable(BasisFunction self): self.splittable = False - + cdef list get_children(BasisFunction self): return self.children - - cpdef _set_parent(self,BasisFunction parent): + + cpdef _set_parent(self, BasisFunction parent): '''Calls _add_child.''' self.parent = parent self.parent._add_child(self) - - cpdef _add_child(self,BasisFunction child): + + cpdef _add_child(self, BasisFunction child): '''Called by _set_parent.''' cdef INDEX_t n = len(self.children) self.children.append(child) @@ -102,18 +102,18 @@ cdef class BasisFunction: self.child_map[var].append(n) else: self.child_map[var] = [n] - + cpdef BasisFunction get_parent(self): return self.parent - + cpdef prune(self): self.pruned = True - + cpdef unprune(self): self.pruned = False - + cpdef knots(BasisFunction self, INDEX_t variable): - + cdef list children cdef BasisFunction child if variable in self.child_map: @@ -130,19 +130,19 @@ cdef class BasisFunction: if child.has_knot(): result.append(child.get_knot_idx()) return result - + cpdef INDEX_t degree(BasisFunction self): return self.parent.degree() + 1 - - cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = True): + + cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse=True): ''' X - Data matrix b - parent vector recurse - If False, assume b already contains the result of the parent function. Otherwise, recurse to compute parent function. ''' - - cpdef cnp.ndarray[INT_t, ndim=1] valid_knots(BasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] values, cnp.ndarray[FLOAT_t,ndim=1] variable, int variable_idx, INDEX_t check_every, int endspan, int minspan, FLOAT_t minspan_alpha, INDEX_t n, cnp.ndarray[INT_t,ndim=1] workspace): + + cpdef cnp.ndarray[INT_t, ndim = 1] valid_knots(BasisFunction self, cnp.ndarray[FLOAT_t, ndim=1] values, cnp.ndarray[FLOAT_t, ndim=1] variable, int variable_idx, INDEX_t check_every, int endspan, int minspan, FLOAT_t minspan_alpha, INDEX_t n, cnp.ndarray[INT_t, ndim=1] workspace): ''' values - The unsorted values of self in the data set variable - The sorted values of variable in the data set @@ -157,23 +157,23 @@ cdef class BasisFunction: cdef INT_t int_tmp cdef INDEX_t count cdef int minspan_ - cdef cnp.ndarray[INT_t, ndim=1] result + cdef cnp.ndarray[INT_t, ndim = 1] result cdef INDEX_t num_used cdef INDEX_t prev cdef INDEX_t start cdef int idx cdef int last_idx - cdef FLOAT_t first_var_value = variable[m-1] - cdef FLOAT_t last_var_value = variable[m-1] + cdef FLOAT_t first_var_value = variable[m - 1] + cdef FLOAT_t last_var_value = variable[m - 1] - #Calculate the used knots + # Calculate the used knots cdef list used_knots = self.knots(variable_idx) used_knots.sort() - - #Initialize workspace to 1 where value is nonzero - #Also, find first_var_value as the maximum variable - #where value is nonzero and last_var_value to the - #minimum variable where value is nonzero + + # Initialize workspace to 1 where value is nonzero + # Also, find first_var_value as the maximum variable + # where value is nonzero and last_var_value to the + # minimum variable where value is nonzero count = 0 for i in range(m): if abs(values[i]) > ZERO_TOL: @@ -184,14 +184,14 @@ cdef class BasisFunction: last_var_value = variable[i] else: workspace[i] = 0 - - #Calculate minspan + + # Calculate minspan if minspan < 0: - minspan_ = (-log2(-(1.0/(n*count))*log(1.0-minspan_alpha)) / 2.5) + minspan_ = (-log2(-(1.0 / (n * count)) * log(1.0 - minspan_alpha)) / 2.5) else: minspan_ = minspan - - #Take out the used points and apply minspan + + # Take out the used points and apply minspan num_used = len(used_knots) prev = 0 last_idx = -1 @@ -203,8 +203,8 @@ cdef class BasisFunction: j = idx k = 0 while j > prev + 1 and k < minspan_: - if workspace[j-1]: - workspace[j-1] = False + if workspace[j - 1]: + workspace[j - 1] = False k += 1 j -= 1 j = idx + 1 @@ -216,8 +216,8 @@ cdef class BasisFunction: j += 1 prev = idx last_idx = idx - - #Apply endspan + + # Apply endspan i = 0 j = 0 while i < endspan: @@ -236,8 +236,8 @@ cdef class BasisFunction: if j == 0: break j -= 1 - - #Implement check_every + + # Implement check_every int_tmp = 0 count = 0 for i in range(m): @@ -249,8 +249,9 @@ cdef class BasisFunction: int_tmp += 1 else: int_tmp = 0 - - #Make sure the greatest value is not a candidate (this can happen if the first endspan+1 values are the same) + + # Make sure the greatest value is not a candidate (this can happen if + # the first endspan+1 values are the same) for i in range(m): if workspace[i]: if variable[i] == first_var_value: @@ -258,24 +259,24 @@ cdef class BasisFunction: count -= 1 else: break - - #Also make sure the least value is not a candidate + + # Also make sure the least value is not a candidate for i in range(m): - if workspace[m-i-1]: - if variable[m-i-1] == last_var_value: - workspace[m-i-1] = 0 + if workspace[m - i - 1]: + if variable[m - i - 1] == last_var_value: + workspace[m - i - 1] = 0 count -= 1 else: break - - #Create result array and return - result = np.empty(shape=count,dtype=int) + + # Create result array and return + result = np.empty(shape=count, dtype=int) j = 0 for i in range(m): if workspace[i]: result[j] = i j += 1 - + return result cdef class PicklePlaceHolderBasisFunction(BasisFunction): @@ -284,62 +285,63 @@ cdef class PicklePlaceHolderBasisFunction(BasisFunction): pickle_place_holder = PicklePlaceHolderBasisFunction() cdef class ConstantBasisFunction(BasisFunction): - def __init__(self): #@DuplicatedSignature + def __init__(self): # @DuplicatedSignature self.prunable = False - + def _get_root(self): return self - + def _get_parent_state(self): return {} - + def _set_parent_state(self, state): pass - + cpdef INDEX_t degree(ConstantBasisFunction self): return 0 - - cpdef translate(ConstantBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse): + + cpdef translate(ConstantBasisFunctionself, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts, bint recurse): pass - - cpdef FLOAT_t scale(ConstantBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): - return 1.0 - - cpdef _set_parent(self,BasisFunction parent): + + cpdef FLOAT_t scale(ConstantBasisFunctionself, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts): + return < FLOAT_t > 1.0 + + cpdef _set_parent(self, BasisFunction parent): raise NotImplementedError cpdef BasisFunction get_parent(self): raise NotImplementedError - cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = False): + cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse=False): ''' X - Data matrix b - parent vector - recurse - The ConstantBasisFunction is the parent of all BasisFunctions and never has a parent. - Therefore the recurse argument is ignored. This spares child BasisFunctions from + recurse - The ConstantBasisFunction is the parent of all BasisFunctions and never has a parent. + Therefore the recurse argument is ignored. This spares child BasisFunctions from having to know whether their parents have parents. - ''' - cdef INDEX_t i #@DuplicatedSignature + ''' + cdef INDEX_t i # @DuplicatedSignature cdef INDEX_t m = len(b) for i in range(m): - b[i] = 1.0 - + b[i] = 1.0 + def __str__(self): return '(Intercept)' cdef class HingeBasisFunction(BasisFunction): - - def __init__(self, BasisFunction parent, FLOAT_t knot, INDEX_t knot_idx, INDEX_t variable, bint reverse, label=None): #@DuplicatedSignature + + #@DuplicatedSignature + def __init__(self, BasisFunction parent, FLOAT_t knot, INDEX_t knot_idx, INDEX_t variable, bint reverse, label=None): self.knot = knot self.knot_idx = knot_idx self.variable = variable self.reverse = reverse - self.label = label if label is not None else 'x'+str(variable) + self.label = label if label is not None else 'x' + str(variable) self._set_parent(parent) - + def __reduce__(self): return (self.__class__, (pickle_place_holder, 1.0, 1, 1, True, ''), self._getstate()) - + def _getstate(self): result = super(HingeBasisFunction, self)._getstate() result.update({'knot': self.knot, @@ -348,7 +350,7 @@ cdef class HingeBasisFunction(BasisFunction): 'reverse': self.reverse, 'label': self.label}) return result - + def __setstate__(self, state): self.knot = state['knot'] self.knot_idx = state['knot_idx'] @@ -356,113 +358,116 @@ cdef class HingeBasisFunction(BasisFunction): self.reverse = state['reverse'] self.label = state['label'] super(HingeBasisFunction, self).__setstate__(state) - + cpdef bint has_knot(HingeBasisFunction self): return True - - cpdef translate(HingeBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse): - self.knot = slopes[self.variable]*self.knot + intercepts[self.variable] + + cpdef translate(HingeBasisFunction self, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts, bint recurse): + self.knot = slopes[self.variable] * \ + self.knot + intercepts[self.variable] if slopes[self.variable] < 0: self.reverse = not self.reverse if recurse: - self.parent.translate(slopes,intercepts) - - cpdef FLOAT_t scale(HingeBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): - result = self.parent.scale(slopes,intercepts) + self.parent.translate(slopes, intercepts) + + cpdef FLOAT_t scale(HingeBasisFunction self, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts): + result = self.parent.scale(slopes, intercepts) result /= slopes[self.variable] return result - + def __str__(self): result = '' if self.variable is not None: if not self.reverse: if self.knot >= 0: - result = 'h(%s-%G)' % (self.label,self.knot) + result = 'h(%s-%G)' % (self.label, self.knot) else: - result = 'h(%s+%G)' % (self.label,-self.knot) + result = 'h(%s+%G)' % (self.label, -self.knot) else: - result = 'h(%G-%s)' % (self.knot,self.label) - parent = str(self.parent) if not self.parent.__class__ is ConstantBasisFunction else '' + result = 'h(%G-%s)' % (self.knot, self.label) + parent = str( + self.parent) if not self.parent.__class__ is ConstantBasisFunction else '' if parent != '': result += '*%s' % (str(self.parent),) return result - + cpdef INDEX_t get_variable(self): return self.variable - + cpdef FLOAT_t get_knot(self): return self.knot - + cpdef bint get_reverse(self): return self.reverse - + cpdef INDEX_t get_knot_idx(self): return self.knot_idx - - cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = True): + + cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse=True): ''' X - Data matrix b - parent vector recurse - If False, assume b already contains the result of the parent function. Otherwise, recurse to compute parent function. - ''' + ''' if recurse: - self.parent.apply(X,b,recurse=True) - cdef INDEX_t i #@DuplicatedSignature - cdef INDEX_t m = len(b) #@DuplicatedSignature + self.parent.apply(X, b, recurse=True) + cdef INDEX_t i # @DuplicatedSignature + cdef INDEX_t m = len(b) # @DuplicatedSignature cdef FLOAT_t tmp if self.reverse: for i in range(m): - tmp = self.knot - X[i,self.variable] + tmp = self.knot - X[i, self.variable] if tmp < 0: - tmp = 0.0 + tmp = 0.0 b[i] *= tmp else: for i in range(m): - tmp = X[i,self.variable] - self.knot + tmp = X[i, self.variable] - self.knot if tmp < 0: - tmp = 0.0 + tmp = 0.0 b[i] *= tmp - + cdef class LinearBasisFunction(BasisFunction): - def __init__(self, BasisFunction parent, INDEX_t variable, label=None): #@DuplicatedSignature + #@DuplicatedSignature + def __init__(self, BasisFunction parent, INDEX_t variable, label=None): self.variable = variable - self.label = label if label is not None else 'x'+str(variable) + self.label = label if label is not None else 'x' + str(variable) self._set_parent(parent) - + def __reduce__(self): return (self.__class__, (pickle_place_holder, 1, ''), self._getstate()) - + def _getstate(self): result = super(LinearBasisFunction, self)._getstate() result.update({'variable': self.variable, 'label': self.label}) return result - + def __setstate__(self, state): self.variable = state['variable'] self.label = state['label'] super(LinearBasisFunction, self).__setstate__(state) - - cpdef translate(LinearBasisFunctionself, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, bint recurse): + + cpdef translate(LinearBasisFunctionself, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts, bint recurse): pass - cpdef FLOAT_t scale(LinearBasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): - result = self.parent.scale(slopes,intercepts) + cpdef FLOAT_t scale(LinearBasisFunction self, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts): + result = self.parent.scale(slopes, intercepts) result /= slopes[self.variable] return result - + def __str__(LinearBasisFunction self): result = self.label if not self.parent.__class__ is ConstantBasisFunction: parent = str(self.parent) - result += '*'+parent + result += '*' + parent return result - + cpdef INDEX_t get_variable(self): return self.variable - - cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = True): + + cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse=True): ''' X - Data matrix b - parent vector @@ -470,30 +475,30 @@ cdef class LinearBasisFunction(BasisFunction): parent function. ''' if recurse: - self.parent.apply(X,b,recurse=True) - cdef INDEX_t i #@DuplicatedSignature - cdef INDEX_t m = len(b) #@DuplicatedSignature + self.parent.apply(X, b, recurse=True) + cdef INDEX_t i # @DuplicatedSignature + cdef INDEX_t m = len(b) # @DuplicatedSignature for i in range(m): - b[i] *= X[i,self.variable] - + b[i] *= X[i, self.variable] + cdef class Basis: - '''A container that provides functionality related to a set of BasisFunctions with a - common ConstantBasisFunction ancestor. Retains the order in which BasisFunctions are + '''A container that provides functionality related to a set of BasisFunctions with a + common ConstantBasisFunction ancestor. Retains the order in which BasisFunctions are added.''' - def __init__(Basis self, num_variables): #@DuplicatedSignature + def __init__(Basis self, num_variables): # @DuplicatedSignature self.order = [] self.num_variables = num_variables - + def __reduce__(self): return (self.__class__, (self.num_variables,), self._getstate()) - + def _getstate(self): return {'order': self.order} - + def __setstate__(self, state): self.order = state['order'] - + def __richcmp__(self, other, method): if method == 2: return self._eq(other) @@ -501,15 +506,15 @@ cdef class Basis: return not self._eq(other) else: return NotImplemented - + def _eq(self, other): return self.__class__ is other.__class__ and self._getstate() == other._getstate() - + def piter(Basis self): for bf in self.order: if not bf.is_pruned(): yield bf - + def __str__(Basis self): cdef INDEX_t i cdef INDEX_t n = len(self) @@ -518,41 +523,41 @@ cdef class Basis: result += str(self[i]) result += '\n' return result - - cpdef translate(Basis self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts): + + cpdef translate(Basis self, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts): cdef INDEX_t n = len(self) - cdef INDEX_t i #@DuplicatedSignature + cdef INDEX_t i # @DuplicatedSignature for i in range(n): - self.order[i].translate(slopes,intercepts,False) - - cpdef scale(Basis self, cnp.ndarray[FLOAT_t,ndim=1] slopes, cnp.ndarray[FLOAT_t,ndim=1] intercepts, cnp.ndarray[FLOAT_t,ndim=1] beta): - cdef INDEX_t n = len(self) #@DuplicatedSignature - cdef INDEX_t i #@DuplicatedSignature + self.order[i].translate(slopes, intercepts, False) + + cpdef scale(Basis self, cnp.ndarray[FLOAT_t, ndim=1] slopes, cnp.ndarray[FLOAT_t, ndim=1] intercepts, cnp.ndarray[FLOAT_t, ndim=1] beta): + cdef INDEX_t n = len(self) # @DuplicatedSignature + cdef INDEX_t i # @DuplicatedSignature cdef INDEX_t j = 0 for i in range(n): if self.order[i].is_pruned(): continue - beta[j] *= self.order[i].scale(slopes,intercepts) + beta[j] *= self.order[i].scale(slopes, intercepts) j += 1 - + cpdef BasisFunction get_root(Basis self): return self.root - + cpdef append(Basis self, BasisFunction basis_function): self.order.append(basis_function) - + def __iter__(Basis self): return self.order.__iter__() - + def __len__(Basis self): return self.order.__len__() - + cpdef BasisFunction get(Basis self, INDEX_t i): return self.order[i] - + def __getitem__(Basis self, INDEX_t i): return self.get(i) - + cpdef INDEX_t plen(Basis self): cdef INDEX_t length = 0 cdef INDEX_t i @@ -561,9 +566,9 @@ cdef class Basis: if not self.order[i].is_pruned(): length += 1 return length - - cpdef transform(Basis self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=2] B): - cdef INDEX_t i #@DuplicatedSignature + + cpdef transform(Basis self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=2] B): + cdef INDEX_t i # @DuplicatedSignature cdef INDEX_t n = self.__len__() cdef BasisFunction bf cdef INDEX_t col = 0 @@ -571,13 +576,12 @@ cdef class Basis: bf = self.order[i] if bf.is_pruned(): continue - bf.apply(X,B[:,col],recurse=True) + bf.apply(X, B[:, col], recurse=True) col += 1 - - cpdef weighted_transform(Basis self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=2] B, cnp.ndarray[FLOAT_t,ndim=1] weights): - cdef INDEX_t i #@DuplicatedSignature + + cpdef weighted_transform(Basis self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=2] B, cnp.ndarray[FLOAT_t, ndim=1] weights): + cdef INDEX_t i # @DuplicatedSignature cdef INDEX_t n = self.__len__() - - self.transform(X,B) - apply_weights_2d(B,weights) - + + self.transform(X, B) + apply_weights_2d(B, weights) diff --git a/sklearn/earth/_forward.c b/sklearn/earth/_forward.c index fde328a93ca34..32e03b5a378aa 100644 --- a/sklearn/earth/_forward.c +++ b/sklearn/earth/_forward.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19.1 on Sat Jul 27 21:13:14 2013 */ +/* Generated by Cython 0.19.1 on Sat Jul 27 22:55:34 2013 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS @@ -958,9 +958,9 @@ struct __pyx_opt_args_7sklearn_5earth_6_basis_19LinearBasisFunction_apply; /* "_basis.pxd":45 * cpdef INDEX_t degree(BasisFunction self) * - * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) # <<<<<<<<<<<<<< + * cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse= ?) # <<<<<<<<<<<<<< * - * cpdef cnp.ndarray[INT_t, ndim=1] valid_knots(BasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] values, cnp.ndarray[FLOAT_t,ndim=1] variable, int variable_idx, INDEX_t check_every, int endspan, int minspan, FLOAT_t minspan_alpha, INDEX_t n, cnp.ndarray[INT_t,ndim=1] workspace) + * cpdef cnp.ndarray[INT_t, ndim = 1] valid_knots(BasisFunction self, cnp.ndarray[FLOAT_t, ndim=1] values, cnp.ndarray[FLOAT_t, ndim=1] variable, int variable_idx, INDEX_t check_every, int endspan, int minspan, FLOAT_t minspan_alpha, INDEX_t n, cnp.ndarray[INT_t, ndim=1] workspace) */ struct __pyx_opt_args_7sklearn_5earth_6_basis_13BasisFunction_apply { int __pyx_n; @@ -970,7 +970,7 @@ struct __pyx_opt_args_7sklearn_5earth_6_basis_13BasisFunction_apply { /* "_basis.pxd":62 * cpdef BasisFunction get_parent(self) * - * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) # <<<<<<<<<<<<<< + * cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse= ?) # <<<<<<<<<<<<<< * * */ @@ -982,7 +982,7 @@ struct __pyx_opt_args_7sklearn_5earth_6_basis_21ConstantBasisFunction_apply { /* "_basis.pxd":86 * cpdef INDEX_t get_knot_idx(self) * - * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) # <<<<<<<<<<<<<< + * cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse= ?) # <<<<<<<<<<<<<< * * cdef class LinearBasisFunction(BasisFunction): */ @@ -994,7 +994,7 @@ struct __pyx_opt_args_7sklearn_5earth_6_basis_18HingeBasisFunction_apply { /* "_basis.pxd":98 * cpdef INDEX_t get_variable(self) * - * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) # <<<<<<<<<<<<<< + * cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse= ?) # <<<<<<<<<<<<<< * * */ @@ -1007,8 +1007,8 @@ struct __pyx_opt_args_7sklearn_5earth_6_basis_19LinearBasisFunction_apply { * from _record cimport ForwardPassRecord * * ctypedef enum StoppingCondition: # <<<<<<<<<<<<<< - * MAXTERMS=0, - * MAXRSQ=1, + * MAXTERMS = 0, + * MAXRSQ = 1, */ enum __pyx_t_7sklearn_5earth_8_forward_StoppingCondition { __pyx_e_7sklearn_5earth_8_forward_MAXTERMS = 0, @@ -1019,7 +1019,7 @@ enum __pyx_t_7sklearn_5earth_8_forward_StoppingCondition { }; typedef enum __pyx_t_7sklearn_5earth_8_forward_StoppingCondition __pyx_t_7sklearn_5earth_8_forward_StoppingCondition; -/* "_basis.pxd":102 +/* "_basis.pxd":101 * * * cdef class Basis: # <<<<<<<<<<<<<< @@ -1102,7 +1102,7 @@ struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction { * * cdef class ForwardPasser: # <<<<<<<<<<<<<< * - * #User selected parameters + * # User selected parameters */ struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser { PyObject_HEAD @@ -1188,7 +1188,7 @@ struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord { /* "_basis.pxd":88 - * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) + * cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse= ?) * * cdef class LinearBasisFunction(BasisFunction): # <<<<<<<<<<<<<< * cdef INDEX_t variable @@ -1315,7 +1315,7 @@ static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *__pyx_vtab /* "_basis.pxd":88 - * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) + * cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse= ?) * * cdef class LinearBasisFunction(BasisFunction): # <<<<<<<<<<<<<< * cdef INDEX_t variable @@ -1434,7 +1434,7 @@ static struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassIteration *__ /* "sklearn/earth/_forward.pyx":23 - * } + * } * * cdef class ForwardPasser: # <<<<<<<<<<<<<< * @@ -1454,7 +1454,7 @@ struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser { static struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *__pyx_vtabptr_7sklearn_5earth_8_forward_ForwardPasser; -/* "_basis.pxd":102 +/* "_basis.pxd":101 * * * cdef class Basis: # <<<<<<<<<<<<<< @@ -2407,7 +2407,7 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ * self.n = self.X.shape[1] * self.endspan = kwargs['endspan'] if 'endspan' in kwargs else -1 # <<<<<<<<<<<<<< * self.minspan = kwargs['minspan'] if 'minspan' in kwargs else -1 - * self.endspan_alpha = kwargs['endspan_alpha'] if 'endspan_alpha' in kwargs else .05 + * self.endspan_alpha = kwargs[ */ __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__endspan), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if ((__pyx_t_4 != 0)) { @@ -2427,8 +2427,8 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ * self.n = self.X.shape[1] * self.endspan = kwargs['endspan'] if 'endspan' in kwargs else -1 * self.minspan = kwargs['minspan'] if 'minspan' in kwargs else -1 # <<<<<<<<<<<<<< - * self.endspan_alpha = kwargs['endspan_alpha'] if 'endspan_alpha' in kwargs else .05 - * self.minspan_alpha = kwargs['minspan_alpha'] if 'minspan_alpha' in kwargs else .05 + * self.endspan_alpha = kwargs[ + * 'endspan_alpha'] if 'endspan_alpha' in kwargs else .05 */ __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__minspan), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if ((__pyx_t_4 != 0)) { @@ -2444,85 +2444,157 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_self->minspan = __pyx_t_5; - /* "sklearn/earth/_forward.pyx":35 - * self.endspan = kwargs['endspan'] if 'endspan' in kwargs else -1 + /* "sklearn/earth/_forward.pyx":36 * self.minspan = kwargs['minspan'] if 'minspan' in kwargs else -1 - * self.endspan_alpha = kwargs['endspan_alpha'] if 'endspan_alpha' in kwargs else .05 # <<<<<<<<<<<<<< - * self.minspan_alpha = kwargs['minspan_alpha'] if 'minspan_alpha' in kwargs else .05 - * self.max_terms = kwargs['max_terms'] if 'max_terms' in kwargs else 2*self.n + 10 + * self.endspan_alpha = kwargs[ + * 'endspan_alpha'] if 'endspan_alpha' in kwargs else .05 # <<<<<<<<<<<<<< + * self.minspan_alpha = kwargs[ + * 'minspan_alpha'] if 'minspan_alpha' in kwargs else .05 */ - __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__endspan_alpha), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__endspan_alpha), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if ((__pyx_t_4 != 0)) { + + /* "sklearn/earth/_forward.pyx":35 + * self.endspan = kwargs['endspan'] if 'endspan' in kwargs else -1 + * self.minspan = kwargs['minspan'] if 'minspan' in kwargs else -1 + * self.endspan_alpha = kwargs[ # <<<<<<<<<<<<<< + * 'endspan_alpha'] if 'endspan_alpha' in kwargs else .05 + * self.minspan_alpha = kwargs[ + */ __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__endspan_alpha)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_1 = 0; } else { - __pyx_t_1 = PyFloat_FromDouble(.05); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/earth/_forward.pyx":36 + * self.minspan = kwargs['minspan'] if 'minspan' in kwargs else -1 + * self.endspan_alpha = kwargs[ + * 'endspan_alpha'] if 'endspan_alpha' in kwargs else .05 # <<<<<<<<<<<<<< + * self.minspan_alpha = kwargs[ + * 'minspan_alpha'] if 'minspan_alpha' in kwargs else .05 + */ + __pyx_t_1 = PyFloat_FromDouble(.05); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_1 = 0; } __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_self->endspan_alpha = __pyx_t_6; - /* "sklearn/earth/_forward.pyx":36 + /* "sklearn/earth/_forward.pyx":35 + * self.endspan = kwargs['endspan'] if 'endspan' in kwargs else -1 * self.minspan = kwargs['minspan'] if 'minspan' in kwargs else -1 - * self.endspan_alpha = kwargs['endspan_alpha'] if 'endspan_alpha' in kwargs else .05 - * self.minspan_alpha = kwargs['minspan_alpha'] if 'minspan_alpha' in kwargs else .05 # <<<<<<<<<<<<<< - * self.max_terms = kwargs['max_terms'] if 'max_terms' in kwargs else 2*self.n + 10 - * self.max_degree = kwargs['max_degree'] if 'max_degree' in kwargs else 1 + * self.endspan_alpha = kwargs[ # <<<<<<<<<<<<<< + * 'endspan_alpha'] if 'endspan_alpha' in kwargs else .05 + * self.minspan_alpha = kwargs[ + */ + __pyx_v_self->endspan_alpha = __pyx_t_6; + + /* "sklearn/earth/_forward.pyx":38 + * 'endspan_alpha'] if 'endspan_alpha' in kwargs else .05 + * self.minspan_alpha = kwargs[ + * 'minspan_alpha'] if 'minspan_alpha' in kwargs else .05 # <<<<<<<<<<<<<< + * self.max_terms = kwargs[ + * 'max_terms'] if 'max_terms' in kwargs else 2 * self.n + 10 */ - __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__minspan_alpha), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__minspan_alpha), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if ((__pyx_t_4 != 0)) { - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__minspan_alpha)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/earth/_forward.pyx":37 + * self.endspan_alpha = kwargs[ + * 'endspan_alpha'] if 'endspan_alpha' in kwargs else .05 + * self.minspan_alpha = kwargs[ # <<<<<<<<<<<<<< + * 'minspan_alpha'] if 'minspan_alpha' in kwargs else .05 + * self.max_terms = kwargs[ + */ + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__minspan_alpha)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_1 = 0; } else { - __pyx_t_1 = PyFloat_FromDouble(.05); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/earth/_forward.pyx":38 + * 'endspan_alpha'] if 'endspan_alpha' in kwargs else .05 + * self.minspan_alpha = kwargs[ + * 'minspan_alpha'] if 'minspan_alpha' in kwargs else .05 # <<<<<<<<<<<<<< + * self.max_terms = kwargs[ + * 'max_terms'] if 'max_terms' in kwargs else 2 * self.n + 10 + */ + __pyx_t_1 = PyFloat_FromDouble(.05); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_1 = 0; } - __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_v_self->minspan_alpha = __pyx_t_6; /* "sklearn/earth/_forward.pyx":37 - * self.endspan_alpha = kwargs['endspan_alpha'] if 'endspan_alpha' in kwargs else .05 - * self.minspan_alpha = kwargs['minspan_alpha'] if 'minspan_alpha' in kwargs else .05 - * self.max_terms = kwargs['max_terms'] if 'max_terms' in kwargs else 2*self.n + 10 # <<<<<<<<<<<<<< + * self.endspan_alpha = kwargs[ + * 'endspan_alpha'] if 'endspan_alpha' in kwargs else .05 + * self.minspan_alpha = kwargs[ # <<<<<<<<<<<<<< + * 'minspan_alpha'] if 'minspan_alpha' in kwargs else .05 + * self.max_terms = kwargs[ + */ + __pyx_v_self->minspan_alpha = __pyx_t_6; + + /* "sklearn/earth/_forward.pyx":40 + * 'minspan_alpha'] if 'minspan_alpha' in kwargs else .05 + * self.max_terms = kwargs[ + * 'max_terms'] if 'max_terms' in kwargs else 2 * self.n + 10 # <<<<<<<<<<<<<< * self.max_degree = kwargs['max_degree'] if 'max_degree' in kwargs else 1 * self.thresh = kwargs['thresh'] if 'thresh' in kwargs else 0.001 */ - __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__max_terms), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__max_terms), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if ((__pyx_t_4 != 0)) { - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__max_terms)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/earth/_forward.pyx":39 + * self.minspan_alpha = kwargs[ + * 'minspan_alpha'] if 'minspan_alpha' in kwargs else .05 + * self.max_terms = kwargs[ # <<<<<<<<<<<<<< + * 'max_terms'] if 'max_terms' in kwargs else 2 * self.n + 10 + * self.max_degree = kwargs['max_degree'] if 'max_degree' in kwargs else 1 + */ + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__max_terms)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_1 = 0; } else { - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((2 * __pyx_v_self->n) + 10)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/earth/_forward.pyx":40 + * 'minspan_alpha'] if 'minspan_alpha' in kwargs else .05 + * self.max_terms = kwargs[ + * 'max_terms'] if 'max_terms' in kwargs else 2 * self.n + 10 # <<<<<<<<<<<<<< + * self.max_degree = kwargs['max_degree'] if 'max_degree' in kwargs else 1 + * self.thresh = kwargs['thresh'] if 'thresh' in kwargs else 0.001 + */ + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((2 * __pyx_v_self->n) + 10)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_1 = 0; } - __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + + /* "sklearn/earth/_forward.pyx":39 + * self.minspan_alpha = kwargs[ + * 'minspan_alpha'] if 'minspan_alpha' in kwargs else .05 + * self.max_terms = kwargs[ # <<<<<<<<<<<<<< + * 'max_terms'] if 'max_terms' in kwargs else 2 * self.n + 10 + * self.max_degree = kwargs['max_degree'] if 'max_degree' in kwargs else 1 + */ __pyx_v_self->max_terms = __pyx_t_5; - /* "sklearn/earth/_forward.pyx":38 - * self.minspan_alpha = kwargs['minspan_alpha'] if 'minspan_alpha' in kwargs else .05 - * self.max_terms = kwargs['max_terms'] if 'max_terms' in kwargs else 2*self.n + 10 + /* "sklearn/earth/_forward.pyx":41 + * self.max_terms = kwargs[ + * 'max_terms'] if 'max_terms' in kwargs else 2 * self.n + 10 * self.max_degree = kwargs['max_degree'] if 'max_degree' in kwargs else 1 # <<<<<<<<<<<<<< * self.thresh = kwargs['thresh'] if 'thresh' in kwargs else 0.001 * self.penalty = kwargs['penalty'] if 'penalty' in kwargs else 3.0 */ - __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__max_degree), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__max_degree), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if ((__pyx_t_4 != 0)) { - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__max_degree)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__max_degree)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_1 = 0; @@ -2530,66 +2602,74 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ __Pyx_INCREF(__pyx_int_1); __pyx_t_3 = __pyx_int_1; } - __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_self->max_degree = __pyx_t_5; - /* "sklearn/earth/_forward.pyx":39 - * self.max_terms = kwargs['max_terms'] if 'max_terms' in kwargs else 2*self.n + 10 + /* "sklearn/earth/_forward.pyx":42 + * 'max_terms'] if 'max_terms' in kwargs else 2 * self.n + 10 * self.max_degree = kwargs['max_degree'] if 'max_degree' in kwargs else 1 * self.thresh = kwargs['thresh'] if 'thresh' in kwargs else 0.001 # <<<<<<<<<<<<<< * self.penalty = kwargs['penalty'] if 'penalty' in kwargs else 3.0 - * self.check_every = kwargs['check_every'] if 'check_every' in kwargs else -1 + * self.check_every = kwargs[ */ - __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__thresh), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__thresh), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if ((__pyx_t_4 != 0)) { - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__thresh)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__thresh)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_1 = 0; } else { - __pyx_t_1 = PyFloat_FromDouble(0.001); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(0.001); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_1 = 0; } - __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_self->thresh = __pyx_t_6; - /* "sklearn/earth/_forward.pyx":40 + /* "sklearn/earth/_forward.pyx":43 * self.max_degree = kwargs['max_degree'] if 'max_degree' in kwargs else 1 * self.thresh = kwargs['thresh'] if 'thresh' in kwargs else 0.001 * self.penalty = kwargs['penalty'] if 'penalty' in kwargs else 3.0 # <<<<<<<<<<<<<< - * self.check_every = kwargs['check_every'] if 'check_every' in kwargs else -1 - * self.min_search_points = kwargs['min_search_points'] if 'min_search_points' in kwargs else 100 + * self.check_every = kwargs[ + * 'check_every'] if 'check_every' in kwargs else -1 */ - __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__penalty), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__penalty), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if ((__pyx_t_4 != 0)) { - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__penalty)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__penalty)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_1 = 0; } else { - __pyx_t_1 = PyFloat_FromDouble(3.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(3.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_1 = 0; } - __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_self->penalty = __pyx_t_6; - /* "sklearn/earth/_forward.pyx":41 - * self.thresh = kwargs['thresh'] if 'thresh' in kwargs else 0.001 + /* "sklearn/earth/_forward.pyx":45 * self.penalty = kwargs['penalty'] if 'penalty' in kwargs else 3.0 - * self.check_every = kwargs['check_every'] if 'check_every' in kwargs else -1 # <<<<<<<<<<<<<< - * self.min_search_points = kwargs['min_search_points'] if 'min_search_points' in kwargs else 100 - * self.xlabels = kwargs['xlabels'] if 'xlabels' in kwargs else None + * self.check_every = kwargs[ + * 'check_every'] if 'check_every' in kwargs else -1 # <<<<<<<<<<<<<< + * self.min_search_points = kwargs[ + * 'min_search_points'] if 'min_search_points' in kwargs else 100 */ - __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__check_every), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__check_every), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if ((__pyx_t_4 != 0)) { - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__check_every)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/earth/_forward.pyx":44 + * self.thresh = kwargs['thresh'] if 'thresh' in kwargs else 0.001 + * self.penalty = kwargs['penalty'] if 'penalty' in kwargs else 3.0 + * self.check_every = kwargs[ # <<<<<<<<<<<<<< + * 'check_every'] if 'check_every' in kwargs else -1 + * self.min_search_points = kwargs[ + */ + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__check_every)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_1 = 0; @@ -2597,20 +2677,28 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ __Pyx_INCREF(__pyx_int_neg_1); __pyx_t_3 = __pyx_int_neg_1; } - __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_self->check_every = __pyx_t_5; - /* "sklearn/earth/_forward.pyx":42 - * self.penalty = kwargs['penalty'] if 'penalty' in kwargs else 3.0 - * self.check_every = kwargs['check_every'] if 'check_every' in kwargs else -1 - * self.min_search_points = kwargs['min_search_points'] if 'min_search_points' in kwargs else 100 # <<<<<<<<<<<<<< + /* "sklearn/earth/_forward.pyx":47 + * 'check_every'] if 'check_every' in kwargs else -1 + * self.min_search_points = kwargs[ + * 'min_search_points'] if 'min_search_points' in kwargs else 100 # <<<<<<<<<<<<<< * self.xlabels = kwargs['xlabels'] if 'xlabels' in kwargs else None * if self.xlabels is None: */ - __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__min_search_points), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__min_search_points), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if ((__pyx_t_4 != 0)) { - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__min_search_points)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/earth/_forward.pyx":46 + * self.check_every = kwargs[ + * 'check_every'] if 'check_every' in kwargs else -1 + * self.min_search_points = kwargs[ # <<<<<<<<<<<<<< + * 'min_search_points'] if 'min_search_points' in kwargs else 100 + * self.xlabels = kwargs['xlabels'] if 'xlabels' in kwargs else None + */ + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__min_search_points)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_1 = 0; @@ -2618,20 +2706,20 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ __Pyx_INCREF(__pyx_int_100); __pyx_t_3 = __pyx_int_100; } - __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_self->min_search_points = __pyx_t_5; - /* "sklearn/earth/_forward.pyx":43 - * self.check_every = kwargs['check_every'] if 'check_every' in kwargs else -1 - * self.min_search_points = kwargs['min_search_points'] if 'min_search_points' in kwargs else 100 + /* "sklearn/earth/_forward.pyx":48 + * self.min_search_points = kwargs[ + * 'min_search_points'] if 'min_search_points' in kwargs else 100 * self.xlabels = kwargs['xlabels'] if 'xlabels' in kwargs else None # <<<<<<<<<<<<<< * if self.xlabels is None: - * self.xlabels = ['x'+str(i) for i in range(self.n)] + * self.xlabels = ['x' + str(i) for i in range(self.n)] */ - __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__xlabels), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__xlabels), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if ((__pyx_t_4 != 0)) { - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__xlabels)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__xlabels)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_1 = 0; @@ -2639,50 +2727,50 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ __Pyx_INCREF(Py_None); __pyx_t_3 = Py_None; } - if (!(likely(PyList_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(PyList_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_3); __Pyx_GOTREF(__pyx_v_self->xlabels); __Pyx_DECREF(((PyObject *)__pyx_v_self->xlabels)); __pyx_v_self->xlabels = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/earth/_forward.pyx":44 - * self.min_search_points = kwargs['min_search_points'] if 'min_search_points' in kwargs else 100 + /* "sklearn/earth/_forward.pyx":49 + * 'min_search_points'] if 'min_search_points' in kwargs else 100 * self.xlabels = kwargs['xlabels'] if 'xlabels' in kwargs else None * if self.xlabels is None: # <<<<<<<<<<<<<< - * self.xlabels = ['x'+str(i) for i in range(self.n)] + * self.xlabels = ['x' + str(i) for i in range(self.n)] * if self.check_every < 0: */ __pyx_t_4 = (__pyx_v_self->xlabels == ((PyObject*)Py_None)); __pyx_t_7 = (__pyx_t_4 != 0); if (__pyx_t_7) { - /* "sklearn/earth/_forward.pyx":45 + /* "sklearn/earth/_forward.pyx":50 * self.xlabels = kwargs['xlabels'] if 'xlabels' in kwargs else None * if self.xlabels is None: - * self.xlabels = ['x'+str(i) for i in range(self.n)] # <<<<<<<<<<<<<< + * self.xlabels = ['x' + str(i) for i in range(self.n)] # <<<<<<<<<<<<<< * if self.check_every < 0: - * self.check_every = (self.m / self.min_search_points) if self.m > self.min_search_points else 1 + * self.check_every = (self.m / self.min_search_points) if self.m > self.min_search_points else 1 */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_8 = __pyx_v_self->n; for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { __pyx_v_i = __pyx_t_9; - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Add(((PyObject *)__pyx_n_s__x), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Add(((PyObject *)__pyx_n_s__x), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); @@ -2694,22 +2782,22 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ } __pyx_L3:; - /* "sklearn/earth/_forward.pyx":46 + /* "sklearn/earth/_forward.pyx":51 * if self.xlabels is None: - * self.xlabels = ['x'+str(i) for i in range(self.n)] + * self.xlabels = ['x' + str(i) for i in range(self.n)] * if self.check_every < 0: # <<<<<<<<<<<<<< - * self.check_every = (self.m / self.min_search_points) if self.m > self.min_search_points else 1 - * self.sst = (np.dot(self.y,self.y) - (np.dot(np.sqrt(self.sample_weight),self.y) / np.sqrt(np.sum(self.sample_weight)))**2) / self.m + * self.check_every = (self.m / self.min_search_points) if self.m > self.min_search_points else 1 + * self.sst = (np.dot(self.y, self.y) - */ __pyx_t_7 = ((__pyx_v_self->check_every < 0) != 0); if (__pyx_t_7) { - /* "sklearn/earth/_forward.pyx":47 - * self.xlabels = ['x'+str(i) for i in range(self.n)] + /* "sklearn/earth/_forward.pyx":52 + * self.xlabels = ['x' + str(i) for i in range(self.n)] * if self.check_every < 0: - * self.check_every = (self.m / self.min_search_points) if self.m > self.min_search_points else 1 # <<<<<<<<<<<<<< - * self.sst = (np.dot(self.y,self.y) - (np.dot(np.sqrt(self.sample_weight),self.y) / np.sqrt(np.sum(self.sample_weight)))**2) / self.m - * self.y_squared = np.dot(self.y,self.y) + * self.check_every = (self.m / self.min_search_points) if self.m > self.min_search_points else 1 # <<<<<<<<<<<<<< + * self.sst = (np.dot(self.y, self.y) - + * (np.dot(np.sqrt(self.sample_weight), self.y) / np.sqrt(np.sum(self.sample_weight))) ** 2) / self.m */ if (((__pyx_v_self->m > __pyx_v_self->min_search_points) != 0)) { __pyx_t_10 = ((int)(__pyx_v_self->m / __pyx_v_self->min_search_points)); @@ -2721,19 +2809,19 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ } __pyx_L6:; - /* "sklearn/earth/_forward.pyx":48 + /* "sklearn/earth/_forward.pyx":53 * if self.check_every < 0: - * self.check_every = (self.m / self.min_search_points) if self.m > self.min_search_points else 1 - * self.sst = (np.dot(self.y,self.y) - (np.dot(np.sqrt(self.sample_weight),self.y) / np.sqrt(np.sum(self.sample_weight)))**2) / self.m # <<<<<<<<<<<<<< - * self.y_squared = np.dot(self.y,self.y) - * self.record = ForwardPassRecord(self.m,self.n,self.penalty,self.sst,self.xlabels) + * self.check_every = (self.m / self.min_search_points) if self.m > self.min_search_points else 1 + * self.sst = (np.dot(self.y, self.y) - # <<<<<<<<<<<<<< + * (np.dot(np.sqrt(self.sample_weight), self.y) / np.sqrt(np.sum(self.sample_weight))) ** 2) / self.m + * self.y_squared = np.dot(self.y, self.y) */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_self->y)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self->y)); @@ -2741,30 +2829,38 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ __Pyx_INCREF(((PyObject *)__pyx_v_self->y)); PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_self->y)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self->y)); - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/earth/_forward.pyx":54 + * self.check_every = (self.m / self.min_search_points) if self.m > self.min_search_points else 1 + * self.sst = (np.dot(self.y, self.y) - + * (np.dot(np.sqrt(self.sample_weight), self.y) / np.sqrt(np.sum(self.sample_weight))) ** 2) / self.m # <<<<<<<<<<<<<< + * self.y_squared = np.dot(self.y, self.y) + * self.record = ForwardPassRecord( + */ + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__sqrt); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__sqrt); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_self->sample_weight)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self->sample_weight)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self->sample_weight)); - __pyx_t_12 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_12); __Pyx_GIVEREF(__pyx_t_12); @@ -2772,72 +2868,80 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_self->y)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self->y)); __pyx_t_12 = 0; - __pyx_t_12 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__sqrt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__sqrt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__sum); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__sum); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_self->sample_weight)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self->sample_weight)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self->sample_weight)); - __pyx_t_13 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_13); __Pyx_GIVEREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_12, __pyx_t_13); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_12, __pyx_t_13); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = PyNumber_Power(__pyx_t_3, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyNumber_Power(__pyx_t_3, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_13); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_13); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); - __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_13); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_13); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_6 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_6 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "sklearn/earth/_forward.pyx":53 + * if self.check_every < 0: + * self.check_every = (self.m / self.min_search_points) if self.m > self.min_search_points else 1 + * self.sst = (np.dot(self.y, self.y) - # <<<<<<<<<<<<<< + * (np.dot(np.sqrt(self.sample_weight), self.y) / np.sqrt(np.sum(self.sample_weight))) ** 2) / self.m + * self.y_squared = np.dot(self.y, self.y) + */ __pyx_v_self->sst = __pyx_t_6; - /* "sklearn/earth/_forward.pyx":49 - * self.check_every = (self.m / self.min_search_points) if self.m > self.min_search_points else 1 - * self.sst = (np.dot(self.y,self.y) - (np.dot(np.sqrt(self.sample_weight),self.y) / np.sqrt(np.sum(self.sample_weight)))**2) / self.m - * self.y_squared = np.dot(self.y,self.y) # <<<<<<<<<<<<<< - * self.record = ForwardPassRecord(self.m,self.n,self.penalty,self.sst,self.xlabels) - * self.basis = Basis(self.n) + /* "sklearn/earth/_forward.pyx":55 + * self.sst = (np.dot(self.y, self.y) - + * (np.dot(np.sqrt(self.sample_weight), self.y) / np.sqrt(np.sum(self.sample_weight))) ** 2) / self.m + * self.y_squared = np.dot(self.y, self.y) # <<<<<<<<<<<<<< + * self.record = ForwardPassRecord( + * self.m, self.n, self.penalty, self.sst, self.xlabels) */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__dot); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__dot); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_self->y)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self->y)); @@ -2845,30 +2949,30 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ __Pyx_INCREF(((PyObject *)__pyx_v_self->y)); PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self->y)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self->y)); - __pyx_t_3 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_self->y_squared = __pyx_t_6; - /* "sklearn/earth/_forward.pyx":50 - * self.sst = (np.dot(self.y,self.y) - (np.dot(np.sqrt(self.sample_weight),self.y) / np.sqrt(np.sum(self.sample_weight)))**2) / self.m - * self.y_squared = np.dot(self.y,self.y) - * self.record = ForwardPassRecord(self.m,self.n,self.penalty,self.sst,self.xlabels) # <<<<<<<<<<<<<< + /* "sklearn/earth/_forward.pyx":57 + * self.y_squared = np.dot(self.y, self.y) + * self.record = ForwardPassRecord( + * self.m, self.n, self.penalty, self.sst, self.xlabels) # <<<<<<<<<<<<<< * self.basis = Basis(self.n) * self.basis.append(ConstantBasisFunction()) */ - __pyx_t_3 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_13 = PyFloat_FromDouble(__pyx_v_self->penalty); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyFloat_FromDouble(__pyx_v_self->penalty); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); - __pyx_t_12 = PyFloat_FromDouble(__pyx_v_self->sst); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyFloat_FromDouble(__pyx_v_self->sst); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); @@ -2885,30 +2989,38 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ __pyx_t_1 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; - __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_ForwardPassRecord)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_ForwardPassRecord)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "sklearn/earth/_forward.pyx":56 + * (np.dot(np.sqrt(self.sample_weight), self.y) / np.sqrt(np.sum(self.sample_weight))) ** 2) / self.m + * self.y_squared = np.dot(self.y, self.y) + * self.record = ForwardPassRecord( # <<<<<<<<<<<<<< + * self.m, self.n, self.penalty, self.sst, self.xlabels) + * self.basis = Basis(self.n) + */ __Pyx_GIVEREF(__pyx_t_12); __Pyx_GOTREF(__pyx_v_self->record); __Pyx_DECREF(((PyObject *)__pyx_v_self->record)); __pyx_v_self->record = ((struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *)__pyx_t_12); __pyx_t_12 = 0; - /* "sklearn/earth/_forward.pyx":51 - * self.y_squared = np.dot(self.y,self.y) - * self.record = ForwardPassRecord(self.m,self.n,self.penalty,self.sst,self.xlabels) + /* "sklearn/earth/_forward.pyx":58 + * self.record = ForwardPassRecord( + * self.m, self.n, self.penalty, self.sst, self.xlabels) * self.basis = Basis(self.n) # <<<<<<<<<<<<<< * self.basis.append(ConstantBasisFunction()) * */ - __pyx_t_12 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->n); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->n); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_12); __Pyx_GIVEREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_Basis)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_Basis)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_GIVEREF(__pyx_t_12); @@ -2917,177 +3029,201 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ __pyx_v_self->basis = ((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)__pyx_t_12); __pyx_t_12 = 0; - /* "sklearn/earth/_forward.pyx":52 - * self.record = ForwardPassRecord(self.m,self.n,self.penalty,self.sst,self.xlabels) + /* "sklearn/earth/_forward.pyx":59 + * self.m, self.n, self.penalty, self.sst, self.xlabels) * self.basis = Basis(self.n) * self.basis.append(ConstantBasisFunction()) # <<<<<<<<<<<<<< * * self.sorting = np.empty(shape=self.m, dtype=np.int) */ - __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_ConstantBasisFunction)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_ConstantBasisFunction)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - __pyx_t_2 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->append(__pyx_v_self->basis, ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_12), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->append(__pyx_v_self->basis, ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_12), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_forward.pyx":54 + /* "sklearn/earth/_forward.pyx":61 * self.basis.append(ConstantBasisFunction()) * * self.sorting = np.empty(shape=self.m, dtype=np.int) # <<<<<<<<<<<<<< * self.mwork = np.empty(shape=self.m, dtype=np.int) * self.u = np.empty(shape=self.max_terms, dtype=float) */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_13 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__shape), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__shape), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s__int); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s__int); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->sorting); __Pyx_DECREF(((PyObject *)__pyx_v_self->sorting)); __pyx_v_self->sorting = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_forward.pyx":55 + /* "sklearn/earth/_forward.pyx":62 * * self.sorting = np.empty(shape=self.m, dtype=np.int) * self.mwork = np.empty(shape=self.m, dtype=np.int) # <<<<<<<<<<<<<< * self.u = np.empty(shape=self.max_terms, dtype=float) - * self.B_orth_times_parent_cum = np.empty(shape=self.max_terms,dtype=np.float) + * self.B_orth_times_parent_cum = np.empty( */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_12 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__shape), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__shape), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__int); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__int); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_13) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_13, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_13) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_13, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_13); __Pyx_GOTREF(__pyx_v_self->mwork); __Pyx_DECREF(((PyObject *)__pyx_v_self->mwork)); __pyx_v_self->mwork = ((PyArrayObject *)__pyx_t_13); __pyx_t_13 = 0; - /* "sklearn/earth/_forward.pyx":56 + /* "sklearn/earth/_forward.pyx":63 * self.sorting = np.empty(shape=self.m, dtype=np.int) * self.mwork = np.empty(shape=self.m, dtype=np.int) * self.u = np.empty(shape=self.max_terms, dtype=float) # <<<<<<<<<<<<<< - * self.B_orth_times_parent_cum = np.empty(shape=self.max_terms,dtype=np.float) - * self.B = np.ones(shape=(self.m,self.max_terms), order='C',dtype=np.float) + * self.B_orth_times_parent_cum = np.empty( + * shape=self.max_terms, dtype=np.float) */ - __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_13)); - __pyx_t_2 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__shape), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__shape), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)(&PyFloat_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)(&PyFloat_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_2); __Pyx_GOTREF(__pyx_v_self->u); __Pyx_DECREF(((PyObject *)__pyx_v_self->u)); __pyx_v_self->u = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_forward.pyx":57 + /* "sklearn/earth/_forward.pyx":64 * self.mwork = np.empty(shape=self.m, dtype=np.int) * self.u = np.empty(shape=self.max_terms, dtype=float) - * self.B_orth_times_parent_cum = np.empty(shape=self.max_terms,dtype=np.float) # <<<<<<<<<<<<<< - * self.B = np.ones(shape=(self.m,self.max_terms), order='C',dtype=np.float) - * self.basis.weighted_transform(self.X,self.B,self.sample_weight) + * self.B_orth_times_parent_cum = np.empty( # <<<<<<<<<<<<<< + * shape=self.max_terms, dtype=np.float) + * self.B = np.ones( */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_1 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/earth/_forward.pyx":65 + * self.u = np.empty(shape=self.max_terms, dtype=float) + * self.B_orth_times_parent_cum = np.empty( + * shape=self.max_terms, dtype=np.float) # <<<<<<<<<<<<<< + * self.B = np.ones( + * shape=(self.m, self.max_terms), order='C', dtype=np.float) + */ + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__shape), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__shape), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__float); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__float); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/earth/_forward.pyx":64 + * self.mwork = np.empty(shape=self.m, dtype=np.int) + * self.u = np.empty(shape=self.max_terms, dtype=float) + * self.B_orth_times_parent_cum = np.empty( # <<<<<<<<<<<<<< + * shape=self.max_terms, dtype=np.float) + * self.B = np.ones( + */ __Pyx_GIVEREF(__pyx_t_12); __Pyx_GOTREF(__pyx_v_self->B_orth_times_parent_cum); __Pyx_DECREF(((PyObject *)__pyx_v_self->B_orth_times_parent_cum)); __pyx_v_self->B_orth_times_parent_cum = ((PyArrayObject *)__pyx_t_12); __pyx_t_12 = 0; - /* "sklearn/earth/_forward.pyx":58 - * self.u = np.empty(shape=self.max_terms, dtype=float) - * self.B_orth_times_parent_cum = np.empty(shape=self.max_terms,dtype=np.float) - * self.B = np.ones(shape=(self.m,self.max_terms), order='C',dtype=np.float) # <<<<<<<<<<<<<< - * self.basis.weighted_transform(self.X,self.B,self.sample_weight) - * self.B_orth = self.B.copy() #An orthogonal matrix with the same column space as B + /* "sklearn/earth/_forward.pyx":66 + * self.B_orth_times_parent_cum = np.empty( + * shape=self.max_terms, dtype=np.float) + * self.B = np.ones( # <<<<<<<<<<<<<< + * shape=(self.m, self.max_terms), order='C', dtype=np.float) + * self.basis.weighted_transform(self.X, self.B, self.sample_weight) */ - __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__ones); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__ones); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_12)); - __pyx_t_13 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/earth/_forward.pyx":67 + * shape=self.max_terms, dtype=np.float) + * self.B = np.ones( + * shape=(self.m, self.max_terms), order='C', dtype=np.float) # <<<<<<<<<<<<<< + * self.basis.weighted_transform(self.X, self.B, self.sample_weight) + * # An orthogonal matrix with the same column space as B + */ + __pyx_t_13 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); - __pyx_t_1 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_13); __Pyx_GIVEREF(__pyx_t_13); @@ -3095,33 +3231,41 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ __Pyx_GIVEREF(__pyx_t_1); __pyx_t_13 = 0; __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__shape), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__shape), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__float); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__float); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/earth/_forward.pyx":66 + * self.B_orth_times_parent_cum = np.empty( + * shape=self.max_terms, dtype=np.float) + * self.B = np.ones( # <<<<<<<<<<<<<< + * shape=(self.m, self.max_terms), order='C', dtype=np.float) + * self.basis.weighted_transform(self.X, self.B, self.sample_weight) + */ __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->B); __Pyx_DECREF(((PyObject *)__pyx_v_self->B)); __pyx_v_self->B = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_forward.pyx":59 - * self.B_orth_times_parent_cum = np.empty(shape=self.max_terms,dtype=np.float) - * self.B = np.ones(shape=(self.m,self.max_terms), order='C',dtype=np.float) - * self.basis.weighted_transform(self.X,self.B,self.sample_weight) # <<<<<<<<<<<<<< - * self.B_orth = self.B.copy() #An orthogonal matrix with the same column space as B - * self.u = np.empty(shape=self.max_terms, dtype=np.float) + /* "sklearn/earth/_forward.pyx":68 + * self.B = np.ones( + * shape=(self.m, self.max_terms), order='C', dtype=np.float) + * self.basis.weighted_transform(self.X, self.B, self.sample_weight) # <<<<<<<<<<<<<< + * # An orthogonal matrix with the same column space as B + * self.B_orth = self.B.copy() */ __pyx_t_1 = ((PyObject *)__pyx_v_self->X); __Pyx_INCREF(__pyx_t_1); @@ -3129,141 +3273,141 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ __Pyx_INCREF(__pyx_t_12); __pyx_t_2 = ((PyObject *)__pyx_v_self->sample_weight); __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->weighted_transform(__pyx_v_self->basis, ((PyArrayObject *)__pyx_t_1), ((PyArrayObject *)__pyx_t_12), ((PyArrayObject *)__pyx_t_2), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->weighted_transform(__pyx_v_self->basis, ((PyArrayObject *)__pyx_t_1), ((PyArrayObject *)__pyx_t_12), ((PyArrayObject *)__pyx_t_2), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/earth/_forward.pyx":60 - * self.B = np.ones(shape=(self.m,self.max_terms), order='C',dtype=np.float) - * self.basis.weighted_transform(self.X,self.B,self.sample_weight) - * self.B_orth = self.B.copy() #An orthogonal matrix with the same column space as B # <<<<<<<<<<<<<< + /* "sklearn/earth/_forward.pyx":70 + * self.basis.weighted_transform(self.X, self.B, self.sample_weight) + * # An orthogonal matrix with the same column space as B + * self.B_orth = self.B.copy() # <<<<<<<<<<<<<< * self.u = np.empty(shape=self.max_terms, dtype=np.float) * self.c = np.empty(shape=self.max_terms, dtype=np.float) */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->B), __pyx_n_s__copy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->B), __pyx_n_s__copy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_2); __Pyx_GOTREF(__pyx_v_self->B_orth); __Pyx_DECREF(((PyObject *)__pyx_v_self->B_orth)); __pyx_v_self->B_orth = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_forward.pyx":61 - * self.basis.weighted_transform(self.X,self.B,self.sample_weight) - * self.B_orth = self.B.copy() #An orthogonal matrix with the same column space as B + /* "sklearn/earth/_forward.pyx":71 + * # An orthogonal matrix with the same column space as B + * self.B_orth = self.B.copy() * self.u = np.empty(shape=self.max_terms, dtype=np.float) # <<<<<<<<<<<<<< * self.c = np.empty(shape=self.max_terms, dtype=np.float) * self.norms = np.empty(shape=self.max_terms, dtype=np.float) */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_12 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__shape), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__shape), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__float); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__float); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->u); __Pyx_DECREF(((PyObject *)__pyx_v_self->u)); __pyx_v_self->u = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_forward.pyx":62 - * self.B_orth = self.B.copy() #An orthogonal matrix with the same column space as B + /* "sklearn/earth/_forward.pyx":72 + * self.B_orth = self.B.copy() * self.u = np.empty(shape=self.max_terms, dtype=np.float) * self.c = np.empty(shape=self.max_terms, dtype=np.float) # <<<<<<<<<<<<<< * self.norms = np.empty(shape=self.max_terms, dtype=np.float) * self.c_squared = 0.0 */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_3 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__shape), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__shape), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__float); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__float); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_12); __Pyx_GOTREF(__pyx_v_self->c); __Pyx_DECREF(((PyObject *)__pyx_v_self->c)); __pyx_v_self->c = ((PyArrayObject *)__pyx_t_12); __pyx_t_12 = 0; - /* "sklearn/earth/_forward.pyx":63 + /* "sklearn/earth/_forward.pyx":73 * self.u = np.empty(shape=self.max_terms, dtype=np.float) * self.c = np.empty(shape=self.max_terms, dtype=np.float) * self.norms = np.empty(shape=self.max_terms, dtype=np.float) # <<<<<<<<<<<<<< * self.c_squared = 0.0 * self.sort_tracker = np.empty(shape=self.m, dtype=np.int) */ - __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_12)); - __pyx_t_2 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__shape), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__shape), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__float); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__float); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_3); __Pyx_GOTREF(__pyx_v_self->norms); __Pyx_DECREF(((PyObject *)__pyx_v_self->norms)); __pyx_v_self->norms = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/earth/_forward.pyx":64 + /* "sklearn/earth/_forward.pyx":74 * self.c = np.empty(shape=self.max_terms, dtype=np.float) * self.norms = np.empty(shape=self.max_terms, dtype=np.float) * self.c_squared = 0.0 # <<<<<<<<<<<<<< @@ -3272,43 +3416,43 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ */ __pyx_v_self->c_squared = 0.0; - /* "sklearn/earth/_forward.pyx":65 + /* "sklearn/earth/_forward.pyx":75 * self.norms = np.empty(shape=self.max_terms, dtype=np.float) * self.c_squared = 0.0 * self.sort_tracker = np.empty(shape=self.m, dtype=np.int) # <<<<<<<<<<<<<< * for i in range(self.m): * self.sort_tracker[i] = i */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__shape), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__shape), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__int); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__int); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_2); __Pyx_GOTREF(__pyx_v_self->sort_tracker); __Pyx_DECREF(((PyObject *)__pyx_v_self->sort_tracker)); __pyx_v_self->sort_tracker = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_forward.pyx":66 + /* "sklearn/earth/_forward.pyx":76 * self.c_squared = 0.0 * self.sort_tracker = np.empty(shape=self.m, dtype=np.int) * for i in range(self.m): # <<<<<<<<<<<<<< @@ -3319,100 +3463,100 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { __pyx_v_i = __pyx_t_9; - /* "sklearn/earth/_forward.pyx":67 + /* "sklearn/earth/_forward.pyx":77 * self.sort_tracker = np.empty(shape=self.m, dtype=np.int) * for i in range(self.m): * self.sort_tracker[i] = i # <<<<<<<<<<<<<< * self.zero_tol = 1e-6 * */ - __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_self->sort_tracker), __pyx_v_i, __pyx_t_2, sizeof(__pyx_t_7sklearn_5earth_8_forward_INDEX_t)+1, __Pyx_PyInt_to_py_npy_ulonglong, 0, 0, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_self->sort_tracker), __pyx_v_i, __pyx_t_2, sizeof(__pyx_t_7sklearn_5earth_8_forward_INDEX_t)+1, __Pyx_PyInt_to_py_npy_ulonglong, 0, 0, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } - /* "sklearn/earth/_forward.pyx":68 + /* "sklearn/earth/_forward.pyx":78 * for i in range(self.m): * self.sort_tracker[i] = i * self.zero_tol = 1e-6 # <<<<<<<<<<<<<< * - * self.linear_variables = np.zeros(shape=self.n,dtype=np.int) + * self.linear_variables = np.zeros(shape=self.n, dtype=np.int) */ __pyx_v_self->zero_tol = 1e-6; - /* "sklearn/earth/_forward.pyx":70 + /* "sklearn/earth/_forward.pyx":80 * self.zero_tol = 1e-6 * - * self.linear_variables = np.zeros(shape=self.n,dtype=np.int) # <<<<<<<<<<<<<< + * self.linear_variables = np.zeros(shape=self.n, dtype=np.int) # <<<<<<<<<<<<<< * self.init_linear_variables() * */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_12 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->n); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->n); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__shape), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__shape), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__int); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__int); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->linear_variables); __Pyx_DECREF(((PyObject *)__pyx_v_self->linear_variables)); __pyx_v_self->linear_variables = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_forward.pyx":71 + /* "sklearn/earth/_forward.pyx":81 * - * self.linear_variables = np.zeros(shape=self.n,dtype=np.int) + * self.linear_variables = np.zeros(shape=self.n, dtype=np.int) * self.init_linear_variables() # <<<<<<<<<<<<<< * - * #Add in user selected linear variables + * # Add in user selected linear variables */ - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->init_linear_variables(__pyx_v_self, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->init_linear_variables(__pyx_v_self, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_forward.pyx":74 + /* "sklearn/earth/_forward.pyx":84 * - * #Add in user selected linear variables + * # Add in user selected linear variables * if 'linvars' in kwargs: # <<<<<<<<<<<<<< * for linvar in kwargs['linvars']: * if linvar in self.xlabels: */ - __pyx_t_7 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__linvars), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__linvars), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = (__pyx_t_7 != 0); if (__pyx_t_4) { - /* "sklearn/earth/_forward.pyx":75 - * #Add in user selected linear variables + /* "sklearn/earth/_forward.pyx":85 + * # Add in user selected linear variables * if 'linvars' in kwargs: * for linvar in kwargs['linvars']: # <<<<<<<<<<<<<< * if linvar in self.xlabels: * self.linear_variables[self.xlabels.index(linvar)] = 1 */ - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__linvars)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__linvars)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) { __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_14 = 0; __pyx_t_15 = NULL; } else { - __pyx_t_14 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_15 = Py_TYPE(__pyx_t_2)->tp_iternext; } @@ -3421,23 +3565,23 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_2)) { if (__pyx_t_14 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_14); __Pyx_INCREF(__pyx_t_1); __pyx_t_14++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_14); __Pyx_INCREF(__pyx_t_1); __pyx_t_14++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_2)) { if (__pyx_t_14 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_14); __Pyx_INCREF(__pyx_t_1); __pyx_t_14++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_14); __Pyx_INCREF(__pyx_t_1); __pyx_t_14++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_1 = __pyx_t_15(__pyx_t_2); if (unlikely(!__pyx_t_1)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } @@ -3447,86 +3591,86 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ __pyx_v_linvar = __pyx_t_1; __pyx_t_1 = 0; - /* "sklearn/earth/_forward.pyx":76 + /* "sklearn/earth/_forward.pyx":86 * if 'linvars' in kwargs: * for linvar in kwargs['linvars']: * if linvar in self.xlabels: # <<<<<<<<<<<<<< * self.linear_variables[self.xlabels.index(linvar)] = 1 * elif linvar in range(self.n): */ - __pyx_t_4 = (__Pyx_PySequence_Contains(__pyx_v_linvar, ((PyObject *)__pyx_v_self->xlabels), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (__Pyx_PySequence_Contains(__pyx_v_linvar, ((PyObject *)__pyx_v_self->xlabels), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_7 = (__pyx_t_4 != 0); if (__pyx_t_7) { - /* "sklearn/earth/_forward.pyx":77 + /* "sklearn/earth/_forward.pyx":87 * for linvar in kwargs['linvars']: * if linvar in self.xlabels: * self.linear_variables[self.xlabels.index(linvar)] = 1 # <<<<<<<<<<<<<< * elif linvar in range(self.n): * self.linear_variables[linvar] = 1 */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->xlabels), __pyx_n_s__index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->xlabels), __pyx_n_s__index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_linvar); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_linvar); __Pyx_GIVEREF(__pyx_v_linvar); - __pyx_t_12 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (PyObject_SetItem(((PyObject *)__pyx_v_self->linear_variables), __pyx_t_12, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(((PyObject *)__pyx_v_self->linear_variables), __pyx_t_12, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; goto __pyx_L12; } - /* "sklearn/earth/_forward.pyx":78 + /* "sklearn/earth/_forward.pyx":88 * if linvar in self.xlabels: * self.linear_variables[self.xlabels.index(linvar)] = 1 * elif linvar in range(self.n): # <<<<<<<<<<<<<< * self.linear_variables[linvar] = 1 * else: */ - __pyx_t_12 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->n); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->n); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_12); __Pyx_GIVEREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_7 = (__Pyx_PySequence_Contains(__pyx_v_linvar, __pyx_t_12, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = (__Pyx_PySequence_Contains(__pyx_v_linvar, __pyx_t_12, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_4 = (__pyx_t_7 != 0); if (__pyx_t_4) { - /* "sklearn/earth/_forward.pyx":79 + /* "sklearn/earth/_forward.pyx":89 * self.linear_variables[self.xlabels.index(linvar)] = 1 * elif linvar in range(self.n): * self.linear_variables[linvar] = 1 # <<<<<<<<<<<<<< * else: - * raise IndexError('Unknown variable selected in linvars argument.') + * raise IndexError( */ - if (PyObject_SetItem(((PyObject *)__pyx_v_self->linear_variables), __pyx_v_linvar, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(((PyObject *)__pyx_v_self->linear_variables), __pyx_v_linvar, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L12; } /*else*/ { - /* "sklearn/earth/_forward.pyx":81 + /* "sklearn/earth/_forward.pyx":91 * self.linear_variables[linvar] = 1 * else: - * raise IndexError('Unknown variable selected in linvars argument.') # <<<<<<<<<<<<<< + * raise IndexError( # <<<<<<<<<<<<<< + * 'Unknown variable selected in linvars argument.') * - * #Initialize B_orth, c, and c_squared (assuming column 0 of B_orth is already filled with 1) */ - __pyx_t_12 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_Raise(__pyx_t_12, 0, 0, 0); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L12:; } @@ -3535,9 +3679,9 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ } __pyx_L9:; - /* "sklearn/earth/_forward.pyx":84 - * - * #Initialize B_orth, c, and c_squared (assuming column 0 of B_orth is already filled with 1) + /* "sklearn/earth/_forward.pyx":96 + * # Initialize B_orth, c, and c_squared (assuming column 0 of B_orth is + * # already filled with 1) * self.orthonormal_update(0) # <<<<<<<<<<<<<< * * cpdef Basis get_basis(ForwardPasser self): @@ -3572,7 +3716,7 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ return __pyx_r; } -/* "sklearn/earth/_forward.pyx":86 +/* "sklearn/earth/_forward.pyx":98 * self.orthonormal_update(0) * * cpdef Basis get_basis(ForwardPasser self): # <<<<<<<<<<<<<< @@ -3594,13 +3738,13 @@ static struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_f_7sklearn_5earth_8 if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_basis); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_basis); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_3get_basis)) { __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7sklearn_5earth_6_basis_Basis))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7sklearn_5earth_6_basis_Basis))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -3609,7 +3753,7 @@ static struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_f_7sklearn_5earth_8 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_forward.pyx":87 + /* "sklearn/earth/_forward.pyx":99 * * cpdef Basis get_basis(ForwardPasser self): * return self.basis # <<<<<<<<<<<<<< @@ -3645,7 +3789,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_3get_basis(P return __pyx_r; } -/* "sklearn/earth/_forward.pyx":86 +/* "sklearn/earth/_forward.pyx":98 * self.orthonormal_update(0) * * cpdef Basis get_basis(ForwardPasser self): # <<<<<<<<<<<<<< @@ -3662,7 +3806,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_2get_basis(s int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_basis", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->get_basis(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->get_basis(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3680,7 +3824,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_2get_basis(s return __pyx_r; } -/* "sklearn/earth/_forward.pyx":89 +/* "sklearn/earth/_forward.pyx":101 * return self.basis * * cpdef init_linear_variables(ForwardPasser self): # <<<<<<<<<<<<<< @@ -3748,11 +3892,11 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_init_linear_v if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_5init_linear_variables)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -3762,19 +3906,19 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_init_linear_v __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_forward.pyx":93 + /* "sklearn/earth/_forward.pyx":105 * cdef INDEX_t endspan - * cdef cnp.ndarray[INT_t, ndim=1] order - * cdef cnp.ndarray[INT_t, ndim=1] linear_variables = self.linear_variables # <<<<<<<<<<<<<< - * cdef cnp.ndarray[FLOAT_t, ndim=2] B = self.B - * cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X + * cdef cnp.ndarray[INT_t, ndim = 1] order + * cdef cnp.ndarray[INT_t, ndim = 1] linear_variables = self.linear_variables # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t, ndim = 2] B = self.B + * cdef cnp.ndarray[FLOAT_t, ndim = 2] X = self.X */ __pyx_t_3 = ((PyArrayObject *)__pyx_v_self->linear_variables); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_linear_variables.rcbuffer->pybuffer, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_linear_variables = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_linear_variables.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_linear_variables.diminfo[0].strides = __pyx_pybuffernd_linear_variables.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_linear_variables.diminfo[0].shape = __pyx_pybuffernd_linear_variables.rcbuffer->pybuffer.shape[0]; } } @@ -3782,11 +3926,11 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_init_linear_v __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->linear_variables))); __pyx_v_linear_variables = ((PyArrayObject *)__pyx_v_self->linear_variables); - /* "sklearn/earth/_forward.pyx":94 - * cdef cnp.ndarray[INT_t, ndim=1] order - * cdef cnp.ndarray[INT_t, ndim=1] linear_variables = self.linear_variables - * cdef cnp.ndarray[FLOAT_t, ndim=2] B = self.B # <<<<<<<<<<<<<< - * cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X + /* "sklearn/earth/_forward.pyx":106 + * cdef cnp.ndarray[INT_t, ndim = 1] order + * cdef cnp.ndarray[INT_t, ndim = 1] linear_variables = self.linear_variables + * cdef cnp.ndarray[FLOAT_t, ndim = 2] B = self.B # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t, ndim = 2] X = self.X * if self.endspan < 0: */ __pyx_t_4 = ((PyArrayObject *)__pyx_v_self->B); @@ -3794,7 +3938,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_init_linear_v __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { __pyx_v_B = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_B.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_B.diminfo[0].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B.diminfo[0].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B.diminfo[1].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B.diminfo[1].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[1]; } } @@ -3802,19 +3946,19 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_init_linear_v __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->B))); __pyx_v_B = ((PyArrayObject *)__pyx_v_self->B); - /* "sklearn/earth/_forward.pyx":95 - * cdef cnp.ndarray[INT_t, ndim=1] linear_variables = self.linear_variables - * cdef cnp.ndarray[FLOAT_t, ndim=2] B = self.B - * cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X # <<<<<<<<<<<<<< + /* "sklearn/earth/_forward.pyx":107 + * cdef cnp.ndarray[INT_t, ndim = 1] linear_variables = self.linear_variables + * cdef cnp.ndarray[FLOAT_t, ndim = 2] B = self.B + * cdef cnp.ndarray[FLOAT_t, ndim = 2] X = self.X # <<<<<<<<<<<<<< * if self.endspan < 0: - * endspan = round(3 - log2(self.endspan_alpha/self.n)) + * endspan = round(3 - log2(self.endspan_alpha / self.n)) */ __pyx_t_5 = ((PyArrayObject *)__pyx_v_self->X); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { __pyx_v_X = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; } } @@ -3822,79 +3966,79 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_init_linear_v __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->X))); __pyx_v_X = ((PyArrayObject *)__pyx_v_self->X); - /* "sklearn/earth/_forward.pyx":96 - * cdef cnp.ndarray[FLOAT_t, ndim=2] B = self.B - * cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X + /* "sklearn/earth/_forward.pyx":108 + * cdef cnp.ndarray[FLOAT_t, ndim = 2] B = self.B + * cdef cnp.ndarray[FLOAT_t, ndim = 2] X = self.X * if self.endspan < 0: # <<<<<<<<<<<<<< - * endspan = round(3 - log2(self.endspan_alpha/self.n)) + * endspan = round(3 - log2(self.endspan_alpha / self.n)) * cdef ConstantBasisFunction root_basis_function = self.basis[0] */ __pyx_t_6 = ((__pyx_v_self->endspan < 0) != 0); if (__pyx_t_6) { - /* "sklearn/earth/_forward.pyx":97 - * cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X + /* "sklearn/earth/_forward.pyx":109 + * cdef cnp.ndarray[FLOAT_t, ndim = 2] X = self.X * if self.endspan < 0: - * endspan = round(3 - log2(self.endspan_alpha/self.n)) # <<<<<<<<<<<<<< + * endspan = round(3 - log2(self.endspan_alpha / self.n)) # <<<<<<<<<<<<<< * cdef ConstantBasisFunction root_basis_function = self.basis[0] * for variable in range(self.n): */ - __pyx_t_1 = PyFloat_FromDouble((3.0 - __pyx_f_7sklearn_5earth_5_util_log2((__pyx_v_self->endspan_alpha / __pyx_v_self->n)))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble((3.0 - __pyx_f_7sklearn_5earth_5_util_log2((__pyx_v_self->endspan_alpha / __pyx_v_self->n)))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_round, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_round, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_7 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_7 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_7 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_endspan = __pyx_t_7; goto __pyx_L3; } __pyx_L3:; - /* "sklearn/earth/_forward.pyx":98 + /* "sklearn/earth/_forward.pyx":110 * if self.endspan < 0: - * endspan = round(3 - log2(self.endspan_alpha/self.n)) + * endspan = round(3 - log2(self.endspan_alpha / self.n)) * cdef ConstantBasisFunction root_basis_function = self.basis[0] # <<<<<<<<<<<<<< * for variable in range(self.n): - * order = np.argsort(X[:,variable])[::-1] + * order = np.argsort(X[:, variable])[::-1] */ - __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->basis), 0, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->basis), 0, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7sklearn_5earth_6_basis_ConstantBasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7sklearn_5earth_6_basis_ConstantBasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_root_basis_function = ((struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_forward.pyx":99 - * endspan = round(3 - log2(self.endspan_alpha/self.n)) + /* "sklearn/earth/_forward.pyx":111 + * endspan = round(3 - log2(self.endspan_alpha / self.n)) * cdef ConstantBasisFunction root_basis_function = self.basis[0] * for variable in range(self.n): # <<<<<<<<<<<<<< - * order = np.argsort(X[:,variable])[::-1] - * if root_basis_function.valid_knots(B[order,0], X[order,variable], + * order = np.argsort(X[:, variable])[::-1] + * if root_basis_function.valid_knots(B[order, 0], X[order, variable], */ __pyx_t_7 = __pyx_v_self->n; for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { __pyx_v_variable = __pyx_t_8; - /* "sklearn/earth/_forward.pyx":100 + /* "sklearn/earth/_forward.pyx":112 * cdef ConstantBasisFunction root_basis_function = self.basis[0] * for variable in range(self.n): - * order = np.argsort(X[:,variable])[::-1] # <<<<<<<<<<<<<< - * if root_basis_function.valid_knots(B[order,0], X[order,variable], + * order = np.argsort(X[:, variable])[::-1] # <<<<<<<<<<<<<< + * if root_basis_function.valid_knots(B[order, 0], X[order, variable], * variable, self.check_every, endspan, */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__argsort); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__argsort); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_INCREF(__pyx_k_slice_4); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_k_slice_4); @@ -3902,22 +4046,22 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_init_linear_v PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_X), ((PyObject *)__pyx_t_9)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_X), ((PyObject *)__pyx_t_9)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - __pyx_t_9 = PyObject_GetItem(__pyx_t_1, __pyx_k_slice_5); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetItem(__pyx_t_1, __pyx_k_slice_5); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_10 = ((PyArrayObject *)__pyx_t_9); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -3933,21 +4077,21 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_init_linear_v } } __pyx_pybuffernd_order.diminfo[0].strides = __pyx_pybuffernd_order.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_order.diminfo[0].shape = __pyx_pybuffernd_order.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_10 = 0; __Pyx_XDECREF(((PyObject *)__pyx_v_order)); __pyx_v_order = ((PyArrayObject *)__pyx_t_9); __pyx_t_9 = 0; - /* "sklearn/earth/_forward.pyx":101 + /* "sklearn/earth/_forward.pyx":113 * for variable in range(self.n): - * order = np.argsort(X[:,variable])[::-1] - * if root_basis_function.valid_knots(B[order,0], X[order,variable], # <<<<<<<<<<<<<< + * order = np.argsort(X[:, variable])[::-1] + * if root_basis_function.valid_knots(B[order, 0], X[order, variable], # <<<<<<<<<<<<<< * variable, self.check_every, endspan, * self.minspan, self.minspan_alpha, */ - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_INCREF(((PyObject *)__pyx_v_order)); PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_v_order)); @@ -3955,13 +4099,13 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_init_linear_v __Pyx_INCREF(__pyx_int_0); PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_9)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_9)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_9 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_order)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_order)); @@ -3969,12 +4113,12 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_init_linear_v PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyObject_GetItem(((PyObject *)__pyx_v_X), ((PyObject *)__pyx_t_2)); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetItem(((PyObject *)__pyx_v_X), ((PyObject *)__pyx_t_2)); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/earth/_forward.pyx":104 + /* "sklearn/earth/_forward.pyx":116 * variable, self.check_every, endspan, * self.minspan, self.minspan_alpha, * self.n, self.mwork).shape[0] == 0: # <<<<<<<<<<<<<< @@ -3983,7 +4127,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_init_linear_v */ __pyx_t_2 = ((PyObject *)__pyx_v_self->mwork); __Pyx_INCREF(__pyx_t_2); - __pyx_t_15 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_ConstantBasisFunction *)__pyx_v_root_basis_function->__pyx_base.__pyx_vtab)->__pyx_base.valid_knots(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_root_basis_function), ((PyArrayObject *)__pyx_t_1), ((PyArrayObject *)__pyx_t_9), __pyx_v_variable, __pyx_v_self->check_every, __pyx_v_endspan, __pyx_v_self->minspan, __pyx_v_self->minspan_alpha, __pyx_v_self->n, ((PyArrayObject *)__pyx_t_2), 0)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_ConstantBasisFunction *)__pyx_v_root_basis_function->__pyx_base.__pyx_vtab)->__pyx_base.valid_knots(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_root_basis_function), ((PyArrayObject *)__pyx_t_1), ((PyArrayObject *)__pyx_t_9), __pyx_v_variable, __pyx_v_self->check_every, __pyx_v_endspan, __pyx_v_self->minspan, __pyx_v_self->minspan_alpha, __pyx_v_self->n, ((PyArrayObject *)__pyx_t_2), 0)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; @@ -3992,7 +4136,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_init_linear_v __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; if (__pyx_t_6) { - /* "sklearn/earth/_forward.pyx":105 + /* "sklearn/earth/_forward.pyx":117 * self.minspan, self.minspan_alpha, * self.n, self.mwork).shape[0] == 0: * linear_variables[variable] = 1 # <<<<<<<<<<<<<< @@ -4005,7 +4149,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_init_linear_v } /*else*/ { - /* "sklearn/earth/_forward.pyx":107 + /* "sklearn/earth/_forward.pyx":119 * linear_variables[variable] = 1 * else: * linear_variables[variable] = 0 # <<<<<<<<<<<<<< @@ -4062,7 +4206,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_5init_linear return __pyx_r; } -/* "sklearn/earth/_forward.pyx":89 +/* "sklearn/earth/_forward.pyx":101 * return self.basis * * cpdef init_linear_variables(ForwardPasser self): # <<<<<<<<<<<<<< @@ -4079,7 +4223,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_4init_linear int __pyx_clineno = 0; __Pyx_RefNannySetupContext("init_linear_variables", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->init_linear_variables(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->init_linear_variables(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4108,7 +4252,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_7get_B_orth( return __pyx_r; } -/* "sklearn/earth/_forward.pyx":109 +/* "sklearn/earth/_forward.pyx":121 * linear_variables[variable] = 0 * * def get_B_orth(ForwardPasser self): # <<<<<<<<<<<<<< @@ -4121,7 +4265,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_6get_B_orth( __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_B_orth", 0); - /* "sklearn/earth/_forward.pyx":110 + /* "sklearn/earth/_forward.pyx":122 * * def get_B_orth(ForwardPasser self): * return self.B_orth # <<<<<<<<<<<<<< @@ -4140,7 +4284,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_6get_B_orth( return __pyx_r; } -/* "sklearn/earth/_forward.pyx":112 +/* "sklearn/earth/_forward.pyx":124 * return self.B_orth * * cpdef run(ForwardPasser self): # <<<<<<<<<<<<<< @@ -4163,11 +4307,11 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_run(struct __ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__run); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__run); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_9run)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -4177,7 +4321,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_run(struct __ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_forward.pyx":114 + /* "sklearn/earth/_forward.pyx":126 * cpdef run(ForwardPasser self): * cdef INDEX_t i * while True: # <<<<<<<<<<<<<< @@ -4187,31 +4331,31 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_run(struct __ while (1) { if (!1) break; - /* "sklearn/earth/_forward.pyx":115 + /* "sklearn/earth/_forward.pyx":127 * cdef INDEX_t i * while True: * self.next_pair() # <<<<<<<<<<<<<< * if self.stop_check(): * break */ - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->next_pair(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->next_pair(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_forward.pyx":116 + /* "sklearn/earth/_forward.pyx":128 * while True: * self.next_pair() * if self.stop_check(): # <<<<<<<<<<<<<< * break * */ - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->stop_check(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->stop_check(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_3) { - /* "sklearn/earth/_forward.pyx":117 + /* "sklearn/earth/_forward.pyx":129 * self.next_pair() * if self.stop_check(): * break # <<<<<<<<<<<<<< @@ -4249,7 +4393,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_9run(PyObjec return __pyx_r; } -/* "sklearn/earth/_forward.pyx":112 +/* "sklearn/earth/_forward.pyx":124 * return self.B_orth * * cpdef run(ForwardPasser self): # <<<<<<<<<<<<<< @@ -4266,7 +4410,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_8run(struct int __pyx_clineno = 0; __Pyx_RefNannySetupContext("run", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->run(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->run(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4284,7 +4428,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_8run(struct return __pyx_r; } -/* "sklearn/earth/_forward.pyx":119 +/* "sklearn/earth/_forward.pyx":131 * break * * cdef stop_check(ForwardPasser self): # <<<<<<<<<<<<<< @@ -4308,25 +4452,25 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_stop_check(st int __pyx_clineno = 0; __Pyx_RefNannySetupContext("stop_check", 0); - /* "sklearn/earth/_forward.pyx":120 + /* "sklearn/earth/_forward.pyx":132 * * cdef stop_check(ForwardPasser self): * last = self.record.__len__() - 1 # <<<<<<<<<<<<<< * if self.record.iterations[last].get_size() + 2 > self.max_terms: * self.record.stopping_condition = MAXTERMS */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->record), __pyx_n_s____len__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->record), __pyx_n_s____len__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_last = __pyx_t_1; __pyx_t_1 = 0; - /* "sklearn/earth/_forward.pyx":121 + /* "sklearn/earth/_forward.pyx":133 * cdef stop_check(ForwardPasser self): * last = self.record.__len__() - 1 * if self.record.iterations[last].get_size() + 2 > self.max_terms: # <<<<<<<<<<<<<< @@ -4335,29 +4479,29 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_stop_check(st */ if (unlikely(((PyObject *)__pyx_v_self->record->__pyx_base.iterations) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self->record->__pyx_base.iterations), __pyx_v_last); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self->record->__pyx_base.iterations), __pyx_v_last); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__get_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__get_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_int_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_int_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_4) { - /* "sklearn/earth/_forward.pyx":122 + /* "sklearn/earth/_forward.pyx":134 * last = self.record.__len__() - 1 * if self.record.iterations[last].get_size() + 2 > self.max_terms: * self.record.stopping_condition = MAXTERMS # <<<<<<<<<<<<<< @@ -4366,7 +4510,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_stop_check(st */ __pyx_v_self->record->stopping_condition = __pyx_e_7sklearn_5earth_8_forward_MAXTERMS; - /* "sklearn/earth/_forward.pyx":123 + /* "sklearn/earth/_forward.pyx":135 * if self.record.iterations[last].get_size() + 2 > self.max_terms: * self.record.stopping_condition = MAXTERMS * return True # <<<<<<<<<<<<<< @@ -4374,7 +4518,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_stop_check(st * if rsq > 1 - self.thresh: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; @@ -4383,35 +4527,35 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_stop_check(st } __pyx_L3:; - /* "sklearn/earth/_forward.pyx":124 + /* "sklearn/earth/_forward.pyx":136 * self.record.stopping_condition = MAXTERMS * return True * rsq = self.record.rsq(last) # <<<<<<<<<<<<<< * if rsq > 1 - self.thresh: * self.record.stopping_condition = MAXRSQ */ - __pyx_t_5 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_last); if (unlikely((__pyx_t_5 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->__pyx_base.rsq(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self->record), __pyx_t_5, 0)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_last); if (unlikely((__pyx_t_5 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->__pyx_base.rsq(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self->record), __pyx_t_5, 0)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_v_rsq = __pyx_t_3; __pyx_t_3 = 0; - /* "sklearn/earth/_forward.pyx":125 + /* "sklearn/earth/_forward.pyx":137 * return True * rsq = self.record.rsq(last) * if rsq > 1 - self.thresh: # <<<<<<<<<<<<<< * self.record.stopping_condition = MAXRSQ * return True */ - __pyx_t_3 = PyFloat_FromDouble((1.0 - __pyx_v_self->thresh)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble((1.0 - __pyx_v_self->thresh)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_RichCompare(__pyx_v_rsq, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_v_rsq, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_4) { - /* "sklearn/earth/_forward.pyx":126 + /* "sklearn/earth/_forward.pyx":138 * rsq = self.record.rsq(last) * if rsq > 1 - self.thresh: * self.record.stopping_condition = MAXRSQ # <<<<<<<<<<<<<< @@ -4420,7 +4564,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_stop_check(st */ __pyx_v_self->record->stopping_condition = __pyx_e_7sklearn_5earth_8_forward_MAXRSQ; - /* "sklearn/earth/_forward.pyx":127 + /* "sklearn/earth/_forward.pyx":139 * if rsq > 1 - self.thresh: * self.record.stopping_condition = MAXRSQ * return True # <<<<<<<<<<<<<< @@ -4428,7 +4572,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_stop_check(st * if rsq - previous_rsq < self.thresh: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4437,41 +4581,41 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_stop_check(st } __pyx_L4:; - /* "sklearn/earth/_forward.pyx":128 + /* "sklearn/earth/_forward.pyx":140 * self.record.stopping_condition = MAXRSQ * return True * previous_rsq = self.record.rsq(last - 1) # <<<<<<<<<<<<<< * if rsq - previous_rsq < self.thresh: * self.record.stopping_condition = NOIMPRV */ - __pyx_t_1 = PyNumber_Subtract(__pyx_v_last, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Subtract(__pyx_v_last, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_5 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_5 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->__pyx_base.rsq(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self->record), __pyx_t_5, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->__pyx_base.rsq(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self->record), __pyx_t_5, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_previous_rsq = __pyx_t_1; __pyx_t_1 = 0; - /* "sklearn/earth/_forward.pyx":129 + /* "sklearn/earth/_forward.pyx":141 * return True * previous_rsq = self.record.rsq(last - 1) * if rsq - previous_rsq < self.thresh: # <<<<<<<<<<<<<< * self.record.stopping_condition = NOIMPRV * return True */ - __pyx_t_1 = PyNumber_Subtract(__pyx_v_rsq, __pyx_v_previous_rsq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Subtract(__pyx_v_rsq, __pyx_v_previous_rsq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->thresh); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->thresh); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_4) { - /* "sklearn/earth/_forward.pyx":130 + /* "sklearn/earth/_forward.pyx":142 * previous_rsq = self.record.rsq(last - 1) * if rsq - previous_rsq < self.thresh: * self.record.stopping_condition = NOIMPRV # <<<<<<<<<<<<<< @@ -4480,7 +4624,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_stop_check(st */ __pyx_v_self->record->stopping_condition = __pyx_e_7sklearn_5earth_8_forward_NOIMPRV; - /* "sklearn/earth/_forward.pyx":131 + /* "sklearn/earth/_forward.pyx":143 * if rsq - previous_rsq < self.thresh: * self.record.stopping_condition = NOIMPRV * return True # <<<<<<<<<<<<<< @@ -4488,7 +4632,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_stop_check(st * self.record.stopping_condition = LOWGRSQ */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -4497,18 +4641,18 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_stop_check(st } __pyx_L5:; - /* "sklearn/earth/_forward.pyx":132 + /* "sklearn/earth/_forward.pyx":144 * self.record.stopping_condition = NOIMPRV * return True * if self.record.grsq(last) < -10: # <<<<<<<<<<<<<< * self.record.stopping_condition = LOWGRSQ * return True */ - __pyx_t_5 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_last); if (unlikely((__pyx_t_5 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_last); if (unlikely((__pyx_t_5 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = ((((struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->__pyx_base.grsq(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self->record), __pyx_t_5, 0) < -10.0) != 0); if (__pyx_t_4) { - /* "sklearn/earth/_forward.pyx":133 + /* "sklearn/earth/_forward.pyx":145 * return True * if self.record.grsq(last) < -10: * self.record.stopping_condition = LOWGRSQ # <<<<<<<<<<<<<< @@ -4517,7 +4661,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_stop_check(st */ __pyx_v_self->record->stopping_condition = __pyx_e_7sklearn_5earth_8_forward_LOWGRSQ; - /* "sklearn/earth/_forward.pyx":134 + /* "sklearn/earth/_forward.pyx":146 * if self.record.grsq(last) < -10: * self.record.stopping_condition = LOWGRSQ * return True # <<<<<<<<<<<<<< @@ -4525,7 +4669,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_stop_check(st * self.record.stopping_condition = NOCAND */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -4534,7 +4678,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_stop_check(st } __pyx_L6:; - /* "sklearn/earth/_forward.pyx":135 + /* "sklearn/earth/_forward.pyx":147 * self.record.stopping_condition = LOWGRSQ * return True * if self.record.iterations[last].no_further_candidates(): # <<<<<<<<<<<<<< @@ -4543,21 +4687,21 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_stop_check(st */ if (unlikely(((PyObject *)__pyx_v_self->record->__pyx_base.iterations) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_self->record->__pyx_base.iterations), __pyx_v_last); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_self->record->__pyx_base.iterations), __pyx_v_last); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_4) { - /* "sklearn/earth/_forward.pyx":136 + /* "sklearn/earth/_forward.pyx":148 * return True * if self.record.iterations[last].no_further_candidates(): * self.record.stopping_condition = NOCAND # <<<<<<<<<<<<<< @@ -4566,7 +4710,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_stop_check(st */ __pyx_v_self->record->stopping_condition = __pyx_e_7sklearn_5earth_8_forward_NOCAND; - /* "sklearn/earth/_forward.pyx":137 + /* "sklearn/earth/_forward.pyx":149 * if self.record.iterations[last].no_further_candidates(): * self.record.stopping_condition = NOCAND * return True # <<<<<<<<<<<<<< @@ -4574,7 +4718,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_stop_check(st * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -4583,7 +4727,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_stop_check(st } __pyx_L7:; - /* "sklearn/earth/_forward.pyx":138 + /* "sklearn/earth/_forward.pyx":150 * self.record.stopping_condition = NOCAND * return True * return False # <<<<<<<<<<<<<< @@ -4591,7 +4735,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_stop_check(st * cpdef int orthonormal_update(ForwardPasser self, INDEX_t k): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -4614,12 +4758,12 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_stop_check(st return __pyx_r; } -/* "sklearn/earth/_forward.pyx":140 +/* "sklearn/earth/_forward.pyx":152 * return False * * cpdef int orthonormal_update(ForwardPasser self, INDEX_t k): # <<<<<<<<<<<<<< * '''Orthogonalize and normalize column k of B_orth against all previous columns of B_orth.''' - * #Currently implemented using modified Gram-Schmidt process + * # Currently implemented using modified Gram-Schmidt process */ static PyObject *__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_11orthonormal_update(PyObject *__pyx_v_self, PyObject *__pyx_arg_k); /*proto*/ @@ -4707,20 +4851,20 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__orthonormal_update); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__orthonormal_update); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_11orthonormal_update)) { - __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_4; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -4729,19 +4873,19 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_forward.pyx":145 - * #TODO: Optimize - replace some for loops with calls to blas + /* "sklearn/earth/_forward.pyx":157 + * # TODO: Optimize - replace some for loops with calls to blas * - * cdef cnp.ndarray[FLOAT_t, ndim=2] B_orth = self.B_orth # <<<<<<<<<<<<<< - * cdef cnp.ndarray[FLOAT_t, ndim=1] c = self.c - * cdef cnp.ndarray[FLOAT_t, ndim=1] y = self.y + * cdef cnp.ndarray[FLOAT_t, ndim = 2] B_orth = self.B_orth # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t, ndim = 1] c = self.c + * cdef cnp.ndarray[FLOAT_t, ndim = 1] y = self.y */ __pyx_t_5 = ((PyArrayObject *)__pyx_v_self->B_orth); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B_orth.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { __pyx_v_B_orth = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_B_orth.diminfo[0].strides = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B_orth.diminfo[0].shape = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B_orth.diminfo[1].strides = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B_orth.diminfo[1].shape = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.shape[1]; } } @@ -4749,19 +4893,19 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->B_orth))); __pyx_v_B_orth = ((PyArrayObject *)__pyx_v_self->B_orth); - /* "sklearn/earth/_forward.pyx":146 + /* "sklearn/earth/_forward.pyx":158 * - * cdef cnp.ndarray[FLOAT_t, ndim=2] B_orth = self.B_orth - * cdef cnp.ndarray[FLOAT_t, ndim=1] c = self.c # <<<<<<<<<<<<<< - * cdef cnp.ndarray[FLOAT_t, ndim=1] y = self.y - * cdef cnp.ndarray[FLOAT_t, ndim=1] norms = self.norms + * cdef cnp.ndarray[FLOAT_t, ndim = 2] B_orth = self.B_orth + * cdef cnp.ndarray[FLOAT_t, ndim = 1] c = self.c # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t, ndim = 1] y = self.y + * cdef cnp.ndarray[FLOAT_t, ndim = 1] norms = self.norms */ __pyx_t_6 = ((PyArrayObject *)__pyx_v_self->c); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_c.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_c = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_c.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_c.diminfo[0].strides = __pyx_pybuffernd_c.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_c.diminfo[0].shape = __pyx_pybuffernd_c.rcbuffer->pybuffer.shape[0]; } } @@ -4769,11 +4913,11 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->c))); __pyx_v_c = ((PyArrayObject *)__pyx_v_self->c); - /* "sklearn/earth/_forward.pyx":147 - * cdef cnp.ndarray[FLOAT_t, ndim=2] B_orth = self.B_orth - * cdef cnp.ndarray[FLOAT_t, ndim=1] c = self.c - * cdef cnp.ndarray[FLOAT_t, ndim=1] y = self.y # <<<<<<<<<<<<<< - * cdef cnp.ndarray[FLOAT_t, ndim=1] norms = self.norms + /* "sklearn/earth/_forward.pyx":159 + * cdef cnp.ndarray[FLOAT_t, ndim = 2] B_orth = self.B_orth + * cdef cnp.ndarray[FLOAT_t, ndim = 1] c = self.c + * cdef cnp.ndarray[FLOAT_t, ndim = 1] y = self.y # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t, ndim = 1] norms = self.norms * */ __pyx_t_7 = ((PyArrayObject *)__pyx_v_self->y); @@ -4781,7 +4925,7 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_y = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_y.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_y.diminfo[0].strides = __pyx_pybuffernd_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y.diminfo[0].shape = __pyx_pybuffernd_y.rcbuffer->pybuffer.shape[0]; } } @@ -4789,10 +4933,10 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->y))); __pyx_v_y = ((PyArrayObject *)__pyx_v_self->y); - /* "sklearn/earth/_forward.pyx":148 - * cdef cnp.ndarray[FLOAT_t, ndim=1] c = self.c - * cdef cnp.ndarray[FLOAT_t, ndim=1] y = self.y - * cdef cnp.ndarray[FLOAT_t, ndim=1] norms = self.norms # <<<<<<<<<<<<<< + /* "sklearn/earth/_forward.pyx":160 + * cdef cnp.ndarray[FLOAT_t, ndim = 1] c = self.c + * cdef cnp.ndarray[FLOAT_t, ndim = 1] y = self.y + * cdef cnp.ndarray[FLOAT_t, ndim = 1] norms = self.norms # <<<<<<<<<<<<<< * * cdef INDEX_t i */ @@ -4801,7 +4945,7 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_norms.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_norms = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_norms.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_norms.diminfo[0].strides = __pyx_pybuffernd_norms.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_norms.diminfo[0].shape = __pyx_pybuffernd_norms.rcbuffer->pybuffer.shape[0]; } } @@ -4809,30 +4953,30 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->norms))); __pyx_v_norms = ((PyArrayObject *)__pyx_v_self->norms); - /* "sklearn/earth/_forward.pyx":157 + /* "sklearn/earth/_forward.pyx":169 * - * #Get the original norm + * # Get the original norm * nrm0 = 0.0 # <<<<<<<<<<<<<< * for i in range(self.m): - * nrm0 += B_orth[i,k]*B_orth[i,k] + * nrm0 += B_orth[i, k] * B_orth[i, k] */ __pyx_v_nrm0 = 0.0; - /* "sklearn/earth/_forward.pyx":158 - * #Get the original norm + /* "sklearn/earth/_forward.pyx":170 + * # Get the original norm * nrm0 = 0.0 * for i in range(self.m): # <<<<<<<<<<<<<< - * nrm0 += B_orth[i,k]*B_orth[i,k] + * nrm0 += B_orth[i, k] * B_orth[i, k] * nrm0 = sqrt(nrm0) */ __pyx_t_9 = __pyx_v_self->m; for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { __pyx_v_i = __pyx_t_10; - /* "sklearn/earth/_forward.pyx":159 + /* "sklearn/earth/_forward.pyx":171 * nrm0 = 0.0 * for i in range(self.m): - * nrm0 += B_orth[i,k]*B_orth[i,k] # <<<<<<<<<<<<<< + * nrm0 += B_orth[i, k] * B_orth[i, k] # <<<<<<<<<<<<<< * nrm0 = sqrt(nrm0) * */ @@ -4843,18 +4987,18 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( __pyx_v_nrm0 = (__pyx_v_nrm0 + ((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_B_orth.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_B_orth.diminfo[1].strides)))); } - /* "sklearn/earth/_forward.pyx":160 + /* "sklearn/earth/_forward.pyx":172 * for i in range(self.m): - * nrm0 += B_orth[i,k]*B_orth[i,k] + * nrm0 += B_orth[i, k] * B_orth[i, k] * nrm0 = sqrt(nrm0) # <<<<<<<<<<<<<< * - * #Orthogonalize + * # Orthogonalize */ __pyx_v_nrm0 = sqrt(__pyx_v_nrm0); - /* "sklearn/earth/_forward.pyx":163 + /* "sklearn/earth/_forward.pyx":175 * - * #Orthogonalize + * # Orthogonalize * if k > 0: # <<<<<<<<<<<<<< * for i in range(k): * dot_prod = 0.0 @@ -4862,8 +5006,8 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( __pyx_t_15 = ((__pyx_v_k > 0) != 0); if (__pyx_t_15) { - /* "sklearn/earth/_forward.pyx":164 - * #Orthogonalize + /* "sklearn/earth/_forward.pyx":176 + * # Orthogonalize * if k > 0: * for i in range(k): # <<<<<<<<<<<<<< * dot_prod = 0.0 @@ -4873,32 +5017,32 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { __pyx_v_i = __pyx_t_10; - /* "sklearn/earth/_forward.pyx":165 + /* "sklearn/earth/_forward.pyx":177 * if k > 0: * for i in range(k): * dot_prod = 0.0 # <<<<<<<<<<<<<< * for j in range(self.m): - * dot_prod += B_orth[j,k]*B_orth[j,i] + * dot_prod += B_orth[j, k] * B_orth[j, i] */ __pyx_v_dot_prod = 0.0; - /* "sklearn/earth/_forward.pyx":166 + /* "sklearn/earth/_forward.pyx":178 * for i in range(k): * dot_prod = 0.0 * for j in range(self.m): # <<<<<<<<<<<<<< - * dot_prod += B_orth[j,k]*B_orth[j,i] + * dot_prod += B_orth[j, k] * B_orth[j, i] * for j in range(self.m): */ __pyx_t_16 = __pyx_v_self->m; for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { __pyx_v_j = __pyx_t_17; - /* "sklearn/earth/_forward.pyx":167 + /* "sklearn/earth/_forward.pyx":179 * dot_prod = 0.0 * for j in range(self.m): - * dot_prod += B_orth[j,k]*B_orth[j,i] # <<<<<<<<<<<<<< + * dot_prod += B_orth[j, k] * B_orth[j, i] # <<<<<<<<<<<<<< * for j in range(self.m): - * B_orth[j,k] -= B_orth[j,i] * dot_prod + * B_orth[j, k] -= B_orth[j, i] * dot_prod */ __pyx_t_18 = __pyx_v_j; __pyx_t_19 = __pyx_v_k; @@ -4907,23 +5051,23 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( __pyx_v_dot_prod = (__pyx_v_dot_prod + ((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_B_orth.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_B_orth.diminfo[1].strides)))); } - /* "sklearn/earth/_forward.pyx":168 + /* "sklearn/earth/_forward.pyx":180 * for j in range(self.m): - * dot_prod += B_orth[j,k]*B_orth[j,i] + * dot_prod += B_orth[j, k] * B_orth[j, i] * for j in range(self.m): # <<<<<<<<<<<<<< - * B_orth[j,k] -= B_orth[j,i] * dot_prod + * B_orth[j, k] -= B_orth[j, i] * dot_prod * */ __pyx_t_16 = __pyx_v_self->m; for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { __pyx_v_j = __pyx_t_17; - /* "sklearn/earth/_forward.pyx":169 - * dot_prod += B_orth[j,k]*B_orth[j,i] + /* "sklearn/earth/_forward.pyx":181 + * dot_prod += B_orth[j, k] * B_orth[j, i] * for j in range(self.m): - * B_orth[j,k] -= B_orth[j,i] * dot_prod # <<<<<<<<<<<<<< + * B_orth[j, k] -= B_orth[j, i] * dot_prod # <<<<<<<<<<<<<< * - * #Normalize + * # Normalize */ __pyx_t_22 = __pyx_v_j; __pyx_t_23 = __pyx_v_i; @@ -4936,30 +5080,30 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( } __pyx_L5:; - /* "sklearn/earth/_forward.pyx":172 + /* "sklearn/earth/_forward.pyx":184 * - * #Normalize + * # Normalize * nrm = 0.0 # <<<<<<<<<<<<<< * for i in range(self.m): - * nrm += B_orth[i,k]*B_orth[i,k] + * nrm += B_orth[i, k] * B_orth[i, k] */ __pyx_v_nrm = 0.0; - /* "sklearn/earth/_forward.pyx":173 - * #Normalize + /* "sklearn/earth/_forward.pyx":185 + * # Normalize * nrm = 0.0 * for i in range(self.m): # <<<<<<<<<<<<<< - * nrm += B_orth[i,k]*B_orth[i,k] + * nrm += B_orth[i, k] * B_orth[i, k] * nrm = sqrt(nrm) */ __pyx_t_9 = __pyx_v_self->m; for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { __pyx_v_i = __pyx_t_10; - /* "sklearn/earth/_forward.pyx":174 + /* "sklearn/earth/_forward.pyx":186 * nrm = 0.0 * for i in range(self.m): - * nrm += B_orth[i,k]*B_orth[i,k] # <<<<<<<<<<<<<< + * nrm += B_orth[i, k] * B_orth[i, k] # <<<<<<<<<<<<<< * nrm = sqrt(nrm) * norms[k] = nrm */ @@ -4970,31 +5114,31 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( __pyx_v_nrm = (__pyx_v_nrm + ((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_B_orth.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_B_orth.diminfo[1].strides)))); } - /* "sklearn/earth/_forward.pyx":175 + /* "sklearn/earth/_forward.pyx":187 * for i in range(self.m): - * nrm += B_orth[i,k]*B_orth[i,k] + * nrm += B_orth[i, k] * B_orth[i, k] * nrm = sqrt(nrm) # <<<<<<<<<<<<<< * norms[k] = nrm * */ __pyx_v_nrm = sqrt(__pyx_v_nrm); - /* "sklearn/earth/_forward.pyx":176 - * nrm += B_orth[i,k]*B_orth[i,k] + /* "sklearn/earth/_forward.pyx":188 + * nrm += B_orth[i, k] * B_orth[i, k] * nrm = sqrt(nrm) * norms[k] = nrm # <<<<<<<<<<<<<< * - * if nrm0 <= self.zero_tol or nrm/nrm0 <= self.zero_tol: + * if nrm0 <= self.zero_tol or nrm / nrm0 <= self.zero_tol: */ __pyx_t_9 = __pyx_v_k; *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_norms.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_norms.diminfo[0].strides) = __pyx_v_nrm; - /* "sklearn/earth/_forward.pyx":178 + /* "sklearn/earth/_forward.pyx":190 * norms[k] = nrm * - * if nrm0 <= self.zero_tol or nrm/nrm0 <= self.zero_tol: # <<<<<<<<<<<<<< + * if nrm0 <= self.zero_tol or nrm / nrm0 <= self.zero_tol: # <<<<<<<<<<<<<< * for i in range(self.m): - * B_orth[i,k] = 0.0 + * B_orth[i, k] = 0.0 */ __pyx_t_15 = ((__pyx_v_nrm0 <= __pyx_v_self->zero_tol) != 0); if (!__pyx_t_15) { @@ -5005,45 +5149,45 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( } if (__pyx_t_29) { - /* "sklearn/earth/_forward.pyx":179 + /* "sklearn/earth/_forward.pyx":191 * - * if nrm0 <= self.zero_tol or nrm/nrm0 <= self.zero_tol: + * if nrm0 <= self.zero_tol or nrm / nrm0 <= self.zero_tol: * for i in range(self.m): # <<<<<<<<<<<<<< - * B_orth[i,k] = 0.0 + * B_orth[i, k] = 0.0 * c[k] = 0.0 */ __pyx_t_10 = __pyx_v_self->m; for (__pyx_t_30 = 0; __pyx_t_30 < __pyx_t_10; __pyx_t_30+=1) { __pyx_v_i = __pyx_t_30; - /* "sklearn/earth/_forward.pyx":180 - * if nrm0 <= self.zero_tol or nrm/nrm0 <= self.zero_tol: + /* "sklearn/earth/_forward.pyx":192 + * if nrm0 <= self.zero_tol or nrm / nrm0 <= self.zero_tol: * for i in range(self.m): - * B_orth[i,k] = 0.0 # <<<<<<<<<<<<<< + * B_orth[i, k] = 0.0 # <<<<<<<<<<<<<< * c[k] = 0.0 - * return 1 #The new column is in the column space of the previous columns + * # The new column is in the column space of the previous columns */ __pyx_t_31 = __pyx_v_i; __pyx_t_32 = __pyx_v_k; *__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_B_orth.diminfo[1].strides) = 0.0; } - /* "sklearn/earth/_forward.pyx":181 + /* "sklearn/earth/_forward.pyx":193 * for i in range(self.m): - * B_orth[i,k] = 0.0 + * B_orth[i, k] = 0.0 * c[k] = 0.0 # <<<<<<<<<<<<<< - * return 1 #The new column is in the column space of the previous columns - * for i in range(self.m): + * # The new column is in the column space of the previous columns + * return 1 */ __pyx_t_10 = __pyx_v_k; *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_c.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_c.diminfo[0].strides) = 0.0; - /* "sklearn/earth/_forward.pyx":182 - * B_orth[i,k] = 0.0 + /* "sklearn/earth/_forward.pyx":195 * c[k] = 0.0 - * return 1 #The new column is in the column space of the previous columns # <<<<<<<<<<<<<< + * # The new column is in the column space of the previous columns + * return 1 # <<<<<<<<<<<<<< * for i in range(self.m): - * B_orth[i,k] /= nrm + * B_orth[i, k] /= nrm */ __pyx_r = 1; goto __pyx_L0; @@ -5051,55 +5195,55 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( } __pyx_L14:; - /* "sklearn/earth/_forward.pyx":183 - * c[k] = 0.0 - * return 1 #The new column is in the column space of the previous columns + /* "sklearn/earth/_forward.pyx":196 + * # The new column is in the column space of the previous columns + * return 1 * for i in range(self.m): # <<<<<<<<<<<<<< - * B_orth[i,k] /= nrm + * B_orth[i, k] /= nrm * */ __pyx_t_30 = __pyx_v_self->m; for (__pyx_t_33 = 0; __pyx_t_33 < __pyx_t_30; __pyx_t_33+=1) { __pyx_v_i = __pyx_t_33; - /* "sklearn/earth/_forward.pyx":184 - * return 1 #The new column is in the column space of the previous columns + /* "sklearn/earth/_forward.pyx":197 + * return 1 * for i in range(self.m): - * B_orth[i,k] /= nrm # <<<<<<<<<<<<<< + * B_orth[i, k] /= nrm # <<<<<<<<<<<<<< * - * #Update c + * # Update c */ __pyx_t_34 = __pyx_v_i; __pyx_t_35 = __pyx_v_k; *__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_B_orth.diminfo[1].strides) /= __pyx_v_nrm; } - /* "sklearn/earth/_forward.pyx":187 + /* "sklearn/earth/_forward.pyx":200 * - * #Update c + * # Update c * c[k] = 0.0 # <<<<<<<<<<<<<< * for i in range(self.m): - * c[k] += B_orth[i,k]*y[i] + * c[k] += B_orth[i, k] * y[i] */ __pyx_t_30 = __pyx_v_k; *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_c.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_c.diminfo[0].strides) = 0.0; - /* "sklearn/earth/_forward.pyx":188 - * #Update c + /* "sklearn/earth/_forward.pyx":201 + * # Update c * c[k] = 0.0 * for i in range(self.m): # <<<<<<<<<<<<<< - * c[k] += B_orth[i,k]*y[i] - * self.c_squared += c[k]**2 + * c[k] += B_orth[i, k] * y[i] + * self.c_squared += c[k] ** 2 */ __pyx_t_33 = __pyx_v_self->m; for (__pyx_t_36 = 0; __pyx_t_36 < __pyx_t_33; __pyx_t_36+=1) { __pyx_v_i = __pyx_t_36; - /* "sklearn/earth/_forward.pyx":189 + /* "sklearn/earth/_forward.pyx":202 * c[k] = 0.0 * for i in range(self.m): - * c[k] += B_orth[i,k]*y[i] # <<<<<<<<<<<<<< - * self.c_squared += c[k]**2 + * c[k] += B_orth[i, k] * y[i] # <<<<<<<<<<<<<< + * self.c_squared += c[k] ** 2 * */ __pyx_t_37 = __pyx_v_i; @@ -5109,20 +5253,20 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_c.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_c.diminfo[0].strides) += ((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_38, __pyx_pybuffernd_B_orth.diminfo[1].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_y.diminfo[0].strides))); } - /* "sklearn/earth/_forward.pyx":190 + /* "sklearn/earth/_forward.pyx":203 * for i in range(self.m): - * c[k] += B_orth[i,k]*y[i] - * self.c_squared += c[k]**2 # <<<<<<<<<<<<<< + * c[k] += B_orth[i, k] * y[i] + * self.c_squared += c[k] ** 2 # <<<<<<<<<<<<<< * - * return 0 #No problems + * return 0 # No problems */ __pyx_t_33 = __pyx_v_k; __pyx_v_self->c_squared = (__pyx_v_self->c_squared + pow((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_c.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_c.diminfo[0].strides)), 2.0)); - /* "sklearn/earth/_forward.pyx":192 - * self.c_squared += c[k]**2 + /* "sklearn/earth/_forward.pyx":205 + * self.c_squared += c[k] ** 2 * - * return 0 #No problems # <<<<<<<<<<<<<< + * return 0 # No problems # <<<<<<<<<<<<<< * * cpdef orthonormal_downdate(ForwardPasser self, INDEX_t k): */ @@ -5171,7 +5315,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_11orthonorma __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("orthonormal_update (wrapper)", 0); assert(__pyx_arg_k); { - __pyx_v_k = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_arg_k); if (unlikely((__pyx_v_k == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_k = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_arg_k); if (unlikely((__pyx_v_k == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -5184,12 +5328,12 @@ static PyObject *__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_11orthonorma return __pyx_r; } -/* "sklearn/earth/_forward.pyx":140 +/* "sklearn/earth/_forward.pyx":152 * return False * * cpdef int orthonormal_update(ForwardPasser self, INDEX_t k): # <<<<<<<<<<<<<< * '''Orthogonalize and normalize column k of B_orth against all previous columns of B_orth.''' - * #Currently implemented using modified Gram-Schmidt process + * # Currently implemented using modified Gram-Schmidt process */ static PyObject *__pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_10orthonormal_update(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser *__pyx_v_self, __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_v_k) { @@ -5201,7 +5345,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_10orthonorma int __pyx_clineno = 0; __Pyx_RefNannySetupContext("orthonormal_update", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_update(__pyx_v_self, __pyx_v_k, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_update(__pyx_v_self, __pyx_v_k, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -5219,8 +5363,8 @@ static PyObject *__pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_10orthonorma return __pyx_r; } -/* "sklearn/earth/_forward.pyx":194 - * return 0 #No problems +/* "sklearn/earth/_forward.pyx":207 + * return 0 # No problems * * cpdef orthonormal_downdate(ForwardPasser self, INDEX_t k): # <<<<<<<<<<<<<< * ''' @@ -5243,18 +5387,18 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_d if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_13orthonormal_downdate)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; @@ -5265,25 +5409,25 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_d __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_forward.pyx":201 + /* "sklearn/earth/_forward.pyx":214 * can simply be ignored until they are overwritten). * ''' - * self.c_squared -= self.c[k]**2 # <<<<<<<<<<<<<< + * self.c_squared -= self.c[k] ** 2 # <<<<<<<<<<<<<< * * def trace(self): */ - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->c_squared); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->c_squared); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->c), __pyx_v_k, sizeof(__pyx_t_7sklearn_5earth_8_forward_INDEX_t)+1, __Pyx_PyInt_to_py_npy_ulonglong, 0, 0, 0); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->c), __pyx_v_k, sizeof(__pyx_t_7sklearn_5earth_8_forward_INDEX_t)+1, __Pyx_PyInt_to_py_npy_ulonglong, 0, 0, 0); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Power(__pyx_t_2, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Power(__pyx_t_2, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_InPlaceSubtract(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_InPlaceSubtract(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_self->c_squared = __pyx_t_4; @@ -5313,7 +5457,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_13orthonorma __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("orthonormal_downdate (wrapper)", 0); assert(__pyx_arg_k); { - __pyx_v_k = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_arg_k); if (unlikely((__pyx_v_k == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_k = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_arg_k); if (unlikely((__pyx_v_k == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -5326,8 +5470,8 @@ static PyObject *__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_13orthonorma return __pyx_r; } -/* "sklearn/earth/_forward.pyx":194 - * return 0 #No problems +/* "sklearn/earth/_forward.pyx":207 + * return 0 # No problems * * cpdef orthonormal_downdate(ForwardPasser self, INDEX_t k): # <<<<<<<<<<<<<< * ''' @@ -5343,7 +5487,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_12orthonorma int __pyx_clineno = 0; __Pyx_RefNannySetupContext("orthonormal_downdate", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_downdate(__pyx_v_self, __pyx_v_k, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_downdate(__pyx_v_self, __pyx_v_k, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -5372,8 +5516,8 @@ static PyObject *__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_15trace(PyOb return __pyx_r; } -/* "sklearn/earth/_forward.pyx":203 - * self.c_squared -= self.c[k]**2 +/* "sklearn/earth/_forward.pyx":216 + * self.c_squared -= self.c[k] ** 2 * * def trace(self): # <<<<<<<<<<<<<< * return self.record @@ -5385,7 +5529,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_14trace(stru __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("trace", 0); - /* "sklearn/earth/_forward.pyx":204 + /* "sklearn/earth/_forward.pyx":217 * * def trace(self): * return self.record # <<<<<<<<<<<<<< @@ -5404,7 +5548,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_14trace(stru return __pyx_r; } -/* "sklearn/earth/_forward.pyx":206 +/* "sklearn/earth/_forward.pyx":219 * return self.record * * cdef next_pair(ForwardPasser self): # <<<<<<<<<<<<<< @@ -5532,7 +5676,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str __pyx_pybuffernd_sorting.data = NULL; __pyx_pybuffernd_sorting.rcbuffer = &__pyx_pybuffer_sorting; - /* "sklearn/earth/_forward.pyx":222 + /* "sklearn/earth/_forward.pyx":235 * cdef BasisFunction parent_choice * cdef INDEX_t variable_choice * cdef bint first = True # <<<<<<<<<<<<<< @@ -5541,7 +5685,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str */ __pyx_v_first = 1; - /* "sklearn/earth/_forward.pyx":225 + /* "sklearn/earth/_forward.pyx":238 * cdef BasisFunction bf1 * cdef BasisFunction bf2 * cdef INDEX_t k = len(self.basis) # <<<<<<<<<<<<<< @@ -5550,41 +5694,41 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str */ __pyx_t_1 = ((PyObject *)__pyx_v_self->basis); __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_k = __pyx_t_2; - /* "sklearn/earth/_forward.pyx":229 + /* "sklearn/earth/_forward.pyx":242 * cdef bint linear_dependence * cdef bint dependent - * cdef FLOAT_t gcv_factor_k_plus_1 = gcv_adjust(k+1,self.m,self.penalty) # <<<<<<<<<<<<<< - * cdef FLOAT_t gcv_factor_k_plus_2 = gcv_adjust(k+2,self.m,self.penalty) + * cdef FLOAT_t gcv_factor_k_plus_1 = gcv_adjust(k + 1, self.m, self.penalty) # <<<<<<<<<<<<<< + * cdef FLOAT_t gcv_factor_k_plus_2 = gcv_adjust(k + 2, self.m, self.penalty) * cdef FLOAT_t gcv_ */ __pyx_v_gcv_factor_k_plus_1 = __pyx_f_7sklearn_5earth_5_util_gcv_adjust((__pyx_v_k + 1), __pyx_v_self->m, __pyx_v_self->penalty, 0); - /* "sklearn/earth/_forward.pyx":230 + /* "sklearn/earth/_forward.pyx":243 * cdef bint dependent - * cdef FLOAT_t gcv_factor_k_plus_1 = gcv_adjust(k+1,self.m,self.penalty) - * cdef FLOAT_t gcv_factor_k_plus_2 = gcv_adjust(k+2,self.m,self.penalty) # <<<<<<<<<<<<<< + * cdef FLOAT_t gcv_factor_k_plus_1 = gcv_adjust(k + 1, self.m, self.penalty) + * cdef FLOAT_t gcv_factor_k_plus_2 = gcv_adjust(k + 2, self.m, self.penalty) # <<<<<<<<<<<<<< * cdef FLOAT_t gcv_ * cdef FLOAT_t mse_ */ __pyx_v_gcv_factor_k_plus_2 = __pyx_f_7sklearn_5earth_5_util_gcv_adjust((__pyx_v_k + 2), __pyx_v_self->m, __pyx_v_self->penalty, 0); - /* "sklearn/earth/_forward.pyx":235 + /* "sklearn/earth/_forward.pyx":248 * cdef INDEX_t i * - * cdef cnp.ndarray[FLOAT_t,ndim=2] X = self.X # <<<<<<<<<<<<<< - * cdef cnp.ndarray[FLOAT_t,ndim=2] B = self.B - * cdef cnp.ndarray[FLOAT_t,ndim=2] B_orth = self.B_orth + * cdef cnp.ndarray[FLOAT_t, ndim = 2] X = self.X # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t, ndim = 2] B = self.B + * cdef cnp.ndarray[FLOAT_t, ndim = 2] B_orth = self.B_orth */ __pyx_t_3 = ((PyArrayObject *)__pyx_v_self->X); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { __pyx_v_X = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; } } @@ -5592,19 +5736,19 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->X))); __pyx_v_X = ((PyArrayObject *)__pyx_v_self->X); - /* "sklearn/earth/_forward.pyx":236 + /* "sklearn/earth/_forward.pyx":249 * - * cdef cnp.ndarray[FLOAT_t,ndim=2] X = self.X - * cdef cnp.ndarray[FLOAT_t,ndim=2] B = self.B # <<<<<<<<<<<<<< - * cdef cnp.ndarray[FLOAT_t,ndim=2] B_orth = self.B_orth - * cdef cnp.ndarray[FLOAT_t,ndim=1] y = self.y + * cdef cnp.ndarray[FLOAT_t, ndim = 2] X = self.X + * cdef cnp.ndarray[FLOAT_t, ndim = 2] B = self.B # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t, ndim = 2] B_orth = self.B_orth + * cdef cnp.ndarray[FLOAT_t, ndim = 1] y = self.y */ __pyx_t_4 = ((PyArrayObject *)__pyx_v_self->B); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { __pyx_v_B = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_B.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_B.diminfo[0].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B.diminfo[0].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B.diminfo[1].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B.diminfo[1].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[1]; } } @@ -5612,19 +5756,19 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->B))); __pyx_v_B = ((PyArrayObject *)__pyx_v_self->B); - /* "sklearn/earth/_forward.pyx":237 - * cdef cnp.ndarray[FLOAT_t,ndim=2] X = self.X - * cdef cnp.ndarray[FLOAT_t,ndim=2] B = self.B - * cdef cnp.ndarray[FLOAT_t,ndim=2] B_orth = self.B_orth # <<<<<<<<<<<<<< - * cdef cnp.ndarray[FLOAT_t,ndim=1] y = self.y - * cdef cnp.ndarray[INT_t,ndim=1] linear_variables = self.linear_variables + /* "sklearn/earth/_forward.pyx":250 + * cdef cnp.ndarray[FLOAT_t, ndim = 2] X = self.X + * cdef cnp.ndarray[FLOAT_t, ndim = 2] B = self.B + * cdef cnp.ndarray[FLOAT_t, ndim = 2] B_orth = self.B_orth # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t, ndim = 1] y = self.y + * cdef cnp.ndarray[INT_t, ndim = 1] linear_variables = self.linear_variables */ __pyx_t_5 = ((PyArrayObject *)__pyx_v_self->B_orth); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B_orth.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { __pyx_v_B_orth = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_B_orth.diminfo[0].strides = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B_orth.diminfo[0].shape = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B_orth.diminfo[1].strides = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B_orth.diminfo[1].shape = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.shape[1]; } } @@ -5632,19 +5776,19 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->B_orth))); __pyx_v_B_orth = ((PyArrayObject *)__pyx_v_self->B_orth); - /* "sklearn/earth/_forward.pyx":238 - * cdef cnp.ndarray[FLOAT_t,ndim=2] B = self.B - * cdef cnp.ndarray[FLOAT_t,ndim=2] B_orth = self.B_orth - * cdef cnp.ndarray[FLOAT_t,ndim=1] y = self.y # <<<<<<<<<<<<<< - * cdef cnp.ndarray[INT_t,ndim=1] linear_variables = self.linear_variables - * cdef cnp.ndarray[INT_t,ndim=1] sorting = self.sorting + /* "sklearn/earth/_forward.pyx":251 + * cdef cnp.ndarray[FLOAT_t, ndim = 2] B = self.B + * cdef cnp.ndarray[FLOAT_t, ndim = 2] B_orth = self.B_orth + * cdef cnp.ndarray[FLOAT_t, ndim = 1] y = self.y # <<<<<<<<<<<<<< + * cdef cnp.ndarray[INT_t, ndim = 1] linear_variables = self.linear_variables + * cdef cnp.ndarray[INT_t, ndim = 1] sorting = self.sorting */ __pyx_t_6 = ((PyArrayObject *)__pyx_v_self->y); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_y = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_y.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_y.diminfo[0].strides = __pyx_pybuffernd_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y.diminfo[0].shape = __pyx_pybuffernd_y.rcbuffer->pybuffer.shape[0]; } } @@ -5652,11 +5796,11 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->y))); __pyx_v_y = ((PyArrayObject *)__pyx_v_self->y); - /* "sklearn/earth/_forward.pyx":239 - * cdef cnp.ndarray[FLOAT_t,ndim=2] B_orth = self.B_orth - * cdef cnp.ndarray[FLOAT_t,ndim=1] y = self.y - * cdef cnp.ndarray[INT_t,ndim=1] linear_variables = self.linear_variables # <<<<<<<<<<<<<< - * cdef cnp.ndarray[INT_t,ndim=1] sorting = self.sorting + /* "sklearn/earth/_forward.pyx":252 + * cdef cnp.ndarray[FLOAT_t, ndim = 2] B_orth = self.B_orth + * cdef cnp.ndarray[FLOAT_t, ndim = 1] y = self.y + * cdef cnp.ndarray[INT_t, ndim = 1] linear_variables = self.linear_variables # <<<<<<<<<<<<<< + * cdef cnp.ndarray[INT_t, ndim = 1] sorting = self.sorting * */ __pyx_t_7 = ((PyArrayObject *)__pyx_v_self->linear_variables); @@ -5664,7 +5808,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_linear_variables.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_linear_variables = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_linear_variables.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_linear_variables.diminfo[0].strides = __pyx_pybuffernd_linear_variables.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_linear_variables.diminfo[0].shape = __pyx_pybuffernd_linear_variables.rcbuffer->pybuffer.shape[0]; } } @@ -5672,10 +5816,10 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->linear_variables))); __pyx_v_linear_variables = ((PyArrayObject *)__pyx_v_self->linear_variables); - /* "sklearn/earth/_forward.pyx":240 - * cdef cnp.ndarray[FLOAT_t,ndim=1] y = self.y - * cdef cnp.ndarray[INT_t,ndim=1] linear_variables = self.linear_variables - * cdef cnp.ndarray[INT_t,ndim=1] sorting = self.sorting # <<<<<<<<<<<<<< + /* "sklearn/earth/_forward.pyx":253 + * cdef cnp.ndarray[FLOAT_t, ndim = 1] y = self.y + * cdef cnp.ndarray[INT_t, ndim = 1] linear_variables = self.linear_variables + * cdef cnp.ndarray[INT_t, ndim = 1] sorting = self.sorting # <<<<<<<<<<<<<< * * if self.endspan < 0: */ @@ -5684,7 +5828,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sorting.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_sorting = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_sorting.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_sorting.diminfo[0].strides = __pyx_pybuffernd_sorting.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sorting.diminfo[0].shape = __pyx_pybuffernd_sorting.rcbuffer->pybuffer.shape[0]; } } @@ -5692,66 +5836,66 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->sorting))); __pyx_v_sorting = ((PyArrayObject *)__pyx_v_self->sorting); - /* "sklearn/earth/_forward.pyx":242 - * cdef cnp.ndarray[INT_t,ndim=1] sorting = self.sorting + /* "sklearn/earth/_forward.pyx":255 + * cdef cnp.ndarray[INT_t, ndim = 1] sorting = self.sorting * * if self.endspan < 0: # <<<<<<<<<<<<<< - * endspan = round(3 - log2(self.endspan_alpha/self.n)) + * endspan = round(3 - log2(self.endspan_alpha / self.n)) * */ __pyx_t_9 = ((__pyx_v_self->endspan < 0) != 0); if (__pyx_t_9) { - /* "sklearn/earth/_forward.pyx":243 + /* "sklearn/earth/_forward.pyx":256 * * if self.endspan < 0: - * endspan = round(3 - log2(self.endspan_alpha/self.n)) # <<<<<<<<<<<<<< + * endspan = round(3 - log2(self.endspan_alpha / self.n)) # <<<<<<<<<<<<<< * - * #Iterate over variables + * # Iterate over variables */ - __pyx_t_1 = PyFloat_FromDouble((3.0 - __pyx_f_7sklearn_5earth_5_util_log2((__pyx_v_self->endspan_alpha / __pyx_v_self->n)))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble((3.0 - __pyx_f_7sklearn_5earth_5_util_log2((__pyx_v_self->endspan_alpha / __pyx_v_self->n)))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_round, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_round, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - __pyx_t_11 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_11 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_11 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_endspan = __pyx_t_11; goto __pyx_L3; } __pyx_L3:; - /* "sklearn/earth/_forward.pyx":246 + /* "sklearn/earth/_forward.pyx":259 * - * #Iterate over variables + * # Iterate over variables * for variable in range(self.n): # <<<<<<<<<<<<<< * - * #Sort the data + * # Sort the data */ __pyx_t_11 = __pyx_v_self->n; for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { __pyx_v_variable = __pyx_t_12; - /* "sklearn/earth/_forward.pyx":249 - * - * #Sort the data - * sorting[:] = np.argsort(X[:,variable])[::-1] #TODO: eliminate Python call / data copy # <<<<<<<<<<<<<< + /* "sklearn/earth/_forward.pyx":263 + * # Sort the data + * # TODO: eliminate Python call / data copy + * sorting[:] = np.argsort(X[:, variable])[::-1] # <<<<<<<<<<<<<< * - * #Iterate over parents + * # Iterate over parents */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__argsort); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__argsort); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_INCREF(__pyx_k_slice_8); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_k_slice_8); @@ -5759,27 +5903,27 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_X), ((PyObject *)__pyx_t_13)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_X), ((PyObject *)__pyx_t_13)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; - __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; - __pyx_t_13 = PyObject_GetItem(__pyx_t_1, __pyx_k_slice_9); if (!__pyx_t_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyObject_GetItem(__pyx_t_1, __pyx_k_slice_9); if (!__pyx_t_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__Pyx_PyObject_SetSlice(((PyObject *)__pyx_v_sorting), __pyx_t_13, 0, 0, NULL, NULL, &__pyx_k_slice_10, 0, 0, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_PyObject_SetSlice(((PyObject *)__pyx_v_sorting), __pyx_t_13, 0, 0, NULL, NULL, &__pyx_k_slice_10, 0, 0, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - /* "sklearn/earth/_forward.pyx":252 + /* "sklearn/earth/_forward.pyx":266 * - * #Iterate over parents + * # Iterate over parents * for parent_idx in range(k): # <<<<<<<<<<<<<< * linear_dependence = False * @@ -5788,8 +5932,8 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { __pyx_v_parent_idx = __pyx_t_15; - /* "sklearn/earth/_forward.pyx":253 - * #Iterate over parents + /* "sklearn/earth/_forward.pyx":267 + * # Iterate over parents * for parent_idx in range(k): * linear_dependence = False # <<<<<<<<<<<<<< * @@ -5797,20 +5941,20 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str */ __pyx_v_linear_dependence = 0; - /* "sklearn/earth/_forward.pyx":255 + /* "sklearn/earth/_forward.pyx":269 * linear_dependence = False * * parent = self.basis.get(parent_idx) # <<<<<<<<<<<<<< * if self.max_degree >= 0: * parent_degree = parent.degree() */ - __pyx_t_13 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->get(__pyx_v_self->basis, __pyx_v_parent_idx, 0)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->get(__pyx_v_self->basis, __pyx_v_parent_idx, 0)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_XDECREF(((PyObject *)__pyx_v_parent)); __pyx_v_parent = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_13); __pyx_t_13 = 0; - /* "sklearn/earth/_forward.pyx":256 + /* "sklearn/earth/_forward.pyx":270 * * parent = self.basis.get(parent_idx) * if self.max_degree >= 0: # <<<<<<<<<<<<<< @@ -5820,7 +5964,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str __pyx_t_9 = ((__pyx_v_self->max_degree >= 0) != 0); if (__pyx_t_9) { - /* "sklearn/earth/_forward.pyx":257 + /* "sklearn/earth/_forward.pyx":271 * parent = self.basis.get(parent_idx) * if self.max_degree >= 0: * parent_degree = parent.degree() # <<<<<<<<<<<<<< @@ -5829,7 +5973,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str */ __pyx_v_parent_degree = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_parent->__pyx_vtab)->degree(__pyx_v_parent, 0); - /* "sklearn/earth/_forward.pyx":258 + /* "sklearn/earth/_forward.pyx":272 * if self.max_degree >= 0: * parent_degree = parent.degree() * if parent_degree >= self.max_degree: # <<<<<<<<<<<<<< @@ -5839,7 +5983,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str __pyx_t_9 = ((__pyx_v_parent_degree >= __pyx_v_self->max_degree) != 0); if (__pyx_t_9) { - /* "sklearn/earth/_forward.pyx":259 + /* "sklearn/earth/_forward.pyx":273 * parent_degree = parent.degree() * if parent_degree >= self.max_degree: * continue # <<<<<<<<<<<<<< @@ -5854,7 +5998,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str } __pyx_L8:; - /* "sklearn/earth/_forward.pyx":260 + /* "sklearn/earth/_forward.pyx":274 * if parent_degree >= self.max_degree: * continue * if not parent.is_splittable(): # <<<<<<<<<<<<<< @@ -5864,35 +6008,35 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str __pyx_t_9 = ((!(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_parent->__pyx_vtab)->is_splittable(__pyx_v_parent, 0) != 0)) != 0); if (__pyx_t_9) { - /* "sklearn/earth/_forward.pyx":261 + /* "sklearn/earth/_forward.pyx":275 * continue * if not parent.is_splittable(): * continue # <<<<<<<<<<<<<< * - * #Add the linear term to B + * # Add the linear term to B */ goto __pyx_L6_continue; goto __pyx_L10; } __pyx_L10:; - /* "sklearn/earth/_forward.pyx":264 + /* "sklearn/earth/_forward.pyx":278 * - * #Add the linear term to B + * # Add the linear term to B * for i in range(self.m): # <<<<<<<<<<<<<< - * B[i,k] = B[i,parent_idx]*X[i,variable] + * B[i, k] = B[i, parent_idx] * X[i, variable] * */ __pyx_t_16 = __pyx_v_self->m; for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { __pyx_v_i = __pyx_t_17; - /* "sklearn/earth/_forward.pyx":265 - * #Add the linear term to B + /* "sklearn/earth/_forward.pyx":279 + * # Add the linear term to B * for i in range(self.m): - * B[i,k] = B[i,parent_idx]*X[i,variable] # <<<<<<<<<<<<<< + * B[i, k] = B[i, parent_idx] * X[i, variable] # <<<<<<<<<<<<<< * - * #Orthonormalize + * # Orthonormalize */ __pyx_t_18 = __pyx_v_i; __pyx_t_19 = __pyx_v_parent_idx; @@ -5903,21 +6047,21 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str *__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_B.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_B.diminfo[1].strides) = ((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_B.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_B.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_X.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_X.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_X.diminfo[1].strides))); } - /* "sklearn/earth/_forward.pyx":268 + /* "sklearn/earth/_forward.pyx":282 * - * #Orthonormalize + * # Orthonormalize * for i in range(self.m): # <<<<<<<<<<<<<< - * B_orth[i,k] = B[i,k] + * B_orth[i, k] = B[i, k] * linear_dependence = self.orthonormal_update(k) */ __pyx_t_16 = __pyx_v_self->m; for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { __pyx_v_i = __pyx_t_17; - /* "sklearn/earth/_forward.pyx":269 - * #Orthonormalize + /* "sklearn/earth/_forward.pyx":283 + * # Orthonormalize * for i in range(self.m): - * B_orth[i,k] = B[i,k] # <<<<<<<<<<<<<< + * B_orth[i, k] = B[i, k] # <<<<<<<<<<<<<< * linear_dependence = self.orthonormal_update(k) * */ @@ -5928,35 +6072,35 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str *__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_B_orth.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_B.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_B.diminfo[1].strides)); } - /* "sklearn/earth/_forward.pyx":270 + /* "sklearn/earth/_forward.pyx":284 * for i in range(self.m): - * B_orth[i,k] = B[i,k] + * B_orth[i, k] = B[i, k] * linear_dependence = self.orthonormal_update(k) # <<<<<<<<<<<<<< * - * #If a new hinge function does not improve the gcv over the linear term + * # If a new hinge function does not improve the gcv over the linear term */ __pyx_v_linear_dependence = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_update(__pyx_v_self, __pyx_v_k, 0); - /* "sklearn/earth/_forward.pyx":277 - * #another term never increases, but the gcv may because it penalizes additional - * #terms. + /* "sklearn/earth/_forward.pyx":291 + * # another term never increases, but the gcv may because it penalizes additional + * # terms. * mse_ = (self.y_squared - self.c_squared) / self.m # <<<<<<<<<<<<<< - * gcv_ = gcv_factor_k_plus_1*(self.y_squared - self.c_squared) / self.m - * + * gcv_ = gcv_factor_k_plus_1 * \ + * (self.y_squared - self.c_squared) / self.m */ __pyx_v_mse_ = ((__pyx_v_self->y_squared - __pyx_v_self->c_squared) / __pyx_v_self->m); - /* "sklearn/earth/_forward.pyx":278 - * #terms. + /* "sklearn/earth/_forward.pyx":293 * mse_ = (self.y_squared - self.c_squared) / self.m - * gcv_ = gcv_factor_k_plus_1*(self.y_squared - self.c_squared) / self.m # <<<<<<<<<<<<<< + * gcv_ = gcv_factor_k_plus_1 * \ + * (self.y_squared - self.c_squared) / self.m # <<<<<<<<<<<<<< * * if linear_variables[variable]: */ __pyx_v_gcv_ = ((__pyx_v_gcv_factor_k_plus_1 * (__pyx_v_self->y_squared - __pyx_v_self->c_squared)) / __pyx_v_self->m); - /* "sklearn/earth/_forward.pyx":280 - * gcv_ = gcv_factor_k_plus_1*(self.y_squared - self.c_squared) / self.m + /* "sklearn/earth/_forward.pyx":295 + * (self.y_squared - self.c_squared) / self.m * * if linear_variables[variable]: # <<<<<<<<<<<<<< * mse = mse_ @@ -5966,7 +6110,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str __pyx_t_9 = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_INT_t *, __pyx_pybuffernd_linear_variables.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_linear_variables.diminfo[0].strides)) != 0); if (__pyx_t_9) { - /* "sklearn/earth/_forward.pyx":281 + /* "sklearn/earth/_forward.pyx":296 * * if linear_variables[variable]: * mse = mse_ # <<<<<<<<<<<<<< @@ -5975,7 +6119,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str */ __pyx_v_mse = __pyx_v_mse_; - /* "sklearn/earth/_forward.pyx":282 + /* "sklearn/earth/_forward.pyx":297 * if linear_variables[variable]: * mse = mse_ * knot_idx = -1 # <<<<<<<<<<<<<< @@ -5987,16 +6131,16 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str } /*else*/ { - /* "sklearn/earth/_forward.pyx":286 + /* "sklearn/earth/_forward.pyx":301 * - * #Find the valid knot candidates - * candidates_idx = parent.valid_knots(B[sorting,parent_idx], X[sorting,variable], variable, self.check_every, endspan, self.minspan, self.minspan_alpha, self.n, self.mwork) # <<<<<<<<<<<<<< + * # Find the valid knot candidates + * candidates_idx = parent.valid_knots(B[sorting, parent_idx], X[ # <<<<<<<<<<<<<< + * sorting, variable], variable, self.check_every, endspan, self.minspan, self.minspan_alpha, self.n, self.mwork) * - * if len(candidates_idx) > 0: */ - __pyx_t_13 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_parent_idx); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_parent_idx); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_sorting)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_sorting)); @@ -6004,13 +6148,21 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_13); __Pyx_GIVEREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_1)); if (!__pyx_t_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_1)); if (!__pyx_t_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_13) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_13, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_13) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_13, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/earth/_forward.pyx":302 + * # Find the valid knot candidates + * candidates_idx = parent.valid_knots(B[sorting, parent_idx], X[ + * sorting, variable], variable, self.check_every, endspan, self.minspan, self.minspan_alpha, self.n, self.mwork) # <<<<<<<<<<<<<< + * + * if len(candidates_idx) > 0: + */ + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_INCREF(((PyObject *)__pyx_v_sorting)); PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_v_sorting)); @@ -6018,13 +6170,13 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_X), ((PyObject *)__pyx_t_10)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_X), ((PyObject *)__pyx_t_10)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_10 = ((PyObject *)__pyx_v_self->mwork); __Pyx_INCREF(__pyx_t_10); - __pyx_t_28 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_parent->__pyx_vtab)->valid_knots(__pyx_v_parent, ((PyArrayObject *)__pyx_t_13), ((PyArrayObject *)__pyx_t_1), __pyx_v_variable, __pyx_v_self->check_every, __pyx_v_endspan, __pyx_v_self->minspan, __pyx_v_self->minspan_alpha, __pyx_v_self->n, ((PyArrayObject *)__pyx_t_10), 0)); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_parent->__pyx_vtab)->valid_knots(__pyx_v_parent, ((PyArrayObject *)__pyx_t_13), ((PyArrayObject *)__pyx_t_1), __pyx_v_variable, __pyx_v_self->check_every, __pyx_v_endspan, __pyx_v_self->minspan, __pyx_v_self->minspan_alpha, __pyx_v_self->n, ((PyArrayObject *)__pyx_t_10), 0)); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -6043,55 +6195,55 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str } } __pyx_pybuffernd_candidates_idx.diminfo[0].strides = __pyx_pybuffernd_candidates_idx.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_candidates_idx.diminfo[0].shape = __pyx_pybuffernd_candidates_idx.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_29 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 286; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_29 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __Pyx_XDECREF(((PyObject *)__pyx_v_candidates_idx)); __pyx_v_candidates_idx = ((PyArrayObject *)__pyx_t_28); __pyx_t_28 = 0; - /* "sklearn/earth/_forward.pyx":288 - * candidates_idx = parent.valid_knots(B[sorting,parent_idx], X[sorting,variable], variable, self.check_every, endspan, self.minspan, self.minspan_alpha, self.n, self.mwork) + /* "sklearn/earth/_forward.pyx":304 + * sorting, variable], variable, self.check_every, endspan, self.minspan, self.minspan_alpha, self.n, self.mwork) * * if len(candidates_idx) > 0: # <<<<<<<<<<<<<< - * #Choose the best candidate (if no candidate is an improvement on the linear term in terms of gcv, knot_idx is set to -1 - * + * # Choose the best candidate (if no candidate is an + * # improvement on the linear term in terms of gcv, knot_idx */ - __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_candidates_idx)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_candidates_idx)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_9 = ((__pyx_t_2 > 0) != 0); if (__pyx_t_9) { - /* "sklearn/earth/_forward.pyx":292 + /* "sklearn/earth/_forward.pyx":311 + * # Find the best knot location for this parent and + * # variable combination + * self.best_knot(parent_idx, variable, k, candidates_idx, sorting, & mse, & knot, & knot_idx) # <<<<<<<<<<<<<< * - * #Find the best knot location for this parent and variable combination - * self.best_knot(parent_idx,variable,k,candidates_idx,sorting,&mse,&knot,&knot_idx) # <<<<<<<<<<<<<< - * - * #If the hinge function does not decrease the gcv then just keep the linear term + * # If the hinge function does not decrease the gcv then */ - __pyx_t_28 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->best_knot(__pyx_v_self, __pyx_v_parent_idx, __pyx_v_variable, __pyx_v_k, ((PyArrayObject *)__pyx_v_candidates_idx), ((PyArrayObject *)__pyx_v_sorting), (&__pyx_v_mse), (&__pyx_v_knot), (&__pyx_v_knot_idx)); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 292; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->best_knot(__pyx_v_self, __pyx_v_parent_idx, __pyx_v_variable, __pyx_v_k, ((PyArrayObject *)__pyx_v_candidates_idx), ((PyArrayObject *)__pyx_v_sorting), (&__pyx_v_mse), (&__pyx_v_knot), (&__pyx_v_knot_idx)); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; - /* "sklearn/earth/_forward.pyx":295 - * - * #If the hinge function does not decrease the gcv then just keep the linear term - * if gcv_factor_k_plus_2*mse >= gcv_: # <<<<<<<<<<<<<< + /* "sklearn/earth/_forward.pyx":315 + * # If the hinge function does not decrease the gcv then + * # just keep the linear term + * if gcv_factor_k_plus_2 * mse >= gcv_: # <<<<<<<<<<<<<< * mse = mse_ * knot_idx = -1 */ __pyx_t_9 = (((__pyx_v_gcv_factor_k_plus_2 * __pyx_v_mse) >= __pyx_v_gcv_) != 0); if (__pyx_t_9) { - /* "sklearn/earth/_forward.pyx":296 - * #If the hinge function does not decrease the gcv then just keep the linear term - * if gcv_factor_k_plus_2*mse >= gcv_: + /* "sklearn/earth/_forward.pyx":316 + * # just keep the linear term + * if gcv_factor_k_plus_2 * mse >= gcv_: * mse = mse_ # <<<<<<<<<<<<<< * knot_idx = -1 * */ __pyx_v_mse = __pyx_v_mse_; - /* "sklearn/earth/_forward.pyx":297 - * if gcv_factor_k_plus_2*mse >= gcv_: + /* "sklearn/earth/_forward.pyx":317 + * if gcv_factor_k_plus_2 * mse >= gcv_: * mse = mse_ * knot_idx = -1 # <<<<<<<<<<<<<< * @@ -6105,23 +6257,23 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str } /*else*/ { - /* "sklearn/earth/_forward.pyx":301 - * else: - * #Do an orthonormal downdate and skip to the next iteration + /* "sklearn/earth/_forward.pyx":322 + * # Do an orthonormal downdate and skip to the next + * # iteration * self.orthonormal_downdate(k) # <<<<<<<<<<<<<< * continue * */ - __pyx_t_28 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_downdate(__pyx_v_self, __pyx_v_k, 0); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_downdate(__pyx_v_self, __pyx_v_k, 0); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; - /* "sklearn/earth/_forward.pyx":302 - * #Do an orthonormal downdate and skip to the next iteration + /* "sklearn/earth/_forward.pyx":323 + * # iteration * self.orthonormal_downdate(k) * continue # <<<<<<<<<<<<<< * - * #Do an orthonormal downdate + * # Do an orthonormal downdate */ goto __pyx_L6_continue; } @@ -6129,20 +6281,20 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str } __pyx_L15:; - /* "sklearn/earth/_forward.pyx":305 + /* "sklearn/earth/_forward.pyx":326 * - * #Do an orthonormal downdate + * # Do an orthonormal downdate * self.orthonormal_downdate(k) # <<<<<<<<<<<<<< * - * #Update the choices + * # Update the choices */ - __pyx_t_28 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_downdate(__pyx_v_self, __pyx_v_k, 0); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_downdate(__pyx_v_self, __pyx_v_k, 0); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; - /* "sklearn/earth/_forward.pyx":308 + /* "sklearn/earth/_forward.pyx":329 * - * #Update the choices + * # Update the choices * if first: # <<<<<<<<<<<<<< * knot_choice = knot * mse_choice = mse @@ -6150,8 +6302,8 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str __pyx_t_9 = (__pyx_v_first != 0); if (__pyx_t_9) { - /* "sklearn/earth/_forward.pyx":309 - * #Update the choices + /* "sklearn/earth/_forward.pyx":330 + * # Update the choices * if first: * knot_choice = knot # <<<<<<<<<<<<<< * mse_choice = mse @@ -6159,7 +6311,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str */ __pyx_v_knot_choice = __pyx_v_knot; - /* "sklearn/earth/_forward.pyx":310 + /* "sklearn/earth/_forward.pyx":331 * if first: * knot_choice = knot * mse_choice = mse # <<<<<<<<<<<<<< @@ -6168,7 +6320,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str */ __pyx_v_mse_choice = __pyx_v_mse; - /* "sklearn/earth/_forward.pyx":311 + /* "sklearn/earth/_forward.pyx":332 * knot_choice = knot * mse_choice = mse * knot_idx_choice = knot_idx # <<<<<<<<<<<<<< @@ -6177,7 +6329,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str */ __pyx_v_knot_idx_choice = __pyx_v_knot_idx; - /* "sklearn/earth/_forward.pyx":312 + /* "sklearn/earth/_forward.pyx":333 * mse_choice = mse * knot_idx_choice = knot_idx * parent_idx_choice = parent_idx # <<<<<<<<<<<<<< @@ -6186,7 +6338,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str */ __pyx_v_parent_idx_choice = __pyx_v_parent_idx; - /* "sklearn/earth/_forward.pyx":313 + /* "sklearn/earth/_forward.pyx":334 * knot_idx_choice = knot_idx * parent_idx_choice = parent_idx * parent_choice = parent # <<<<<<<<<<<<<< @@ -6197,7 +6349,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str __Pyx_XDECREF(((PyObject *)__pyx_v_parent_choice)); __pyx_v_parent_choice = __pyx_v_parent; - /* "sklearn/earth/_forward.pyx":314 + /* "sklearn/earth/_forward.pyx":335 * parent_idx_choice = parent_idx * parent_choice = parent * variable_choice = variable # <<<<<<<<<<<<<< @@ -6206,7 +6358,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str */ __pyx_v_variable_choice = __pyx_v_variable; - /* "sklearn/earth/_forward.pyx":315 + /* "sklearn/earth/_forward.pyx":336 * parent_choice = parent * variable_choice = variable * first = False # <<<<<<<<<<<<<< @@ -6215,7 +6367,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str */ __pyx_v_first = 0; - /* "sklearn/earth/_forward.pyx":316 + /* "sklearn/earth/_forward.pyx":337 * variable_choice = variable * first = False * dependent = linear_dependence # <<<<<<<<<<<<<< @@ -6227,7 +6379,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str } __pyx_L18:; - /* "sklearn/earth/_forward.pyx":317 + /* "sklearn/earth/_forward.pyx":338 * first = False * dependent = linear_dependence * if mse < mse_choice: # <<<<<<<<<<<<<< @@ -6237,7 +6389,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str __pyx_t_9 = ((__pyx_v_mse < __pyx_v_mse_choice) != 0); if (__pyx_t_9) { - /* "sklearn/earth/_forward.pyx":318 + /* "sklearn/earth/_forward.pyx":339 * dependent = linear_dependence * if mse < mse_choice: * knot_choice = knot # <<<<<<<<<<<<<< @@ -6246,7 +6398,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str */ __pyx_v_knot_choice = __pyx_v_knot; - /* "sklearn/earth/_forward.pyx":319 + /* "sklearn/earth/_forward.pyx":340 * if mse < mse_choice: * knot_choice = knot * mse_choice = mse # <<<<<<<<<<<<<< @@ -6255,7 +6407,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str */ __pyx_v_mse_choice = __pyx_v_mse; - /* "sklearn/earth/_forward.pyx":320 + /* "sklearn/earth/_forward.pyx":341 * knot_choice = knot * mse_choice = mse * knot_idx_choice = knot_idx # <<<<<<<<<<<<<< @@ -6264,7 +6416,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str */ __pyx_v_knot_idx_choice = __pyx_v_knot_idx; - /* "sklearn/earth/_forward.pyx":321 + /* "sklearn/earth/_forward.pyx":342 * mse_choice = mse * knot_idx_choice = knot_idx * parent_idx_choice = parent_idx # <<<<<<<<<<<<<< @@ -6273,7 +6425,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str */ __pyx_v_parent_idx_choice = __pyx_v_parent_idx; - /* "sklearn/earth/_forward.pyx":322 + /* "sklearn/earth/_forward.pyx":343 * knot_idx_choice = knot_idx * parent_idx_choice = parent_idx * parent_choice = parent # <<<<<<<<<<<<<< @@ -6284,7 +6436,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str __Pyx_XDECREF(((PyObject *)__pyx_v_parent_choice)); __pyx_v_parent_choice = __pyx_v_parent; - /* "sklearn/earth/_forward.pyx":323 + /* "sklearn/earth/_forward.pyx":344 * parent_idx_choice = parent_idx * parent_choice = parent * variable_choice = variable # <<<<<<<<<<<<<< @@ -6293,12 +6445,12 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str */ __pyx_v_variable_choice = __pyx_v_variable; - /* "sklearn/earth/_forward.pyx":324 + /* "sklearn/earth/_forward.pyx":345 * parent_choice = parent * variable_choice = variable * dependent = linear_dependence # <<<<<<<<<<<<<< * - * #Make sure at least one candidate was checked + * # Make sure at least one candidate was checked */ __pyx_v_dependent = __pyx_v_linear_dependence; goto __pyx_L19; @@ -6308,9 +6460,9 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str } } - /* "sklearn/earth/_forward.pyx":327 + /* "sklearn/earth/_forward.pyx":348 * - * #Make sure at least one candidate was checked + * # Make sure at least one candidate was checked * if first: # <<<<<<<<<<<<<< * self.record[len(self.record) - 1].set_no_candidates(True) * return @@ -6318,8 +6470,8 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str __pyx_t_9 = (__pyx_v_first != 0); if (__pyx_t_9) { - /* "sklearn/earth/_forward.pyx":328 - * #Make sure at least one candidate was checked + /* "sklearn/earth/_forward.pyx":349 + * # Make sure at least one candidate was checked * if first: * self.record[len(self.record) - 1].set_no_candidates(True) # <<<<<<<<<<<<<< * return @@ -6327,33 +6479,33 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str */ __pyx_t_28 = ((PyObject *)__pyx_v_self->record); __Pyx_INCREF(__pyx_t_28); - __pyx_t_2 = PyObject_Length(__pyx_t_28); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Length(__pyx_t_28); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; __pyx_t_33 = (__pyx_t_2 - 1); - __pyx_t_28 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->record), __pyx_t_33, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 0, 0); if (!__pyx_t_28) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->record), __pyx_t_33, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 0, 0); if (!__pyx_t_28) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_28, __pyx_n_s__set_no_candidates); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_28, __pyx_n_s__set_no_candidates); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; - __pyx_t_28 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_28); __Pyx_GIVEREF(__pyx_t_28); __pyx_t_28 = 0; - __pyx_t_28 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; - /* "sklearn/earth/_forward.pyx":329 + /* "sklearn/earth/_forward.pyx":350 * if first: * self.record[len(self.record) - 1].set_no_candidates(True) * return # <<<<<<<<<<<<<< * - * #Add the new basis functions + * # Add the new basis functions */ __Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -6362,62 +6514,62 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str } __pyx_L20:; - /* "sklearn/earth/_forward.pyx":332 + /* "sklearn/earth/_forward.pyx":353 * - * #Add the new basis functions + * # Add the new basis functions * parent = self.basis.get(parent_idx) # <<<<<<<<<<<<<< * label = self.xlabels[variable_choice] * if knot_idx_choice != -1: */ - __pyx_t_28 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->get(__pyx_v_self->basis, __pyx_v_parent_idx, 0)); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->get(__pyx_v_self->basis, __pyx_v_parent_idx, 0)); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); __Pyx_XDECREF(((PyObject *)__pyx_v_parent)); __pyx_v_parent = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_28); __pyx_t_28 = 0; - /* "sklearn/earth/_forward.pyx":333 - * #Add the new basis functions + /* "sklearn/earth/_forward.pyx":354 + * # Add the new basis functions * parent = self.basis.get(parent_idx) * label = self.xlabels[variable_choice] # <<<<<<<<<<<<<< * if knot_idx_choice != -1: - * #Add the new basis functions + * # Add the new basis functions */ if (unlikely(((PyObject *)__pyx_v_self->xlabels) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_28 = PyList_GET_ITEM(__pyx_v_self->xlabels, __pyx_v_variable_choice); __Pyx_INCREF(__pyx_t_28); __pyx_v_label = __pyx_t_28; __pyx_t_28 = 0; - /* "sklearn/earth/_forward.pyx":334 + /* "sklearn/earth/_forward.pyx":355 * parent = self.basis.get(parent_idx) * label = self.xlabels[variable_choice] * if knot_idx_choice != -1: # <<<<<<<<<<<<<< - * #Add the new basis functions - * bf1 = HingeBasisFunction(parent_choice,knot_choice,knot_idx_choice,variable_choice,False,label) + * # Add the new basis functions + * bf1 = HingeBasisFunction( */ __pyx_t_9 = ((__pyx_v_knot_idx_choice != -1) != 0); if (__pyx_t_9) { - /* "sklearn/earth/_forward.pyx":336 - * if knot_idx_choice != -1: - * #Add the new basis functions - * bf1 = HingeBasisFunction(parent_choice,knot_choice,knot_idx_choice,variable_choice,False,label) # <<<<<<<<<<<<<< - * bf2 = HingeBasisFunction(parent_choice,knot_choice,knot_idx_choice,variable_choice,True,label) - * bf1.apply(X,B[:,k]) - */ - if (unlikely(!__pyx_v_parent_choice)) { __Pyx_RaiseUnboundLocalError("parent_choice"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_28 = PyFloat_FromDouble(__pyx_v_knot_choice); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /* "sklearn/earth/_forward.pyx":358 + * # Add the new basis functions + * bf1 = HingeBasisFunction( + * parent_choice, knot_choice, knot_idx_choice, variable_choice, False, label) # <<<<<<<<<<<<<< + * bf2 = HingeBasisFunction( + * parent_choice, knot_choice, knot_idx_choice, variable_choice, True, label) + */ + if (unlikely(!__pyx_v_parent_choice)) { __Pyx_RaiseUnboundLocalError("parent_choice"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_28 = PyFloat_FromDouble(__pyx_v_knot_choice); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); - __pyx_t_1 = PyInt_FromLong(__pyx_v_knot_idx_choice); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_knot_idx_choice); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable_choice); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable_choice); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_13 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); - __pyx_t_34 = PyTuple_New(6); if (unlikely(!__pyx_t_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_34 = PyTuple_New(6); if (unlikely(!__pyx_t_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_34); __Pyx_INCREF(((PyObject *)__pyx_v_parent_choice)); PyTuple_SET_ITEM(__pyx_t_34, 0, ((PyObject *)__pyx_v_parent_choice)); @@ -6437,28 +6589,28 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str __pyx_t_1 = 0; __pyx_t_10 = 0; __pyx_t_13 = 0; - __pyx_t_13 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_HingeBasisFunction)), ((PyObject *)__pyx_t_34), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 336; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_HingeBasisFunction)), ((PyObject *)__pyx_t_34), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(((PyObject *)__pyx_t_34)); __pyx_t_34 = 0; __pyx_v_bf1 = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_13); __pyx_t_13 = 0; - /* "sklearn/earth/_forward.pyx":337 - * #Add the new basis functions - * bf1 = HingeBasisFunction(parent_choice,knot_choice,knot_idx_choice,variable_choice,False,label) - * bf2 = HingeBasisFunction(parent_choice,knot_choice,knot_idx_choice,variable_choice,True,label) # <<<<<<<<<<<<<< - * bf1.apply(X,B[:,k]) - * bf2.apply(X,B[:,k+1]) + /* "sklearn/earth/_forward.pyx":360 + * parent_choice, knot_choice, knot_idx_choice, variable_choice, False, label) + * bf2 = HingeBasisFunction( + * parent_choice, knot_choice, knot_idx_choice, variable_choice, True, label) # <<<<<<<<<<<<<< + * bf1.apply(X, B[:, k]) + * bf2.apply(X, B[:, k + 1]) */ - __pyx_t_13 = PyFloat_FromDouble(__pyx_v_knot_choice); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyFloat_FromDouble(__pyx_v_knot_choice); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); - __pyx_t_34 = PyInt_FromLong(__pyx_v_knot_idx_choice); if (unlikely(!__pyx_t_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_34 = PyInt_FromLong(__pyx_v_knot_idx_choice); if (unlikely(!__pyx_t_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_34); - __pyx_t_10 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable_choice); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable_choice); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_28 = PyTuple_New(6); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = PyTuple_New(6); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); __Pyx_INCREF(((PyObject *)__pyx_v_parent_choice)); PyTuple_SET_ITEM(__pyx_t_28, 0, ((PyObject *)__pyx_v_parent_choice)); @@ -6478,22 +6630,22 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str __pyx_t_34 = 0; __pyx_t_10 = 0; __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_HingeBasisFunction)), ((PyObject *)__pyx_t_28), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 337; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_HingeBasisFunction)), ((PyObject *)__pyx_t_28), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_28)); __pyx_t_28 = 0; __pyx_v_bf2 = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_forward.pyx":338 - * bf1 = HingeBasisFunction(parent_choice,knot_choice,knot_idx_choice,variable_choice,False,label) - * bf2 = HingeBasisFunction(parent_choice,knot_choice,knot_idx_choice,variable_choice,True,label) - * bf1.apply(X,B[:,k]) # <<<<<<<<<<<<<< - * bf2.apply(X,B[:,k+1]) + /* "sklearn/earth/_forward.pyx":361 + * bf2 = HingeBasisFunction( + * parent_choice, knot_choice, knot_idx_choice, variable_choice, True, label) + * bf1.apply(X, B[:, k]) # <<<<<<<<<<<<<< + * bf2.apply(X, B[:, k + 1]) * self.basis.append(bf1) */ - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_28 = PyTuple_New(2); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = PyTuple_New(2); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); __Pyx_INCREF(__pyx_k_slice_11); PyTuple_SET_ITEM(__pyx_t_28, 0, __pyx_k_slice_11); @@ -6501,25 +6653,25 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str PyTuple_SET_ITEM(__pyx_t_28, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_28)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_28)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_28)); __pyx_t_28 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_28 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_bf1->__pyx_vtab)->apply(__pyx_v_bf1, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_t_1), 0, NULL); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_bf1->__pyx_vtab)->apply(__pyx_v_bf1, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_t_1), 0, NULL); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; - /* "sklearn/earth/_forward.pyx":339 - * bf2 = HingeBasisFunction(parent_choice,knot_choice,knot_idx_choice,variable_choice,True,label) - * bf1.apply(X,B[:,k]) - * bf2.apply(X,B[:,k+1]) # <<<<<<<<<<<<<< + /* "sklearn/earth/_forward.pyx":362 + * parent_choice, knot_choice, knot_idx_choice, variable_choice, True, label) + * bf1.apply(X, B[:, k]) + * bf2.apply(X, B[:, k + 1]) # <<<<<<<<<<<<<< * self.basis.append(bf1) * self.basis.append(bf2) */ - __pyx_t_28 = __Pyx_PyInt_to_py_npy_ulonglong((__pyx_v_k + 1)); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = __Pyx_PyInt_to_py_npy_ulonglong((__pyx_v_k + 1)); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_k_slice_12); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_k_slice_12); @@ -6527,47 +6679,47 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_28); __Pyx_GIVEREF(__pyx_t_28); __pyx_t_28 = 0; - __pyx_t_28 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_1)); if (!__pyx_t_28) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_1)); if (!__pyx_t_28) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_28) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_28, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_bf2->__pyx_vtab)->apply(__pyx_v_bf2, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_t_28), 0, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_28) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_28, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_bf2->__pyx_vtab)->apply(__pyx_v_bf2, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_t_28), 0, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_forward.pyx":340 - * bf1.apply(X,B[:,k]) - * bf2.apply(X,B[:,k+1]) + /* "sklearn/earth/_forward.pyx":363 + * bf1.apply(X, B[:, k]) + * bf2.apply(X, B[:, k + 1]) * self.basis.append(bf1) # <<<<<<<<<<<<<< * self.basis.append(bf2) * */ - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->append(__pyx_v_self->basis, __pyx_v_bf1, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->append(__pyx_v_self->basis, __pyx_v_bf1, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_forward.pyx":341 - * bf2.apply(X,B[:,k+1]) + /* "sklearn/earth/_forward.pyx":364 + * bf2.apply(X, B[:, k + 1]) * self.basis.append(bf1) * self.basis.append(bf2) # <<<<<<<<<<<<<< * - * #Orthogonalize the new basis + * # Orthogonalize the new basis */ - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->append(__pyx_v_self->basis, __pyx_v_bf2, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 341; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->append(__pyx_v_self->basis, __pyx_v_bf2, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_forward.pyx":344 + /* "sklearn/earth/_forward.pyx":367 * - * #Orthogonalize the new basis - * B_orth[:,k] = B[:,k] # <<<<<<<<<<<<<< + * # Orthogonalize the new basis + * B_orth[:, k] = B[:, k] # <<<<<<<<<<<<<< * if self.orthonormal_update(k) == 1: * bf1.make_unsplittable() */ - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_28 = PyTuple_New(2); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = PyTuple_New(2); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); __Pyx_INCREF(__pyx_k_slice_13); PyTuple_SET_ITEM(__pyx_t_28, 0, __pyx_k_slice_13); @@ -6575,12 +6727,12 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str PyTuple_SET_ITEM(__pyx_t_28, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_28)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_28)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_28)); __pyx_t_28 = 0; - __pyx_t_28 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); - __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_INCREF(__pyx_k_slice_14); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_k_slice_14); @@ -6588,42 +6740,42 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_28); __Pyx_GIVEREF(__pyx_t_28); __pyx_t_28 = 0; - if (PyObject_SetItem(((PyObject *)__pyx_v_B_orth), ((PyObject *)__pyx_t_10), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(((PyObject *)__pyx_v_B_orth), ((PyObject *)__pyx_t_10), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_forward.pyx":345 - * #Orthogonalize the new basis - * B_orth[:,k] = B[:,k] + /* "sklearn/earth/_forward.pyx":368 + * # Orthogonalize the new basis + * B_orth[:, k] = B[:, k] * if self.orthonormal_update(k) == 1: # <<<<<<<<<<<<<< * bf1.make_unsplittable() - * B_orth[:,k+1] = B[:,k+1] + * B_orth[:, k + 1] = B[:, k + 1] */ __pyx_t_9 = ((((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_update(__pyx_v_self, __pyx_v_k, 0) == 1) != 0); if (__pyx_t_9) { - /* "sklearn/earth/_forward.pyx":346 - * B_orth[:,k] = B[:,k] + /* "sklearn/earth/_forward.pyx":369 + * B_orth[:, k] = B[:, k] * if self.orthonormal_update(k) == 1: * bf1.make_unsplittable() # <<<<<<<<<<<<<< - * B_orth[:,k+1] = B[:,k+1] - * if self.orthonormal_update(k+1) == 1: + * B_orth[:, k + 1] = B[:, k + 1] + * if self.orthonormal_update(k + 1) == 1: */ ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_bf1->__pyx_vtab)->make_unsplittable(__pyx_v_bf1, 0); goto __pyx_L22; } __pyx_L22:; - /* "sklearn/earth/_forward.pyx":347 + /* "sklearn/earth/_forward.pyx":370 * if self.orthonormal_update(k) == 1: * bf1.make_unsplittable() - * B_orth[:,k+1] = B[:,k+1] # <<<<<<<<<<<<<< - * if self.orthonormal_update(k+1) == 1: + * B_orth[:, k + 1] = B[:, k + 1] # <<<<<<<<<<<<<< + * if self.orthonormal_update(k + 1) == 1: * bf2.make_unsplittable() */ - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong((__pyx_v_k + 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong((__pyx_v_k + 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_INCREF(__pyx_k_slice_15); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_k_slice_15); @@ -6631,12 +6783,12 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_10)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_10)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyInt_to_py_npy_ulonglong((__pyx_v_k + 1)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyInt_to_py_npy_ulonglong((__pyx_v_k + 1)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_28 = PyTuple_New(2); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = PyTuple_New(2); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); __Pyx_INCREF(__pyx_k_slice_16); PyTuple_SET_ITEM(__pyx_t_28, 0, __pyx_k_slice_16); @@ -6644,26 +6796,26 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str PyTuple_SET_ITEM(__pyx_t_28, 1, __pyx_t_10); __Pyx_GIVEREF(__pyx_t_10); __pyx_t_10 = 0; - if (PyObject_SetItem(((PyObject *)__pyx_v_B_orth), ((PyObject *)__pyx_t_28), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(((PyObject *)__pyx_v_B_orth), ((PyObject *)__pyx_t_28), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_28)); __pyx_t_28 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_forward.pyx":348 + /* "sklearn/earth/_forward.pyx":371 * bf1.make_unsplittable() - * B_orth[:,k+1] = B[:,k+1] - * if self.orthonormal_update(k+1) == 1: # <<<<<<<<<<<<<< + * B_orth[:, k + 1] = B[:, k + 1] + * if self.orthonormal_update(k + 1) == 1: # <<<<<<<<<<<<<< * bf2.make_unsplittable() * elif not dependent and knot_idx_choice == -1: */ __pyx_t_9 = ((((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_update(__pyx_v_self, (__pyx_v_k + 1), 0) == 1) != 0); if (__pyx_t_9) { - /* "sklearn/earth/_forward.pyx":349 - * B_orth[:,k+1] = B[:,k+1] - * if self.orthonormal_update(k+1) == 1: + /* "sklearn/earth/_forward.pyx":372 + * B_orth[:, k + 1] = B[:, k + 1] + * if self.orthonormal_update(k + 1) == 1: * bf2.make_unsplittable() # <<<<<<<<<<<<<< * elif not dependent and knot_idx_choice == -1: - * #In this case, only add the linear basis function + * # In this case, only add the linear basis function */ ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_bf2->__pyx_vtab)->make_unsplittable(__pyx_v_bf2, 0); goto __pyx_L23; @@ -6672,12 +6824,12 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str goto __pyx_L21; } - /* "sklearn/earth/_forward.pyx":350 - * if self.orthonormal_update(k+1) == 1: + /* "sklearn/earth/_forward.pyx":373 + * if self.orthonormal_update(k + 1) == 1: * bf2.make_unsplittable() * elif not dependent and knot_idx_choice == -1: # <<<<<<<<<<<<<< - * #In this case, only add the linear basis function - * bf1 = LinearBasisFunction(parent_choice,variable_choice,label) + * # In this case, only add the linear basis function + * bf1 = LinearBasisFunction(parent_choice, variable_choice, label) */ __pyx_t_9 = ((!(__pyx_v_dependent != 0)) != 0); if (__pyx_t_9) { @@ -6688,17 +6840,17 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str } if (__pyx_t_36) { - /* "sklearn/earth/_forward.pyx":352 + /* "sklearn/earth/_forward.pyx":375 * elif not dependent and knot_idx_choice == -1: - * #In this case, only add the linear basis function - * bf1 = LinearBasisFunction(parent_choice,variable_choice,label) # <<<<<<<<<<<<<< - * bf1.apply(X,B[:,k]) + * # In this case, only add the linear basis function + * bf1 = LinearBasisFunction(parent_choice, variable_choice, label) # <<<<<<<<<<<<<< + * bf1.apply(X, B[:, k]) * self.basis.append(bf1) */ - if (unlikely(!__pyx_v_parent_choice)) { __Pyx_RaiseUnboundLocalError("parent_choice"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable_choice); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_v_parent_choice)) { __Pyx_RaiseUnboundLocalError("parent_choice"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable_choice); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_28 = PyTuple_New(3); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = PyTuple_New(3); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); __Pyx_INCREF(((PyObject *)__pyx_v_parent_choice)); PyTuple_SET_ITEM(__pyx_t_28, 0, ((PyObject *)__pyx_v_parent_choice)); @@ -6709,22 +6861,22 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str PyTuple_SET_ITEM(__pyx_t_28, 2, __pyx_v_label); __Pyx_GIVEREF(__pyx_v_label); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_LinearBasisFunction)), ((PyObject *)__pyx_t_28), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 352; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_LinearBasisFunction)), ((PyObject *)__pyx_t_28), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_28)); __pyx_t_28 = 0; __pyx_v_bf1 = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_forward.pyx":353 - * #In this case, only add the linear basis function - * bf1 = LinearBasisFunction(parent_choice,variable_choice,label) - * bf1.apply(X,B[:,k]) # <<<<<<<<<<<<<< + /* "sklearn/earth/_forward.pyx":376 + * # In this case, only add the linear basis function + * bf1 = LinearBasisFunction(parent_choice, variable_choice, label) + * bf1.apply(X, B[:, k]) # <<<<<<<<<<<<<< * self.basis.append(bf1) * */ - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_28 = PyTuple_New(2); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = PyTuple_New(2); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); __Pyx_INCREF(__pyx_k_slice_17); PyTuple_SET_ITEM(__pyx_t_28, 0, __pyx_k_slice_17); @@ -6732,36 +6884,36 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str PyTuple_SET_ITEM(__pyx_t_28, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_28)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_28)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_28)); __pyx_t_28 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_28 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_bf1->__pyx_vtab)->apply(__pyx_v_bf1, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_t_1), 0, NULL); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_bf1->__pyx_vtab)->apply(__pyx_v_bf1, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_t_1), 0, NULL); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; - /* "sklearn/earth/_forward.pyx":354 - * bf1 = LinearBasisFunction(parent_choice,variable_choice,label) - * bf1.apply(X,B[:,k]) + /* "sklearn/earth/_forward.pyx":377 + * bf1 = LinearBasisFunction(parent_choice, variable_choice, label) + * bf1.apply(X, B[:, k]) * self.basis.append(bf1) # <<<<<<<<<<<<<< * - * #Orthogonalize the new basis + * # Orthogonalize the new basis */ - __pyx_t_28 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->append(__pyx_v_self->basis, __pyx_v_bf1, 0); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->append(__pyx_v_self->basis, __pyx_v_bf1, 0); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; - /* "sklearn/earth/_forward.pyx":357 + /* "sklearn/earth/_forward.pyx":380 * - * #Orthogonalize the new basis - * B_orth[:,k] = B[:,k] # <<<<<<<<<<<<<< + * # Orthogonalize the new basis + * B_orth[:, k] = B[:, k] # <<<<<<<<<<<<<< * if self.orthonormal_update(k) == 1: * bf1.make_unsplittable() */ - __pyx_t_28 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_k_slice_18); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_k_slice_18); @@ -6769,12 +6921,12 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_28); __Pyx_GIVEREF(__pyx_t_28); __pyx_t_28 = 0; - __pyx_t_28 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_1)); if (!__pyx_t_28) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_1)); if (!__pyx_t_28) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_INCREF(__pyx_k_slice_19); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_k_slice_19); @@ -6782,26 +6934,26 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyObject_SetItem(((PyObject *)__pyx_v_B_orth), ((PyObject *)__pyx_t_10), __pyx_t_28) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(((PyObject *)__pyx_v_B_orth), ((PyObject *)__pyx_t_10), __pyx_t_28) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; - /* "sklearn/earth/_forward.pyx":358 - * #Orthogonalize the new basis - * B_orth[:,k] = B[:,k] + /* "sklearn/earth/_forward.pyx":381 + * # Orthogonalize the new basis + * B_orth[:, k] = B[:, k] * if self.orthonormal_update(k) == 1: # <<<<<<<<<<<<<< * bf1.make_unsplittable() - * else:#dependent and knot_idx_choice == -1 + * else: # dependent and knot_idx_choice == -1 */ __pyx_t_36 = ((((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_update(__pyx_v_self, __pyx_v_k, 0) == 1) != 0); if (__pyx_t_36) { - /* "sklearn/earth/_forward.pyx":359 - * B_orth[:,k] = B[:,k] + /* "sklearn/earth/_forward.pyx":382 + * B_orth[:, k] = B[:, k] * if self.orthonormal_update(k) == 1: * bf1.make_unsplittable() # <<<<<<<<<<<<<< - * else:#dependent and knot_idx_choice == -1 - * #In this case there were no acceptable choices remaining, so end the forward pass + * else: # dependent and knot_idx_choice == -1 + * # In this case there were no acceptable choices remaining, so end */ ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_bf1->__pyx_vtab)->make_unsplittable(__pyx_v_bf1, 0); goto __pyx_L24; @@ -6811,42 +6963,42 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str } /*else*/ { - /* "sklearn/earth/_forward.pyx":362 - * else:#dependent and knot_idx_choice == -1 - * #In this case there were no acceptable choices remaining, so end the forward pass + /* "sklearn/earth/_forward.pyx":386 + * # In this case there were no acceptable choices remaining, so end + * # the forward pass * self.record[len(self.record) - 1].set_no_candidates(True) # <<<<<<<<<<<<<< * return * */ __pyx_t_28 = ((PyObject *)__pyx_v_self->record); __Pyx_INCREF(__pyx_t_28); - __pyx_t_33 = PyObject_Length(__pyx_t_28); if (unlikely(__pyx_t_33 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_33 = PyObject_Length(__pyx_t_28); if (unlikely(__pyx_t_33 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; __pyx_t_2 = (__pyx_t_33 - 1); - __pyx_t_28 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->record), __pyx_t_2, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 0, 0); if (!__pyx_t_28) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->record), __pyx_t_2, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 0, 0); if (!__pyx_t_28) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_28, __pyx_n_s__set_no_candidates); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_28, __pyx_n_s__set_no_candidates); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; - __pyx_t_28 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_28); __Pyx_GIVEREF(__pyx_t_28); __pyx_t_28 = 0; - __pyx_t_28 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; - /* "sklearn/earth/_forward.pyx":363 - * #In this case there were no acceptable choices remaining, so end the forward pass + /* "sklearn/earth/_forward.pyx":387 + * # the forward pass * self.record[len(self.record) - 1].set_no_candidates(True) * return # <<<<<<<<<<<<<< * - * #Update the build record + * # Update the build record */ __Pyx_XDECREF(__pyx_r); __pyx_r = Py_None; __Pyx_INCREF(Py_None); @@ -6854,28 +7006,28 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str } __pyx_L21:; - /* "sklearn/earth/_forward.pyx":366 - * - * #Update the build record - * self.record.append(ForwardPassIteration(parent_idx_choice,variable_choice,knot_idx_choice,mse_choice,len(self.basis))) # <<<<<<<<<<<<<< + /* "sklearn/earth/_forward.pyx":391 + * # Update the build record + * self.record.append(ForwardPassIteration( + * parent_idx_choice, variable_choice, knot_idx_choice, mse_choice, len(self.basis))) # <<<<<<<<<<<<<< * - * cdef best_knot(ForwardPasser self, INDEX_t parent, INDEX_t variable, INDEX_t k, cnp.ndarray[INT_t,ndim=1] candidates, cnp.ndarray[INT_t,ndim=1] order, FLOAT_t * mse, FLOAT_t * knot, INDEX_t * knot_idx): + * cdef best_knot(ForwardPasser self, INDEX_t parent, INDEX_t variable, INDEX_t k, cnp.ndarray[INT_t, ndim=1] candidates, cnp.ndarray[INT_t, ndim=1] order, FLOAT_t * mse, FLOAT_t * knot, INDEX_t * knot_idx): */ - __pyx_t_28 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_parent_idx_choice); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_28 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_parent_idx_choice); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_28); - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable_choice); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable_choice); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = PyInt_FromLong(__pyx_v_knot_idx_choice); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyInt_FromLong(__pyx_v_knot_idx_choice); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_34 = PyFloat_FromDouble(__pyx_v_mse_choice); if (unlikely(!__pyx_t_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_34 = PyFloat_FromDouble(__pyx_v_mse_choice); if (unlikely(!__pyx_t_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_34); __pyx_t_13 = ((PyObject *)__pyx_v_self->basis); __Pyx_INCREF(__pyx_t_13); - __pyx_t_2 = PyObject_Length(__pyx_t_13); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Length(__pyx_t_13); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); - __pyx_t_37 = PyTuple_New(5); if (unlikely(!__pyx_t_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_37 = PyTuple_New(5); if (unlikely(!__pyx_t_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_37); PyTuple_SET_ITEM(__pyx_t_37, 0, __pyx_t_28); __Pyx_GIVEREF(__pyx_t_28); @@ -6892,10 +7044,10 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str __pyx_t_10 = 0; __pyx_t_34 = 0; __pyx_t_13 = 0; - __pyx_t_13 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_ForwardPassIteration)), ((PyObject *)__pyx_t_37), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_ForwardPassIteration)), ((PyObject *)__pyx_t_37), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(((PyObject *)__pyx_t_37)); __pyx_t_37 = 0; - __pyx_t_37 = ((struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->__pyx_base.append(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self->record), ((struct __pyx_obj_7sklearn_5earth_7_record_Iteration *)__pyx_t_13), 0); if (unlikely(!__pyx_t_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_37 = ((struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->__pyx_base.append(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self->record), ((struct __pyx_obj_7sklearn_5earth_7_record_Iteration *)__pyx_t_13), 0); if (unlikely(!__pyx_t_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_37); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0; @@ -6948,10 +7100,10 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str return __pyx_r; } -/* "sklearn/earth/_forward.pyx":368 - * self.record.append(ForwardPassIteration(parent_idx_choice,variable_choice,knot_idx_choice,mse_choice,len(self.basis))) +/* "sklearn/earth/_forward.pyx":393 + * parent_idx_choice, variable_choice, knot_idx_choice, mse_choice, len(self.basis))) * - * cdef best_knot(ForwardPasser self, INDEX_t parent, INDEX_t variable, INDEX_t k, cnp.ndarray[INT_t,ndim=1] candidates, cnp.ndarray[INT_t,ndim=1] order, FLOAT_t * mse, FLOAT_t * knot, INDEX_t * knot_idx): # <<<<<<<<<<<<<< + * cdef best_knot(ForwardPasser self, INDEX_t parent, INDEX_t variable, INDEX_t k, cnp.ndarray[INT_t, ndim=1] candidates, cnp.ndarray[INT_t, ndim=1] order, FLOAT_t * mse, FLOAT_t * knot, INDEX_t * knot_idx): # <<<<<<<<<<<<<< * ''' * Find the best knot location (in terms of squared error). */ @@ -7145,25 +7297,25 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_pybuffernd_order.rcbuffer = &__pyx_pybuffer_order; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_candidates.rcbuffer->pybuffer, (PyObject*)__pyx_v_candidates, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_candidates.rcbuffer->pybuffer, (PyObject*)__pyx_v_candidates, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_candidates.diminfo[0].strides = __pyx_pybuffernd_candidates.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_candidates.diminfo[0].shape = __pyx_pybuffernd_candidates.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_order.rcbuffer->pybuffer, (PyObject*)__pyx_v_order, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_order.rcbuffer->pybuffer, (PyObject*)__pyx_v_order, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_order.diminfo[0].strides = __pyx_pybuffernd_order.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_order.diminfo[0].shape = __pyx_pybuffernd_order.rcbuffer->pybuffer.shape[0]; - /* "sklearn/earth/_forward.pyx":379 + /* "sklearn/earth/_forward.pyx":404 * ''' * - * cdef cnp.ndarray[FLOAT_t, ndim=1] b = self.B[:,k+1] # <<<<<<<<<<<<<< - * cdef cnp.ndarray[FLOAT_t, ndim=1] b_parent = self.B[:,parent] - * cdef cnp.ndarray[FLOAT_t, ndim=1] u = self.u + * cdef cnp.ndarray[FLOAT_t, ndim = 1] b = self.B[:, k + 1] # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t, ndim = 1] b_parent = self.B[:, parent] + * cdef cnp.ndarray[FLOAT_t, ndim = 1] u = self.u */ - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong((__pyx_v_k + 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong((__pyx_v_k + 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_k_slice_20); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_k_slice_20); @@ -7171,7 +7323,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self->B), ((PyObject *)__pyx_t_2)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self->B), ((PyObject *)__pyx_t_2)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_t_2 = __pyx_t_1; @@ -7181,23 +7333,23 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_2), &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_b = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_b.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_b.diminfo[0].strides = __pyx_pybuffernd_b.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_b.diminfo[0].shape = __pyx_pybuffernd_b.rcbuffer->pybuffer.shape[0]; } } __pyx_v_b = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_forward.pyx":380 + /* "sklearn/earth/_forward.pyx":405 * - * cdef cnp.ndarray[FLOAT_t, ndim=1] b = self.B[:,k+1] - * cdef cnp.ndarray[FLOAT_t, ndim=1] b_parent = self.B[:,parent] # <<<<<<<<<<<<<< - * cdef cnp.ndarray[FLOAT_t, ndim=1] u = self.u - * cdef cnp.ndarray[FLOAT_t, ndim=2] B_orth = self.B_orth + * cdef cnp.ndarray[FLOAT_t, ndim = 1] b = self.B[:, k + 1] + * cdef cnp.ndarray[FLOAT_t, ndim = 1] b_parent = self.B[:, parent] # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t, ndim = 1] u = self.u + * cdef cnp.ndarray[FLOAT_t, ndim = 2] B_orth = self.B_orth */ - __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_parent); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_parent); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_k_slice_21); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_k_slice_21); @@ -7205,7 +7357,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_self->B), ((PyObject *)__pyx_t_1)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_self->B), ((PyObject *)__pyx_t_1)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_1 = __pyx_t_2; @@ -7215,26 +7367,26 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b_parent.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_b_parent = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_b_parent.diminfo[0].strides = __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_b_parent.diminfo[0].shape = __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.shape[0]; } } __pyx_v_b_parent = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_forward.pyx":381 - * cdef cnp.ndarray[FLOAT_t, ndim=1] b = self.B[:,k+1] - * cdef cnp.ndarray[FLOAT_t, ndim=1] b_parent = self.B[:,parent] - * cdef cnp.ndarray[FLOAT_t, ndim=1] u = self.u # <<<<<<<<<<<<<< - * cdef cnp.ndarray[FLOAT_t, ndim=2] B_orth = self.B_orth - * cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X + /* "sklearn/earth/_forward.pyx":406 + * cdef cnp.ndarray[FLOAT_t, ndim = 1] b = self.B[:, k + 1] + * cdef cnp.ndarray[FLOAT_t, ndim = 1] b_parent = self.B[:, parent] + * cdef cnp.ndarray[FLOAT_t, ndim = 1] u = self.u # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t, ndim = 2] B_orth = self.B_orth + * cdef cnp.ndarray[FLOAT_t, ndim = 2] X = self.X */ __pyx_t_3 = ((PyArrayObject *)__pyx_v_self->u); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_u.rcbuffer->pybuffer, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_u = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_u.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 381; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_u.diminfo[0].strides = __pyx_pybuffernd_u.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_u.diminfo[0].shape = __pyx_pybuffernd_u.rcbuffer->pybuffer.shape[0]; } } @@ -7242,19 +7394,19 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->u))); __pyx_v_u = ((PyArrayObject *)__pyx_v_self->u); - /* "sklearn/earth/_forward.pyx":382 - * cdef cnp.ndarray[FLOAT_t, ndim=1] b_parent = self.B[:,parent] - * cdef cnp.ndarray[FLOAT_t, ndim=1] u = self.u - * cdef cnp.ndarray[FLOAT_t, ndim=2] B_orth = self.B_orth # <<<<<<<<<<<<<< - * cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X - * cdef cnp.ndarray[FLOAT_t, ndim=1] y = self.y + /* "sklearn/earth/_forward.pyx":407 + * cdef cnp.ndarray[FLOAT_t, ndim = 1] b_parent = self.B[:, parent] + * cdef cnp.ndarray[FLOAT_t, ndim = 1] u = self.u + * cdef cnp.ndarray[FLOAT_t, ndim = 2] B_orth = self.B_orth # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t, ndim = 2] X = self.X + * cdef cnp.ndarray[FLOAT_t, ndim = 1] y = self.y */ __pyx_t_4 = ((PyArrayObject *)__pyx_v_self->B_orth); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B_orth.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { __pyx_v_B_orth = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_B_orth.diminfo[0].strides = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B_orth.diminfo[0].shape = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B_orth.diminfo[1].strides = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B_orth.diminfo[1].shape = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.shape[1]; } } @@ -7262,19 +7414,19 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->B_orth))); __pyx_v_B_orth = ((PyArrayObject *)__pyx_v_self->B_orth); - /* "sklearn/earth/_forward.pyx":383 - * cdef cnp.ndarray[FLOAT_t, ndim=1] u = self.u - * cdef cnp.ndarray[FLOAT_t, ndim=2] B_orth = self.B_orth - * cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X # <<<<<<<<<<<<<< - * cdef cnp.ndarray[FLOAT_t, ndim=1] y = self.y - * cdef cnp.ndarray[FLOAT_t, ndim=1] c = self.c + /* "sklearn/earth/_forward.pyx":408 + * cdef cnp.ndarray[FLOAT_t, ndim = 1] u = self.u + * cdef cnp.ndarray[FLOAT_t, ndim = 2] B_orth = self.B_orth + * cdef cnp.ndarray[FLOAT_t, ndim = 2] X = self.X # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t, ndim = 1] y = self.y + * cdef cnp.ndarray[FLOAT_t, ndim = 1] c = self.c */ __pyx_t_5 = ((PyArrayObject *)__pyx_v_self->X); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { __pyx_v_X = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; } } @@ -7282,19 +7434,19 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->X))); __pyx_v_X = ((PyArrayObject *)__pyx_v_self->X); - /* "sklearn/earth/_forward.pyx":384 - * cdef cnp.ndarray[FLOAT_t, ndim=2] B_orth = self.B_orth - * cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X - * cdef cnp.ndarray[FLOAT_t, ndim=1] y = self.y # <<<<<<<<<<<<<< - * cdef cnp.ndarray[FLOAT_t, ndim=1] c = self.c - * cdef cnp.ndarray[FLOAT_t, ndim=1] B_orth_times_parent_cum = self.B_orth_times_parent_cum + /* "sklearn/earth/_forward.pyx":409 + * cdef cnp.ndarray[FLOAT_t, ndim = 2] B_orth = self.B_orth + * cdef cnp.ndarray[FLOAT_t, ndim = 2] X = self.X + * cdef cnp.ndarray[FLOAT_t, ndim = 1] y = self.y # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t, ndim = 1] c = self.c + * cdef cnp.ndarray[FLOAT_t, ndim = 1] B_orth_times_parent_cum = self.B_orth_times_parent_cum */ __pyx_t_6 = ((PyArrayObject *)__pyx_v_self->y); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_y = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_y.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_y.diminfo[0].strides = __pyx_pybuffernd_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y.diminfo[0].shape = __pyx_pybuffernd_y.rcbuffer->pybuffer.shape[0]; } } @@ -7302,19 +7454,19 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->y))); __pyx_v_y = ((PyArrayObject *)__pyx_v_self->y); - /* "sklearn/earth/_forward.pyx":385 - * cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X - * cdef cnp.ndarray[FLOAT_t, ndim=1] y = self.y - * cdef cnp.ndarray[FLOAT_t, ndim=1] c = self.c # <<<<<<<<<<<<<< - * cdef cnp.ndarray[FLOAT_t, ndim=1] B_orth_times_parent_cum = self.B_orth_times_parent_cum - * cdef cnp.ndarray[FLOAT_t, ndim=2] B = self.B + /* "sklearn/earth/_forward.pyx":410 + * cdef cnp.ndarray[FLOAT_t, ndim = 2] X = self.X + * cdef cnp.ndarray[FLOAT_t, ndim = 1] y = self.y + * cdef cnp.ndarray[FLOAT_t, ndim = 1] c = self.c # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t, ndim = 1] B_orth_times_parent_cum = self.B_orth_times_parent_cum + * cdef cnp.ndarray[FLOAT_t, ndim = 2] B = self.B */ __pyx_t_7 = ((PyArrayObject *)__pyx_v_self->c); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_c.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_c = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_c.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_c.diminfo[0].strides = __pyx_pybuffernd_c.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_c.diminfo[0].shape = __pyx_pybuffernd_c.rcbuffer->pybuffer.shape[0]; } } @@ -7322,11 +7474,11 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->c))); __pyx_v_c = ((PyArrayObject *)__pyx_v_self->c); - /* "sklearn/earth/_forward.pyx":386 - * cdef cnp.ndarray[FLOAT_t, ndim=1] y = self.y - * cdef cnp.ndarray[FLOAT_t, ndim=1] c = self.c - * cdef cnp.ndarray[FLOAT_t, ndim=1] B_orth_times_parent_cum = self.B_orth_times_parent_cum # <<<<<<<<<<<<<< - * cdef cnp.ndarray[FLOAT_t, ndim=2] B = self.B + /* "sklearn/earth/_forward.pyx":411 + * cdef cnp.ndarray[FLOAT_t, ndim = 1] y = self.y + * cdef cnp.ndarray[FLOAT_t, ndim = 1] c = self.c + * cdef cnp.ndarray[FLOAT_t, ndim = 1] B_orth_times_parent_cum = self.B_orth_times_parent_cum # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t, ndim = 2] B = self.B * */ __pyx_t_8 = ((PyArrayObject *)__pyx_v_self->B_orth_times_parent_cum); @@ -7334,7 +7486,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B_orth_times_parent_cum.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_B_orth_times_parent_cum = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_B_orth_times_parent_cum.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_B_orth_times_parent_cum.diminfo[0].strides = __pyx_pybuffernd_B_orth_times_parent_cum.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B_orth_times_parent_cum.diminfo[0].shape = __pyx_pybuffernd_B_orth_times_parent_cum.rcbuffer->pybuffer.shape[0]; } } @@ -7342,10 +7494,10 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->B_orth_times_parent_cum))); __pyx_v_B_orth_times_parent_cum = ((PyArrayObject *)__pyx_v_self->B_orth_times_parent_cum); - /* "sklearn/earth/_forward.pyx":387 - * cdef cnp.ndarray[FLOAT_t, ndim=1] c = self.c - * cdef cnp.ndarray[FLOAT_t, ndim=1] B_orth_times_parent_cum = self.B_orth_times_parent_cum - * cdef cnp.ndarray[FLOAT_t, ndim=2] B = self.B # <<<<<<<<<<<<<< + /* "sklearn/earth/_forward.pyx":412 + * cdef cnp.ndarray[FLOAT_t, ndim = 1] c = self.c + * cdef cnp.ndarray[FLOAT_t, ndim = 1] B_orth_times_parent_cum = self.B_orth_times_parent_cum + * cdef cnp.ndarray[FLOAT_t, ndim = 2] B = self.B # <<<<<<<<<<<<<< * * cdef INDEX_t num_candidates = candidates.shape[0] */ @@ -7354,7 +7506,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { __pyx_v_B = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_B.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_B.diminfo[0].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B.diminfo[0].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B.diminfo[1].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B.diminfo[1].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[1]; } } @@ -7362,8 +7514,8 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->B))); __pyx_v_B = ((PyArrayObject *)__pyx_v_self->B); - /* "sklearn/earth/_forward.pyx":389 - * cdef cnp.ndarray[FLOAT_t, ndim=2] B = self.B + /* "sklearn/earth/_forward.pyx":414 + * cdef cnp.ndarray[FLOAT_t, ndim = 2] B = self.B * * cdef INDEX_t num_candidates = candidates.shape[0] # <<<<<<<<<<<<<< * @@ -7371,21 +7523,21 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str */ __pyx_v_num_candidates = (__pyx_v_candidates->dimensions[0]); - /* "sklearn/earth/_forward.pyx":423 + /* "sklearn/earth/_forward.pyx":448 * - * #Compute the initial basis function + * # Compute the initial basis function * candidate_idx = candidates[0] # <<<<<<<<<<<<<< - * candidate = X[order[candidate_idx],variable] - * for i in range(self.m):#TODO: Vectorize? + * candidate = X[order[candidate_idx], variable] + * for i in range(self.m): # TODO: Vectorize? */ __pyx_t_10 = 0; __pyx_v_candidate_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_INT_t *, __pyx_pybuffernd_candidates.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_candidates.diminfo[0].strides)); - /* "sklearn/earth/_forward.pyx":424 - * #Compute the initial basis function + /* "sklearn/earth/_forward.pyx":449 + * # Compute the initial basis function * candidate_idx = candidates[0] - * candidate = X[order[candidate_idx],variable] # <<<<<<<<<<<<<< - * for i in range(self.m):#TODO: Vectorize? + * candidate = X[order[candidate_idx], variable] # <<<<<<<<<<<<<< + * for i in range(self.m): # TODO: Vectorize? * b[i] = 0 */ __pyx_t_11 = __pyx_v_candidate_idx; @@ -7393,10 +7545,10 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_t_13 = __pyx_v_variable; __pyx_v_candidate = (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_X.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_X.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_X.diminfo[1].strides)); - /* "sklearn/earth/_forward.pyx":425 + /* "sklearn/earth/_forward.pyx":450 * candidate_idx = candidates[0] - * candidate = X[order[candidate_idx],variable] - * for i in range(self.m):#TODO: Vectorize? # <<<<<<<<<<<<<< + * candidate = X[order[candidate_idx], variable] + * for i in range(self.m): # TODO: Vectorize? # <<<<<<<<<<<<<< * b[i] = 0 * for i_ in range(self.m): */ @@ -7404,9 +7556,9 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { __pyx_v_i = __pyx_t_15; - /* "sklearn/earth/_forward.pyx":426 - * candidate = X[order[candidate_idx],variable] - * for i in range(self.m):#TODO: Vectorize? + /* "sklearn/earth/_forward.pyx":451 + * candidate = X[order[candidate_idx], variable] + * for i in range(self.m): # TODO: Vectorize? * b[i] = 0 # <<<<<<<<<<<<<< * for i_ in range(self.m): * i = order[i_] @@ -7415,52 +7567,52 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_b.diminfo[0].strides) = 0.0; } - /* "sklearn/earth/_forward.pyx":427 - * for i in range(self.m):#TODO: Vectorize? + /* "sklearn/earth/_forward.pyx":452 + * for i in range(self.m): # TODO: Vectorize? * b[i] = 0 * for i_ in range(self.m): # <<<<<<<<<<<<<< * i = order[i_] - * float_tmp = X[i,variable] - candidate + * float_tmp = X[i, variable] - candidate */ __pyx_t_14 = __pyx_v_self->m; for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { __pyx_v_i_ = __pyx_t_15; - /* "sklearn/earth/_forward.pyx":428 + /* "sklearn/earth/_forward.pyx":453 * b[i] = 0 * for i_ in range(self.m): * i = order[i_] # <<<<<<<<<<<<<< - * float_tmp = X[i,variable] - candidate + * float_tmp = X[i, variable] - candidate * if float_tmp > 0: */ __pyx_t_17 = __pyx_v_i_; __pyx_v_i = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_INT_t *, __pyx_pybuffernd_order.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_order.diminfo[0].strides)); - /* "sklearn/earth/_forward.pyx":429 + /* "sklearn/earth/_forward.pyx":454 * for i_ in range(self.m): * i = order[i_] - * float_tmp = X[i,variable] - candidate # <<<<<<<<<<<<<< + * float_tmp = X[i, variable] - candidate # <<<<<<<<<<<<<< * if float_tmp > 0: - * b[i] = b_parent[i]*float_tmp + * b[i] = b_parent[i] * float_tmp */ __pyx_t_18 = __pyx_v_i; __pyx_t_19 = __pyx_v_variable; __pyx_v_float_tmp = ((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_X.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_X.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_X.diminfo[1].strides)) - __pyx_v_candidate); - /* "sklearn/earth/_forward.pyx":430 + /* "sklearn/earth/_forward.pyx":455 * i = order[i_] - * float_tmp = X[i,variable] - candidate + * float_tmp = X[i, variable] - candidate * if float_tmp > 0: # <<<<<<<<<<<<<< - * b[i] = b_parent[i]*float_tmp + * b[i] = b_parent[i] * float_tmp * else: */ __pyx_t_20 = ((__pyx_v_float_tmp > 0.0) != 0); if (__pyx_t_20) { - /* "sklearn/earth/_forward.pyx":431 - * float_tmp = X[i,variable] - candidate + /* "sklearn/earth/_forward.pyx":456 + * float_tmp = X[i, variable] - candidate * if float_tmp > 0: - * b[i] = b_parent[i]*float_tmp # <<<<<<<<<<<<<< + * b[i] = b_parent[i] * float_tmp # <<<<<<<<<<<<<< * else: * break */ @@ -7471,12 +7623,12 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str } /*else*/ { - /* "sklearn/earth/_forward.pyx":433 - * b[i] = b_parent[i]*float_tmp + /* "sklearn/earth/_forward.pyx":458 + * b[i] = b_parent[i] * float_tmp * else: * break # <<<<<<<<<<<<<< * - * #Compute the initial covariance column, u (not including the final element) + * # Compute the initial covariance column, u (not including the final */ goto __pyx_L6_break; } @@ -7484,24 +7636,24 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str } __pyx_L6_break:; - /* "sklearn/earth/_forward.pyx":436 - * - * #Compute the initial covariance column, u (not including the final element) - * u[0:k+1] = np.dot(b,B_orth[:,0:k+1]) # <<<<<<<<<<<<<< + /* "sklearn/earth/_forward.pyx":462 + * # Compute the initial covariance column, u (not including the final + * # element) + * u[0:k + 1] = np.dot(b, B_orth[:, 0:k + 1]) # <<<<<<<<<<<<<< * - * #Compute the new last elements of c and u + * # Compute the new last elements of c and u */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong((__pyx_v_k + 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong((__pyx_v_k + 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_23 = PySlice_New(__pyx_int_0, __pyx_t_1, Py_None); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_23 = PySlice_New(__pyx_int_0, __pyx_t_1, Py_None); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_23); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_k_slice_22); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_k_slice_22); @@ -7509,10 +7661,10 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_23); __Pyx_GIVEREF(__pyx_t_23); __pyx_t_23 = 0; - __pyx_t_23 = PyObject_GetItem(((PyObject *)__pyx_v_B_orth), ((PyObject *)__pyx_t_1)); if (!__pyx_t_23) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_23 = PyObject_GetItem(((PyObject *)__pyx_v_B_orth), ((PyObject *)__pyx_t_1)); if (!__pyx_t_23) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_23); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_b)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_b)); @@ -7520,109 +7672,109 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_23); __Pyx_GIVEREF(__pyx_t_23); __pyx_t_23 = 0; - __pyx_t_23 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_23 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_23); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (__Pyx_PyObject_SetSlice(((PyObject *)__pyx_v_u), __pyx_t_23, 0, (__pyx_v_k + 1), NULL, NULL, NULL, 1, 1, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_PyObject_SetSlice(((PyObject *)__pyx_v_u), __pyx_t_23, 0, (__pyx_v_k + 1), NULL, NULL, NULL, 1, 1, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; - /* "sklearn/earth/_forward.pyx":439 + /* "sklearn/earth/_forward.pyx":465 * - * #Compute the new last elements of c and u + * # Compute the new last elements of c and u * c_end = 0.0 # <<<<<<<<<<<<<< * u_end = 0.0 * for i in range(self.m): */ __pyx_v_c_end = 0.0; - /* "sklearn/earth/_forward.pyx":440 - * #Compute the new last elements of c and u + /* "sklearn/earth/_forward.pyx":466 + * # Compute the new last elements of c and u * c_end = 0.0 * u_end = 0.0 # <<<<<<<<<<<<<< * for i in range(self.m): - * u_end += b[i]*b[i] + * u_end += b[i] * b[i] */ __pyx_v_u_end = 0.0; - /* "sklearn/earth/_forward.pyx":441 + /* "sklearn/earth/_forward.pyx":467 * c_end = 0.0 * u_end = 0.0 * for i in range(self.m): # <<<<<<<<<<<<<< - * u_end += b[i]*b[i] - * c_end += b[i]*y[i] + * u_end += b[i] * b[i] + * c_end += b[i] * y[i] */ __pyx_t_14 = __pyx_v_self->m; for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { __pyx_v_i = __pyx_t_15; - /* "sklearn/earth/_forward.pyx":442 + /* "sklearn/earth/_forward.pyx":468 * u_end = 0.0 * for i in range(self.m): - * u_end += b[i]*b[i] # <<<<<<<<<<<<<< - * c_end += b[i]*y[i] + * u_end += b[i] * b[i] # <<<<<<<<<<<<<< + * c_end += b[i] * y[i] * */ __pyx_t_24 = __pyx_v_i; __pyx_t_25 = __pyx_v_i; __pyx_v_u_end = (__pyx_v_u_end + ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_b.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_b.diminfo[0].strides)))); - /* "sklearn/earth/_forward.pyx":443 + /* "sklearn/earth/_forward.pyx":469 * for i in range(self.m): - * u_end += b[i]*b[i] - * c_end += b[i]*y[i] # <<<<<<<<<<<<<< + * u_end += b[i] * b[i] + * c_end += b[i] * y[i] # <<<<<<<<<<<<<< * - * #Compute the last element of z (the others are identical to c) + * # Compute the last element of z (the others are identical to c) */ __pyx_t_26 = __pyx_v_i; __pyx_t_27 = __pyx_v_i; __pyx_v_c_end = (__pyx_v_c_end + ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_b.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_y.diminfo[0].strides)))); } - /* "sklearn/earth/_forward.pyx":446 + /* "sklearn/earth/_forward.pyx":472 * - * #Compute the last element of z (the others are identical to c) + * # Compute the last element of z (the others are identical to c) * u_dot_c = 0.0 # <<<<<<<<<<<<<< * u_dot_u = 0.0 - * for i in range(k+1): + * for i in range(k + 1): */ __pyx_v_u_dot_c = 0.0; - /* "sklearn/earth/_forward.pyx":447 - * #Compute the last element of z (the others are identical to c) + /* "sklearn/earth/_forward.pyx":473 + * # Compute the last element of z (the others are identical to c) * u_dot_c = 0.0 * u_dot_u = 0.0 # <<<<<<<<<<<<<< - * for i in range(k+1): - * u_dot_u += u[i]*u[i] + * for i in range(k + 1): + * u_dot_u += u[i] * u[i] */ __pyx_v_u_dot_u = 0.0; - /* "sklearn/earth/_forward.pyx":448 + /* "sklearn/earth/_forward.pyx":474 * u_dot_c = 0.0 * u_dot_u = 0.0 - * for i in range(k+1): # <<<<<<<<<<<<<< - * u_dot_u += u[i]*u[i] - * u_dot_c += u[i]*c[i] + * for i in range(k + 1): # <<<<<<<<<<<<<< + * u_dot_u += u[i] * u[i] + * u_dot_c += u[i] * c[i] */ __pyx_t_14 = (__pyx_v_k + 1); for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { __pyx_v_i = __pyx_t_15; - /* "sklearn/earth/_forward.pyx":449 + /* "sklearn/earth/_forward.pyx":475 * u_dot_u = 0.0 - * for i in range(k+1): - * u_dot_u += u[i]*u[i] # <<<<<<<<<<<<<< - * u_dot_c += u[i]*c[i] + * for i in range(k + 1): + * u_dot_u += u[i] * u[i] # <<<<<<<<<<<<<< + * u_dot_c += u[i] * c[i] * z_denom = u_end - u_dot_u */ __pyx_t_28 = __pyx_v_i; __pyx_t_29 = __pyx_v_i; __pyx_v_u_dot_u = (__pyx_v_u_dot_u + ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_u.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_u.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_u.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_u.diminfo[0].strides)))); - /* "sklearn/earth/_forward.pyx":450 - * for i in range(k+1): - * u_dot_u += u[i]*u[i] - * u_dot_c += u[i]*c[i] # <<<<<<<<<<<<<< + /* "sklearn/earth/_forward.pyx":476 + * for i in range(k + 1): + * u_dot_u += u[i] * u[i] + * u_dot_c += u[i] * c[i] # <<<<<<<<<<<<<< * z_denom = u_end - u_dot_u * if z_denom <= self.zero_tol: */ @@ -7631,17 +7783,17 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_v_u_dot_c = (__pyx_v_u_dot_c + ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_u.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_u.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_c.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_c.diminfo[0].strides)))); } - /* "sklearn/earth/_forward.pyx":451 - * u_dot_u += u[i]*u[i] - * u_dot_c += u[i]*c[i] + /* "sklearn/earth/_forward.pyx":477 + * u_dot_u += u[i] * u[i] + * u_dot_c += u[i] * c[i] * z_denom = u_end - u_dot_u # <<<<<<<<<<<<<< * if z_denom <= self.zero_tol: * z_end_squared = np.nan */ __pyx_v_z_denom = (__pyx_v_u_end - __pyx_v_u_dot_u); - /* "sklearn/earth/_forward.pyx":452 - * u_dot_c += u[i]*c[i] + /* "sklearn/earth/_forward.pyx":478 + * u_dot_c += u[i] * c[i] * z_denom = u_end - u_dot_u * if z_denom <= self.zero_tol: # <<<<<<<<<<<<<< * z_end_squared = np.nan @@ -7650,47 +7802,47 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_t_20 = ((__pyx_v_z_denom <= __pyx_v_self->zero_tol) != 0); if (__pyx_t_20) { - /* "sklearn/earth/_forward.pyx":453 + /* "sklearn/earth/_forward.pyx":479 * z_denom = u_end - u_dot_u * if z_denom <= self.zero_tol: * z_end_squared = np.nan # <<<<<<<<<<<<<< * else: - * z_end_squared = ((c_end - u_dot_c)**2) / z_denom + * z_end_squared = ((c_end - u_dot_c) ** 2) / z_denom */ - __pyx_t_23 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_23 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_23); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_23, __pyx_n_s__nan); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_23, __pyx_n_s__nan); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; - __pyx_t_32 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_32 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_32 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_32 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_z_end_squared = __pyx_t_32; goto __pyx_L12; } /*else*/ { - /* "sklearn/earth/_forward.pyx":455 + /* "sklearn/earth/_forward.pyx":481 * z_end_squared = np.nan * else: - * z_end_squared = ((c_end - u_dot_c)**2) / z_denom # <<<<<<<<<<<<<< + * z_end_squared = ((c_end - u_dot_c) ** 2) / z_denom # <<<<<<<<<<<<<< * - * #Minimizing the norm is actually equivalent to maximizing z_end_squared + * # Minimizing the norm is actually equivalent to maximizing z_end_squared */ __pyx_v_z_end_squared = (pow((__pyx_v_c_end - __pyx_v_u_dot_c), 2.0) / __pyx_v_z_denom); } __pyx_L12:; - /* "sklearn/earth/_forward.pyx":459 - * #Minimizing the norm is actually equivalent to maximizing z_end_squared - * #Store z_end_squared and the current candidate as the best knot choice + /* "sklearn/earth/_forward.pyx":485 + * # Minimizing the norm is actually equivalent to maximizing z_end_squared + * # Store z_end_squared and the current candidate as the best knot choice * best_z_end_squared = z_end_squared # <<<<<<<<<<<<<< * best_candidate_idx = candidate_idx * best_candidate = candidate */ __pyx_v_best_z_end_squared = __pyx_v_z_end_squared; - /* "sklearn/earth/_forward.pyx":460 - * #Store z_end_squared and the current candidate as the best knot choice + /* "sklearn/earth/_forward.pyx":486 + * # Store z_end_squared and the current candidate as the best knot choice * best_z_end_squared = z_end_squared * best_candidate_idx = candidate_idx # <<<<<<<<<<<<<< * best_candidate = candidate @@ -7698,18 +7850,18 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str */ __pyx_v_best_candidate_idx = __pyx_v_candidate_idx; - /* "sklearn/earth/_forward.pyx":461 + /* "sklearn/earth/_forward.pyx":487 * best_z_end_squared = z_end_squared * best_candidate_idx = candidate_idx * best_candidate = candidate # <<<<<<<<<<<<<< * - * #Initialize the accumulators + * # Initialize the accumulators */ __pyx_v_best_candidate = __pyx_v_candidate; - /* "sklearn/earth/_forward.pyx":464 + /* "sklearn/earth/_forward.pyx":490 * - * #Initialize the accumulators + * # Initialize the accumulators * i = order[0] # <<<<<<<<<<<<<< * last_candidate_idx = 0 * y_cum = y[i] @@ -7717,40 +7869,40 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_t_33 = 0; __pyx_v_i = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_INT_t *, __pyx_pybuffernd_order.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_order.diminfo[0].strides)); - /* "sklearn/earth/_forward.pyx":465 - * #Initialize the accumulators + /* "sklearn/earth/_forward.pyx":491 + * # Initialize the accumulators * i = order[0] * last_candidate_idx = 0 # <<<<<<<<<<<<<< * y_cum = y[i] - * B_orth_times_parent_cum[0:k+1] = B_orth[i,0:k+1] * b_parent[i] + * B_orth_times_parent_cum[0:k + 1] = B_orth[i, 0:k + 1] * b_parent[i] */ __pyx_v_last_candidate_idx = 0; - /* "sklearn/earth/_forward.pyx":466 + /* "sklearn/earth/_forward.pyx":492 * i = order[0] * last_candidate_idx = 0 * y_cum = y[i] # <<<<<<<<<<<<<< - * B_orth_times_parent_cum[0:k+1] = B_orth[i,0:k+1] * b_parent[i] + * B_orth_times_parent_cum[0:k + 1] = B_orth[i, 0:k + 1] * b_parent[i] * b_times_parent_cum = b[i] * b_parent[i] */ __pyx_t_14 = __pyx_v_i; __pyx_v_y_cum = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_y.diminfo[0].strides)); - /* "sklearn/earth/_forward.pyx":467 + /* "sklearn/earth/_forward.pyx":493 * last_candidate_idx = 0 * y_cum = y[i] - * B_orth_times_parent_cum[0:k+1] = B_orth[i,0:k+1] * b_parent[i] # <<<<<<<<<<<<<< + * B_orth_times_parent_cum[0:k + 1] = B_orth[i, 0:k + 1] * b_parent[i] # <<<<<<<<<<<<<< * b_times_parent_cum = b[i] * b_parent[i] * parent_squared_cum = b_parent[i] ** 2 */ - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_23 = __Pyx_PyInt_to_py_npy_ulonglong((__pyx_v_k + 1)); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_23 = __Pyx_PyInt_to_py_npy_ulonglong((__pyx_v_k + 1)); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_23); - __pyx_t_2 = PySlice_New(__pyx_int_0, __pyx_t_23, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PySlice_New(__pyx_int_0, __pyx_t_23, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; - __pyx_t_23 = PyTuple_New(2); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_23 = PyTuple_New(2); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_23); PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); @@ -7758,22 +7910,22 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __Pyx_GIVEREF(__pyx_t_2); __pyx_t_1 = 0; __pyx_t_2 = 0; - __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_B_orth), ((PyObject *)__pyx_t_23)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_B_orth), ((PyObject *)__pyx_t_23)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_23)); __pyx_t_23 = 0; __pyx_t_15 = __pyx_v_i; - __pyx_t_23 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_b_parent.diminfo[0].strides))); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_23 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_b_parent.diminfo[0].strides))); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_23); - __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_t_23); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_t_23); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; - if (__Pyx_PyObject_SetSlice(((PyObject *)__pyx_v_B_orth_times_parent_cum), __pyx_t_1, 0, (__pyx_v_k + 1), NULL, NULL, NULL, 1, 1, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 467; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_PyObject_SetSlice(((PyObject *)__pyx_v_B_orth_times_parent_cum), __pyx_t_1, 0, (__pyx_v_k + 1), NULL, NULL, NULL, 1, 1, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_forward.pyx":468 + /* "sklearn/earth/_forward.pyx":494 * y_cum = y[i] - * B_orth_times_parent_cum[0:k+1] = B_orth[i,0:k+1] * b_parent[i] + * B_orth_times_parent_cum[0:k + 1] = B_orth[i, 0:k + 1] * b_parent[i] * b_times_parent_cum = b[i] * b_parent[i] # <<<<<<<<<<<<<< * parent_squared_cum = b_parent[i] ** 2 * parent_times_y_cum = b_parent[i] * y[i] @@ -7782,8 +7934,8 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_t_35 = __pyx_v_i; __pyx_v_b_times_parent_cum = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_b.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_b_parent.diminfo[0].strides))); - /* "sklearn/earth/_forward.pyx":469 - * B_orth_times_parent_cum[0:k+1] = B_orth[i,0:k+1] * b_parent[i] + /* "sklearn/earth/_forward.pyx":495 + * B_orth_times_parent_cum[0:k + 1] = B_orth[i, 0:k + 1] * b_parent[i] * b_times_parent_cum = b[i] * b_parent[i] * parent_squared_cum = b_parent[i] ** 2 # <<<<<<<<<<<<<< * parent_times_y_cum = b_parent[i] * y[i] @@ -7792,21 +7944,21 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_t_36 = __pyx_v_i; __pyx_v_parent_squared_cum = pow((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_b_parent.diminfo[0].strides)), 2.0); - /* "sklearn/earth/_forward.pyx":470 + /* "sklearn/earth/_forward.pyx":496 * b_times_parent_cum = b[i] * b_parent[i] * parent_squared_cum = b_parent[i] ** 2 * parent_times_y_cum = b_parent[i] * y[i] # <<<<<<<<<<<<<< * - * #Now loop over the remaining candidates and update z_end_squared for each, looking for the greatest value + * # Now loop over the remaining candidates and update z_end_squared for */ __pyx_t_37 = __pyx_v_i; __pyx_t_38 = __pyx_v_i; __pyx_v_parent_times_y_cum = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_b_parent.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_y.diminfo[0].strides))); - /* "sklearn/earth/_forward.pyx":473 - * - * #Now loop over the remaining candidates and update z_end_squared for each, looking for the greatest value - * for i_ in range(1,num_candidates): # <<<<<<<<<<<<<< + /* "sklearn/earth/_forward.pyx":500 + * # Now loop over the remaining candidates and update z_end_squared for + * # each, looking for the greatest value + * for i_ in range(1, num_candidates): # <<<<<<<<<<<<<< * i = order[i_] * */ @@ -7814,27 +7966,27 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str for (__pyx_t_40 = 1; __pyx_t_40 < __pyx_t_39; __pyx_t_40+=1) { __pyx_v_i_ = __pyx_t_40; - /* "sklearn/earth/_forward.pyx":474 - * #Now loop over the remaining candidates and update z_end_squared for each, looking for the greatest value - * for i_ in range(1,num_candidates): + /* "sklearn/earth/_forward.pyx":501 + * # each, looking for the greatest value + * for i_ in range(1, num_candidates): * i = order[i_] # <<<<<<<<<<<<<< * - * #Update the candidate + * # Update the candidate */ __pyx_t_41 = __pyx_v_i_; __pyx_v_i = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_INT_t *, __pyx_pybuffernd_order.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_order.diminfo[0].strides)); - /* "sklearn/earth/_forward.pyx":477 + /* "sklearn/earth/_forward.pyx":504 * - * #Update the candidate + * # Update the candidate * last_last_candidate_idx = last_candidate_idx # <<<<<<<<<<<<<< * last_candidate_idx = candidate_idx * last_candidate = candidate */ __pyx_v_last_last_candidate_idx = __pyx_v_last_candidate_idx; - /* "sklearn/earth/_forward.pyx":478 - * #Update the candidate + /* "sklearn/earth/_forward.pyx":505 + * # Update the candidate * last_last_candidate_idx = last_candidate_idx * last_candidate_idx = candidate_idx # <<<<<<<<<<<<<< * last_candidate = candidate @@ -7842,66 +7994,66 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str */ __pyx_v_last_candidate_idx = __pyx_v_candidate_idx; - /* "sklearn/earth/_forward.pyx":479 + /* "sklearn/earth/_forward.pyx":506 * last_last_candidate_idx = last_candidate_idx * last_candidate_idx = candidate_idx * last_candidate = candidate # <<<<<<<<<<<<<< * candidate_idx = candidates[i_] - * candidate = X[order[candidate_idx],variable] + * candidate = X[order[candidate_idx], variable] */ __pyx_v_last_candidate = __pyx_v_candidate; - /* "sklearn/earth/_forward.pyx":480 + /* "sklearn/earth/_forward.pyx":507 * last_candidate_idx = candidate_idx * last_candidate = candidate * candidate_idx = candidates[i_] # <<<<<<<<<<<<<< - * candidate = X[order[candidate_idx],variable] + * candidate = X[order[candidate_idx], variable] * */ __pyx_t_42 = __pyx_v_i_; __pyx_v_candidate_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_INT_t *, __pyx_pybuffernd_candidates.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_candidates.diminfo[0].strides)); - /* "sklearn/earth/_forward.pyx":481 + /* "sklearn/earth/_forward.pyx":508 * last_candidate = candidate * candidate_idx = candidates[i_] - * candidate = X[order[candidate_idx],variable] # <<<<<<<<<<<<<< + * candidate = X[order[candidate_idx], variable] # <<<<<<<<<<<<<< * - * #Update the accumulators and compute delta_b + * # Update the accumulators and compute delta_b */ __pyx_t_43 = __pyx_v_candidate_idx; __pyx_t_44 = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_INT_t *, __pyx_pybuffernd_order.rcbuffer->pybuffer.buf, __pyx_t_43, __pyx_pybuffernd_order.diminfo[0].strides)); __pyx_t_45 = __pyx_v_variable; __pyx_v_candidate = (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_X.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_X.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_X.diminfo[1].strides)); - /* "sklearn/earth/_forward.pyx":484 + /* "sklearn/earth/_forward.pyx":511 * - * #Update the accumulators and compute delta_b + * # Update the accumulators and compute delta_b * diff = last_candidate - candidate # <<<<<<<<<<<<<< * delta_c_end = 0.0 * */ __pyx_v_diff = (__pyx_v_last_candidate - __pyx_v_candidate); - /* "sklearn/earth/_forward.pyx":485 - * #Update the accumulators and compute delta_b + /* "sklearn/earth/_forward.pyx":512 + * # Update the accumulators and compute delta_b * diff = last_candidate - candidate * delta_c_end = 0.0 # <<<<<<<<<<<<<< * - * #What follows is a section of code that has been optimized for speed at the expense of + * # What follows is a section of code that has been optimized for speed at the expense of */ __pyx_v_delta_c_end = 0.0; - /* "sklearn/earth/_forward.pyx":516 + /* "sklearn/earth/_forward.pyx":544 * - * #BEGIN HYPER-OPTIMIZED + * # BEGIN HYPER-OPTIMIZED * delta_b_squared = 0.0 # <<<<<<<<<<<<<< * delta_c_end = 0.0 * delta_u_end = 0.0 */ __pyx_v_delta_b_squared = 0.0; - /* "sklearn/earth/_forward.pyx":517 - * #BEGIN HYPER-OPTIMIZED + /* "sklearn/earth/_forward.pyx":545 + * # BEGIN HYPER-OPTIMIZED * delta_b_squared = 0.0 * delta_c_end = 0.0 # <<<<<<<<<<<<<< * delta_u_end = 0.0 @@ -7909,19 +8061,19 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str */ __pyx_v_delta_c_end = 0.0; - /* "sklearn/earth/_forward.pyx":518 + /* "sklearn/earth/_forward.pyx":546 * delta_b_squared = 0.0 * delta_c_end = 0.0 * delta_u_end = 0.0 # <<<<<<<<<<<<<< * - * #Update the accumulators + * # Update the accumulators */ __pyx_v_delta_u_end = 0.0; - /* "sklearn/earth/_forward.pyx":521 + /* "sklearn/earth/_forward.pyx":549 * - * #Update the accumulators - * for j_ in range(last_last_candidate_idx+1,last_candidate_idx+1): # <<<<<<<<<<<<<< + * # Update the accumulators + * for j_ in range(last_last_candidate_idx + 1, last_candidate_idx + 1): # <<<<<<<<<<<<<< * j = order[j_] * y_cum += y[j] */ @@ -7929,42 +8081,42 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str for (__pyx_t_47 = (__pyx_v_last_last_candidate_idx + 1); __pyx_t_47 < __pyx_t_46; __pyx_t_47+=1) { __pyx_v_j_ = __pyx_t_47; - /* "sklearn/earth/_forward.pyx":522 - * #Update the accumulators - * for j_ in range(last_last_candidate_idx+1,last_candidate_idx+1): + /* "sklearn/earth/_forward.pyx":550 + * # Update the accumulators + * for j_ in range(last_last_candidate_idx + 1, last_candidate_idx + 1): * j = order[j_] # <<<<<<<<<<<<<< * y_cum += y[j] - * for h in range(k+1):#TODO: BLAS + * for h in range(k + 1): # TODO: BLAS */ __pyx_t_48 = __pyx_v_j_; __pyx_v_j = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_INT_t *, __pyx_pybuffernd_order.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_order.diminfo[0].strides)); - /* "sklearn/earth/_forward.pyx":523 - * for j_ in range(last_last_candidate_idx+1,last_candidate_idx+1): + /* "sklearn/earth/_forward.pyx":551 + * for j_ in range(last_last_candidate_idx + 1, last_candidate_idx + 1): * j = order[j_] * y_cum += y[j] # <<<<<<<<<<<<<< - * for h in range(k+1):#TODO: BLAS - * B_orth_times_parent_cum[h] += B_orth[j,h]*b_parent[j] + * for h in range(k + 1): # TODO: BLAS + * B_orth_times_parent_cum[h] += B_orth[j, h] * b_parent[j] */ __pyx_t_49 = __pyx_v_j; __pyx_v_y_cum = (__pyx_v_y_cum + (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_49, __pyx_pybuffernd_y.diminfo[0].strides))); - /* "sklearn/earth/_forward.pyx":524 + /* "sklearn/earth/_forward.pyx":552 * j = order[j_] * y_cum += y[j] - * for h in range(k+1):#TODO: BLAS # <<<<<<<<<<<<<< - * B_orth_times_parent_cum[h] += B_orth[j,h]*b_parent[j] - * b_times_parent_cum += b[j]*b_parent[j] + * for h in range(k + 1): # TODO: BLAS # <<<<<<<<<<<<<< + * B_orth_times_parent_cum[h] += B_orth[j, h] * b_parent[j] + * b_times_parent_cum += b[j] * b_parent[j] */ __pyx_t_50 = (__pyx_v_k + 1); for (__pyx_t_51 = 0; __pyx_t_51 < __pyx_t_50; __pyx_t_51+=1) { __pyx_v_h = __pyx_t_51; - /* "sklearn/earth/_forward.pyx":525 + /* "sklearn/earth/_forward.pyx":553 * y_cum += y[j] - * for h in range(k+1):#TODO: BLAS - * B_orth_times_parent_cum[h] += B_orth[j,h]*b_parent[j] # <<<<<<<<<<<<<< - * b_times_parent_cum += b[j]*b_parent[j] + * for h in range(k + 1): # TODO: BLAS + * B_orth_times_parent_cum[h] += B_orth[j, h] * b_parent[j] # <<<<<<<<<<<<<< + * b_times_parent_cum += b[j] * b_parent[j] * parent_squared_cum += b_parent[j] ** 2 */ __pyx_t_52 = __pyx_v_j; @@ -7974,10 +8126,10 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth_times_parent_cum.rcbuffer->pybuffer.buf, __pyx_t_55, __pyx_pybuffernd_B_orth_times_parent_cum.diminfo[0].strides) += ((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_52, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_53, __pyx_pybuffernd_B_orth.diminfo[1].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_54, __pyx_pybuffernd_b_parent.diminfo[0].strides))); } - /* "sklearn/earth/_forward.pyx":526 - * for h in range(k+1):#TODO: BLAS - * B_orth_times_parent_cum[h] += B_orth[j,h]*b_parent[j] - * b_times_parent_cum += b[j]*b_parent[j] # <<<<<<<<<<<<<< + /* "sklearn/earth/_forward.pyx":554 + * for h in range(k + 1): # TODO: BLAS + * B_orth_times_parent_cum[h] += B_orth[j, h] * b_parent[j] + * b_times_parent_cum += b[j] * b_parent[j] # <<<<<<<<<<<<<< * parent_squared_cum += b_parent[j] ** 2 * parent_times_y_cum += b_parent[j] * y[j] */ @@ -7985,9 +8137,9 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_t_51 = __pyx_v_j; __pyx_v_b_times_parent_cum = (__pyx_v_b_times_parent_cum + ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_50, __pyx_pybuffernd_b.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_51, __pyx_pybuffernd_b_parent.diminfo[0].strides)))); - /* "sklearn/earth/_forward.pyx":527 - * B_orth_times_parent_cum[h] += B_orth[j,h]*b_parent[j] - * b_times_parent_cum += b[j]*b_parent[j] + /* "sklearn/earth/_forward.pyx":555 + * B_orth_times_parent_cum[h] += B_orth[j, h] * b_parent[j] + * b_times_parent_cum += b[j] * b_parent[j] * parent_squared_cum += b_parent[j] ** 2 # <<<<<<<<<<<<<< * parent_times_y_cum += b_parent[j] * y[j] * delta_c_end += diff * parent_times_y_cum @@ -7995,123 +8147,123 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_t_56 = __pyx_v_j; __pyx_v_parent_squared_cum = (__pyx_v_parent_squared_cum + pow((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_56, __pyx_pybuffernd_b_parent.diminfo[0].strides)), 2.0)); - /* "sklearn/earth/_forward.pyx":528 - * b_times_parent_cum += b[j]*b_parent[j] + /* "sklearn/earth/_forward.pyx":556 + * b_times_parent_cum += b[j] * b_parent[j] * parent_squared_cum += b_parent[j] ** 2 * parent_times_y_cum += b_parent[j] * y[j] # <<<<<<<<<<<<<< * delta_c_end += diff * parent_times_y_cum - * delta_u_end += 2*diff * b_times_parent_cum + * delta_u_end += 2 * diff * b_times_parent_cum */ __pyx_t_57 = __pyx_v_j; __pyx_t_58 = __pyx_v_j; __pyx_v_parent_times_y_cum = (__pyx_v_parent_times_y_cum + ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_57, __pyx_pybuffernd_b_parent.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_58, __pyx_pybuffernd_y.diminfo[0].strides)))); } - /* "sklearn/earth/_forward.pyx":529 + /* "sklearn/earth/_forward.pyx":557 * parent_squared_cum += b_parent[j] ** 2 * parent_times_y_cum += b_parent[j] * y[j] * delta_c_end += diff * parent_times_y_cum # <<<<<<<<<<<<<< - * delta_u_end += 2*diff * b_times_parent_cum - * delta_b_squared = (diff**2)*parent_squared_cum + * delta_u_end += 2 * diff * b_times_parent_cum + * delta_b_squared = (diff ** 2) * parent_squared_cum */ __pyx_v_delta_c_end = (__pyx_v_delta_c_end + (__pyx_v_diff * __pyx_v_parent_times_y_cum)); - /* "sklearn/earth/_forward.pyx":530 + /* "sklearn/earth/_forward.pyx":558 * parent_times_y_cum += b_parent[j] * y[j] * delta_c_end += diff * parent_times_y_cum - * delta_u_end += 2*diff * b_times_parent_cum # <<<<<<<<<<<<<< - * delta_b_squared = (diff**2)*parent_squared_cum + * delta_u_end += 2 * diff * b_times_parent_cum # <<<<<<<<<<<<<< + * delta_b_squared = (diff ** 2) * parent_squared_cum * */ __pyx_v_delta_u_end = (__pyx_v_delta_u_end + ((2.0 * __pyx_v_diff) * __pyx_v_b_times_parent_cum)); - /* "sklearn/earth/_forward.pyx":531 + /* "sklearn/earth/_forward.pyx":559 * delta_c_end += diff * parent_times_y_cum - * delta_u_end += 2*diff * b_times_parent_cum - * delta_b_squared = (diff**2)*parent_squared_cum # <<<<<<<<<<<<<< + * delta_u_end += 2 * diff * b_times_parent_cum + * delta_b_squared = (diff ** 2) * parent_squared_cum # <<<<<<<<<<<<<< * - * #Update u and a bunch of other stuff + * # Update u and a bunch of other stuff */ __pyx_v_delta_b_squared = (pow(__pyx_v_diff, 2.0) * __pyx_v_parent_squared_cum); - /* "sklearn/earth/_forward.pyx":534 + /* "sklearn/earth/_forward.pyx":562 * - * #Update u and a bunch of other stuff - * for j in range(k+1): # <<<<<<<<<<<<<< - * float_tmp = diff*B_orth_times_parent_cum[j] + * # Update u and a bunch of other stuff + * for j in range(k + 1): # <<<<<<<<<<<<<< + * float_tmp = diff * B_orth_times_parent_cum[j] * u_dot_c += float_tmp * c[j] */ __pyx_t_46 = (__pyx_v_k + 1); for (__pyx_t_47 = 0; __pyx_t_47 < __pyx_t_46; __pyx_t_47+=1) { __pyx_v_j = __pyx_t_47; - /* "sklearn/earth/_forward.pyx":535 - * #Update u and a bunch of other stuff - * for j in range(k+1): - * float_tmp = diff*B_orth_times_parent_cum[j] # <<<<<<<<<<<<<< + /* "sklearn/earth/_forward.pyx":563 + * # Update u and a bunch of other stuff + * for j in range(k + 1): + * float_tmp = diff * B_orth_times_parent_cum[j] # <<<<<<<<<<<<<< * u_dot_c += float_tmp * c[j] - * u_dot_u += 2*u[j]*float_tmp + float_tmp*float_tmp + * u_dot_u += 2 * u[j] * float_tmp + float_tmp * float_tmp */ __pyx_t_59 = __pyx_v_j; __pyx_v_float_tmp = (__pyx_v_diff * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth_times_parent_cum.rcbuffer->pybuffer.buf, __pyx_t_59, __pyx_pybuffernd_B_orth_times_parent_cum.diminfo[0].strides))); - /* "sklearn/earth/_forward.pyx":536 - * for j in range(k+1): - * float_tmp = diff*B_orth_times_parent_cum[j] + /* "sklearn/earth/_forward.pyx":564 + * for j in range(k + 1): + * float_tmp = diff * B_orth_times_parent_cum[j] * u_dot_c += float_tmp * c[j] # <<<<<<<<<<<<<< - * u_dot_u += 2*u[j]*float_tmp + float_tmp*float_tmp + * u_dot_u += 2 * u[j] * float_tmp + float_tmp * float_tmp * u[j] += float_tmp */ __pyx_t_60 = __pyx_v_j; __pyx_v_u_dot_c = (__pyx_v_u_dot_c + (__pyx_v_float_tmp * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_c.rcbuffer->pybuffer.buf, __pyx_t_60, __pyx_pybuffernd_c.diminfo[0].strides)))); - /* "sklearn/earth/_forward.pyx":537 - * float_tmp = diff*B_orth_times_parent_cum[j] + /* "sklearn/earth/_forward.pyx":565 + * float_tmp = diff * B_orth_times_parent_cum[j] * u_dot_c += float_tmp * c[j] - * u_dot_u += 2*u[j]*float_tmp + float_tmp*float_tmp # <<<<<<<<<<<<<< + * u_dot_u += 2 * u[j] * float_tmp + float_tmp * float_tmp # <<<<<<<<<<<<<< * u[j] += float_tmp - * for j_ in range(last_candidate_idx+1,candidate_idx): + * for j_ in range(last_candidate_idx + 1, candidate_idx): */ __pyx_t_61 = __pyx_v_j; __pyx_v_u_dot_u = (__pyx_v_u_dot_u + (((2.0 * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_u.rcbuffer->pybuffer.buf, __pyx_t_61, __pyx_pybuffernd_u.diminfo[0].strides))) * __pyx_v_float_tmp) + (__pyx_v_float_tmp * __pyx_v_float_tmp))); - /* "sklearn/earth/_forward.pyx":538 + /* "sklearn/earth/_forward.pyx":566 * u_dot_c += float_tmp * c[j] - * u_dot_u += 2*u[j]*float_tmp + float_tmp*float_tmp + * u_dot_u += 2 * u[j] * float_tmp + float_tmp * float_tmp * u[j] += float_tmp # <<<<<<<<<<<<<< - * for j_ in range(last_candidate_idx+1,candidate_idx): + * for j_ in range(last_candidate_idx + 1, candidate_idx): * j = order[j_] */ __pyx_t_62 = __pyx_v_j; *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_u.rcbuffer->pybuffer.buf, __pyx_t_62, __pyx_pybuffernd_u.diminfo[0].strides) += __pyx_v_float_tmp; } - /* "sklearn/earth/_forward.pyx":539 - * u_dot_u += 2*u[j]*float_tmp + float_tmp*float_tmp + /* "sklearn/earth/_forward.pyx":567 + * u_dot_u += 2 * u[j] * float_tmp + float_tmp * float_tmp * u[j] += float_tmp - * for j_ in range(last_candidate_idx+1,candidate_idx): # <<<<<<<<<<<<<< + * for j_ in range(last_candidate_idx + 1, candidate_idx): # <<<<<<<<<<<<<< * j = order[j_] - * delta_b_j = (X[j,variable] - candidate) * b_parent[j] + * delta_b_j = (X[j, variable] - candidate) * b_parent[j] */ __pyx_t_46 = __pyx_v_candidate_idx; for (__pyx_t_47 = (__pyx_v_last_candidate_idx + 1); __pyx_t_47 < __pyx_t_46; __pyx_t_47+=1) { __pyx_v_j_ = __pyx_t_47; - /* "sklearn/earth/_forward.pyx":540 + /* "sklearn/earth/_forward.pyx":568 * u[j] += float_tmp - * for j_ in range(last_candidate_idx+1,candidate_idx): + * for j_ in range(last_candidate_idx + 1, candidate_idx): * j = order[j_] # <<<<<<<<<<<<<< - * delta_b_j = (X[j,variable] - candidate) * b_parent[j] - * delta_b_squared += delta_b_j**2 + * delta_b_j = (X[j, variable] - candidate) * b_parent[j] + * delta_b_squared += delta_b_j ** 2 */ __pyx_t_63 = __pyx_v_j_; __pyx_v_j = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_INT_t *, __pyx_pybuffernd_order.rcbuffer->pybuffer.buf, __pyx_t_63, __pyx_pybuffernd_order.diminfo[0].strides)); - /* "sklearn/earth/_forward.pyx":541 - * for j_ in range(last_candidate_idx+1,candidate_idx): + /* "sklearn/earth/_forward.pyx":569 + * for j_ in range(last_candidate_idx + 1, candidate_idx): * j = order[j_] - * delta_b_j = (X[j,variable] - candidate) * b_parent[j] # <<<<<<<<<<<<<< - * delta_b_squared += delta_b_j**2 + * delta_b_j = (X[j, variable] - candidate) * b_parent[j] # <<<<<<<<<<<<<< + * delta_b_squared += delta_b_j ** 2 * delta_c_end += delta_b_j * y[j] */ __pyx_t_64 = __pyx_v_j; @@ -8119,80 +8271,80 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_t_66 = __pyx_v_j; __pyx_v_delta_b_j = (((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_X.rcbuffer->pybuffer.buf, __pyx_t_64, __pyx_pybuffernd_X.diminfo[0].strides, __pyx_t_65, __pyx_pybuffernd_X.diminfo[1].strides)) - __pyx_v_candidate) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_66, __pyx_pybuffernd_b_parent.diminfo[0].strides))); - /* "sklearn/earth/_forward.pyx":542 + /* "sklearn/earth/_forward.pyx":570 * j = order[j_] - * delta_b_j = (X[j,variable] - candidate) * b_parent[j] - * delta_b_squared += delta_b_j**2 # <<<<<<<<<<<<<< + * delta_b_j = (X[j, variable] - candidate) * b_parent[j] + * delta_b_squared += delta_b_j ** 2 # <<<<<<<<<<<<<< * delta_c_end += delta_b_j * y[j] - * delta_u_end += 2*delta_b_j*b[j] + * delta_u_end += 2 * delta_b_j * b[j] */ __pyx_v_delta_b_squared = (__pyx_v_delta_b_squared + pow(__pyx_v_delta_b_j, 2.0)); - /* "sklearn/earth/_forward.pyx":543 - * delta_b_j = (X[j,variable] - candidate) * b_parent[j] - * delta_b_squared += delta_b_j**2 + /* "sklearn/earth/_forward.pyx":571 + * delta_b_j = (X[j, variable] - candidate) * b_parent[j] + * delta_b_squared += delta_b_j ** 2 * delta_c_end += delta_b_j * y[j] # <<<<<<<<<<<<<< - * delta_u_end += 2*delta_b_j*b[j] - * for h in range(k+1): + * delta_u_end += 2 * delta_b_j * b[j] + * for h in range(k + 1): */ __pyx_t_67 = __pyx_v_j; __pyx_v_delta_c_end = (__pyx_v_delta_c_end + (__pyx_v_delta_b_j * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_67, __pyx_pybuffernd_y.diminfo[0].strides)))); - /* "sklearn/earth/_forward.pyx":544 - * delta_b_squared += delta_b_j**2 + /* "sklearn/earth/_forward.pyx":572 + * delta_b_squared += delta_b_j ** 2 * delta_c_end += delta_b_j * y[j] - * delta_u_end += 2*delta_b_j*b[j] # <<<<<<<<<<<<<< - * for h in range(k+1): - * float_tmp = delta_b_j * B_orth[j,h] + * delta_u_end += 2 * delta_b_j * b[j] # <<<<<<<<<<<<<< + * for h in range(k + 1): + * float_tmp = delta_b_j * B_orth[j, h] */ __pyx_t_68 = __pyx_v_j; __pyx_v_delta_u_end = (__pyx_v_delta_u_end + ((2.0 * __pyx_v_delta_b_j) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_68, __pyx_pybuffernd_b.diminfo[0].strides)))); - /* "sklearn/earth/_forward.pyx":545 + /* "sklearn/earth/_forward.pyx":573 * delta_c_end += delta_b_j * y[j] - * delta_u_end += 2*delta_b_j*b[j] - * for h in range(k+1): # <<<<<<<<<<<<<< - * float_tmp = delta_b_j * B_orth[j,h] + * delta_u_end += 2 * delta_b_j * b[j] + * for h in range(k + 1): # <<<<<<<<<<<<<< + * float_tmp = delta_b_j * B_orth[j, h] * u_dot_c += float_tmp * c[h] */ __pyx_t_69 = (__pyx_v_k + 1); for (__pyx_t_70 = 0; __pyx_t_70 < __pyx_t_69; __pyx_t_70+=1) { __pyx_v_h = __pyx_t_70; - /* "sklearn/earth/_forward.pyx":546 - * delta_u_end += 2*delta_b_j*b[j] - * for h in range(k+1): - * float_tmp = delta_b_j * B_orth[j,h] # <<<<<<<<<<<<<< + /* "sklearn/earth/_forward.pyx":574 + * delta_u_end += 2 * delta_b_j * b[j] + * for h in range(k + 1): + * float_tmp = delta_b_j * B_orth[j, h] # <<<<<<<<<<<<<< * u_dot_c += float_tmp * c[h] - * u_dot_u += 2*u[h]*float_tmp + float_tmp*float_tmp + * u_dot_u += 2 * u[h] * float_tmp + float_tmp * float_tmp */ __pyx_t_71 = __pyx_v_j; __pyx_t_72 = __pyx_v_h; __pyx_v_float_tmp = (__pyx_v_delta_b_j * (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_71, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_72, __pyx_pybuffernd_B_orth.diminfo[1].strides))); - /* "sklearn/earth/_forward.pyx":547 - * for h in range(k+1): - * float_tmp = delta_b_j * B_orth[j,h] + /* "sklearn/earth/_forward.pyx":575 + * for h in range(k + 1): + * float_tmp = delta_b_j * B_orth[j, h] * u_dot_c += float_tmp * c[h] # <<<<<<<<<<<<<< - * u_dot_u += 2*u[h]*float_tmp + float_tmp*float_tmp + * u_dot_u += 2 * u[h] * float_tmp + float_tmp * float_tmp * u[h] += float_tmp */ __pyx_t_73 = __pyx_v_h; __pyx_v_u_dot_c = (__pyx_v_u_dot_c + (__pyx_v_float_tmp * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_c.rcbuffer->pybuffer.buf, __pyx_t_73, __pyx_pybuffernd_c.diminfo[0].strides)))); - /* "sklearn/earth/_forward.pyx":548 - * float_tmp = delta_b_j * B_orth[j,h] + /* "sklearn/earth/_forward.pyx":576 + * float_tmp = delta_b_j * B_orth[j, h] * u_dot_c += float_tmp * c[h] - * u_dot_u += 2*u[h]*float_tmp + float_tmp*float_tmp # <<<<<<<<<<<<<< + * u_dot_u += 2 * u[h] * float_tmp + float_tmp * float_tmp # <<<<<<<<<<<<<< * u[h] += float_tmp * b[j] += delta_b_j */ __pyx_t_74 = __pyx_v_h; __pyx_v_u_dot_u = (__pyx_v_u_dot_u + (((2.0 * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_u.rcbuffer->pybuffer.buf, __pyx_t_74, __pyx_pybuffernd_u.diminfo[0].strides))) * __pyx_v_float_tmp) + (__pyx_v_float_tmp * __pyx_v_float_tmp))); - /* "sklearn/earth/_forward.pyx":549 + /* "sklearn/earth/_forward.pyx":577 * u_dot_c += float_tmp * c[h] - * u_dot_u += 2*u[h]*float_tmp + float_tmp*float_tmp + * u_dot_u += 2 * u[h] * float_tmp + float_tmp * float_tmp * u[h] += float_tmp # <<<<<<<<<<<<<< * b[j] += delta_b_j * @@ -8201,87 +8353,87 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_u.rcbuffer->pybuffer.buf, __pyx_t_75, __pyx_pybuffernd_u.diminfo[0].strides) += __pyx_v_float_tmp; } - /* "sklearn/earth/_forward.pyx":550 - * u_dot_u += 2*u[h]*float_tmp + float_tmp*float_tmp + /* "sklearn/earth/_forward.pyx":578 + * u_dot_u += 2 * u[h] * float_tmp + float_tmp * float_tmp * u[h] += float_tmp * b[j] += delta_b_j # <<<<<<<<<<<<<< * - * #Update u_end + * # Update u_end */ __pyx_t_69 = __pyx_v_j; *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_69, __pyx_pybuffernd_b.diminfo[0].strides) += __pyx_v_delta_b_j; } - /* "sklearn/earth/_forward.pyx":553 + /* "sklearn/earth/_forward.pyx":581 * - * #Update u_end + * # Update u_end * delta_u_end += delta_b_squared # <<<<<<<<<<<<<< * u_end += delta_u_end * */ __pyx_v_delta_u_end = (__pyx_v_delta_u_end + __pyx_v_delta_b_squared); - /* "sklearn/earth/_forward.pyx":554 - * #Update u_end + /* "sklearn/earth/_forward.pyx":582 + * # Update u_end * delta_u_end += delta_b_squared * u_end += delta_u_end # <<<<<<<<<<<<<< * - * #Update c_end + * # Update c_end */ __pyx_v_u_end = (__pyx_v_u_end + __pyx_v_delta_u_end); - /* "sklearn/earth/_forward.pyx":557 + /* "sklearn/earth/_forward.pyx":585 * - * #Update c_end + * # Update c_end * c_end += delta_c_end # <<<<<<<<<<<<<< * - * #Update b_times_parent_cum + * # Update b_times_parent_cum */ __pyx_v_c_end = (__pyx_v_c_end + __pyx_v_delta_c_end); - /* "sklearn/earth/_forward.pyx":560 + /* "sklearn/earth/_forward.pyx":588 * - * #Update b_times_parent_cum + * # Update b_times_parent_cum * b_times_parent_cum += parent_squared_cum * diff # <<<<<<<<<<<<<< * - * #Compute the new z_end_squared (this is the quantity we're optimizing) + * # Compute the new z_end_squared (this is the quantity we're */ __pyx_v_b_times_parent_cum = (__pyx_v_b_times_parent_cum + (__pyx_v_parent_squared_cum * __pyx_v_diff)); - /* "sklearn/earth/_forward.pyx":563 - * - * #Compute the new z_end_squared (this is the quantity we're optimizing) + /* "sklearn/earth/_forward.pyx":592 + * # Compute the new z_end_squared (this is the quantity we're + * # optimizing) * if (u_end - u_dot_u) <= self.zero_tol: # <<<<<<<<<<<<<< * continue - * z_end_squared = ((c_end - u_dot_c)**2) / (u_end - u_dot_u) + * z_end_squared = ((c_end - u_dot_c) ** 2) / (u_end - u_dot_u) */ __pyx_t_20 = (((__pyx_v_u_end - __pyx_v_u_dot_u) <= __pyx_v_self->zero_tol) != 0); if (__pyx_t_20) { - /* "sklearn/earth/_forward.pyx":564 - * #Compute the new z_end_squared (this is the quantity we're optimizing) + /* "sklearn/earth/_forward.pyx":593 + * # optimizing) * if (u_end - u_dot_u) <= self.zero_tol: * continue # <<<<<<<<<<<<<< - * z_end_squared = ((c_end - u_dot_c)**2) / (u_end - u_dot_u) - * #END HYPER-OPTIMIZED + * z_end_squared = ((c_end - u_dot_c) ** 2) / (u_end - u_dot_u) + * # END HYPER-OPTIMIZED */ goto __pyx_L13_continue; goto __pyx_L25; } __pyx_L25:; - /* "sklearn/earth/_forward.pyx":565 + /* "sklearn/earth/_forward.pyx":594 * if (u_end - u_dot_u) <= self.zero_tol: * continue - * z_end_squared = ((c_end - u_dot_c)**2) / (u_end - u_dot_u) # <<<<<<<<<<<<<< - * #END HYPER-OPTIMIZED + * z_end_squared = ((c_end - u_dot_c) ** 2) / (u_end - u_dot_u) # <<<<<<<<<<<<<< + * # END HYPER-OPTIMIZED * */ __pyx_v_z_end_squared = (pow((__pyx_v_c_end - __pyx_v_u_dot_c), 2.0) / (__pyx_v_u_end - __pyx_v_u_dot_u)); - /* "sklearn/earth/_forward.pyx":569 + /* "sklearn/earth/_forward.pyx":598 * - * #Update the best if necessary + * # Update the best if necessary * if z_end_squared > best_z_end_squared: # <<<<<<<<<<<<<< * best_z_end_squared = z_end_squared * best_candidate_idx = candidate_idx @@ -8289,8 +8441,8 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_t_20 = ((__pyx_v_z_end_squared > __pyx_v_best_z_end_squared) != 0); if (__pyx_t_20) { - /* "sklearn/earth/_forward.pyx":570 - * #Update the best if necessary + /* "sklearn/earth/_forward.pyx":599 + * # Update the best if necessary * if z_end_squared > best_z_end_squared: * best_z_end_squared = z_end_squared # <<<<<<<<<<<<<< * best_candidate_idx = candidate_idx @@ -8298,7 +8450,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str */ __pyx_v_best_z_end_squared = __pyx_v_z_end_squared; - /* "sklearn/earth/_forward.pyx":571 + /* "sklearn/earth/_forward.pyx":600 * if z_end_squared > best_z_end_squared: * best_z_end_squared = z_end_squared * best_candidate_idx = candidate_idx # <<<<<<<<<<<<<< @@ -8307,12 +8459,12 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str */ __pyx_v_best_candidate_idx = __pyx_v_candidate_idx; - /* "sklearn/earth/_forward.pyx":572 + /* "sklearn/earth/_forward.pyx":601 * best_z_end_squared = z_end_squared * best_candidate_idx = candidate_idx * best_candidate = candidate # <<<<<<<<<<<<<< * - * #Compute the mse for the best z_end and set return values + * # Compute the mse for the best z_end and set return values */ __pyx_v_best_candidate = __pyx_v_candidate; goto __pyx_L26; @@ -8321,30 +8473,27 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_L13_continue:; } - /* "sklearn/earth/_forward.pyx":575 + /* "sklearn/earth/_forward.pyx":604 * - * #Compute the mse for the best z_end and set return values - * mse[0] = (self.y_squared - self.c_squared - best_z_end_squared)/self.m # <<<<<<<<<<<<<< + * # Compute the mse for the best z_end and set return values + * mse[0] = ( # <<<<<<<<<<<<<< + * self.y_squared - self.c_squared - best_z_end_squared) / self.m * knot[0] = best_candidate - * knot_idx[0] = best_candidate_idx */ (__pyx_v_mse[0]) = (((__pyx_v_self->y_squared - __pyx_v_self->c_squared) - __pyx_v_best_z_end_squared) / __pyx_v_self->m); - /* "sklearn/earth/_forward.pyx":576 - * #Compute the mse for the best z_end and set return values - * mse[0] = (self.y_squared - self.c_squared - best_z_end_squared)/self.m + /* "sklearn/earth/_forward.pyx":606 + * mse[0] = ( + * self.y_squared - self.c_squared - best_z_end_squared) / self.m * knot[0] = best_candidate # <<<<<<<<<<<<<< * knot_idx[0] = best_candidate_idx - * */ (__pyx_v_knot[0]) = __pyx_v_best_candidate; - /* "sklearn/earth/_forward.pyx":577 - * mse[0] = (self.y_squared - self.c_squared - best_z_end_squared)/self.m + /* "sklearn/earth/_forward.pyx":607 + * self.y_squared - self.c_squared - best_z_end_squared) / self.m * knot[0] = best_candidate * knot_idx[0] = best_candidate_idx # <<<<<<<<<<<<<< - * - * */ (__pyx_v_knot_idx[0]) = __pyx_v_best_candidate_idx; @@ -10669,9 +10818,9 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_round = __Pyx_GetBuiltinName(__pyx_n_s__round); if (!__pyx_builtin_round) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_round = __Pyx_GetBuiltinName(__pyx_n_s__round); if (!__pyx_builtin_round) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; @@ -10683,153 +10832,153 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "sklearn/earth/_forward.pyx":81 + /* "sklearn/earth/_forward.pyx":91 * self.linear_variables[linvar] = 1 * else: - * raise IndexError('Unknown variable selected in linvars argument.') # <<<<<<<<<<<<<< + * raise IndexError( # <<<<<<<<<<<<<< + * 'Unknown variable selected in linvars argument.') * - * #Initialize B_orth, c, and c_squared (assuming column 0 of B_orth is already filled with 1) */ - __pyx_k_tuple_2 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_1)); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_2 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_1)); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_2); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); - /* "sklearn/earth/_forward.pyx":100 + /* "sklearn/earth/_forward.pyx":112 * cdef ConstantBasisFunction root_basis_function = self.basis[0] * for variable in range(self.n): - * order = np.argsort(X[:,variable])[::-1] # <<<<<<<<<<<<<< - * if root_basis_function.valid_knots(B[order,0], X[order,variable], + * order = np.argsort(X[:, variable])[::-1] # <<<<<<<<<<<<<< + * if root_basis_function.valid_knots(B[order, 0], X[order, variable], * variable, self.check_every, endspan, */ - __pyx_k_slice_4 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_4 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_4); __Pyx_GIVEREF(__pyx_k_slice_4); - __pyx_k_slice_5 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_k_slice_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_5 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_k_slice_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_5); __Pyx_GIVEREF(__pyx_k_slice_5); - /* "sklearn/earth/_forward.pyx":249 - * - * #Sort the data - * sorting[:] = np.argsort(X[:,variable])[::-1] #TODO: eliminate Python call / data copy # <<<<<<<<<<<<<< + /* "sklearn/earth/_forward.pyx":263 + * # Sort the data + * # TODO: eliminate Python call / data copy + * sorting[:] = np.argsort(X[:, variable])[::-1] # <<<<<<<<<<<<<< * - * #Iterate over parents + * # Iterate over parents */ - __pyx_k_slice_8 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_8 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_8); __Pyx_GIVEREF(__pyx_k_slice_8); - __pyx_k_slice_9 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_k_slice_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_9 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_k_slice_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_9); __Pyx_GIVEREF(__pyx_k_slice_9); - __pyx_k_slice_10 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_10 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_10); __Pyx_GIVEREF(__pyx_k_slice_10); - /* "sklearn/earth/_forward.pyx":338 - * bf1 = HingeBasisFunction(parent_choice,knot_choice,knot_idx_choice,variable_choice,False,label) - * bf2 = HingeBasisFunction(parent_choice,knot_choice,knot_idx_choice,variable_choice,True,label) - * bf1.apply(X,B[:,k]) # <<<<<<<<<<<<<< - * bf2.apply(X,B[:,k+1]) + /* "sklearn/earth/_forward.pyx":361 + * bf2 = HingeBasisFunction( + * parent_choice, knot_choice, knot_idx_choice, variable_choice, True, label) + * bf1.apply(X, B[:, k]) # <<<<<<<<<<<<<< + * bf2.apply(X, B[:, k + 1]) * self.basis.append(bf1) */ - __pyx_k_slice_11 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_11 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_11); __Pyx_GIVEREF(__pyx_k_slice_11); - /* "sklearn/earth/_forward.pyx":339 - * bf2 = HingeBasisFunction(parent_choice,knot_choice,knot_idx_choice,variable_choice,True,label) - * bf1.apply(X,B[:,k]) - * bf2.apply(X,B[:,k+1]) # <<<<<<<<<<<<<< + /* "sklearn/earth/_forward.pyx":362 + * parent_choice, knot_choice, knot_idx_choice, variable_choice, True, label) + * bf1.apply(X, B[:, k]) + * bf2.apply(X, B[:, k + 1]) # <<<<<<<<<<<<<< * self.basis.append(bf1) * self.basis.append(bf2) */ - __pyx_k_slice_12 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 339; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_12 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_12); __Pyx_GIVEREF(__pyx_k_slice_12); - /* "sklearn/earth/_forward.pyx":344 + /* "sklearn/earth/_forward.pyx":367 * - * #Orthogonalize the new basis - * B_orth[:,k] = B[:,k] # <<<<<<<<<<<<<< + * # Orthogonalize the new basis + * B_orth[:, k] = B[:, k] # <<<<<<<<<<<<<< * if self.orthonormal_update(k) == 1: * bf1.make_unsplittable() */ - __pyx_k_slice_13 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_13 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_13); __Pyx_GIVEREF(__pyx_k_slice_13); - __pyx_k_slice_14 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 344; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_14 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_14); __Pyx_GIVEREF(__pyx_k_slice_14); - /* "sklearn/earth/_forward.pyx":347 + /* "sklearn/earth/_forward.pyx":370 * if self.orthonormal_update(k) == 1: * bf1.make_unsplittable() - * B_orth[:,k+1] = B[:,k+1] # <<<<<<<<<<<<<< - * if self.orthonormal_update(k+1) == 1: + * B_orth[:, k + 1] = B[:, k + 1] # <<<<<<<<<<<<<< + * if self.orthonormal_update(k + 1) == 1: * bf2.make_unsplittable() */ - __pyx_k_slice_15 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_15 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_15); __Pyx_GIVEREF(__pyx_k_slice_15); - __pyx_k_slice_16 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 347; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_16 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_16); __Pyx_GIVEREF(__pyx_k_slice_16); - /* "sklearn/earth/_forward.pyx":353 - * #In this case, only add the linear basis function - * bf1 = LinearBasisFunction(parent_choice,variable_choice,label) - * bf1.apply(X,B[:,k]) # <<<<<<<<<<<<<< + /* "sklearn/earth/_forward.pyx":376 + * # In this case, only add the linear basis function + * bf1 = LinearBasisFunction(parent_choice, variable_choice, label) + * bf1.apply(X, B[:, k]) # <<<<<<<<<<<<<< * self.basis.append(bf1) * */ - __pyx_k_slice_17 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_17 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_17); __Pyx_GIVEREF(__pyx_k_slice_17); - /* "sklearn/earth/_forward.pyx":357 + /* "sklearn/earth/_forward.pyx":380 * - * #Orthogonalize the new basis - * B_orth[:,k] = B[:,k] # <<<<<<<<<<<<<< + * # Orthogonalize the new basis + * B_orth[:, k] = B[:, k] # <<<<<<<<<<<<<< * if self.orthonormal_update(k) == 1: * bf1.make_unsplittable() */ - __pyx_k_slice_18 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_18 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_18); __Pyx_GIVEREF(__pyx_k_slice_18); - __pyx_k_slice_19 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_19 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_19); __Pyx_GIVEREF(__pyx_k_slice_19); - /* "sklearn/earth/_forward.pyx":379 + /* "sklearn/earth/_forward.pyx":404 * ''' * - * cdef cnp.ndarray[FLOAT_t, ndim=1] b = self.B[:,k+1] # <<<<<<<<<<<<<< - * cdef cnp.ndarray[FLOAT_t, ndim=1] b_parent = self.B[:,parent] - * cdef cnp.ndarray[FLOAT_t, ndim=1] u = self.u + * cdef cnp.ndarray[FLOAT_t, ndim = 1] b = self.B[:, k + 1] # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t, ndim = 1] b_parent = self.B[:, parent] + * cdef cnp.ndarray[FLOAT_t, ndim = 1] u = self.u */ - __pyx_k_slice_20 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 379; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_20 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_20); __Pyx_GIVEREF(__pyx_k_slice_20); - /* "sklearn/earth/_forward.pyx":380 + /* "sklearn/earth/_forward.pyx":405 * - * cdef cnp.ndarray[FLOAT_t, ndim=1] b = self.B[:,k+1] - * cdef cnp.ndarray[FLOAT_t, ndim=1] b_parent = self.B[:,parent] # <<<<<<<<<<<<<< - * cdef cnp.ndarray[FLOAT_t, ndim=1] u = self.u - * cdef cnp.ndarray[FLOAT_t, ndim=2] B_orth = self.B_orth + * cdef cnp.ndarray[FLOAT_t, ndim = 1] b = self.B[:, k + 1] + * cdef cnp.ndarray[FLOAT_t, ndim = 1] b_parent = self.B[:, parent] # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t, ndim = 1] u = self.u + * cdef cnp.ndarray[FLOAT_t, ndim = 2] B_orth = self.B_orth */ - __pyx_k_slice_21 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_21 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_21); __Pyx_GIVEREF(__pyx_k_slice_21); - /* "sklearn/earth/_forward.pyx":436 - * - * #Compute the initial covariance column, u (not including the final element) - * u[0:k+1] = np.dot(b,B_orth[:,0:k+1]) # <<<<<<<<<<<<<< + /* "sklearn/earth/_forward.pyx":462 + * # Compute the initial covariance column, u (not including the final + * # element) + * u[0:k + 1] = np.dot(b, B_orth[:, 0:k + 1]) # <<<<<<<<<<<<<< * - * #Compute the new last elements of c and u + * # Compute the new last elements of c and u */ - __pyx_k_slice_22 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 436; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_22 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_22); __Pyx_GIVEREF(__pyx_k_slice_22); @@ -11036,8 +11185,8 @@ PyMODINIT_FUNC PyInit__forward(void) __pyx_vtabptr_7sklearn_5earth_6_basis_HingeBasisFunction = (struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_6_basis_HingeBasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_6_basis_HingeBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_5earth_6_basis_LinearBasisFunction = __Pyx_ImportType("sklearn.earth._basis", "LinearBasisFunction", sizeof(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_6_basis_LinearBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_vtabptr_7sklearn_5earth_6_basis_LinearBasisFunction = (struct __pyx_vtabstruct_7sklearn_5earth_6_basis_LinearBasisFunction*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_6_basis_LinearBasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_6_basis_LinearBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7sklearn_5earth_6_basis_Basis = __Pyx_ImportType("sklearn.earth._basis", "Basis", sizeof(struct __pyx_obj_7sklearn_5earth_6_basis_Basis), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_6_basis_Basis)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_vtabptr_7sklearn_5earth_6_basis_Basis = (struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_6_basis_Basis->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_6_basis_Basis)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_6_basis_Basis = __Pyx_ImportType("sklearn.earth._basis", "Basis", sizeof(struct __pyx_obj_7sklearn_5earth_6_basis_Basis), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_6_basis_Basis)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5earth_6_basis_Basis = (struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_6_basis_Basis->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_6_basis_Basis)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_5earth_7_record_Record = __Pyx_ImportType("sklearn.earth._record", "Record", sizeof(struct __pyx_obj_7sklearn_5earth_7_record_Record), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_7_record_Record)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_vtabptr_7sklearn_5earth_7_record_Record = (struct __pyx_vtabstruct_7sklearn_5earth_7_record_Record*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_7_record_Record->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_7_record_Record)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_5earth_7_record_PruningPassRecord = __Pyx_ImportType("sklearn.earth._record", "PruningPassRecord", sizeof(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_7_record_PruningPassRecord)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -11088,8 +11237,8 @@ PyMODINIT_FUNC PyInit__forward(void) * cnp.import_array() * * stopping_conditions = { # <<<<<<<<<<<<<< - * MAXTERMS:"Reached maximum number of terms", - * MAXRSQ:"Achieved RSQ value within threshold of 1", + * MAXTERMS: "Reached maximum number of terms", + * MAXRSQ: "Achieved RSQ value within threshold of 1", */ __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); @@ -11097,9 +11246,9 @@ PyMODINIT_FUNC PyInit__forward(void) /* "sklearn/earth/_forward.pyx":16 * * stopping_conditions = { - * MAXTERMS:"Reached maximum number of terms", # <<<<<<<<<<<<<< - * MAXRSQ:"Achieved RSQ value within threshold of 1", - * NOIMPRV:"Improvement below threshold", + * MAXTERMS: "Reached maximum number of terms", # <<<<<<<<<<<<<< + * MAXRSQ: "Achieved RSQ value within threshold of 1", + * NOIMPRV: "Improvement below threshold", */ __pyx_t_3 = PyInt_FromLong(__pyx_e_7sklearn_5earth_8_forward_MAXTERMS); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); @@ -11108,10 +11257,10 @@ PyMODINIT_FUNC PyInit__forward(void) /* "sklearn/earth/_forward.pyx":17 * stopping_conditions = { - * MAXTERMS:"Reached maximum number of terms", - * MAXRSQ:"Achieved RSQ value within threshold of 1", # <<<<<<<<<<<<<< - * NOIMPRV:"Improvement below threshold", - * LOWGRSQ:"GRSQ too low", + * MAXTERMS: "Reached maximum number of terms", + * MAXRSQ: "Achieved RSQ value within threshold of 1", # <<<<<<<<<<<<<< + * NOIMPRV: "Improvement below threshold", + * LOWGRSQ: "GRSQ too low", */ __pyx_t_3 = PyInt_FromLong(__pyx_e_7sklearn_5earth_8_forward_MAXRSQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); @@ -11119,11 +11268,11 @@ PyMODINIT_FUNC PyInit__forward(void) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "sklearn/earth/_forward.pyx":18 - * MAXTERMS:"Reached maximum number of terms", - * MAXRSQ:"Achieved RSQ value within threshold of 1", - * NOIMPRV:"Improvement below threshold", # <<<<<<<<<<<<<< - * LOWGRSQ:"GRSQ too low", - * NOCAND:"No remaining candidate knot locations" + * MAXTERMS: "Reached maximum number of terms", + * MAXRSQ: "Achieved RSQ value within threshold of 1", + * NOIMPRV: "Improvement below threshold", # <<<<<<<<<<<<<< + * LOWGRSQ: "GRSQ too low", + * NOCAND: "No remaining candidate knot locations" */ __pyx_t_3 = PyInt_FromLong(__pyx_e_7sklearn_5earth_8_forward_NOIMPRV); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); @@ -11131,11 +11280,11 @@ PyMODINIT_FUNC PyInit__forward(void) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "sklearn/earth/_forward.pyx":19 - * MAXRSQ:"Achieved RSQ value within threshold of 1", - * NOIMPRV:"Improvement below threshold", - * LOWGRSQ:"GRSQ too low", # <<<<<<<<<<<<<< - * NOCAND:"No remaining candidate knot locations" - * } + * MAXRSQ: "Achieved RSQ value within threshold of 1", + * NOIMPRV: "Improvement below threshold", + * LOWGRSQ: "GRSQ too low", # <<<<<<<<<<<<<< + * NOCAND: "No remaining candidate knot locations" + * } */ __pyx_t_3 = PyInt_FromLong(__pyx_e_7sklearn_5earth_8_forward_LOWGRSQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); @@ -11143,10 +11292,10 @@ PyMODINIT_FUNC PyInit__forward(void) __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "sklearn/earth/_forward.pyx":20 - * NOIMPRV:"Improvement below threshold", - * LOWGRSQ:"GRSQ too low", - * NOCAND:"No remaining candidate knot locations" # <<<<<<<<<<<<<< - * } + * NOIMPRV: "Improvement below threshold", + * LOWGRSQ: "GRSQ too low", + * NOCAND: "No remaining candidate knot locations" # <<<<<<<<<<<<<< + * } * */ __pyx_t_3 = PyInt_FromLong(__pyx_e_7sklearn_5earth_8_forward_NOCAND); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} diff --git a/sklearn/earth/_forward.pxd b/sklearn/earth/_forward.pxd index 1e769038ad6e5..e3e744afa3639 100644 --- a/sklearn/earth/_forward.pxd +++ b/sklearn/earth/_forward.pxd @@ -8,17 +8,17 @@ from _basis cimport Basis from _record cimport ForwardPassRecord ctypedef enum StoppingCondition: - MAXTERMS=0, - MAXRSQ=1, - NOIMPRV=2, - LOWGRSQ=3, - NOCAND=4 + MAXTERMS = 0, + MAXRSQ = 1, + NOIMPRV = 2, + LOWGRSQ = 3, + NOCAND = 4 cdef dict stopping_conditions cdef class ForwardPasser: - #User selected parameters + # User selected parameters cdef int endspan cdef int minspan cdef FLOAT_t endspan_alpha @@ -31,8 +31,8 @@ cdef class ForwardPasser: cdef int min_search_points cdef list xlabels cdef FLOAT_t zero_tol - - #Input data + + # Input data cdef cnp.ndarray X cdef cnp.ndarray y cdef cnp.ndarray sample_weight @@ -40,43 +40,38 @@ cdef class ForwardPasser: cdef INDEX_t n cdef FLOAT_t sst cdef FLOAT_t y_squared - - #Working floating point data - cdef cnp.ndarray B #Data matrix in basis space - cdef cnp.ndarray B_orth #Orthogonalized version of B + + # Working floating point data + cdef cnp.ndarray B # Data matrix in basis space + cdef cnp.ndarray B_orth # Orthogonalized version of B cdef cnp.ndarray c cdef cnp.ndarray norms cdef cnp.ndarray u cdef cnp.ndarray B_orth_times_parent_cum cdef FLOAT_t c_squared - - #Working integer data + + # Working integer data cdef cnp.ndarray sort_tracker cdef cnp.ndarray sorting cdef cnp.ndarray mwork -# cdef cnp.ndarray x_order cdef cnp.ndarray linear_variables - - #Object construction + + # Object construction cdef ForwardPassRecord record cdef Basis basis - + cpdef Basis get_basis(ForwardPasser self) - -# cpdef init_x_order(ForwardPasser self) - + cpdef init_linear_variables(ForwardPasser self) - + cpdef run(ForwardPasser self) - + cdef stop_check(ForwardPasser self) - + cpdef int orthonormal_update(ForwardPasser self, INDEX_t k) - + cpdef orthonormal_downdate(ForwardPasser self, INDEX_t k) - + cdef next_pair(ForwardPasser self) - - cdef best_knot(ForwardPasser self, INDEX_t parent, INDEX_t variable, INDEX_t k, cnp.ndarray[INT_t,ndim=1] candidates, cnp.ndarray[INT_t,ndim=1] order, FLOAT_t * mse, FLOAT_t * knot, INDEX_t * knot_idx) - \ No newline at end of file + cdef best_knot(ForwardPasser self, INDEX_t parent, INDEX_t variable, INDEX_t k, cnp.ndarray[INT_t, ndim=1] candidates, cnp.ndarray[INT_t, ndim=1] order, FLOAT_t * mse, FLOAT_t * knot, INDEX_t * knot_idx) diff --git a/sklearn/earth/_forward.pyx b/sklearn/earth/_forward.pyx index 7625c88e6bbbc..01a410c46ddf8 100644 --- a/sklearn/earth/_forward.pyx +++ b/sklearn/earth/_forward.pyx @@ -13,15 +13,15 @@ import numpy as np cnp.import_array() stopping_conditions = { - MAXTERMS:"Reached maximum number of terms", - MAXRSQ:"Achieved RSQ value within threshold of 1", - NOIMPRV:"Improvement below threshold", - LOWGRSQ:"GRSQ too low", - NOCAND:"No remaining candidate knot locations" - } + MAXTERMS: "Reached maximum number of terms", + MAXRSQ: "Achieved RSQ value within threshold of 1", + NOIMPRV: "Improvement below threshold", + LOWGRSQ: "GRSQ too low", + NOCAND: "No remaining candidate knot locations" +} cdef class ForwardPasser: - + def __init__(ForwardPasser self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] sample_weight, **kwargs): cdef INDEX_t i self.X = X @@ -32,32 +32,42 @@ cdef class ForwardPasser: self.n = self.X.shape[1] self.endspan = kwargs['endspan'] if 'endspan' in kwargs else -1 self.minspan = kwargs['minspan'] if 'minspan' in kwargs else -1 - self.endspan_alpha = kwargs['endspan_alpha'] if 'endspan_alpha' in kwargs else .05 - self.minspan_alpha = kwargs['minspan_alpha'] if 'minspan_alpha' in kwargs else .05 - self.max_terms = kwargs['max_terms'] if 'max_terms' in kwargs else 2*self.n + 10 + self.endspan_alpha = kwargs[ + 'endspan_alpha'] if 'endspan_alpha' in kwargs else .05 + self.minspan_alpha = kwargs[ + 'minspan_alpha'] if 'minspan_alpha' in kwargs else .05 + self.max_terms = kwargs[ + 'max_terms'] if 'max_terms' in kwargs else 2 * self.n + 10 self.max_degree = kwargs['max_degree'] if 'max_degree' in kwargs else 1 self.thresh = kwargs['thresh'] if 'thresh' in kwargs else 0.001 self.penalty = kwargs['penalty'] if 'penalty' in kwargs else 3.0 - self.check_every = kwargs['check_every'] if 'check_every' in kwargs else -1 - self.min_search_points = kwargs['min_search_points'] if 'min_search_points' in kwargs else 100 + self.check_every = kwargs[ + 'check_every'] if 'check_every' in kwargs else -1 + self.min_search_points = kwargs[ + 'min_search_points'] if 'min_search_points' in kwargs else 100 self.xlabels = kwargs['xlabels'] if 'xlabels' in kwargs else None if self.xlabels is None: - self.xlabels = ['x'+str(i) for i in range(self.n)] + self.xlabels = ['x' + str(i) for i in range(self.n)] if self.check_every < 0: - self.check_every = (self.m / self.min_search_points) if self.m > self.min_search_points else 1 - self.sst = (np.dot(self.y,self.y) - (np.dot(np.sqrt(self.sample_weight),self.y) / np.sqrt(np.sum(self.sample_weight)))**2) / self.m - self.y_squared = np.dot(self.y,self.y) - self.record = ForwardPassRecord(self.m,self.n,self.penalty,self.sst,self.xlabels) + self.check_every = (self.m / self.min_search_points) if self.m > self.min_search_points else 1 + self.sst = (np.dot(self.y, self.y) - + (np.dot(np.sqrt(self.sample_weight), self.y) / np.sqrt(np.sum(self.sample_weight))) ** 2) / self.m + self.y_squared = np.dot(self.y, self.y) + self.record = ForwardPassRecord( + self.m, self.n, self.penalty, self.sst, self.xlabels) self.basis = Basis(self.n) self.basis.append(ConstantBasisFunction()) - + self.sorting = np.empty(shape=self.m, dtype=np.int) self.mwork = np.empty(shape=self.m, dtype=np.int) self.u = np.empty(shape=self.max_terms, dtype=float) - self.B_orth_times_parent_cum = np.empty(shape=self.max_terms,dtype=np.float) - self.B = np.ones(shape=(self.m,self.max_terms), order='C',dtype=np.float) - self.basis.weighted_transform(self.X,self.B,self.sample_weight) - self.B_orth = self.B.copy() #An orthogonal matrix with the same column space as B + self.B_orth_times_parent_cum = np.empty( + shape=self.max_terms, dtype=np.float) + self.B = np.ones( + shape=(self.m, self.max_terms), order='C', dtype=np.float) + self.basis.weighted_transform(self.X, self.B, self.sample_weight) + # An orthogonal matrix with the same column space as B + self.B_orth = self.B.copy() self.u = np.empty(shape=self.max_terms, dtype=np.float) self.c = np.empty(shape=self.max_terms, dtype=np.float) self.norms = np.empty(shape=self.max_terms, dtype=np.float) @@ -66,11 +76,11 @@ cdef class ForwardPasser: for i in range(self.m): self.sort_tracker[i] = i self.zero_tol = 1e-6 - - self.linear_variables = np.zeros(shape=self.n,dtype=np.int) + + self.linear_variables = np.zeros(shape=self.n, dtype=np.int) self.init_linear_variables() - - #Add in user selected linear variables + + # Add in user selected linear variables if 'linvars' in kwargs: for linvar in kwargs['linvars']: if linvar in self.xlabels: @@ -78,37 +88,39 @@ cdef class ForwardPasser: elif linvar in range(self.n): self.linear_variables[linvar] = 1 else: - raise IndexError('Unknown variable selected in linvars argument.') - - #Initialize B_orth, c, and c_squared (assuming column 0 of B_orth is already filled with 1) + raise IndexError( + 'Unknown variable selected in linvars argument.') + + # Initialize B_orth, c, and c_squared (assuming column 0 of B_orth is + # already filled with 1) self.orthonormal_update(0) - + cpdef Basis get_basis(ForwardPasser self): return self.basis - + cpdef init_linear_variables(ForwardPasser self): cdef INDEX_t variable cdef INDEX_t endspan - cdef cnp.ndarray[INT_t, ndim=1] order - cdef cnp.ndarray[INT_t, ndim=1] linear_variables = self.linear_variables - cdef cnp.ndarray[FLOAT_t, ndim=2] B = self.B - cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X + cdef cnp.ndarray[INT_t, ndim = 1] order + cdef cnp.ndarray[INT_t, ndim = 1] linear_variables = self.linear_variables + cdef cnp.ndarray[FLOAT_t, ndim = 2] B = self.B + cdef cnp.ndarray[FLOAT_t, ndim = 2] X = self.X if self.endspan < 0: - endspan = round(3 - log2(self.endspan_alpha/self.n)) + endspan = round(3 - log2(self.endspan_alpha / self.n)) cdef ConstantBasisFunction root_basis_function = self.basis[0] for variable in range(self.n): - order = np.argsort(X[:,variable])[::-1] - if root_basis_function.valid_knots(B[order,0], X[order,variable], - variable, self.check_every, endspan, - self.minspan, self.minspan_alpha, + order = np.argsort(X[:, variable])[::-1] + if root_basis_function.valid_knots(B[order, 0], X[order, variable], + variable, self.check_every, endspan, + self.minspan, self.minspan_alpha, self.n, self.mwork).shape[0] == 0: linear_variables[variable] = 1 else: linear_variables[variable] = 0 - + def get_B_orth(ForwardPasser self): return self.B_orth - + cpdef run(ForwardPasser self): cdef INDEX_t i while True: @@ -136,61 +148,62 @@ cdef class ForwardPasser: self.record.stopping_condition = NOCAND return True return False - + cpdef int orthonormal_update(ForwardPasser self, INDEX_t k): '''Orthogonalize and normalize column k of B_orth against all previous columns of B_orth.''' - #Currently implemented using modified Gram-Schmidt process - #TODO: Optimize - replace some for loops with calls to blas - - cdef cnp.ndarray[FLOAT_t, ndim=2] B_orth = self.B_orth - cdef cnp.ndarray[FLOAT_t, ndim=1] c = self.c - cdef cnp.ndarray[FLOAT_t, ndim=1] y = self.y - cdef cnp.ndarray[FLOAT_t, ndim=1] norms = self.norms - + # Currently implemented using modified Gram-Schmidt process + # TODO: Optimize - replace some for loops with calls to blas + + cdef cnp.ndarray[FLOAT_t, ndim = 2] B_orth = self.B_orth + cdef cnp.ndarray[FLOAT_t, ndim = 1] c = self.c + cdef cnp.ndarray[FLOAT_t, ndim = 1] y = self.y + cdef cnp.ndarray[FLOAT_t, ndim = 1] norms = self.norms + cdef INDEX_t i cdef INDEX_t j cdef FLOAT_t nrm cdef FLOAT_t nrm0 cdef FLOAT_t dot_prod - - #Get the original norm + + # Get the original norm nrm0 = 0.0 for i in range(self.m): - nrm0 += B_orth[i,k]*B_orth[i,k] + nrm0 += B_orth[i, k] * B_orth[i, k] nrm0 = sqrt(nrm0) - - #Orthogonalize + + # Orthogonalize if k > 0: for i in range(k): dot_prod = 0.0 for j in range(self.m): - dot_prod += B_orth[j,k]*B_orth[j,i] + dot_prod += B_orth[j, k] * B_orth[j, i] for j in range(self.m): - B_orth[j,k] -= B_orth[j,i] * dot_prod - - #Normalize + B_orth[j, k] -= B_orth[j, i] * dot_prod + + # Normalize nrm = 0.0 for i in range(self.m): - nrm += B_orth[i,k]*B_orth[i,k] + nrm += B_orth[i, k] * B_orth[i, k] nrm = sqrt(nrm) norms[k] = nrm - - if nrm0 <= self.zero_tol or nrm/nrm0 <= self.zero_tol: + + if nrm0 <= self.zero_tol or nrm / nrm0 <= self.zero_tol: for i in range(self.m): - B_orth[i,k] = 0.0 + B_orth[i, k] = 0.0 c[k] = 0.0 - return 1 #The new column is in the column space of the previous columns + # The new column is in the column space of the previous columns + return 1 for i in range(self.m): - B_orth[i,k] /= nrm - - #Update c + B_orth[i, k] /= nrm + + # Update c c[k] = 0.0 for i in range(self.m): - c[k] += B_orth[i,k]*y[i] - self.c_squared += c[k]**2 - - return 0 #No problems - + c[k] += B_orth[i, k] * y[i] + self.c_squared += c[k] ** 2 + + return 0 # No problems + cpdef orthonormal_downdate(ForwardPasser self, INDEX_t k): ''' Undo the effects of the last orthonormal update. You can only undo the last orthonormal update this way. @@ -198,18 +211,18 @@ cdef class ForwardPasser: In reality, all this does is downdate c_squared (the elements of c and B_orth are left alone, since they can simply be ignored until they are overwritten). ''' - self.c_squared -= self.c[k]**2 - + self.c_squared -= self.c[k] ** 2 + def trace(self): return self.record - + cdef next_pair(ForwardPasser self): cdef INDEX_t variable cdef INDEX_t parent_idx cdef INDEX_t parent_degree cdef INDEX_t nonzero_count cdef BasisFunction parent - cdef cnp.ndarray[INT_t,ndim=1] candidates_idx + cdef cnp.ndarray[INT_t, ndim = 1] candidates_idx cdef FLOAT_t knot cdef FLOAT_t mse cdef INDEX_t knot_idx @@ -226,32 +239,33 @@ cdef class ForwardPasser: cdef INDEX_t endspan cdef bint linear_dependence cdef bint dependent - cdef FLOAT_t gcv_factor_k_plus_1 = gcv_adjust(k+1,self.m,self.penalty) - cdef FLOAT_t gcv_factor_k_plus_2 = gcv_adjust(k+2,self.m,self.penalty) + cdef FLOAT_t gcv_factor_k_plus_1 = gcv_adjust(k + 1, self.m, self.penalty) + cdef FLOAT_t gcv_factor_k_plus_2 = gcv_adjust(k + 2, self.m, self.penalty) cdef FLOAT_t gcv_ cdef FLOAT_t mse_ cdef INDEX_t i - - cdef cnp.ndarray[FLOAT_t,ndim=2] X = self.X - cdef cnp.ndarray[FLOAT_t,ndim=2] B = self.B - cdef cnp.ndarray[FLOAT_t,ndim=2] B_orth = self.B_orth - cdef cnp.ndarray[FLOAT_t,ndim=1] y = self.y - cdef cnp.ndarray[INT_t,ndim=1] linear_variables = self.linear_variables - cdef cnp.ndarray[INT_t,ndim=1] sorting = self.sorting - + + cdef cnp.ndarray[FLOAT_t, ndim = 2] X = self.X + cdef cnp.ndarray[FLOAT_t, ndim = 2] B = self.B + cdef cnp.ndarray[FLOAT_t, ndim = 2] B_orth = self.B_orth + cdef cnp.ndarray[FLOAT_t, ndim = 1] y = self.y + cdef cnp.ndarray[INT_t, ndim = 1] linear_variables = self.linear_variables + cdef cnp.ndarray[INT_t, ndim = 1] sorting = self.sorting + if self.endspan < 0: - endspan = round(3 - log2(self.endspan_alpha/self.n)) - - #Iterate over variables + endspan = round(3 - log2(self.endspan_alpha / self.n)) + + # Iterate over variables for variable in range(self.n): - - #Sort the data - sorting[:] = np.argsort(X[:,variable])[::-1] #TODO: eliminate Python call / data copy - - #Iterate over parents + + # Sort the data + # TODO: eliminate Python call / data copy + sorting[:] = np.argsort(X[:, variable])[::-1] + + # Iterate over parents for parent_idx in range(k): linear_dependence = False - + parent = self.basis.get(parent_idx) if self.max_degree >= 0: parent_degree = parent.degree() @@ -259,52 +273,59 @@ cdef class ForwardPasser: continue if not parent.is_splittable(): continue - - #Add the linear term to B + + # Add the linear term to B for i in range(self.m): - B[i,k] = B[i,parent_idx]*X[i,variable] - - #Orthonormalize + B[i, k] = B[i, parent_idx] * X[i, variable] + + # Orthonormalize for i in range(self.m): - B_orth[i,k] = B[i,k] + B_orth[i, k] = B[i, k] linear_dependence = self.orthonormal_update(k) - - #If a new hinge function does not improve the gcv over the linear term - #then just the linear term will be retained. Calculate the gcv with - #just the linear term in order to compare later. Note that the mse with - #another term never increases, but the gcv may because it penalizes additional - #terms. + + # If a new hinge function does not improve the gcv over the linear term + # then just the linear term will be retained. Calculate the gcv with + # just the linear term in order to compare later. Note that the mse with + # another term never increases, but the gcv may because it penalizes additional + # terms. mse_ = (self.y_squared - self.c_squared) / self.m - gcv_ = gcv_factor_k_plus_1*(self.y_squared - self.c_squared) / self.m - + gcv_ = gcv_factor_k_plus_1 * \ + (self.y_squared - self.c_squared) / self.m + if linear_variables[variable]: mse = mse_ knot_idx = -1 else: - - #Find the valid knot candidates - candidates_idx = parent.valid_knots(B[sorting,parent_idx], X[sorting,variable], variable, self.check_every, endspan, self.minspan, self.minspan_alpha, self.n, self.mwork) + + # Find the valid knot candidates + candidates_idx = parent.valid_knots(B[sorting, parent_idx], X[ + sorting, variable], variable, self.check_every, endspan, self.minspan, self.minspan_alpha, self.n, self.mwork) if len(candidates_idx) > 0: - #Choose the best candidate (if no candidate is an improvement on the linear term in terms of gcv, knot_idx is set to -1 - - #Find the best knot location for this parent and variable combination - self.best_knot(parent_idx,variable,k,candidates_idx,sorting,&mse,&knot,&knot_idx) - - #If the hinge function does not decrease the gcv then just keep the linear term - if gcv_factor_k_plus_2*mse >= gcv_: + # Choose the best candidate (if no candidate is an + # improvement on the linear term in terms of gcv, knot_idx + # is set to -1 + + # Find the best knot location for this parent and + # variable combination + self.best_knot(parent_idx, variable, k, candidates_idx, sorting, & mse, & knot, & knot_idx) + + # If the hinge function does not decrease the gcv then + # just keep the linear term + if gcv_factor_k_plus_2 * mse >= gcv_: mse = mse_ knot_idx = -1 - + else: - #Do an orthonormal downdate and skip to the next iteration + # Do an orthonormal downdate and skip to the next + # iteration self.orthonormal_downdate(k) continue - - #Do an orthonormal downdate + + # Do an orthonormal downdate self.orthonormal_downdate(k) - - #Update the choices + + # Update the choices if first: knot_choice = knot mse_choice = mse @@ -322,72 +343,76 @@ cdef class ForwardPasser: parent_choice = parent variable_choice = variable dependent = linear_dependence - - #Make sure at least one candidate was checked + + # Make sure at least one candidate was checked if first: self.record[len(self.record) - 1].set_no_candidates(True) return - - #Add the new basis functions + + # Add the new basis functions parent = self.basis.get(parent_idx) label = self.xlabels[variable_choice] if knot_idx_choice != -1: - #Add the new basis functions - bf1 = HingeBasisFunction(parent_choice,knot_choice,knot_idx_choice,variable_choice,False,label) - bf2 = HingeBasisFunction(parent_choice,knot_choice,knot_idx_choice,variable_choice,True,label) - bf1.apply(X,B[:,k]) - bf2.apply(X,B[:,k+1]) + # Add the new basis functions + bf1 = HingeBasisFunction( + parent_choice, knot_choice, knot_idx_choice, variable_choice, False, label) + bf2 = HingeBasisFunction( + parent_choice, knot_choice, knot_idx_choice, variable_choice, True, label) + bf1.apply(X, B[:, k]) + bf2.apply(X, B[:, k + 1]) self.basis.append(bf1) self.basis.append(bf2) - - #Orthogonalize the new basis - B_orth[:,k] = B[:,k] + + # Orthogonalize the new basis + B_orth[:, k] = B[:, k] if self.orthonormal_update(k) == 1: bf1.make_unsplittable() - B_orth[:,k+1] = B[:,k+1] - if self.orthonormal_update(k+1) == 1: + B_orth[:, k + 1] = B[:, k + 1] + if self.orthonormal_update(k + 1) == 1: bf2.make_unsplittable() elif not dependent and knot_idx_choice == -1: - #In this case, only add the linear basis function - bf1 = LinearBasisFunction(parent_choice,variable_choice,label) - bf1.apply(X,B[:,k]) + # In this case, only add the linear basis function + bf1 = LinearBasisFunction(parent_choice, variable_choice, label) + bf1.apply(X, B[:, k]) self.basis.append(bf1) - - #Orthogonalize the new basis - B_orth[:,k] = B[:,k] + + # Orthogonalize the new basis + B_orth[:, k] = B[:, k] if self.orthonormal_update(k) == 1: bf1.make_unsplittable() - else:#dependent and knot_idx_choice == -1 - #In this case there were no acceptable choices remaining, so end the forward pass + else: # dependent and knot_idx_choice == -1 + # In this case there were no acceptable choices remaining, so end + # the forward pass self.record[len(self.record) - 1].set_no_candidates(True) return - - #Update the build record - self.record.append(ForwardPassIteration(parent_idx_choice,variable_choice,knot_idx_choice,mse_choice,len(self.basis))) - - cdef best_knot(ForwardPasser self, INDEX_t parent, INDEX_t variable, INDEX_t k, cnp.ndarray[INT_t,ndim=1] candidates, cnp.ndarray[INT_t,ndim=1] order, FLOAT_t * mse, FLOAT_t * knot, INDEX_t * knot_idx): + + # Update the build record + self.record.append(ForwardPassIteration( + parent_idx_choice, variable_choice, knot_idx_choice, mse_choice, len(self.basis))) + + cdef best_knot(ForwardPasser self, INDEX_t parent, INDEX_t variable, INDEX_t k, cnp.ndarray[INT_t, ndim=1] candidates, cnp.ndarray[INT_t, ndim=1] order, FLOAT_t * mse, FLOAT_t * knot, INDEX_t * knot_idx): ''' Find the best knot location (in terms of squared error). - + Assumes: B[:,k] is the linear term for variable X[:,variable] is in decreasing order candidates is in increasing order (it is an array of indices into X[:,variable] mse is a pointer to the mean squared error of including just the linear term in B[:,k] ''' - - cdef cnp.ndarray[FLOAT_t, ndim=1] b = self.B[:,k+1] - cdef cnp.ndarray[FLOAT_t, ndim=1] b_parent = self.B[:,parent] - cdef cnp.ndarray[FLOAT_t, ndim=1] u = self.u - cdef cnp.ndarray[FLOAT_t, ndim=2] B_orth = self.B_orth - cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X - cdef cnp.ndarray[FLOAT_t, ndim=1] y = self.y - cdef cnp.ndarray[FLOAT_t, ndim=1] c = self.c - cdef cnp.ndarray[FLOAT_t, ndim=1] B_orth_times_parent_cum = self.B_orth_times_parent_cum - cdef cnp.ndarray[FLOAT_t, ndim=2] B = self.B - + + cdef cnp.ndarray[FLOAT_t, ndim = 1] b = self.B[:, k + 1] + cdef cnp.ndarray[FLOAT_t, ndim = 1] b_parent = self.B[:, parent] + cdef cnp.ndarray[FLOAT_t, ndim = 1] u = self.u + cdef cnp.ndarray[FLOAT_t, ndim = 2] B_orth = self.B_orth + cdef cnp.ndarray[FLOAT_t, ndim = 2] X = self.X + cdef cnp.ndarray[FLOAT_t, ndim = 1] y = self.y + cdef cnp.ndarray[FLOAT_t, ndim = 1] c = self.c + cdef cnp.ndarray[FLOAT_t, ndim = 1] B_orth_times_parent_cum = self.B_orth_times_parent_cum + cdef cnp.ndarray[FLOAT_t, ndim = 2] B = self.B + cdef INDEX_t num_candidates = candidates.shape[0] - + cdef INDEX_t h cdef INDEX_t i cdef INDEX_t j @@ -418,162 +443,165 @@ cdef class ForwardPasser: cdef FLOAT_t float_tmp cdef FLOAT_t delta_b_j cdef FLOAT_t z_denom - - #Compute the initial basis function + + # Compute the initial basis function candidate_idx = candidates[0] - candidate = X[order[candidate_idx],variable] - for i in range(self.m):#TODO: Vectorize? + candidate = X[order[candidate_idx], variable] + for i in range(self.m): # TODO: Vectorize? b[i] = 0 for i_ in range(self.m): i = order[i_] - float_tmp = X[i,variable] - candidate + float_tmp = X[i, variable] - candidate if float_tmp > 0: - b[i] = b_parent[i]*float_tmp + b[i] = b_parent[i] * float_tmp else: break - - #Compute the initial covariance column, u (not including the final element) - u[0:k+1] = np.dot(b,B_orth[:,0:k+1]) - - #Compute the new last elements of c and u + + # Compute the initial covariance column, u (not including the final + # element) + u[0:k + 1] = np.dot(b, B_orth[:, 0:k + 1]) + + # Compute the new last elements of c and u c_end = 0.0 u_end = 0.0 for i in range(self.m): - u_end += b[i]*b[i] - c_end += b[i]*y[i] - - #Compute the last element of z (the others are identical to c) + u_end += b[i] * b[i] + c_end += b[i] * y[i] + + # Compute the last element of z (the others are identical to c) u_dot_c = 0.0 u_dot_u = 0.0 - for i in range(k+1): - u_dot_u += u[i]*u[i] - u_dot_c += u[i]*c[i] + for i in range(k + 1): + u_dot_u += u[i] * u[i] + u_dot_c += u[i] * c[i] z_denom = u_end - u_dot_u if z_denom <= self.zero_tol: z_end_squared = np.nan else: - z_end_squared = ((c_end - u_dot_c)**2) / z_denom - - #Minimizing the norm is actually equivalent to maximizing z_end_squared - #Store z_end_squared and the current candidate as the best knot choice + z_end_squared = ((c_end - u_dot_c) ** 2) / z_denom + + # Minimizing the norm is actually equivalent to maximizing z_end_squared + # Store z_end_squared and the current candidate as the best knot choice best_z_end_squared = z_end_squared best_candidate_idx = candidate_idx best_candidate = candidate - - #Initialize the accumulators + + # Initialize the accumulators i = order[0] last_candidate_idx = 0 y_cum = y[i] - B_orth_times_parent_cum[0:k+1] = B_orth[i,0:k+1] * b_parent[i] + B_orth_times_parent_cum[0:k + 1] = B_orth[i, 0:k + 1] * b_parent[i] b_times_parent_cum = b[i] * b_parent[i] parent_squared_cum = b_parent[i] ** 2 parent_times_y_cum = b_parent[i] * y[i] - - #Now loop over the remaining candidates and update z_end_squared for each, looking for the greatest value - for i_ in range(1,num_candidates): + + # Now loop over the remaining candidates and update z_end_squared for + # each, looking for the greatest value + for i_ in range(1, num_candidates): i = order[i_] - #Update the candidate + # Update the candidate last_last_candidate_idx = last_candidate_idx last_candidate_idx = candidate_idx last_candidate = candidate candidate_idx = candidates[i_] - candidate = X[order[candidate_idx],variable] - - #Update the accumulators and compute delta_b + candidate = X[order[candidate_idx], variable] + + # Update the accumulators and compute delta_b diff = last_candidate - candidate delta_c_end = 0.0 - - #What follows is a section of code that has been optimized for speed at the expense of - #some readability. To make it easier to understand this code in the future, I have included a - #"simple" block that implements the same math in a more straightforward (but much less efficient) - #way. The (commented out) code between "BEGIN SIMPLE" and "END SIMPLE" should produce the same - #output as the code between "BEGIN HYPER-OPTIMIZED" and "END HYPER-OPTIMIZED". - - #BEGIN SIMPLE -# #Calculate delta_b + + # What follows is a section of code that has been optimized for speed at the expense of + # some readability. To make it easier to understand this code in the future, I have included a + #"simple" block that implements the same math in a more straightforward (but much less efficient) + # way. The (commented out) code between "BEGIN SIMPLE" and "END SIMPLE" should produce the same + # output as the code between "BEGIN HYPER-OPTIMIZED" and "END + # HYPER-OPTIMIZED". + + # BEGIN SIMPLE +# Calculate delta_b # for j in range(0,last_candidate_idx+1): # delta_b[j] = diff # for j in range(last_candidate_idx+1,candidate_idx): # float_tmp = (X[j,variable] - candidate) * b_parent[j] # delta_b[j] = float_tmp -# -# #Update u and z_end_squared +# +# Update u and z_end_squared # u[0:k+1] += np.dot(delta_b,B_orth[:,0:k+1]) # u_end += 2*np.dot(delta_b,b) + np.dot(delta_b, delta_b) -# -# #Update c_end +# +# Update c_end # c_end += np.dot(delta_b,y) -# -# #Update z_end_squared +# +# Update z_end_squared # z_end_squared = ((c_end - np.dot(u[0:k+1],c[0:k+1]))**2) / (u_end) -# -# #Update b +# +# Update b # b += delta_b - #END SIMPLE - - #BEGIN HYPER-OPTIMIZED + # END SIMPLE + + # BEGIN HYPER-OPTIMIZED delta_b_squared = 0.0 delta_c_end = 0.0 delta_u_end = 0.0 - - #Update the accumulators - for j_ in range(last_last_candidate_idx+1,last_candidate_idx+1): + + # Update the accumulators + for j_ in range(last_last_candidate_idx + 1, last_candidate_idx + 1): j = order[j_] y_cum += y[j] - for h in range(k+1):#TODO: BLAS - B_orth_times_parent_cum[h] += B_orth[j,h]*b_parent[j] - b_times_parent_cum += b[j]*b_parent[j] + for h in range(k + 1): # TODO: BLAS + B_orth_times_parent_cum[h] += B_orth[j, h] * b_parent[j] + b_times_parent_cum += b[j] * b_parent[j] parent_squared_cum += b_parent[j] ** 2 parent_times_y_cum += b_parent[j] * y[j] delta_c_end += diff * parent_times_y_cum - delta_u_end += 2*diff * b_times_parent_cum - delta_b_squared = (diff**2)*parent_squared_cum - - #Update u and a bunch of other stuff - for j in range(k+1): - float_tmp = diff*B_orth_times_parent_cum[j] + delta_u_end += 2 * diff * b_times_parent_cum + delta_b_squared = (diff ** 2) * parent_squared_cum + + # Update u and a bunch of other stuff + for j in range(k + 1): + float_tmp = diff * B_orth_times_parent_cum[j] u_dot_c += float_tmp * c[j] - u_dot_u += 2*u[j]*float_tmp + float_tmp*float_tmp + u_dot_u += 2 * u[j] * float_tmp + float_tmp * float_tmp u[j] += float_tmp - for j_ in range(last_candidate_idx+1,candidate_idx): + for j_ in range(last_candidate_idx + 1, candidate_idx): j = order[j_] - delta_b_j = (X[j,variable] - candidate) * b_parent[j] - delta_b_squared += delta_b_j**2 + delta_b_j = (X[j, variable] - candidate) * b_parent[j] + delta_b_squared += delta_b_j ** 2 delta_c_end += delta_b_j * y[j] - delta_u_end += 2*delta_b_j*b[j] - for h in range(k+1): - float_tmp = delta_b_j * B_orth[j,h] + delta_u_end += 2 * delta_b_j * b[j] + for h in range(k + 1): + float_tmp = delta_b_j * B_orth[j, h] u_dot_c += float_tmp * c[h] - u_dot_u += 2*u[h]*float_tmp + float_tmp*float_tmp + u_dot_u += 2 * u[h] * float_tmp + float_tmp * float_tmp u[h] += float_tmp b[j] += delta_b_j - - #Update u_end + + # Update u_end delta_u_end += delta_b_squared u_end += delta_u_end - - #Update c_end + + # Update c_end c_end += delta_c_end - - #Update b_times_parent_cum + + # Update b_times_parent_cum b_times_parent_cum += parent_squared_cum * diff - - #Compute the new z_end_squared (this is the quantity we're optimizing) + + # Compute the new z_end_squared (this is the quantity we're + # optimizing) if (u_end - u_dot_u) <= self.zero_tol: continue - z_end_squared = ((c_end - u_dot_c)**2) / (u_end - u_dot_u) - #END HYPER-OPTIMIZED + z_end_squared = ((c_end - u_dot_c) ** 2) / (u_end - u_dot_u) + # END HYPER-OPTIMIZED - #Update the best if necessary + # Update the best if necessary if z_end_squared > best_z_end_squared: best_z_end_squared = z_end_squared best_candidate_idx = candidate_idx best_candidate = candidate - #Compute the mse for the best z_end and set return values - mse[0] = (self.y_squared - self.c_squared - best_z_end_squared)/self.m + # Compute the mse for the best z_end and set return values + mse[0] = ( + self.y_squared - self.c_squared - best_z_end_squared) / self.m knot[0] = best_candidate knot_idx[0] = best_candidate_idx - - \ No newline at end of file diff --git a/sklearn/earth/_pruning.c b/sklearn/earth/_pruning.c index 8fd45d57e9d30..147e41d0b2266 100644 --- a/sklearn/earth/_pruning.c +++ b/sklearn/earth/_pruning.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19.1 on Sat Jul 27 21:13:14 2013 */ +/* Generated by Cython 0.19.1 on Sat Jul 27 22:55:34 2013 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS @@ -956,9 +956,9 @@ struct __pyx_opt_args_7sklearn_5earth_6_basis_19LinearBasisFunction_apply; /* "_basis.pxd":45 * cpdef INDEX_t degree(BasisFunction self) * - * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) # <<<<<<<<<<<<<< + * cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse= ?) # <<<<<<<<<<<<<< * - * cpdef cnp.ndarray[INT_t, ndim=1] valid_knots(BasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] values, cnp.ndarray[FLOAT_t,ndim=1] variable, int variable_idx, INDEX_t check_every, int endspan, int minspan, FLOAT_t minspan_alpha, INDEX_t n, cnp.ndarray[INT_t,ndim=1] workspace) + * cpdef cnp.ndarray[INT_t, ndim = 1] valid_knots(BasisFunction self, cnp.ndarray[FLOAT_t, ndim=1] values, cnp.ndarray[FLOAT_t, ndim=1] variable, int variable_idx, INDEX_t check_every, int endspan, int minspan, FLOAT_t minspan_alpha, INDEX_t n, cnp.ndarray[INT_t, ndim=1] workspace) */ struct __pyx_opt_args_7sklearn_5earth_6_basis_13BasisFunction_apply { int __pyx_n; @@ -968,7 +968,7 @@ struct __pyx_opt_args_7sklearn_5earth_6_basis_13BasisFunction_apply { /* "_basis.pxd":62 * cpdef BasisFunction get_parent(self) * - * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) # <<<<<<<<<<<<<< + * cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse= ?) # <<<<<<<<<<<<<< * * */ @@ -980,7 +980,7 @@ struct __pyx_opt_args_7sklearn_5earth_6_basis_21ConstantBasisFunction_apply { /* "_basis.pxd":86 * cpdef INDEX_t get_knot_idx(self) * - * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) # <<<<<<<<<<<<<< + * cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse= ?) # <<<<<<<<<<<<<< * * cdef class LinearBasisFunction(BasisFunction): */ @@ -992,7 +992,7 @@ struct __pyx_opt_args_7sklearn_5earth_6_basis_18HingeBasisFunction_apply { /* "_basis.pxd":98 * cpdef INDEX_t get_variable(self) * - * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) # <<<<<<<<<<<<<< + * cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse= ?) # <<<<<<<<<<<<<< * * */ @@ -1001,7 +1001,7 @@ struct __pyx_opt_args_7sklearn_5earth_6_basis_19LinearBasisFunction_apply { int recurse; }; -/* "_basis.pxd":102 +/* "_basis.pxd":101 * * * cdef class Basis: # <<<<<<<<<<<<<< @@ -1148,7 +1148,7 @@ struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord { /* "_basis.pxd":88 - * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) + * cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse= ?) * * cdef class LinearBasisFunction(BasisFunction): # <<<<<<<<<<<<<< * cdef INDEX_t variable @@ -1275,7 +1275,7 @@ static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *__pyx_vtab /* "_basis.pxd":88 - * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) + * cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse= ?) * * cdef class LinearBasisFunction(BasisFunction): # <<<<<<<<<<<<<< * cdef INDEX_t variable @@ -1408,7 +1408,7 @@ struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassIteration { static struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassIteration *__pyx_vtabptr_7sklearn_5earth_7_record_ForwardPassIteration; -/* "_basis.pxd":102 +/* "_basis.pxd":101 * * * cdef class Basis: # <<<<<<<<<<<<<< @@ -2180,7 +2180,7 @@ static int __pyx_pf_7sklearn_5earth_8_pruning_13PruningPasser___init__(struct __ * self.y = y * self.weights = weights # <<<<<<<<<<<<<< * self.basis = basis - * self.B = np.empty(shape=(self.m,len(self.basis)+1),dtype=np.float) + * self.B = np.empty(shape=(self.m, len(self.basis) + 1), dtype=np.float) */ __Pyx_INCREF(((PyObject *)__pyx_v_weights)); __Pyx_GIVEREF(((PyObject *)__pyx_v_weights)); @@ -2192,7 +2192,7 @@ static int __pyx_pf_7sklearn_5earth_8_pruning_13PruningPasser___init__(struct __ * self.y = y * self.weights = weights * self.basis = basis # <<<<<<<<<<<<<< - * self.B = np.empty(shape=(self.m,len(self.basis)+1),dtype=np.float) + * self.B = np.empty(shape=(self.m, len(self.basis) + 1), dtype=np.float) * self.penalty = kwargs['penalty'] if 'penalty' in kwargs else 3.0 */ __Pyx_INCREF(((PyObject *)__pyx_v_basis)); @@ -2204,9 +2204,9 @@ static int __pyx_pf_7sklearn_5earth_8_pruning_13PruningPasser___init__(struct __ /* "sklearn/earth/_pruning.pyx":20 * self.weights = weights * self.basis = basis - * self.B = np.empty(shape=(self.m,len(self.basis)+1),dtype=np.float) # <<<<<<<<<<<<<< + * self.B = np.empty(shape=(self.m, len(self.basis) + 1), dtype=np.float) # <<<<<<<<<<<<<< * self.penalty = kwargs['penalty'] if 'penalty' in kwargs else 3.0 - * self.sst = np.sum(self.weights*(self.y - np.average(self.y,weights=self.weights))**2) / self.m + * self.sst = np.sum( */ __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); @@ -2253,10 +2253,10 @@ static int __pyx_pf_7sklearn_5earth_8_pruning_13PruningPasser___init__(struct __ /* "sklearn/earth/_pruning.pyx":21 * self.basis = basis - * self.B = np.empty(shape=(self.m,len(self.basis)+1),dtype=np.float) + * self.B = np.empty(shape=(self.m, len(self.basis) + 1), dtype=np.float) * self.penalty = kwargs['penalty'] if 'penalty' in kwargs else 3.0 # <<<<<<<<<<<<<< - * self.sst = np.sum(self.weights*(self.y - np.average(self.y,weights=self.weights))**2) / self.m - * + * self.sst = np.sum( + * self.weights * (self.y - np.average(self.y, weights=self.weights)) ** 2) / self.m */ __pyx_t_7 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__penalty), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if ((__pyx_t_7 != 0)) { @@ -2275,42 +2275,50 @@ static int __pyx_pf_7sklearn_5earth_8_pruning_13PruningPasser___init__(struct __ __pyx_v_self->penalty = __pyx_t_8; /* "sklearn/earth/_pruning.pyx":22 - * self.B = np.empty(shape=(self.m,len(self.basis)+1),dtype=np.float) + * self.B = np.empty(shape=(self.m, len(self.basis) + 1), dtype=np.float) * self.penalty = kwargs['penalty'] if 'penalty' in kwargs else 3.0 - * self.sst = np.sum(self.weights*(self.y - np.average(self.y,weights=self.weights))**2) / self.m # <<<<<<<<<<<<<< + * self.sst = np.sum( # <<<<<<<<<<<<<< + * self.weights * (self.y - np.average(self.y, weights=self.weights)) ** 2) / self.m * - * cpdef run(PruningPasser self): */ __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__sum); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/earth/_pruning.pyx":23 + * self.penalty = kwargs['penalty'] if 'penalty' in kwargs else 3.0 + * self.sst = np.sum( + * self.weights * (self.y - np.average(self.y, weights=self.weights)) ** 2) / self.m # <<<<<<<<<<<<<< + * + * cpdef run(PruningPasser self): + */ + __pyx_t_4 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__average); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_4, __pyx_n_s__average); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(((PyObject *)__pyx_v_self->y)); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_v_self->y)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self->y)); - __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__weights), ((PyObject *)__pyx_v_self->weights)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__weights), ((PyObject *)__pyx_v_self->weights)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_4), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_Subtract(((PyObject *)__pyx_v_self->y), __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyNumber_Subtract(((PyObject *)__pyx_v_self->y), __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Power(__pyx_t_6, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Power(__pyx_t_6, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_Multiply(((PyObject *)__pyx_v_self->weights), __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyNumber_Multiply(((PyObject *)__pyx_v_self->weights), __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -2322,14 +2330,22 @@ static int __pyx_pf_7sklearn_5earth_8_pruning_13PruningPasser___init__(struct __ __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_6, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_8 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_8 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "sklearn/earth/_pruning.pyx":22 + * self.B = np.empty(shape=(self.m, len(self.basis) + 1), dtype=np.float) + * self.penalty = kwargs['penalty'] if 'penalty' in kwargs else 3.0 + * self.sst = np.sum( # <<<<<<<<<<<<<< + * self.weights * (self.y - np.average(self.y, weights=self.weights)) ** 2) / self.m + * + */ __pyx_v_self->sst = __pyx_t_8; __pyx_r = 0; @@ -2358,12 +2374,12 @@ static int __pyx_pf_7sklearn_5earth_8_pruning_13PruningPasser___init__(struct __ return __pyx_r; } -/* "sklearn/earth/_pruning.pyx":24 - * self.sst = np.sum(self.weights*(self.y - np.average(self.y,weights=self.weights))**2) / self.m +/* "sklearn/earth/_pruning.pyx":25 + * self.weights * (self.y - np.average(self.y, weights=self.weights)) ** 2) / self.m * * cpdef run(PruningPasser self): # <<<<<<<<<<<<<< - * #This is a totally naive implementation and could potentially be made faster - * #through the use of updating algorithms. It is not clear that such + * # This is a totally naive implementation and could potentially be made faster + * # through the use of updating algorithms. It is not clear that such */ static PyObject *__pyx_pw_7sklearn_5earth_8_pruning_13PruningPasser_3run(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ @@ -2448,11 +2464,11 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__run); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__run); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_8_pruning_13PruningPasser_3run)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -2462,7 +2478,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_pruning.pyx":31 + /* "sklearn/earth/_pruning.pyx":32 * cdef INDEX_t i * cdef INDEX_t j * cdef INDEX_t basis_size = len(self.basis) # <<<<<<<<<<<<<< @@ -2471,11 +2487,11 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ */ __pyx_t_1 = ((PyObject *)__pyx_v_self->basis); __Pyx_INCREF(__pyx_t_1); - __pyx_t_3 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_basis_size = __pyx_t_3; - /* "sklearn/earth/_pruning.pyx":32 + /* "sklearn/earth/_pruning.pyx":33 * cdef INDEX_t j * cdef INDEX_t basis_size = len(self.basis) * cdef INDEX_t pruned_basis_size = self.basis.plen() # <<<<<<<<<<<<<< @@ -2484,19 +2500,19 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ */ __pyx_v_pruned_basis_size = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->plen(__pyx_v_self->basis, 0); - /* "sklearn/earth/_pruning.pyx":40 + /* "sklearn/earth/_pruning.pyx":41 * cdef FLOAT_t best_iteration_mse * - * cdef cnp.ndarray[FLOAT_t, ndim=2] B = self.B # <<<<<<<<<<<<<< - * cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X - * cdef cnp.ndarray[FLOAT_t, ndim=1] y = self.y + * cdef cnp.ndarray[FLOAT_t, ndim = 2] B = self.B # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t, ndim = 2] X = self.X + * cdef cnp.ndarray[FLOAT_t, ndim = 1] y = self.y */ __pyx_t_4 = ((PyArrayObject *)__pyx_v_self->B); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_pruning_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { __pyx_v_B = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_B.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_B.diminfo[0].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B.diminfo[0].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B.diminfo[1].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B.diminfo[1].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[1]; } } @@ -2504,19 +2520,19 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->B))); __pyx_v_B = ((PyArrayObject *)__pyx_v_self->B); - /* "sklearn/earth/_pruning.pyx":41 + /* "sklearn/earth/_pruning.pyx":42 * - * cdef cnp.ndarray[FLOAT_t, ndim=2] B = self.B - * cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X # <<<<<<<<<<<<<< - * cdef cnp.ndarray[FLOAT_t, ndim=1] y = self.y - * cdef cnp.ndarray[FLOAT_t, ndim=1] weights = self.weights + * cdef cnp.ndarray[FLOAT_t, ndim = 2] B = self.B + * cdef cnp.ndarray[FLOAT_t, ndim = 2] X = self.X # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t, ndim = 1] y = self.y + * cdef cnp.ndarray[FLOAT_t, ndim = 1] weights = self.weights */ __pyx_t_5 = ((PyArrayObject *)__pyx_v_self->X); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_pruning_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { __pyx_v_X = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; } } @@ -2524,19 +2540,19 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->X))); __pyx_v_X = ((PyArrayObject *)__pyx_v_self->X); - /* "sklearn/earth/_pruning.pyx":42 - * cdef cnp.ndarray[FLOAT_t, ndim=2] B = self.B - * cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X - * cdef cnp.ndarray[FLOAT_t, ndim=1] y = self.y # <<<<<<<<<<<<<< - * cdef cnp.ndarray[FLOAT_t, ndim=1] weights = self.weights - * cdef cnp.ndarray[FLOAT_t, ndim=1] weighted_y = y.copy() + /* "sklearn/earth/_pruning.pyx":43 + * cdef cnp.ndarray[FLOAT_t, ndim = 2] B = self.B + * cdef cnp.ndarray[FLOAT_t, ndim = 2] X = self.X + * cdef cnp.ndarray[FLOAT_t, ndim = 1] y = self.y # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t, ndim = 1] weights = self.weights + * cdef cnp.ndarray[FLOAT_t, ndim = 1] weighted_y = y.copy() */ __pyx_t_6 = ((PyArrayObject *)__pyx_v_self->y); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_pruning_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_y = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_y.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_y.diminfo[0].strides = __pyx_pybuffernd_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y.diminfo[0].shape = __pyx_pybuffernd_y.rcbuffer->pybuffer.shape[0]; } } @@ -2544,11 +2560,11 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->y))); __pyx_v_y = ((PyArrayObject *)__pyx_v_self->y); - /* "sklearn/earth/_pruning.pyx":43 - * cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X - * cdef cnp.ndarray[FLOAT_t, ndim=1] y = self.y - * cdef cnp.ndarray[FLOAT_t, ndim=1] weights = self.weights # <<<<<<<<<<<<<< - * cdef cnp.ndarray[FLOAT_t, ndim=1] weighted_y = y.copy() + /* "sklearn/earth/_pruning.pyx":44 + * cdef cnp.ndarray[FLOAT_t, ndim = 2] X = self.X + * cdef cnp.ndarray[FLOAT_t, ndim = 1] y = self.y + * cdef cnp.ndarray[FLOAT_t, ndim = 1] weights = self.weights # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t, ndim = 1] weighted_y = y.copy() * */ __pyx_t_7 = ((PyArrayObject *)__pyx_v_self->weights); @@ -2556,7 +2572,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_pruning_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_weights = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_weights.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_weights.diminfo[0].strides = __pyx_pybuffernd_weights.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weights.diminfo[0].shape = __pyx_pybuffernd_weights.rcbuffer->pybuffer.shape[0]; } } @@ -2564,25 +2580,25 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->weights))); __pyx_v_weights = ((PyArrayObject *)__pyx_v_self->weights); - /* "sklearn/earth/_pruning.pyx":44 - * cdef cnp.ndarray[FLOAT_t, ndim=1] y = self.y - * cdef cnp.ndarray[FLOAT_t, ndim=1] weights = self.weights - * cdef cnp.ndarray[FLOAT_t, ndim=1] weighted_y = y.copy() # <<<<<<<<<<<<<< + /* "sklearn/earth/_pruning.pyx":45 + * cdef cnp.ndarray[FLOAT_t, ndim = 1] y = self.y + * cdef cnp.ndarray[FLOAT_t, ndim = 1] weights = self.weights + * cdef cnp.ndarray[FLOAT_t, ndim = 1] weighted_y = y.copy() # <<<<<<<<<<<<<< * - * #Initial solution + * # Initial solution */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_y), __pyx_n_s__copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_y), __pyx_n_s__copy); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_8 = ((PyArrayObject *)__pyx_t_2); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weighted_y.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_pruning_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_weighted_y = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_weighted_y.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_weighted_y.diminfo[0].strides = __pyx_pybuffernd_weighted_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weighted_y.diminfo[0].shape = __pyx_pybuffernd_weighted_y.rcbuffer->pybuffer.shape[0]; } } @@ -2590,49 +2606,49 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ __pyx_v_weighted_y = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_pruning.pyx":47 + /* "sklearn/earth/_pruning.pyx":48 * - * #Initial solution - * apply_weights_1d(weighted_y,weights) # <<<<<<<<<<<<<< - * self.basis.weighted_transform(X,B,weights) - * beta, mse = np.linalg.lstsq(B[:,0:(basis_size)],weighted_y)[0:2] + * # Initial solution + * apply_weights_1d(weighted_y, weights) # <<<<<<<<<<<<<< + * self.basis.weighted_transform(X, B, weights) + * beta, mse = np.linalg.lstsq(B[:, 0:(basis_size)], weighted_y)[0:2] */ - __pyx_t_2 = __pyx_f_7sklearn_5earth_5_util_apply_weights_1d(((PyArrayObject *)__pyx_v_weighted_y), ((PyArrayObject *)__pyx_v_weights), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_f_7sklearn_5earth_5_util_apply_weights_1d(((PyArrayObject *)__pyx_v_weighted_y), ((PyArrayObject *)__pyx_v_weights), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_pruning.pyx":48 - * #Initial solution - * apply_weights_1d(weighted_y,weights) - * self.basis.weighted_transform(X,B,weights) # <<<<<<<<<<<<<< - * beta, mse = np.linalg.lstsq(B[:,0:(basis_size)],weighted_y)[0:2] + /* "sklearn/earth/_pruning.pyx":49 + * # Initial solution + * apply_weights_1d(weighted_y, weights) + * self.basis.weighted_transform(X, B, weights) # <<<<<<<<<<<<<< + * beta, mse = np.linalg.lstsq(B[:, 0:(basis_size)], weighted_y)[0:2] * if mse: */ - __pyx_t_2 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->weighted_transform(__pyx_v_self->basis, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_B), ((PyArrayObject *)__pyx_v_weights), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->weighted_transform(__pyx_v_self->basis, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_B), ((PyArrayObject *)__pyx_v_weights), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_pruning.pyx":49 - * apply_weights_1d(weighted_y,weights) - * self.basis.weighted_transform(X,B,weights) - * beta, mse = np.linalg.lstsq(B[:,0:(basis_size)],weighted_y)[0:2] # <<<<<<<<<<<<<< + /* "sklearn/earth/_pruning.pyx":50 + * apply_weights_1d(weighted_y, weights) + * self.basis.weighted_transform(X, B, weights) + * beta, mse = np.linalg.lstsq(B[:, 0:(basis_size)], weighted_y)[0:2] # <<<<<<<<<<<<<< * if mse: * mse /= self.m */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__linalg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__linalg); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__lstsq); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__lstsq); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_basis_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_basis_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = PySlice_New(__pyx_int_0, __pyx_t_1, Py_None); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PySlice_New(__pyx_int_0, __pyx_t_1, Py_None); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_k_slice_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_k_slice_1); @@ -2640,10 +2656,10 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_1)); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_1)); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); @@ -2651,11 +2667,11 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_weighted_y)); __Pyx_GIVEREF(((PyObject *)__pyx_v_weighted_y)); __pyx_t_9 = 0; - __pyx_t_9 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_9, 0, 2, NULL, NULL, &__pyx_k_slice_2, 1, 1, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetSlice(__pyx_t_9, 0, 2, NULL, NULL, &__pyx_k_slice_2, 1, 1, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; if ((likely(PyTuple_CheckExact(__pyx_t_1))) || (PyList_CheckExact(__pyx_t_1))) { @@ -2668,7 +2684,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { @@ -2681,16 +2697,16 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(__pyx_t_2); #else - __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); #endif __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } else { Py_ssize_t index = -1; - __pyx_t_10 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_11 = Py_TYPE(__pyx_t_10)->tp_iternext; @@ -2698,7 +2714,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ __Pyx_GOTREF(__pyx_t_9); index = 1; __pyx_t_2 = __pyx_t_11(__pyx_t_10); if (unlikely(!__pyx_t_2)) goto __pyx_L3_unpacking_failed; __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_10), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_11 = NULL; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; goto __pyx_L4_unpacking_done; @@ -2706,7 +2722,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_11 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L4_unpacking_done:; } __pyx_v_beta = __pyx_t_9; @@ -2714,26 +2730,26 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ __pyx_v_mse = __pyx_t_2; __pyx_t_2 = 0; - /* "sklearn/earth/_pruning.pyx":50 - * self.basis.weighted_transform(X,B,weights) - * beta, mse = np.linalg.lstsq(B[:,0:(basis_size)],weighted_y)[0:2] + /* "sklearn/earth/_pruning.pyx":51 + * self.basis.weighted_transform(X, B, weights) + * beta, mse = np.linalg.lstsq(B[:, 0:(basis_size)], weighted_y)[0:2] * if mse: # <<<<<<<<<<<<<< * mse /= self.m * else: */ - __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_mse); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_v_mse); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_12) { - /* "sklearn/earth/_pruning.pyx":51 - * beta, mse = np.linalg.lstsq(B[:,0:(basis_size)],weighted_y)[0:2] + /* "sklearn/earth/_pruning.pyx":52 + * beta, mse = np.linalg.lstsq(B[:, 0:(basis_size)], weighted_y)[0:2] * if mse: * mse /= self.m # <<<<<<<<<<<<<< * else: - * mse = (1.0/self.m)*np.sum((np.dot(B[:,0:basis_size],beta) - weighted_y)**2) + * mse = (1.0 / self.m) * np.sum( */ - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyNumber_InPlaceDivide(__pyx_v_mse, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyNumber_InPlaceDivide(__pyx_v_mse, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_v_mse); @@ -2743,31 +2759,39 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ } /*else*/ { - /* "sklearn/earth/_pruning.pyx":53 + /* "sklearn/earth/_pruning.pyx":54 * mse /= self.m * else: - * mse = (1.0/self.m)*np.sum((np.dot(B[:,0:basis_size],beta) - weighted_y)**2) # <<<<<<<<<<<<<< + * mse = (1.0 / self.m) * np.sum( # <<<<<<<<<<<<<< + * (np.dot(B[:, 0:basis_size], beta) - weighted_y) ** 2) * - * #Create the record object */ - __pyx_t_2 = PyFloat_FromDouble((1.0 / __pyx_v_self->m)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble((1.0 / __pyx_v_self->m)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__sum); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__sum); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/earth/_pruning.pyx":55 + * else: + * mse = (1.0 / self.m) * np.sum( + * (np.dot(B[:, 0:basis_size], beta) - weighted_y) ** 2) # <<<<<<<<<<<<<< + * + * # Create the record object + */ + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__dot); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__dot); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_basis_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_basis_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_13 = PySlice_New(__pyx_int_0, __pyx_t_1, Py_None); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PySlice_New(__pyx_int_0, __pyx_t_1, Py_None); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_k_slice_3); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_k_slice_3); @@ -2775,10 +2799,10 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_13); __Pyx_GIVEREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_1)); if (!__pyx_t_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_1)); if (!__pyx_t_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_13); __Pyx_GIVEREF(__pyx_t_13); @@ -2786,26 +2810,26 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_beta); __Pyx_GIVEREF(__pyx_v_beta); __pyx_t_13 = 0; - __pyx_t_13 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Subtract(__pyx_t_13, ((PyObject *)__pyx_v_weighted_y)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Subtract(__pyx_t_13, ((PyObject *)__pyx_v_weighted_y)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = PyNumber_Power(__pyx_t_1, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyNumber_Power(__pyx_t_1, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_13); __Pyx_GIVEREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_t_13); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_t_13); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; @@ -2815,24 +2839,24 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ } __pyx_L5:; - /* "sklearn/earth/_pruning.pyx":56 - * - * #Create the record object - * self.record = PruningPassRecord(self.m,self.n,self.penalty,self.sst,pruned_basis_size,mse) # <<<<<<<<<<<<<< + /* "sklearn/earth/_pruning.pyx":59 + * # Create the record object + * self.record = PruningPassRecord( + * self.m, self.n, self.penalty, self.sst, pruned_basis_size, mse) # <<<<<<<<<<<<<< * gcv_ = self.record.gcv(0) * best_gcv = gcv_ */ - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_13 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->n); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->n); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->penalty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->penalty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_9 = PyFloat_FromDouble(__pyx_v_self->sst); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyFloat_FromDouble(__pyx_v_self->sst); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_10 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_pruned_basis_size); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_pruned_basis_size); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_14 = PyTuple_New(6); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyTuple_New(6); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); PyTuple_SET_ITEM(__pyx_t_14, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); @@ -2852,26 +2876,34 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ __pyx_t_2 = 0; __pyx_t_9 = 0; __pyx_t_10 = 0; - __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_PruningPassRecord)), ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_PruningPassRecord)), ((PyObject *)__pyx_t_14), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(((PyObject *)__pyx_t_14)); __pyx_t_14 = 0; + + /* "sklearn/earth/_pruning.pyx":58 + * + * # Create the record object + * self.record = PruningPassRecord( # <<<<<<<<<<<<<< + * self.m, self.n, self.penalty, self.sst, pruned_basis_size, mse) + * gcv_ = self.record.gcv(0) + */ __Pyx_GIVEREF(__pyx_t_10); __Pyx_GOTREF(__pyx_v_self->record); __Pyx_DECREF(((PyObject *)__pyx_v_self->record)); __pyx_v_self->record = ((struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_t_10); __pyx_t_10 = 0; - /* "sklearn/earth/_pruning.pyx":57 - * #Create the record object - * self.record = PruningPassRecord(self.m,self.n,self.penalty,self.sst,pruned_basis_size,mse) + /* "sklearn/earth/_pruning.pyx":60 + * self.record = PruningPassRecord( + * self.m, self.n, self.penalty, self.sst, pruned_basis_size, mse) * gcv_ = self.record.gcv(0) # <<<<<<<<<<<<<< * best_gcv = gcv_ * best_iteration = 0 */ __pyx_v_gcv_ = ((struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->__pyx_base.gcv(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self->record), 0, 0); - /* "sklearn/earth/_pruning.pyx":58 - * self.record = PruningPassRecord(self.m,self.n,self.penalty,self.sst,pruned_basis_size,mse) + /* "sklearn/earth/_pruning.pyx":61 + * self.m, self.n, self.penalty, self.sst, pruned_basis_size, mse) * gcv_ = self.record.gcv(0) * best_gcv = gcv_ # <<<<<<<<<<<<<< * best_iteration = 0 @@ -2879,19 +2911,19 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ */ __pyx_v_best_gcv = __pyx_v_gcv_; - /* "sklearn/earth/_pruning.pyx":59 + /* "sklearn/earth/_pruning.pyx":62 * gcv_ = self.record.gcv(0) * best_gcv = gcv_ * best_iteration = 0 # <<<<<<<<<<<<<< * - * #Prune basis functions sequentially + * # Prune basis functions sequentially */ __pyx_v_best_iteration = 0; - /* "sklearn/earth/_pruning.pyx":62 + /* "sklearn/earth/_pruning.pyx":65 * - * #Prune basis functions sequentially - * for i in range(1,pruned_basis_size): # <<<<<<<<<<<<<< + * # Prune basis functions sequentially + * for i in range(1, pruned_basis_size): # <<<<<<<<<<<<<< * first = True * pruned_basis_size -= 1 */ @@ -2899,27 +2931,27 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ for (__pyx_t_16 = 1; __pyx_t_16 < __pyx_t_15; __pyx_t_16+=1) { __pyx_v_i = __pyx_t_16; - /* "sklearn/earth/_pruning.pyx":63 - * #Prune basis functions sequentially - * for i in range(1,pruned_basis_size): + /* "sklearn/earth/_pruning.pyx":66 + * # Prune basis functions sequentially + * for i in range(1, pruned_basis_size): * first = True # <<<<<<<<<<<<<< * pruned_basis_size -= 1 * */ __pyx_v_first = 1; - /* "sklearn/earth/_pruning.pyx":64 - * for i in range(1,pruned_basis_size): + /* "sklearn/earth/_pruning.pyx":67 + * for i in range(1, pruned_basis_size): * first = True * pruned_basis_size -= 1 # <<<<<<<<<<<<<< * - * #Find the best basis function to prune + * # Find the best basis function to prune */ __pyx_v_pruned_basis_size = (__pyx_v_pruned_basis_size - 1); - /* "sklearn/earth/_pruning.pyx":67 + /* "sklearn/earth/_pruning.pyx":70 * - * #Find the best basis function to prune + * # Find the best basis function to prune * for j in range(basis_size): # <<<<<<<<<<<<<< * bf = self.basis[j] * if bf.is_pruned(): @@ -2928,36 +2960,36 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ for (__pyx_t_18 = 0; __pyx_t_18 < __pyx_t_17; __pyx_t_18+=1) { __pyx_v_j = __pyx_t_18; - /* "sklearn/earth/_pruning.pyx":68 - * #Find the best basis function to prune + /* "sklearn/earth/_pruning.pyx":71 + * # Find the best basis function to prune * for j in range(basis_size): * bf = self.basis[j] # <<<<<<<<<<<<<< * if bf.is_pruned(): * continue */ - __pyx_t_10 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->basis), __pyx_v_j, sizeof(__pyx_t_7sklearn_5earth_8_pruning_INDEX_t)+1, __Pyx_PyInt_to_py_npy_ulonglong, 0, 0, 0); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->basis), __pyx_v_j, sizeof(__pyx_t_7sklearn_5earth_8_pruning_INDEX_t)+1, __Pyx_PyInt_to_py_npy_ulonglong, 0, 0, 0); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_XDECREF(__pyx_v_bf); __pyx_v_bf = __pyx_t_10; __pyx_t_10 = 0; - /* "sklearn/earth/_pruning.pyx":69 + /* "sklearn/earth/_pruning.pyx":72 * for j in range(basis_size): * bf = self.basis[j] * if bf.is_pruned(): # <<<<<<<<<<<<<< * continue * if not bf.is_prunable(): */ - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_bf, __pyx_n_s__is_pruned); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_bf, __pyx_n_s__is_pruned); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_14 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_14); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; if (__pyx_t_12) { - /* "sklearn/earth/_pruning.pyx":70 + /* "sklearn/earth/_pruning.pyx":73 * bf = self.basis[j] * if bf.is_pruned(): * continue # <<<<<<<<<<<<<< @@ -2969,24 +3001,24 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ } __pyx_L10:; - /* "sklearn/earth/_pruning.pyx":71 + /* "sklearn/earth/_pruning.pyx":74 * if bf.is_pruned(): * continue * if not bf.is_prunable(): # <<<<<<<<<<<<<< * continue * bf.prune() */ - __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_bf, __pyx_n_s__is_prunable); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_v_bf, __pyx_n_s__is_prunable); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - __pyx_t_10 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyObject_IsTrue(__pyx_t_10); if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_19 = ((!__pyx_t_12) != 0); if (__pyx_t_19) { - /* "sklearn/earth/_pruning.pyx":72 + /* "sklearn/earth/_pruning.pyx":75 * continue * if not bf.is_prunable(): * continue # <<<<<<<<<<<<<< @@ -2998,52 +3030,60 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ } __pyx_L11:; - /* "sklearn/earth/_pruning.pyx":73 + /* "sklearn/earth/_pruning.pyx":76 * if not bf.is_prunable(): * continue * bf.prune() # <<<<<<<<<<<<<< * self.basis.weighted_transform(X, B, weights) - * beta, mse = np.linalg.lstsq(B[:,0:pruned_basis_size],weighted_y)[0:2] + * beta, mse = np.linalg.lstsq( */ - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_bf, __pyx_n_s__prune); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_bf, __pyx_n_s__prune); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_14 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - /* "sklearn/earth/_pruning.pyx":74 + /* "sklearn/earth/_pruning.pyx":77 * continue * bf.prune() * self.basis.weighted_transform(X, B, weights) # <<<<<<<<<<<<<< - * beta, mse = np.linalg.lstsq(B[:,0:pruned_basis_size],weighted_y)[0:2] - * if mse: + * beta, mse = np.linalg.lstsq( + * B[:, 0:pruned_basis_size], weighted_y)[0:2] */ - __pyx_t_14 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->weighted_transform(__pyx_v_self->basis, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_B), ((PyArrayObject *)__pyx_v_weights), 0); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->weighted_transform(__pyx_v_self->basis, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_v_B), ((PyArrayObject *)__pyx_v_weights), 0); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - /* "sklearn/earth/_pruning.pyx":75 + /* "sklearn/earth/_pruning.pyx":78 * bf.prune() * self.basis.weighted_transform(X, B, weights) - * beta, mse = np.linalg.lstsq(B[:,0:pruned_basis_size],weighted_y)[0:2] # <<<<<<<<<<<<<< + * beta, mse = np.linalg.lstsq( # <<<<<<<<<<<<<< + * B[:, 0:pruned_basis_size], weighted_y)[0:2] * if mse: - * mse /= self.m */ - __pyx_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s__linalg); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_14, __pyx_n_s__linalg); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; - __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__lstsq); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__lstsq); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_pruned_basis_size); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/earth/_pruning.pyx":79 + * self.basis.weighted_transform(X, B, weights) + * beta, mse = np.linalg.lstsq( + * B[:, 0:pruned_basis_size], weighted_y)[0:2] # <<<<<<<<<<<<<< + * if mse: + * mse /= self.m + */ + __pyx_t_10 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_pruned_basis_size); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_9 = PySlice_New(__pyx_int_0, __pyx_t_10, Py_None); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PySlice_New(__pyx_int_0, __pyx_t_10, Py_None); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_INCREF(__pyx_k_slice_4); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_k_slice_4); @@ -3051,10 +3091,10 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_10)); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_10)); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); @@ -3062,11 +3102,11 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ PyTuple_SET_ITEM(__pyx_t_10, 1, ((PyObject *)__pyx_v_weighted_y)); __Pyx_GIVEREF(((PyObject *)__pyx_v_weighted_y)); __pyx_t_9 = 0; - __pyx_t_9 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyObject_GetSlice(__pyx_t_9, 0, 2, NULL, NULL, &__pyx_k_slice_5, 1, 1, 0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyObject_GetSlice(__pyx_t_9, 0, 2, NULL, NULL, &__pyx_k_slice_5, 1, 1, 0); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; if ((likely(PyTuple_CheckExact(__pyx_t_10))) || (PyList_CheckExact(__pyx_t_10))) { @@ -3079,7 +3119,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ if (unlikely(size != 2)) { if (size > 2) __Pyx_RaiseTooManyValuesError(2); else if (size >= 0) __Pyx_RaiseNeedMoreValuesError(size); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } #if CYTHON_COMPILING_IN_CPYTHON if (likely(PyTuple_CheckExact(sequence))) { @@ -3092,16 +3132,16 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ __Pyx_INCREF(__pyx_t_9); __Pyx_INCREF(__pyx_t_14); #else - __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PySequence_ITEM(sequence, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_14 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PySequence_ITEM(sequence, 1); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); #endif __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; } else { Py_ssize_t index = -1; - __pyx_t_2 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetIter(__pyx_t_10); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __pyx_t_11 = Py_TYPE(__pyx_t_2)->tp_iternext; @@ -3109,7 +3149,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ __Pyx_GOTREF(__pyx_t_9); index = 1; __pyx_t_14 = __pyx_t_11(__pyx_t_2); if (unlikely(!__pyx_t_14)) goto __pyx_L12_unpacking_failed; __Pyx_GOTREF(__pyx_t_14); - if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_2), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_IternextUnpackEndCheck(__pyx_t_11(__pyx_t_2), 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_11 = NULL; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L13_unpacking_done; @@ -3117,9 +3157,17 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_11 = NULL; if (__Pyx_IterFinish() == 0) __Pyx_RaiseNeedMoreValuesError(index); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_L13_unpacking_done:; } + + /* "sklearn/earth/_pruning.pyx":78 + * bf.prune() + * self.basis.weighted_transform(X, B, weights) + * beta, mse = np.linalg.lstsq( # <<<<<<<<<<<<<< + * B[:, 0:pruned_basis_size], weighted_y)[0:2] + * if mse: + */ __Pyx_DECREF(__pyx_v_beta); __pyx_v_beta = __pyx_t_9; __pyx_t_9 = 0; @@ -3127,26 +3175,26 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ __pyx_v_mse = __pyx_t_14; __pyx_t_14 = 0; - /* "sklearn/earth/_pruning.pyx":76 - * self.basis.weighted_transform(X, B, weights) - * beta, mse = np.linalg.lstsq(B[:,0:pruned_basis_size],weighted_y)[0:2] + /* "sklearn/earth/_pruning.pyx":80 + * beta, mse = np.linalg.lstsq( + * B[:, 0:pruned_basis_size], weighted_y)[0:2] * if mse: # <<<<<<<<<<<<<< * mse /= self.m * else: */ - __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_v_mse); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_19 = __Pyx_PyObject_IsTrue(__pyx_v_mse); if (unlikely(__pyx_t_19 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_19) { - /* "sklearn/earth/_pruning.pyx":77 - * beta, mse = np.linalg.lstsq(B[:,0:pruned_basis_size],weighted_y)[0:2] + /* "sklearn/earth/_pruning.pyx":81 + * B[:, 0:pruned_basis_size], weighted_y)[0:2] * if mse: * mse /= self.m # <<<<<<<<<<<<<< * else: - * mse = (1/float(self.m))*np.sum((np.dot(B[:,0:pruned_basis_size],beta) - weighted_y)**2) + * mse = (1 / float(self.m)) * np.sum( */ - __pyx_t_10 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_14 = __Pyx_PyNumber_InPlaceDivide(__pyx_v_mse, __pyx_t_10); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = __Pyx_PyNumber_InPlaceDivide(__pyx_v_mse, __pyx_t_10); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_v_mse); @@ -3156,31 +3204,39 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ } /*else*/ { - /* "sklearn/earth/_pruning.pyx":79 + /* "sklearn/earth/_pruning.pyx":83 * mse /= self.m * else: - * mse = (1/float(self.m))*np.sum((np.dot(B[:,0:pruned_basis_size],beta) - weighted_y)**2) # <<<<<<<<<<<<<< - * gcv_ = gcv(mse,pruned_basis_size,self.m,self.penalty) - * + * mse = (1 / float(self.m)) * np.sum( # <<<<<<<<<<<<<< + * (np.dot(B[:, 0:pruned_basis_size], beta) - weighted_y) ** 2) + * gcv_ = gcv(mse, pruned_basis_size, self.m, self.penalty) */ - __pyx_t_14 = PyFloat_FromDouble((1.0 / ((double)__pyx_v_self->m))); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyFloat_FromDouble((1.0 / ((double)__pyx_v_self->m))); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__sum); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__sum); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/earth/_pruning.pyx":84 + * else: + * mse = (1 / float(self.m)) * np.sum( + * (np.dot(B[:, 0:pruned_basis_size], beta) - weighted_y) ** 2) # <<<<<<<<<<<<<< + * gcv_ = gcv(mse, pruned_basis_size, self.m, self.penalty) + * + */ + __pyx_t_10 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_10, __pyx_n_s__dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_pruned_basis_size); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_pruned_basis_size); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_13 = PySlice_New(__pyx_int_0, __pyx_t_10, Py_None); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PySlice_New(__pyx_int_0, __pyx_t_10, Py_None); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_INCREF(__pyx_k_slice_6); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_k_slice_6); @@ -3188,10 +3244,10 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_13); __Pyx_GIVEREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_10)); if (!__pyx_t_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_10)); if (!__pyx_t_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_13); __Pyx_GIVEREF(__pyx_t_13); @@ -3199,26 +3255,26 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_v_beta); __Pyx_GIVEREF(__pyx_v_beta); __pyx_t_13 = 0; - __pyx_t_13 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - __pyx_t_10 = PyNumber_Subtract(__pyx_t_13, ((PyObject *)__pyx_v_weighted_y)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyNumber_Subtract(__pyx_t_13, ((PyObject *)__pyx_v_weighted_y)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = PyNumber_Power(__pyx_t_10, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyNumber_Power(__pyx_t_10, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_13); __Pyx_GIVEREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - __pyx_t_10 = PyNumber_Multiply(__pyx_t_14, __pyx_t_13); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyNumber_Multiply(__pyx_t_14, __pyx_t_13); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; @@ -3228,18 +3284,18 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ } __pyx_L14:; - /* "sklearn/earth/_pruning.pyx":80 - * else: - * mse = (1/float(self.m))*np.sum((np.dot(B[:,0:pruned_basis_size],beta) - weighted_y)**2) - * gcv_ = gcv(mse,pruned_basis_size,self.m,self.penalty) # <<<<<<<<<<<<<< + /* "sklearn/earth/_pruning.pyx":85 + * mse = (1 / float(self.m)) * np.sum( + * (np.dot(B[:, 0:pruned_basis_size], beta) - weighted_y) ** 2) + * gcv_ = gcv(mse, pruned_basis_size, self.m, self.penalty) # <<<<<<<<<<<<<< * * if gcv_ <= best_iteration_gcv or first: */ - __pyx_t_20 = __pyx_PyFloat_AsDouble(__pyx_v_mse); if (unlikely((__pyx_t_20 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_20 = __pyx_PyFloat_AsDouble(__pyx_v_mse); if (unlikely((__pyx_t_20 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_gcv_ = __pyx_f_7sklearn_5earth_5_util_gcv(__pyx_t_20, __pyx_v_pruned_basis_size, __pyx_v_self->m, __pyx_v_self->penalty, 0); - /* "sklearn/earth/_pruning.pyx":82 - * gcv_ = gcv(mse,pruned_basis_size,self.m,self.penalty) + /* "sklearn/earth/_pruning.pyx":87 + * gcv_ = gcv(mse, pruned_basis_size, self.m, self.penalty) * * if gcv_ <= best_iteration_gcv or first: # <<<<<<<<<<<<<< * best_iteration_gcv = gcv_ @@ -3253,7 +3309,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ } if (__pyx_t_12) { - /* "sklearn/earth/_pruning.pyx":83 + /* "sklearn/earth/_pruning.pyx":88 * * if gcv_ <= best_iteration_gcv or first: * best_iteration_gcv = gcv_ # <<<<<<<<<<<<<< @@ -3262,17 +3318,17 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ */ __pyx_v_best_iteration_gcv = __pyx_v_gcv_; - /* "sklearn/earth/_pruning.pyx":84 + /* "sklearn/earth/_pruning.pyx":89 * if gcv_ <= best_iteration_gcv or first: * best_iteration_gcv = gcv_ * best_iteration_mse = mse # <<<<<<<<<<<<<< * best_bf_to_prune = j * first = False */ - __pyx_t_21 = __pyx_PyFloat_AsDouble(__pyx_v_mse); if (unlikely((__pyx_t_21 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_21 = __pyx_PyFloat_AsDouble(__pyx_v_mse); if (unlikely((__pyx_t_21 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_best_iteration_mse = __pyx_t_21; - /* "sklearn/earth/_pruning.pyx":85 + /* "sklearn/earth/_pruning.pyx":90 * best_iteration_gcv = gcv_ * best_iteration_mse = mse * best_bf_to_prune = j # <<<<<<<<<<<<<< @@ -3281,7 +3337,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ */ __pyx_v_best_bf_to_prune = __pyx_v_j; - /* "sklearn/earth/_pruning.pyx":86 + /* "sklearn/earth/_pruning.pyx":91 * best_iteration_mse = mse * best_bf_to_prune = j * first = False # <<<<<<<<<<<<<< @@ -3293,25 +3349,25 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ } __pyx_L15:; - /* "sklearn/earth/_pruning.pyx":87 + /* "sklearn/earth/_pruning.pyx":92 * best_bf_to_prune = j * first = False * bf.unprune() # <<<<<<<<<<<<<< * - * #The inner loop found the best basis function to remove for this iteration. + * # The inner loop found the best basis function to remove for this iteration. */ - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_bf, __pyx_n_s__unprune); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_v_bf, __pyx_n_s__unprune); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_13 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __pyx_L8_continue:; } - /* "sklearn/earth/_pruning.pyx":91 - * #The inner loop found the best basis function to remove for this iteration. - * #Now check whether this iteration is better than all the previous ones. + /* "sklearn/earth/_pruning.pyx":97 + * # Now check whether this iteration is better than all the previous + * # ones. * if best_iteration_gcv <= best_gcv: # <<<<<<<<<<<<<< * best_gcv = best_iteration_gcv * best_iteration = i @@ -3319,8 +3375,8 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ __pyx_t_12 = ((__pyx_v_best_iteration_gcv <= __pyx_v_best_gcv) != 0); if (__pyx_t_12) { - /* "sklearn/earth/_pruning.pyx":92 - * #Now check whether this iteration is better than all the previous ones. + /* "sklearn/earth/_pruning.pyx":98 + * # ones. * if best_iteration_gcv <= best_gcv: * best_gcv = best_iteration_gcv # <<<<<<<<<<<<<< * best_iteration = i @@ -3328,32 +3384,32 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ */ __pyx_v_best_gcv = __pyx_v_best_iteration_gcv; - /* "sklearn/earth/_pruning.pyx":93 + /* "sklearn/earth/_pruning.pyx":99 * if best_iteration_gcv <= best_gcv: * best_gcv = best_iteration_gcv * best_iteration = i # <<<<<<<<<<<<<< * - * #Update the record and prune the selected basis function + * # Update the record and prune the selected basis function */ __pyx_v_best_iteration = __pyx_v_i; goto __pyx_L16; } __pyx_L16:; - /* "sklearn/earth/_pruning.pyx":96 - * - * #Update the record and prune the selected basis function - * self.record.append(PruningPassIteration(best_bf_to_prune,pruned_basis_size,best_iteration_mse)) # <<<<<<<<<<<<<< + /* "sklearn/earth/_pruning.pyx":103 + * # Update the record and prune the selected basis function + * self.record.append(PruningPassIteration( + * best_bf_to_prune, pruned_basis_size, best_iteration_mse)) # <<<<<<<<<<<<<< * self.basis[best_bf_to_prune].prune() * */ - __pyx_t_13 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_best_bf_to_prune); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_best_bf_to_prune); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); - __pyx_t_10 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_pruned_basis_size); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_pruned_basis_size); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_14 = PyFloat_FromDouble(__pyx_v_best_iteration_mse); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyFloat_FromDouble(__pyx_v_best_iteration_mse); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); - __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_13); __Pyx_GIVEREF(__pyx_t_13); @@ -3364,45 +3420,45 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ __pyx_t_13 = 0; __pyx_t_10 = 0; __pyx_t_14 = 0; - __pyx_t_14 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_PruningPassIteration)), ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_PruningPassIteration)), ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - __pyx_t_9 = ((struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->__pyx_base.append(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self->record), ((struct __pyx_obj_7sklearn_5earth_7_record_Iteration *)__pyx_t_14), 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = ((struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->__pyx_base.append(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self->record), ((struct __pyx_obj_7sklearn_5earth_7_record_Iteration *)__pyx_t_14), 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "sklearn/earth/_pruning.pyx":97 - * #Update the record and prune the selected basis function - * self.record.append(PruningPassIteration(best_bf_to_prune,pruned_basis_size,best_iteration_mse)) + /* "sklearn/earth/_pruning.pyx":104 + * self.record.append(PruningPassIteration( + * best_bf_to_prune, pruned_basis_size, best_iteration_mse)) * self.basis[best_bf_to_prune].prune() # <<<<<<<<<<<<<< * - * #Unprune the basis functions pruned after the best iteration + * # Unprune the basis functions pruned after the best iteration */ - __pyx_t_9 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->basis), __pyx_v_best_bf_to_prune, sizeof(__pyx_t_7sklearn_5earth_8_pruning_INDEX_t)+1, __Pyx_PyInt_to_py_npy_ulonglong, 0, 0, 0); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->basis), __pyx_v_best_bf_to_prune, sizeof(__pyx_t_7sklearn_5earth_8_pruning_INDEX_t)+1, __Pyx_PyInt_to_py_npy_ulonglong, 0, 0, 0); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__prune); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = __Pyx_PyObject_GetAttrStr(__pyx_t_9, __pyx_n_s__prune); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_Call(__pyx_t_14, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } - /* "sklearn/earth/_pruning.pyx":100 + /* "sklearn/earth/_pruning.pyx":107 * - * #Unprune the basis functions pruned after the best iteration + * # Unprune the basis functions pruned after the best iteration * self.record.set_selected(best_iteration) # <<<<<<<<<<<<<< * self.record.roll_back(self.basis) * */ - __pyx_t_9 = ((struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->set_selected(__pyx_v_self->record, __pyx_v_best_iteration, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = ((struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->set_selected(__pyx_v_self->record, __pyx_v_best_iteration, 0); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "sklearn/earth/_pruning.pyx":101 - * #Unprune the basis functions pruned after the best iteration + /* "sklearn/earth/_pruning.pyx":108 + * # Unprune the basis functions pruned after the best iteration * self.record.set_selected(best_iteration) * self.record.roll_back(self.basis) # <<<<<<<<<<<<<< * @@ -3410,7 +3466,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ */ __pyx_t_9 = ((PyObject *)__pyx_v_self->basis); __Pyx_INCREF(__pyx_t_9); - __pyx_t_14 = ((struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->roll_back(__pyx_v_self->record, ((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)__pyx_t_9), 0); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = ((struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->roll_back(__pyx_v_self->record, ((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)__pyx_t_9), 0); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; @@ -3466,12 +3522,12 @@ static PyObject *__pyx_pw_7sklearn_5earth_8_pruning_13PruningPasser_3run(PyObjec return __pyx_r; } -/* "sklearn/earth/_pruning.pyx":24 - * self.sst = np.sum(self.weights*(self.y - np.average(self.y,weights=self.weights))**2) / self.m +/* "sklearn/earth/_pruning.pyx":25 + * self.weights * (self.y - np.average(self.y, weights=self.weights)) ** 2) / self.m * * cpdef run(PruningPasser self): # <<<<<<<<<<<<<< - * #This is a totally naive implementation and could potentially be made faster - * #through the use of updating algorithms. It is not clear that such + * # This is a totally naive implementation and could potentially be made faster + * # through the use of updating algorithms. It is not clear that such */ static PyObject *__pyx_pf_7sklearn_5earth_8_pruning_13PruningPasser_2run(struct __pyx_obj_7sklearn_5earth_8_pruning_PruningPasser *__pyx_v_self) { @@ -3483,7 +3539,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_8_pruning_13PruningPasser_2run(struct int __pyx_clineno = 0; __Pyx_RefNannySetupContext("run", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_pruning_PruningPasser *)__pyx_v_self->__pyx_vtab)->run(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_pruning_PruningPasser *)__pyx_v_self->__pyx_vtab)->run(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3501,12 +3557,11 @@ static PyObject *__pyx_pf_7sklearn_5earth_8_pruning_13PruningPasser_2run(struct return __pyx_r; } -/* "sklearn/earth/_pruning.pyx":103 +/* "sklearn/earth/_pruning.pyx":110 * self.record.roll_back(self.basis) * * cpdef PruningPassRecord trace(PruningPasser self): # <<<<<<<<<<<<<< * return self.record - * */ static PyObject *__pyx_pw_7sklearn_5earth_8_pruning_13PruningPasser_5trace(PyObject *__pyx_v_self, CYTHON_UNUSED PyObject *unused); /*proto*/ @@ -3523,13 +3578,13 @@ static struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *__pyx_f_7skl if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__trace); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__trace); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_8_pruning_13PruningPasser_5trace)) { __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7sklearn_5earth_7_record_PruningPassRecord))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7sklearn_5earth_7_record_PruningPassRecord))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -3538,12 +3593,10 @@ static struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *__pyx_f_7skl __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_pruning.pyx":104 + /* "sklearn/earth/_pruning.pyx":111 * * cpdef PruningPassRecord trace(PruningPasser self): * return self.record # <<<<<<<<<<<<<< - * - * */ __Pyx_XDECREF(((PyObject *)__pyx_r)); __Pyx_INCREF(((PyObject *)__pyx_v_self->record)); @@ -3574,12 +3627,11 @@ static PyObject *__pyx_pw_7sklearn_5earth_8_pruning_13PruningPasser_5trace(PyObj return __pyx_r; } -/* "sklearn/earth/_pruning.pyx":103 +/* "sklearn/earth/_pruning.pyx":110 * self.record.roll_back(self.basis) * * cpdef PruningPassRecord trace(PruningPasser self): # <<<<<<<<<<<<<< * return self.record - * */ static PyObject *__pyx_pf_7sklearn_5earth_8_pruning_13PruningPasser_4trace(struct __pyx_obj_7sklearn_5earth_8_pruning_PruningPasser *__pyx_v_self) { @@ -3591,7 +3643,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_8_pruning_13PruningPasser_4trace(struc int __pyx_clineno = 0; __Pyx_RefNannySetupContext("trace", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_8_pruning_PruningPasser *)__pyx_v_self->__pyx_vtab)->trace(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_8_pruning_PruningPasser *)__pyx_v_self->__pyx_vtab)->trace(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -5765,7 +5817,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; @@ -5777,53 +5829,53 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "sklearn/earth/_pruning.pyx":49 - * apply_weights_1d(weighted_y,weights) - * self.basis.weighted_transform(X,B,weights) - * beta, mse = np.linalg.lstsq(B[:,0:(basis_size)],weighted_y)[0:2] # <<<<<<<<<<<<<< + /* "sklearn/earth/_pruning.pyx":50 + * apply_weights_1d(weighted_y, weights) + * self.basis.weighted_transform(X, B, weights) + * beta, mse = np.linalg.lstsq(B[:, 0:(basis_size)], weighted_y)[0:2] # <<<<<<<<<<<<<< * if mse: * mse /= self.m */ - __pyx_k_slice_1 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_1 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_1); __Pyx_GIVEREF(__pyx_k_slice_1); - __pyx_k_slice_2 = PySlice_New(__pyx_int_0, __pyx_int_2, Py_None); if (unlikely(!__pyx_k_slice_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_2 = PySlice_New(__pyx_int_0, __pyx_int_2, Py_None); if (unlikely(!__pyx_k_slice_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_2); __Pyx_GIVEREF(__pyx_k_slice_2); - /* "sklearn/earth/_pruning.pyx":53 - * mse /= self.m + /* "sklearn/earth/_pruning.pyx":55 * else: - * mse = (1.0/self.m)*np.sum((np.dot(B[:,0:basis_size],beta) - weighted_y)**2) # <<<<<<<<<<<<<< + * mse = (1.0 / self.m) * np.sum( + * (np.dot(B[:, 0:basis_size], beta) - weighted_y) ** 2) # <<<<<<<<<<<<<< * - * #Create the record object + * # Create the record object */ - __pyx_k_slice_3 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_3 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_3); __Pyx_GIVEREF(__pyx_k_slice_3); - /* "sklearn/earth/_pruning.pyx":75 - * bf.prune() + /* "sklearn/earth/_pruning.pyx":79 * self.basis.weighted_transform(X, B, weights) - * beta, mse = np.linalg.lstsq(B[:,0:pruned_basis_size],weighted_y)[0:2] # <<<<<<<<<<<<<< + * beta, mse = np.linalg.lstsq( + * B[:, 0:pruned_basis_size], weighted_y)[0:2] # <<<<<<<<<<<<<< * if mse: * mse /= self.m */ - __pyx_k_slice_4 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_4 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_4); __Pyx_GIVEREF(__pyx_k_slice_4); - __pyx_k_slice_5 = PySlice_New(__pyx_int_0, __pyx_int_2, Py_None); if (unlikely(!__pyx_k_slice_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_5 = PySlice_New(__pyx_int_0, __pyx_int_2, Py_None); if (unlikely(!__pyx_k_slice_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_5); __Pyx_GIVEREF(__pyx_k_slice_5); - /* "sklearn/earth/_pruning.pyx":79 - * mse /= self.m + /* "sklearn/earth/_pruning.pyx":84 * else: - * mse = (1/float(self.m))*np.sum((np.dot(B[:,0:pruned_basis_size],beta) - weighted_y)**2) # <<<<<<<<<<<<<< - * gcv_ = gcv(mse,pruned_basis_size,self.m,self.penalty) + * mse = (1 / float(self.m)) * np.sum( + * (np.dot(B[:, 0:pruned_basis_size], beta) - weighted_y) ** 2) # <<<<<<<<<<<<<< + * gcv_ = gcv(mse, pruned_basis_size, self.m, self.penalty) * */ - __pyx_k_slice_6 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_slice_6 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_slice_6); __Pyx_GIVEREF(__pyx_k_slice_6); @@ -6018,8 +6070,8 @@ PyMODINIT_FUNC PyInit__pruning(void) __pyx_vtabptr_7sklearn_5earth_6_basis_HingeBasisFunction = (struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_6_basis_HingeBasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_6_basis_HingeBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_5earth_6_basis_LinearBasisFunction = __Pyx_ImportType("sklearn.earth._basis", "LinearBasisFunction", sizeof(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_6_basis_LinearBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_vtabptr_7sklearn_5earth_6_basis_LinearBasisFunction = (struct __pyx_vtabstruct_7sklearn_5earth_6_basis_LinearBasisFunction*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_6_basis_LinearBasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_6_basis_LinearBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7sklearn_5earth_6_basis_Basis = __Pyx_ImportType("sklearn.earth._basis", "Basis", sizeof(struct __pyx_obj_7sklearn_5earth_6_basis_Basis), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_6_basis_Basis)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_vtabptr_7sklearn_5earth_6_basis_Basis = (struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_6_basis_Basis->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_6_basis_Basis)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_6_basis_Basis = __Pyx_ImportType("sklearn.earth._basis", "Basis", sizeof(struct __pyx_obj_7sklearn_5earth_6_basis_Basis), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_6_basis_Basis)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5earth_6_basis_Basis = (struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_6_basis_Basis->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_6_basis_Basis)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_5earth_7_record_Record = __Pyx_ImportType("sklearn.earth._record", "Record", sizeof(struct __pyx_obj_7sklearn_5earth_7_record_Record), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_7_record_Record)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_vtabptr_7sklearn_5earth_7_record_Record = (struct __pyx_vtabstruct_7sklearn_5earth_7_record_Record*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_7_record_Record->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_7_record_Record)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_5earth_7_record_PruningPassRecord = __Pyx_ImportType("sklearn.earth._record", "PruningPassRecord", sizeof(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_7_record_PruningPassRecord)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 25; __pyx_clineno = __LINE__; goto __pyx_L1_error;} diff --git a/sklearn/earth/_pruning.pxd b/sklearn/earth/_pruning.pxd index b78f611965c7f..86b31942849c4 100644 --- a/sklearn/earth/_pruning.pxd +++ b/sklearn/earth/_pruning.pxd @@ -17,7 +17,7 @@ cdef class PruningPasser: cdef FLOAT_t penalty cdef FLOAT_t sst cdef PruningPassRecord record - + cpdef run(PruningPasser self) - - cpdef PruningPassRecord trace(PruningPasser self) \ No newline at end of file + + cpdef PruningPassRecord trace(PruningPasser self) diff --git a/sklearn/earth/_pruning.pyx b/sklearn/earth/_pruning.pyx index f01a4f1a4393a..c5bb6c8a851ac 100644 --- a/sklearn/earth/_pruning.pyx +++ b/sklearn/earth/_pruning.pyx @@ -17,15 +17,16 @@ cdef class PruningPasser: self.y = y self.weights = weights self.basis = basis - self.B = np.empty(shape=(self.m,len(self.basis)+1),dtype=np.float) + self.B = np.empty(shape=(self.m, len(self.basis) + 1), dtype=np.float) self.penalty = kwargs['penalty'] if 'penalty' in kwargs else 3.0 - self.sst = np.sum(self.weights*(self.y - np.average(self.y,weights=self.weights))**2) / self.m - + self.sst = np.sum( + self.weights * (self.y - np.average(self.y, weights=self.weights)) ** 2) / self.m + cpdef run(PruningPasser self): - #This is a totally naive implementation and could potentially be made faster - #through the use of updating algorithms. It is not clear that such - #optimization would be worthwhile, as the pruning pass is not the slowest - #part of the algorithm. + # This is a totally naive implementation and could potentially be made faster + # through the use of updating algorithms. It is not clear that such + # optimization would be worthwhile, as the pruning pass is not the slowest + # part of the algorithm. cdef INDEX_t i cdef INDEX_t j cdef INDEX_t basis_size = len(self.basis) @@ -36,34 +37,36 @@ cdef class PruningPasser: cdef FLOAT_t best_gcv cdef FLOAT_t best_iteration_gcv cdef FLOAT_t best_iteration_mse - - cdef cnp.ndarray[FLOAT_t, ndim=2] B = self.B - cdef cnp.ndarray[FLOAT_t, ndim=2] X = self.X - cdef cnp.ndarray[FLOAT_t, ndim=1] y = self.y - cdef cnp.ndarray[FLOAT_t, ndim=1] weights = self.weights - cdef cnp.ndarray[FLOAT_t, ndim=1] weighted_y = y.copy() - - #Initial solution - apply_weights_1d(weighted_y,weights) - self.basis.weighted_transform(X,B,weights) - beta, mse = np.linalg.lstsq(B[:,0:(basis_size)],weighted_y)[0:2] + + cdef cnp.ndarray[FLOAT_t, ndim = 2] B = self.B + cdef cnp.ndarray[FLOAT_t, ndim = 2] X = self.X + cdef cnp.ndarray[FLOAT_t, ndim = 1] y = self.y + cdef cnp.ndarray[FLOAT_t, ndim = 1] weights = self.weights + cdef cnp.ndarray[FLOAT_t, ndim = 1] weighted_y = y.copy() + + # Initial solution + apply_weights_1d(weighted_y, weights) + self.basis.weighted_transform(X, B, weights) + beta, mse = np.linalg.lstsq(B[:, 0:(basis_size)], weighted_y)[0:2] if mse: mse /= self.m else: - mse = (1.0/self.m)*np.sum((np.dot(B[:,0:basis_size],beta) - weighted_y)**2) + mse = (1.0 / self.m) * np.sum( + (np.dot(B[:, 0:basis_size], beta) - weighted_y) ** 2) - #Create the record object - self.record = PruningPassRecord(self.m,self.n,self.penalty,self.sst,pruned_basis_size,mse) + # Create the record object + self.record = PruningPassRecord( + self.m, self.n, self.penalty, self.sst, pruned_basis_size, mse) gcv_ = self.record.gcv(0) best_gcv = gcv_ best_iteration = 0 - - #Prune basis functions sequentially - for i in range(1,pruned_basis_size): + + # Prune basis functions sequentially + for i in range(1, pruned_basis_size): first = True pruned_basis_size -= 1 - - #Find the best basis function to prune + + # Find the best basis function to prune for j in range(basis_size): bf = self.basis[j] if bf.is_pruned(): @@ -72,37 +75,37 @@ cdef class PruningPasser: continue bf.prune() self.basis.weighted_transform(X, B, weights) - beta, mse = np.linalg.lstsq(B[:,0:pruned_basis_size],weighted_y)[0:2] + beta, mse = np.linalg.lstsq( + B[:, 0:pruned_basis_size], weighted_y)[0:2] if mse: mse /= self.m else: - mse = (1/float(self.m))*np.sum((np.dot(B[:,0:pruned_basis_size],beta) - weighted_y)**2) - gcv_ = gcv(mse,pruned_basis_size,self.m,self.penalty) - + mse = (1 / float(self.m)) * np.sum( + (np.dot(B[:, 0:pruned_basis_size], beta) - weighted_y) ** 2) + gcv_ = gcv(mse, pruned_basis_size, self.m, self.penalty) + if gcv_ <= best_iteration_gcv or first: best_iteration_gcv = gcv_ best_iteration_mse = mse best_bf_to_prune = j first = False bf.unprune() - - #The inner loop found the best basis function to remove for this iteration. - #Now check whether this iteration is better than all the previous ones. + + # The inner loop found the best basis function to remove for this iteration. + # Now check whether this iteration is better than all the previous + # ones. if best_iteration_gcv <= best_gcv: best_gcv = best_iteration_gcv best_iteration = i - - #Update the record and prune the selected basis function - self.record.append(PruningPassIteration(best_bf_to_prune,pruned_basis_size,best_iteration_mse)) + + # Update the record and prune the selected basis function + self.record.append(PruningPassIteration( + best_bf_to_prune, pruned_basis_size, best_iteration_mse)) self.basis[best_bf_to_prune].prune() - - #Unprune the basis functions pruned after the best iteration + + # Unprune the basis functions pruned after the best iteration self.record.set_selected(best_iteration) self.record.roll_back(self.basis) - + cpdef PruningPassRecord trace(PruningPasser self): return self.record - - - - diff --git a/sklearn/earth/_record.c b/sklearn/earth/_record.c index 267f164edbdcf..6ec73a5f33c2e 100644 --- a/sklearn/earth/_record.c +++ b/sklearn/earth/_record.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19.1 on Sat Jul 27 21:13:14 2013 */ +/* Generated by Cython 0.19.1 on Sat Jul 27 22:55:34 2013 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS @@ -922,9 +922,9 @@ struct __pyx_opt_args_7sklearn_5earth_6_basis_19LinearBasisFunction_apply; /* "_basis.pxd":45 * cpdef INDEX_t degree(BasisFunction self) * - * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) # <<<<<<<<<<<<<< + * cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse= ?) # <<<<<<<<<<<<<< * - * cpdef cnp.ndarray[INT_t, ndim=1] valid_knots(BasisFunction self, cnp.ndarray[FLOAT_t,ndim=1] values, cnp.ndarray[FLOAT_t,ndim=1] variable, int variable_idx, INDEX_t check_every, int endspan, int minspan, FLOAT_t minspan_alpha, INDEX_t n, cnp.ndarray[INT_t,ndim=1] workspace) + * cpdef cnp.ndarray[INT_t, ndim = 1] valid_knots(BasisFunction self, cnp.ndarray[FLOAT_t, ndim=1] values, cnp.ndarray[FLOAT_t, ndim=1] variable, int variable_idx, INDEX_t check_every, int endspan, int minspan, FLOAT_t minspan_alpha, INDEX_t n, cnp.ndarray[INT_t, ndim=1] workspace) */ struct __pyx_opt_args_7sklearn_5earth_6_basis_13BasisFunction_apply { int __pyx_n; @@ -934,7 +934,7 @@ struct __pyx_opt_args_7sklearn_5earth_6_basis_13BasisFunction_apply { /* "_basis.pxd":62 * cpdef BasisFunction get_parent(self) * - * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) # <<<<<<<<<<<<<< + * cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse= ?) # <<<<<<<<<<<<<< * * */ @@ -946,7 +946,7 @@ struct __pyx_opt_args_7sklearn_5earth_6_basis_21ConstantBasisFunction_apply { /* "_basis.pxd":86 * cpdef INDEX_t get_knot_idx(self) * - * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) # <<<<<<<<<<<<<< + * cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse= ?) # <<<<<<<<<<<<<< * * cdef class LinearBasisFunction(BasisFunction): */ @@ -958,7 +958,7 @@ struct __pyx_opt_args_7sklearn_5earth_6_basis_18HingeBasisFunction_apply { /* "_basis.pxd":98 * cpdef INDEX_t get_variable(self) * - * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) # <<<<<<<<<<<<<< + * cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse= ?) # <<<<<<<<<<<<<< * * */ @@ -971,8 +971,8 @@ struct __pyx_opt_args_7sklearn_5earth_6_basis_19LinearBasisFunction_apply { * from _record cimport ForwardPassRecord * * ctypedef enum StoppingCondition: # <<<<<<<<<<<<<< - * MAXTERMS=0, - * MAXRSQ=1, + * MAXTERMS = 0, + * MAXRSQ = 1, */ enum __pyx_t_7sklearn_5earth_8_forward_StoppingCondition { __pyx_e_7sklearn_5earth_8_forward_MAXTERMS = 0, @@ -983,7 +983,7 @@ enum __pyx_t_7sklearn_5earth_8_forward_StoppingCondition { }; typedef enum __pyx_t_7sklearn_5earth_8_forward_StoppingCondition __pyx_t_7sklearn_5earth_8_forward_StoppingCondition; -/* "_basis.pxd":102 +/* "_basis.pxd":101 * * * cdef class Basis: # <<<<<<<<<<<<<< @@ -1128,7 +1128,7 @@ struct __pyx_obj_7sklearn_5earth_6_basis_HingeBasisFunction { * * cdef class ForwardPasser: # <<<<<<<<<<<<<< * - * #User selected parameters + * # User selected parameters */ struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser { PyObject_HEAD @@ -1205,7 +1205,7 @@ struct __pyx_obj_7sklearn_5earth_7_record_FirstForwardPassIteration { /* "_basis.pxd":88 - * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) + * cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse= ?) * * cdef class LinearBasisFunction(BasisFunction): # <<<<<<<<<<<<<< * cdef INDEX_t variable @@ -1219,7 +1219,7 @@ struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction { -/* "sklearn/earth/_record.pyx":144 +/* "sklearn/earth/_record.pyx":151 * return result * * cdef class Iteration: # <<<<<<<<<<<<<< @@ -1234,7 +1234,7 @@ struct __pyx_vtabstruct_7sklearn_5earth_7_record_Iteration { static struct __pyx_vtabstruct_7sklearn_5earth_7_record_Iteration *__pyx_vtabptr_7sklearn_5earth_7_record_Iteration; -/* "sklearn/earth/_record.pyx":163 +/* "sklearn/earth/_record.pyx":170 * return self.size * * cdef class PruningPassIteration(Iteration): # <<<<<<<<<<<<<< @@ -1279,7 +1279,7 @@ static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *__pyx_vtab /* "_basis.pxd":88 - * cpdef apply(self, cnp.ndarray[FLOAT_t,ndim=2] X, cnp.ndarray[FLOAT_t,ndim=1] b, bint recurse = ?) + * cpdef apply(self, cnp.ndarray[FLOAT_t, ndim=2] X, cnp.ndarray[FLOAT_t, ndim=1] b, bint recurse= ?) * * cdef class LinearBasisFunction(BasisFunction): # <<<<<<<<<<<<<< * cdef INDEX_t variable @@ -1313,8 +1313,8 @@ struct __pyx_vtabstruct_7sklearn_5earth_7_record_Record { static struct __pyx_vtabstruct_7sklearn_5earth_7_record_Record *__pyx_vtabptr_7sklearn_5earth_7_record_Record; -/* "sklearn/earth/_record.pyx":50 - * return 1 - (gcv_/gcv0) +/* "sklearn/earth/_record.pyx":52 + * return 1 - (gcv_ / gcv0) * * cdef class PruningPassRecord(Record): # <<<<<<<<<<<<<< * def __init__(PruningPassRecord self, INDEX_t num_samples, INDEX_t num_variables, FLOAT_t penalty, FLOAT_t sst, INDEX_t size, FLOAT_t mse): @@ -1335,7 +1335,7 @@ static struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord *__pyx * * cdef class ForwardPasser: # <<<<<<<<<<<<<< * - * #User selected parameters + * # User selected parameters */ struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser { @@ -1387,7 +1387,7 @@ struct __pyx_vtabstruct_7sklearn_5earth_6_basis_ConstantBasisFunction { static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_ConstantBasisFunction *__pyx_vtabptr_7sklearn_5earth_6_basis_ConstantBasisFunction; -/* "sklearn/earth/_record.pyx":102 +/* "sklearn/earth/_record.pyx":105 * return result * * cdef class ForwardPassRecord(Record): # <<<<<<<<<<<<<< @@ -1402,7 +1402,7 @@ struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord { static struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord *__pyx_vtabptr_7sklearn_5earth_7_record_ForwardPassRecord; -/* "sklearn/earth/_record.pyx":209 +/* "sklearn/earth/_record.pyx":218 * return result * * cdef class ForwardPassIteration(Iteration): # <<<<<<<<<<<<<< @@ -1418,7 +1418,7 @@ struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassIteration { static struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassIteration *__pyx_vtabptr_7sklearn_5earth_7_record_ForwardPassIteration; -/* "_basis.pxd":102 +/* "_basis.pxd":101 * * * cdef class Basis: # <<<<<<<<<<<<<< @@ -1439,7 +1439,7 @@ struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis { static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *__pyx_vtabptr_7sklearn_5earth_6_basis_Basis; -/* "sklearn/earth/_record.pyx":244 +/* "sklearn/earth/_record.pyx":254 * return self.no_candidates * * cdef class FirstForwardPassIteration(ForwardPassIteration): # <<<<<<<<<<<<<< @@ -1453,7 +1453,7 @@ struct __pyx_vtabstruct_7sklearn_5earth_7_record_FirstForwardPassIteration { static struct __pyx_vtabstruct_7sklearn_5earth_7_record_FirstForwardPassIteration *__pyx_vtabptr_7sklearn_5earth_7_record_FirstForwardPassIteration; -/* "sklearn/earth/_record.pyx":189 +/* "sklearn/earth/_record.pyx":197 * return result * * cdef class FirstPruningPassIteration(PruningPassIteration): # <<<<<<<<<<<<<< @@ -2768,7 +2768,7 @@ static __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_f_7sklearn_5earth_7_record * cpdef FLOAT_t gcv(Record self, INDEX_t iteration): * cdef Iteration it = self.iterations[iteration] # <<<<<<<<<<<<<< * cdef FLOAT_t mse = it.mse - * return gcv(mse,it.get_size(),self.num_samples,self.penalty) + * return gcv(mse, it.get_size(), self.num_samples, self.penalty) */ if (unlikely(((PyObject *)__pyx_v_self->iterations) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); @@ -2784,7 +2784,7 @@ static __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_f_7sklearn_5earth_7_record * cpdef FLOAT_t gcv(Record self, INDEX_t iteration): * cdef Iteration it = self.iterations[iteration] * cdef FLOAT_t mse = it.mse # <<<<<<<<<<<<<< - * return gcv(mse,it.get_size(),self.num_samples,self.penalty) + * return gcv(mse, it.get_size(), self.num_samples, self.penalty) * */ __pyx_t_4 = __pyx_v_it->mse; @@ -2793,7 +2793,7 @@ static __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_f_7sklearn_5earth_7_record /* "sklearn/earth/_record.pyx":38 * cdef Iteration it = self.iterations[iteration] * cdef FLOAT_t mse = it.mse - * return gcv(mse,it.get_size(),self.num_samples,self.penalty) # <<<<<<<<<<<<<< + * return gcv(mse, it.get_size(), self.num_samples, self.penalty) # <<<<<<<<<<<<<< * * cpdef FLOAT_t rsq(Record self, INDEX_t iteration): */ @@ -2874,11 +2874,11 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_6Record_12gcv(struct __pyx_ob } /* "sklearn/earth/_record.pyx":40 - * return gcv(mse,it.get_size(),self.num_samples,self.penalty) + * return gcv(mse, it.get_size(), self.num_samples, self.penalty) * * cpdef FLOAT_t rsq(Record self, INDEX_t iteration): # <<<<<<<<<<<<<< - * cdef FLOAT_t mse0 = self.sst#gcv(self.sst,1,self.num_samples,self.penalty) - * cdef FLOAT_t mse = self.mse(iteration)#gcv(self.mse(iteration):,self.iterations[iteration].get_size(),self.num_samples,self.penalty)#self.gcv(iteration) + * # gcv(self.sst,1,self.num_samples,self.penalty) + * cdef FLOAT_t mse0 = self.sst */ static PyObject *__pyx_pw_7sklearn_5earth_7_record_6Record_15rsq(PyObject *__pyx_v_self, PyObject *__pyx_arg_iteration); /*proto*/ @@ -2921,28 +2921,28 @@ static __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_f_7sklearn_5earth_7_record __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_record.pyx":41 - * + /* "sklearn/earth/_record.pyx":42 * cpdef FLOAT_t rsq(Record self, INDEX_t iteration): - * cdef FLOAT_t mse0 = self.sst#gcv(self.sst,1,self.num_samples,self.penalty) # <<<<<<<<<<<<<< - * cdef FLOAT_t mse = self.mse(iteration)#gcv(self.mse(iteration):,self.iterations[iteration].get_size(),self.num_samples,self.penalty)#self.gcv(iteration) - * return 1 - (mse / mse0) + * # gcv(self.sst,1,self.num_samples,self.penalty) + * cdef FLOAT_t mse0 = self.sst # <<<<<<<<<<<<<< + * # gcv(self.mse(iteration):,self.iterations[iteration].get_size(),self.num_samples,self.penalty)#self.gcv(iteration) + * cdef FLOAT_t mse = self.mse(iteration) */ __pyx_t_4 = __pyx_v_self->sst; __pyx_v_mse0 = __pyx_t_4; - /* "sklearn/earth/_record.pyx":42 - * cpdef FLOAT_t rsq(Record self, INDEX_t iteration): - * cdef FLOAT_t mse0 = self.sst#gcv(self.sst,1,self.num_samples,self.penalty) - * cdef FLOAT_t mse = self.mse(iteration)#gcv(self.mse(iteration):,self.iterations[iteration].get_size(),self.num_samples,self.penalty)#self.gcv(iteration) # <<<<<<<<<<<<<< + /* "sklearn/earth/_record.pyx":44 + * cdef FLOAT_t mse0 = self.sst + * # gcv(self.mse(iteration):,self.iterations[iteration].get_size(),self.num_samples,self.penalty)#self.gcv(iteration) + * cdef FLOAT_t mse = self.mse(iteration) # <<<<<<<<<<<<<< * return 1 - (mse / mse0) * */ __pyx_v_mse = ((struct __pyx_vtabstruct_7sklearn_5earth_7_record_Record *)__pyx_v_self->__pyx_vtab)->mse(__pyx_v_self, __pyx_v_iteration, 0); - /* "sklearn/earth/_record.pyx":43 - * cdef FLOAT_t mse0 = self.sst#gcv(self.sst,1,self.num_samples,self.penalty) - * cdef FLOAT_t mse = self.mse(iteration)#gcv(self.mse(iteration):,self.iterations[iteration].get_size(),self.num_samples,self.penalty)#self.gcv(iteration) + /* "sklearn/earth/_record.pyx":45 + * # gcv(self.mse(iteration):,self.iterations[iteration].get_size(),self.num_samples,self.penalty)#self.gcv(iteration) + * cdef FLOAT_t mse = self.mse(iteration) * return 1 - (mse / mse0) # <<<<<<<<<<<<<< * * cpdef FLOAT_t grsq(Record self, INDEX_t iteration): @@ -2988,11 +2988,11 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_6Record_15rsq(PyObject *__pyx } /* "sklearn/earth/_record.pyx":40 - * return gcv(mse,it.get_size(),self.num_samples,self.penalty) + * return gcv(mse, it.get_size(), self.num_samples, self.penalty) * * cpdef FLOAT_t rsq(Record self, INDEX_t iteration): # <<<<<<<<<<<<<< - * cdef FLOAT_t mse0 = self.sst#gcv(self.sst,1,self.num_samples,self.penalty) - * cdef FLOAT_t mse = self.mse(iteration)#gcv(self.mse(iteration):,self.iterations[iteration].get_size(),self.num_samples,self.penalty)#self.gcv(iteration) + * # gcv(self.sst,1,self.num_samples,self.penalty) + * cdef FLOAT_t mse0 = self.sst */ static PyObject *__pyx_pf_7sklearn_5earth_7_record_6Record_14rsq(struct __pyx_obj_7sklearn_5earth_7_record_Record *__pyx_v_self, __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_v_iteration) { @@ -3022,11 +3022,11 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_6Record_14rsq(struct __pyx_ob return __pyx_r; } -/* "sklearn/earth/_record.pyx":45 +/* "sklearn/earth/_record.pyx":47 * return 1 - (mse / mse0) * * cpdef FLOAT_t grsq(Record self, INDEX_t iteration): # <<<<<<<<<<<<<< - * cdef FLOAT_t gcv0 = gcv(self.sst,1,self.num_samples,self.penalty) + * cdef FLOAT_t gcv0 = gcv(self.sst, 1, self.num_samples, self.penalty) * cdef FLOAT_t gcv_ = self.gcv(iteration) */ @@ -3048,20 +3048,20 @@ static __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_f_7sklearn_5earth_7_record if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__grsq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__grsq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_6Record_17grsq)) { - __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_iteration); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_iteration); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_4; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -3070,28 +3070,28 @@ static __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_f_7sklearn_5earth_7_record __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_record.pyx":46 + /* "sklearn/earth/_record.pyx":48 * * cpdef FLOAT_t grsq(Record self, INDEX_t iteration): - * cdef FLOAT_t gcv0 = gcv(self.sst,1,self.num_samples,self.penalty) # <<<<<<<<<<<<<< + * cdef FLOAT_t gcv0 = gcv(self.sst, 1, self.num_samples, self.penalty) # <<<<<<<<<<<<<< * cdef FLOAT_t gcv_ = self.gcv(iteration) - * return 1 - (gcv_/gcv0) + * return 1 - (gcv_ / gcv0) */ __pyx_v_gcv0 = __pyx_f_7sklearn_5earth_5_util_gcv(__pyx_v_self->sst, 1, __pyx_v_self->num_samples, __pyx_v_self->penalty, 0); - /* "sklearn/earth/_record.pyx":47 + /* "sklearn/earth/_record.pyx":49 * cpdef FLOAT_t grsq(Record self, INDEX_t iteration): - * cdef FLOAT_t gcv0 = gcv(self.sst,1,self.num_samples,self.penalty) + * cdef FLOAT_t gcv0 = gcv(self.sst, 1, self.num_samples, self.penalty) * cdef FLOAT_t gcv_ = self.gcv(iteration) # <<<<<<<<<<<<<< - * return 1 - (gcv_/gcv0) + * return 1 - (gcv_ / gcv0) * */ __pyx_v_gcv_ = ((struct __pyx_vtabstruct_7sklearn_5earth_7_record_Record *)__pyx_v_self->__pyx_vtab)->gcv(__pyx_v_self, __pyx_v_iteration, 0); - /* "sklearn/earth/_record.pyx":48 - * cdef FLOAT_t gcv0 = gcv(self.sst,1,self.num_samples,self.penalty) + /* "sklearn/earth/_record.pyx":50 + * cdef FLOAT_t gcv0 = gcv(self.sst, 1, self.num_samples, self.penalty) * cdef FLOAT_t gcv_ = self.gcv(iteration) - * return 1 - (gcv_/gcv0) # <<<<<<<<<<<<<< + * return 1 - (gcv_ / gcv0) # <<<<<<<<<<<<<< * * cdef class PruningPassRecord(Record): */ @@ -3122,7 +3122,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_6Record_17grsq(PyObject *__py __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("grsq (wrapper)", 0); assert(__pyx_arg_iteration); { - __pyx_v_iteration = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_arg_iteration); if (unlikely((__pyx_v_iteration == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_iteration = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_arg_iteration); if (unlikely((__pyx_v_iteration == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -3135,11 +3135,11 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_6Record_17grsq(PyObject *__py return __pyx_r; } -/* "sklearn/earth/_record.pyx":45 +/* "sklearn/earth/_record.pyx":47 * return 1 - (mse / mse0) * * cpdef FLOAT_t grsq(Record self, INDEX_t iteration): # <<<<<<<<<<<<<< - * cdef FLOAT_t gcv0 = gcv(self.sst,1,self.num_samples,self.penalty) + * cdef FLOAT_t gcv0 = gcv(self.sst, 1, self.num_samples, self.penalty) * cdef FLOAT_t gcv_ = self.gcv(iteration) */ @@ -3152,7 +3152,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_6Record_16grsq(struct __pyx_o int __pyx_clineno = 0; __Pyx_RefNannySetupContext("grsq", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_Record *)__pyx_v_self->__pyx_vtab)->grsq(__pyx_v_self, __pyx_v_iteration, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_Record *)__pyx_v_self->__pyx_vtab)->grsq(__pyx_v_self, __pyx_v_iteration, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3209,31 +3209,31 @@ static int __pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_1__init__(PyObj case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__num_variables)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__penalty)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sst)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 5: if (likely((values[5] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mse)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, 5); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 6) { goto __pyx_L5_argtuple_error; @@ -3245,16 +3245,16 @@ static int __pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_1__init__(PyObj values[4] = PyTuple_GET_ITEM(__pyx_args, 4); values[5] = PyTuple_GET_ITEM(__pyx_args, 5); } - __pyx_v_num_samples = __Pyx_PyInt_from_py_npy_ulonglong(values[0]); if (unlikely((__pyx_v_num_samples == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_num_variables = __Pyx_PyInt_from_py_npy_ulonglong(values[1]); if (unlikely((__pyx_v_num_variables == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_penalty = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_penalty == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_sst = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_sst == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_size = __Pyx_PyInt_from_py_npy_ulonglong(values[4]); if (unlikely((__pyx_v_size == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_mse = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_mse == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_num_samples = __Pyx_PyInt_from_py_npy_ulonglong(values[0]); if (unlikely((__pyx_v_num_samples == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_num_variables = __Pyx_PyInt_from_py_npy_ulonglong(values[1]); if (unlikely((__pyx_v_num_variables == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_penalty = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_penalty == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_sst = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_sst == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_size = __Pyx_PyInt_from_py_npy_ulonglong(values[4]); if (unlikely((__pyx_v_size == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_mse = __pyx_PyFloat_AsDouble(values[5]); if (unlikely((__pyx_v_mse == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 6, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.earth._record.PruningPassRecord.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -3265,7 +3265,7 @@ static int __pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_1__init__(PyObj return __pyx_r; } -/* "sklearn/earth/_record.pyx":51 +/* "sklearn/earth/_record.pyx":53 * * cdef class PruningPassRecord(Record): * def __init__(PruningPassRecord self, INDEX_t num_samples, INDEX_t num_variables, FLOAT_t penalty, FLOAT_t sst, INDEX_t size, FLOAT_t mse): # <<<<<<<<<<<<<< @@ -3284,7 +3284,7 @@ static int __pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord___init__(struct int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "sklearn/earth/_record.pyx":52 + /* "sklearn/earth/_record.pyx":54 * cdef class PruningPassRecord(Record): * def __init__(PruningPassRecord self, INDEX_t num_samples, INDEX_t num_variables, FLOAT_t penalty, FLOAT_t sst, INDEX_t size, FLOAT_t mse): * self.num_samples = num_samples # <<<<<<<<<<<<<< @@ -3293,7 +3293,7 @@ static int __pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord___init__(struct */ __pyx_v_self->__pyx_base.num_samples = __pyx_v_num_samples; - /* "sklearn/earth/_record.pyx":53 + /* "sklearn/earth/_record.pyx":55 * def __init__(PruningPassRecord self, INDEX_t num_samples, INDEX_t num_variables, FLOAT_t penalty, FLOAT_t sst, INDEX_t size, FLOAT_t mse): * self.num_samples = num_samples * self.num_variables = num_variables # <<<<<<<<<<<<<< @@ -3302,7 +3302,7 @@ static int __pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord___init__(struct */ __pyx_v_self->__pyx_base.num_variables = __pyx_v_num_variables; - /* "sklearn/earth/_record.pyx":54 + /* "sklearn/earth/_record.pyx":56 * self.num_samples = num_samples * self.num_variables = num_variables * self.penalty = penalty # <<<<<<<<<<<<<< @@ -3311,7 +3311,7 @@ static int __pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord___init__(struct */ __pyx_v_self->__pyx_base.penalty = __pyx_v_penalty; - /* "sklearn/earth/_record.pyx":55 + /* "sklearn/earth/_record.pyx":57 * self.num_variables = num_variables * self.penalty = penalty * self.sst = sst # <<<<<<<<<<<<<< @@ -3320,18 +3320,18 @@ static int __pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord___init__(struct */ __pyx_v_self->__pyx_base.sst = __pyx_v_sst; - /* "sklearn/earth/_record.pyx":56 + /* "sklearn/earth/_record.pyx":58 * self.penalty = penalty * self.sst = sst * self.iterations = [FirstPruningPassIteration(size, mse)] # <<<<<<<<<<<<<< * * def __reduce__(PruningPassRecord self): */ - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_mse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_mse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); @@ -3339,10 +3339,10 @@ static int __pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord___init__(struct __Pyx_GIVEREF(__pyx_t_2); __pyx_t_1 = 0; __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_FirstPruningPassIteration)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_FirstPruningPassIteration)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyList_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); @@ -3377,11 +3377,11 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_3__reduce return __pyx_r; } -/* "sklearn/earth/_record.pyx":58 +/* "sklearn/earth/_record.pyx":60 * self.iterations = [FirstPruningPassIteration(size, mse)] * * def __reduce__(PruningPassRecord self): # <<<<<<<<<<<<<< - * return (PruningPassRecord, (1,1,1.0,1.0,1,1.0), self._getstate()) + * return (PruningPassRecord, (1, 1, 1.0, 1.0, 1, 1.0), self._getstate()) * */ @@ -3397,21 +3397,21 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_2__reduce int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce__", 0); - /* "sklearn/earth/_record.pyx":59 + /* "sklearn/earth/_record.pyx":61 * * def __reduce__(PruningPassRecord self): - * return (PruningPassRecord, (1,1,1.0,1.0,1,1.0), self._getstate()) # <<<<<<<<<<<<<< + * return (PruningPassRecord, (1, 1, 1.0, 1.0, 1, 1.0), self._getstate()) # <<<<<<<<<<<<<< * * def _getstate(PruningPassRecord self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_int_1); @@ -3431,12 +3431,12 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_2__reduce __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_PruningPassRecord))); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_PruningPassRecord))); @@ -3477,12 +3477,12 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_5_getstat return __pyx_r; } -/* "sklearn/earth/_record.pyx":61 - * return (PruningPassRecord, (1,1,1.0,1.0,1,1.0), self._getstate()) +/* "sklearn/earth/_record.pyx":63 + * return (PruningPassRecord, (1, 1, 1.0, 1.0, 1, 1.0), self._getstate()) * * def _getstate(PruningPassRecord self): # <<<<<<<<<<<<<< * result = {'num_samples': self.num_samples, - * 'num_variables': self.num_variables, + * 'num_variables': self.num_variables, */ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_4_getstate(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *__pyx_v_self) { @@ -3496,82 +3496,82 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_4_getstat int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_getstate", 0); - /* "sklearn/earth/_record.pyx":62 + /* "sklearn/earth/_record.pyx":64 * * def _getstate(PruningPassRecord self): * result = {'num_samples': self.num_samples, # <<<<<<<<<<<<<< - * 'num_variables': self.num_variables, - * 'penalty': self.penalty, + * 'num_variables': self.num_variables, + * 'penalty': self.penalty, */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = PyInt_FromLong(__pyx_v_self->__pyx_base.num_samples); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_v_self->__pyx_base.num_samples); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__num_samples), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__num_samples), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_record.pyx":63 + /* "sklearn/earth/_record.pyx":65 * def _getstate(PruningPassRecord self): * result = {'num_samples': self.num_samples, - * 'num_variables': self.num_variables, # <<<<<<<<<<<<<< - * 'penalty': self.penalty, - * 'sst': self.sst, + * 'num_variables': self.num_variables, # <<<<<<<<<<<<<< + * 'penalty': self.penalty, + * 'sst': self.sst, */ - __pyx_t_2 = PyInt_FromLong(__pyx_v_self->__pyx_base.num_variables); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_v_self->__pyx_base.num_variables); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__num_variables), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__num_variables), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_record.pyx":64 + /* "sklearn/earth/_record.pyx":66 * result = {'num_samples': self.num_samples, - * 'num_variables': self.num_variables, - * 'penalty': self.penalty, # <<<<<<<<<<<<<< - * 'sst': self.sst, - * 'iterations': self.iterations, + * 'num_variables': self.num_variables, + * 'penalty': self.penalty, # <<<<<<<<<<<<<< + * 'sst': self.sst, + * 'iterations': self.iterations, */ - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.penalty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.penalty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__penalty), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__penalty), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_record.pyx":65 - * 'num_variables': self.num_variables, - * 'penalty': self.penalty, - * 'sst': self.sst, # <<<<<<<<<<<<<< - * 'iterations': self.iterations, - * 'selected': self.selected} + /* "sklearn/earth/_record.pyx":67 + * 'num_variables': self.num_variables, + * 'penalty': self.penalty, + * 'sst': self.sst, # <<<<<<<<<<<<<< + * 'iterations': self.iterations, + * 'selected': self.selected} */ - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.sst); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.sst); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__sst), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__sst), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_record.pyx":66 - * 'penalty': self.penalty, - * 'sst': self.sst, - * 'iterations': self.iterations, # <<<<<<<<<<<<<< - * 'selected': self.selected} + /* "sklearn/earth/_record.pyx":68 + * 'penalty': self.penalty, + * 'sst': self.sst, + * 'iterations': self.iterations, # <<<<<<<<<<<<<< + * 'selected': self.selected} * return result */ - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__iterations), ((PyObject *)__pyx_v_self->__pyx_base.iterations)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__iterations), ((PyObject *)__pyx_v_self->__pyx_base.iterations)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/earth/_record.pyx":67 - * 'sst': self.sst, - * 'iterations': self.iterations, - * 'selected': self.selected} # <<<<<<<<<<<<<< + /* "sklearn/earth/_record.pyx":69 + * 'sst': self.sst, + * 'iterations': self.iterations, + * 'selected': self.selected} # <<<<<<<<<<<<<< * return result * */ - __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->selected); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->selected); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__selected), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__selected), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_result = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_record.pyx":68 - * 'iterations': self.iterations, - * 'selected': self.selected} + /* "sklearn/earth/_record.pyx":70 + * 'iterations': self.iterations, + * 'selected': self.selected} * return result # <<<<<<<<<<<<<< * * def __setstate__(PruningPassRecord self, dict state): @@ -3604,7 +3604,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_7__setsta PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), (&PyDict_Type), 1, "state", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), (&PyDict_Type), 1, "state", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_6__setstate__(((struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_v_self), ((PyObject*)__pyx_v_state)); goto __pyx_L0; __pyx_L1_error:; @@ -3614,7 +3614,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_7__setsta return __pyx_r; } -/* "sklearn/earth/_record.pyx":70 +/* "sklearn/earth/_record.pyx":72 * return result * * def __setstate__(PruningPassRecord self, dict state): # <<<<<<<<<<<<<< @@ -3634,7 +3634,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_6__setsta int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate__", 0); - /* "sklearn/earth/_record.pyx":71 + /* "sklearn/earth/_record.pyx":73 * * def __setstate__(PruningPassRecord self, dict state): * self.num_samples = state['num_samples'] # <<<<<<<<<<<<<< @@ -3643,15 +3643,15 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_6__setsta */ if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__num_samples)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__num_samples)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->__pyx_base.num_samples = __pyx_t_2; - /* "sklearn/earth/_record.pyx":72 + /* "sklearn/earth/_record.pyx":74 * def __setstate__(PruningPassRecord self, dict state): * self.num_samples = state['num_samples'] * self.num_variables = state['num_variables'] # <<<<<<<<<<<<<< @@ -3660,15 +3660,15 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_6__setsta */ if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__num_variables)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__num_variables)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->__pyx_base.num_variables = __pyx_t_2; - /* "sklearn/earth/_record.pyx":73 + /* "sklearn/earth/_record.pyx":75 * self.num_samples = state['num_samples'] * self.num_variables = state['num_variables'] * self.penalty = state['penalty'] # <<<<<<<<<<<<<< @@ -3677,15 +3677,15 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_6__setsta */ if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__penalty)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__penalty)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->__pyx_base.penalty = __pyx_t_3; - /* "sklearn/earth/_record.pyx":74 + /* "sklearn/earth/_record.pyx":76 * self.num_variables = state['num_variables'] * self.penalty = state['penalty'] * self.sst = state['sst'] # <<<<<<<<<<<<<< @@ -3694,15 +3694,15 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_6__setsta */ if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__sst)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__sst)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->__pyx_base.sst = __pyx_t_3; - /* "sklearn/earth/_record.pyx":75 + /* "sklearn/earth/_record.pyx":77 * self.penalty = state['penalty'] * self.sst = state['sst'] * self.iterations = state['iterations'] # <<<<<<<<<<<<<< @@ -3711,18 +3711,18 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_6__setsta */ if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__iterations)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__iterations)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->__pyx_base.iterations); __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.iterations)); __pyx_v_self->__pyx_base.iterations = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_record.pyx":76 + /* "sklearn/earth/_record.pyx":78 * self.sst = state['sst'] * self.iterations = state['iterations'] * self.selected = state['selected'] # <<<<<<<<<<<<<< @@ -3731,11 +3731,11 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_6__setsta */ if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__selected)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__selected)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_4 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_4 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->selected = __pyx_t_4; @@ -3751,7 +3751,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_6__setsta return __pyx_r; } -/* "sklearn/earth/_record.pyx":78 +/* "sklearn/earth/_record.pyx":80 * self.selected = state['selected'] * * cpdef set_selected(PruningPassRecord self, INDEX_t selected): # <<<<<<<<<<<<<< @@ -3774,18 +3774,18 @@ static PyObject *__pyx_f_7sklearn_5earth_7_record_17PruningPassRecord_set_select if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__set_selected); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__set_selected); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_9set_selected)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_selected); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_selected); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; @@ -3796,7 +3796,7 @@ static PyObject *__pyx_f_7sklearn_5earth_7_record_17PruningPassRecord_set_select __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_record.pyx":79 + /* "sklearn/earth/_record.pyx":81 * * cpdef set_selected(PruningPassRecord self, INDEX_t selected): * self.selected = selected # <<<<<<<<<<<<<< @@ -3830,7 +3830,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_9set_sele __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_selected (wrapper)", 0); assert(__pyx_arg_selected); { - __pyx_v_selected = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_arg_selected); if (unlikely((__pyx_v_selected == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_selected = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_arg_selected); if (unlikely((__pyx_v_selected == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -3843,7 +3843,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_9set_sele return __pyx_r; } -/* "sklearn/earth/_record.pyx":78 +/* "sklearn/earth/_record.pyx":80 * self.selected = state['selected'] * * cpdef set_selected(PruningPassRecord self, INDEX_t selected): # <<<<<<<<<<<<<< @@ -3860,7 +3860,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_8set_sele int __pyx_clineno = 0; __Pyx_RefNannySetupContext("set_selected", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->set_selected(__pyx_v_self, __pyx_v_selected, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->set_selected(__pyx_v_self, __pyx_v_selected, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3878,7 +3878,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_8set_sele return __pyx_r; } -/* "sklearn/earth/_record.pyx":81 +/* "sklearn/earth/_record.pyx":83 * self.selected = selected * * cpdef INDEX_t get_selected(PruningPassRecord self): # <<<<<<<<<<<<<< @@ -3901,12 +3901,12 @@ static __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_f_7sklearn_5earth_7_record if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_selected); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_selected); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_11get_selected)) { - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -3915,7 +3915,7 @@ static __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_f_7sklearn_5earth_7_record __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_record.pyx":82 + /* "sklearn/earth/_record.pyx":84 * * cpdef INDEX_t get_selected(PruningPassRecord self): * return self.selected # <<<<<<<<<<<<<< @@ -3948,7 +3948,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_11get_sel return __pyx_r; } -/* "sklearn/earth/_record.pyx":81 +/* "sklearn/earth/_record.pyx":83 * self.selected = selected * * cpdef INDEX_t get_selected(PruningPassRecord self): # <<<<<<<<<<<<<< @@ -3965,7 +3965,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_10get_sel int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_selected", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_selected(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_selected(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 83; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3983,7 +3983,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_10get_sel return __pyx_r; } -/* "sklearn/earth/_record.pyx":84 +/* "sklearn/earth/_record.pyx":86 * return self.selected * * cpdef roll_back(PruningPassRecord self, Basis basis): # <<<<<<<<<<<<<< @@ -4012,16 +4012,16 @@ static PyObject *__pyx_f_7sklearn_5earth_7_record_17PruningPassRecord_roll_back( if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__roll_back); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__roll_back); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_13roll_back)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_basis)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_basis)); __Pyx_GIVEREF(((PyObject *)__pyx_v_basis)); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; @@ -4032,7 +4032,7 @@ static PyObject *__pyx_f_7sklearn_5earth_7_record_17PruningPassRecord_roll_back( __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_record.pyx":85 + /* "sklearn/earth/_record.pyx":87 * * cpdef roll_back(PruningPassRecord self, Basis basis): * cdef INDEX_t n = len(self.iterations) # <<<<<<<<<<<<<< @@ -4043,13 +4043,13 @@ static PyObject *__pyx_f_7sklearn_5earth_7_record_17PruningPassRecord_roll_back( __Pyx_INCREF(__pyx_t_1); if (unlikely(__pyx_t_1 == Py_None)) { PyErr_SetString(PyExc_TypeError, "object of type 'NoneType' has no len()"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_4 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyList_GET_SIZE(__pyx_t_1); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_n = __pyx_t_4; - /* "sklearn/earth/_record.pyx":87 + /* "sklearn/earth/_record.pyx":89 * cdef INDEX_t n = len(self.iterations) * cdef INDEX_t i * for i in range(n - self.selected - 1): # <<<<<<<<<<<<<< @@ -4060,7 +4060,7 @@ static PyObject *__pyx_f_7sklearn_5earth_7_record_17PruningPassRecord_roll_back( for (__pyx_t_6 = 0; __pyx_t_6 < __pyx_t_5; __pyx_t_6+=1) { __pyx_v_i = __pyx_t_6; - /* "sklearn/earth/_record.pyx":88 + /* "sklearn/earth/_record.pyx":90 * cdef INDEX_t i * for i in range(n - self.selected - 1): * basis[self.iterations[n - i - 1].get_pruned()].unprune() # <<<<<<<<<<<<<< @@ -4069,21 +4069,21 @@ static PyObject *__pyx_f_7sklearn_5earth_7_record_17PruningPassRecord_roll_back( */ if (unlikely(((PyObject *)__pyx_v_self->__pyx_base.iterations) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_7 = ((__pyx_v_n - __pyx_v_i) - 1); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_self->__pyx_base.iterations, __pyx_t_7), __pyx_n_s__get_pruned); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(PyList_GET_ITEM(__pyx_v_self->__pyx_base.iterations, __pyx_t_7), __pyx_n_s__get_pruned); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_basis), __pyx_t_3); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_basis), __pyx_t_3); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__unprune); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__unprune); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -4112,7 +4112,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_13roll_ba PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("roll_back (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_basis), __pyx_ptype_7sklearn_5earth_6_basis_Basis, 1, "basis", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_basis), __pyx_ptype_7sklearn_5earth_6_basis_Basis, 1, "basis", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_12roll_back(((struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_v_self), ((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)__pyx_v_basis)); goto __pyx_L0; __pyx_L1_error:; @@ -4122,7 +4122,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_13roll_ba return __pyx_r; } -/* "sklearn/earth/_record.pyx":84 +/* "sklearn/earth/_record.pyx":86 * return self.selected * * cpdef roll_back(PruningPassRecord self, Basis basis): # <<<<<<<<<<<<<< @@ -4139,7 +4139,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_12roll_ba int __pyx_clineno = 0; __Pyx_RefNannySetupContext("roll_back", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->roll_back(__pyx_v_self, __pyx_v_basis, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->roll_back(__pyx_v_self, __pyx_v_basis, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4168,7 +4168,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_17PruningPassRecord_15__str__ return __pyx_r; } -/* "sklearn/earth/_record.pyx":90 +/* "sklearn/earth/_record.pyx":92 * basis[self.iterations[n - i - 1].get_pruned()].unprune() * * def __str__(PruningPassRecord self): # <<<<<<<<<<<<<< @@ -4200,7 +4200,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_14__str__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - /* "sklearn/earth/_record.pyx":91 + /* "sklearn/earth/_record.pyx":93 * * def __str__(PruningPassRecord self): * result = '' # <<<<<<<<<<<<<< @@ -4210,52 +4210,52 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_14__str__ __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); __pyx_v_result = ((PyObject *)__pyx_kp_s_1); - /* "sklearn/earth/_record.pyx":92 + /* "sklearn/earth/_record.pyx":94 * def __str__(PruningPassRecord self): * result = '' * result += 'Pruning Pass\n' # <<<<<<<<<<<<<< * header = 'iter\tbf\tterms\tmse\tgcv\trsq\tgrsq'.split('\t') * data = [] */ - __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_v_result); __pyx_v_result = __pyx_t_1; __pyx_t_1 = 0; - /* "sklearn/earth/_record.pyx":93 + /* "sklearn/earth/_record.pyx":95 * result = '' * result += 'Pruning Pass\n' * header = 'iter\tbf\tterms\tmse\tgcv\trsq\tgrsq'.split('\t') # <<<<<<<<<<<<<< * data = [] * for i, iteration in enumerate(self.iterations): */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_3), __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_kp_s_3), __pyx_n_s__split); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_header = __pyx_t_2; __pyx_t_2 = 0; - /* "sklearn/earth/_record.pyx":94 + /* "sklearn/earth/_record.pyx":96 * result += 'Pruning Pass\n' * header = 'iter\tbf\tterms\tmse\tgcv\trsq\tgrsq'.split('\t') * data = [] # <<<<<<<<<<<<<< * for i, iteration in enumerate(self.iterations): - * row = str(i) + '\t' + str(iteration) + '\t%.3f\t%.3f\t%.3f' % (self.gcv(i),self.rsq(i),self.grsq(i)) + * row = str(i) + '\t' + str(iteration) + '\t%.3f\t%.3f\t%.3f' % ( */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_v_data = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_record.pyx":95 + /* "sklearn/earth/_record.pyx":97 * header = 'iter\tbf\tterms\tmse\tgcv\trsq\tgrsq'.split('\t') * data = [] * for i, iteration in enumerate(self.iterations): # <<<<<<<<<<<<<< - * row = str(i) + '\t' + str(iteration) + '\t%.3f\t%.3f\t%.3f' % (self.gcv(i),self.rsq(i),self.grsq(i)) - * data.append(row.split('\t')) + * row = str(i) + '\t' + str(iteration) + '\t%.3f\t%.3f\t%.3f' % ( + * self.gcv(i), self.rsq(i), self.grsq(i)) */ __Pyx_INCREF(__pyx_int_0); __pyx_t_2 = __pyx_int_0; @@ -4263,9 +4263,9 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_14__str__ for (;;) { if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_1)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif __Pyx_XDECREF(__pyx_v_iteration); __pyx_v_iteration = __pyx_t_4; @@ -4273,52 +4273,60 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_14__str__ __Pyx_INCREF(__pyx_t_2); __Pyx_XDECREF(__pyx_v_i); __pyx_v_i = __pyx_t_2; - __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = __pyx_t_4; __pyx_t_4 = 0; - /* "sklearn/earth/_record.pyx":96 + /* "sklearn/earth/_record.pyx":98 * data = [] * for i, iteration in enumerate(self.iterations): - * row = str(i) + '\t' + str(iteration) + '\t%.3f\t%.3f\t%.3f' % (self.gcv(i),self.rsq(i),self.grsq(i)) # <<<<<<<<<<<<<< + * row = str(i) + '\t' + str(iteration) + '\t%.3f\t%.3f\t%.3f' % ( # <<<<<<<<<<<<<< + * self.gcv(i), self.rsq(i), self.grsq(i)) * data.append(row.split('\t')) - * result += ascii_table(header,data) */ - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_i); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_i); __Pyx_GIVEREF(__pyx_v_i); - __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Add(__pyx_t_5, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Add(__pyx_t_5, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_iteration); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_iteration); __Pyx_GIVEREF(__pyx_v_iteration); - __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_Add(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Add(__pyx_t_4, __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_7 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_i); if (unlikely((__pyx_t_7 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.gcv(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self), __pyx_t_7, 0)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/earth/_record.pyx":99 + * for i, iteration in enumerate(self.iterations): + * row = str(i) + '\t' + str(iteration) + '\t%.3f\t%.3f\t%.3f' % ( + * self.gcv(i), self.rsq(i), self.grsq(i)) # <<<<<<<<<<<<<< + * data.append(row.split('\t')) + * result += ascii_table(header, data) + */ + __pyx_t_7 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_i); if (unlikely((__pyx_t_7 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.gcv(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self), __pyx_t_7, 0)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_i); if (unlikely((__pyx_t_7 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.rsq(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self), __pyx_t_7, 0)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_i); if (unlikely((__pyx_t_7 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.rsq(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self), __pyx_t_7, 0)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_i); if (unlikely((__pyx_t_7 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_8 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.grsq(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self), __pyx_t_7, 0)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_i); if (unlikely((__pyx_t_7 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.grsq(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self), __pyx_t_7, 0)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); @@ -4329,10 +4337,10 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_14__str__ __pyx_t_6 = 0; __pyx_t_4 = 0; __pyx_t_8 = 0; - __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_6), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_6), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - __pyx_t_9 = PyNumber_Add(__pyx_t_5, ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyNumber_Add(__pyx_t_5, ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; @@ -4340,73 +4348,73 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_14__str__ __pyx_v_row = __pyx_t_9; __pyx_t_9 = 0; - /* "sklearn/earth/_record.pyx":97 - * for i, iteration in enumerate(self.iterations): - * row = str(i) + '\t' + str(iteration) + '\t%.3f\t%.3f\t%.3f' % (self.gcv(i),self.rsq(i),self.grsq(i)) + /* "sklearn/earth/_record.pyx":100 + * row = str(i) + '\t' + str(iteration) + '\t%.3f\t%.3f\t%.3f' % ( + * self.gcv(i), self.rsq(i), self.grsq(i)) * data.append(row.split('\t')) # <<<<<<<<<<<<<< - * result += ascii_table(header,data) - * result += '\nSelected iteration: ' + str(self.selected) + '\n' + * result += ascii_table(header, data) + * result += '\nSelected iteration: ' + str(self.selected) + '\n' */ - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_row, __pyx_n_s__split); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(__pyx_v_row, __pyx_n_s__split); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_k_tuple_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_k_tuple_7), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_data, __pyx_t_8); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_data, __pyx_t_8); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_record.pyx":98 - * row = str(i) + '\t' + str(iteration) + '\t%.3f\t%.3f\t%.3f' % (self.gcv(i),self.rsq(i),self.grsq(i)) + /* "sklearn/earth/_record.pyx":101 + * self.gcv(i), self.rsq(i), self.grsq(i)) * data.append(row.split('\t')) - * result += ascii_table(header,data) # <<<<<<<<<<<<<< - * result += '\nSelected iteration: ' + str(self.selected) + '\n' + * result += ascii_table(header, data) # <<<<<<<<<<<<<< + * result += '\nSelected iteration: ' + str(self.selected) + '\n' * return result */ - __pyx_t_2 = __pyx_f_7sklearn_5earth_5_util_ascii_table(__pyx_v_header, ((PyObject *)__pyx_v_data), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_f_7sklearn_5earth_5_util_ascii_table(__pyx_v_header, ((PyObject *)__pyx_v_data), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_result, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_result, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_v_result); __pyx_v_result = __pyx_t_1; __pyx_t_1 = 0; - /* "sklearn/earth/_record.pyx":99 + /* "sklearn/earth/_record.pyx":102 * data.append(row.split('\t')) - * result += ascii_table(header,data) - * result += '\nSelected iteration: ' + str(self.selected) + '\n' # <<<<<<<<<<<<<< + * result += ascii_table(header, data) + * result += '\nSelected iteration: ' + str(self.selected) + '\n' # <<<<<<<<<<<<<< * return result * */ - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->selected); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->selected); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Add(((PyObject *)__pyx_kp_s_8), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Add(((PyObject *)__pyx_kp_s_8), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Add(__pyx_t_2, ((PyObject *)__pyx_kp_s_9)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Add(__pyx_t_2, ((PyObject *)__pyx_kp_s_9)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_result, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_result, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_v_result); __pyx_v_result = __pyx_t_2; __pyx_t_2 = 0; - /* "sklearn/earth/_record.pyx":100 - * result += ascii_table(header,data) - * result += '\nSelected iteration: ' + str(self.selected) + '\n' + /* "sklearn/earth/_record.pyx":103 + * result += ascii_table(header, data) + * result += '\nSelected iteration: ' + str(self.selected) + '\n' * return result # <<<<<<<<<<<<<< * * cdef class ForwardPassRecord(Record): @@ -4477,26 +4485,26 @@ static int __pyx_pw_7sklearn_5earth_7_record_17ForwardPassRecord_1__init__(PyObj case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__num_variables)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__penalty)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__sst)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xlabels)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { goto __pyx_L5_argtuple_error; @@ -4507,21 +4515,21 @@ static int __pyx_pw_7sklearn_5earth_7_record_17ForwardPassRecord_1__init__(PyObj values[3] = PyTuple_GET_ITEM(__pyx_args, 3); values[4] = PyTuple_GET_ITEM(__pyx_args, 4); } - __pyx_v_num_samples = __Pyx_PyInt_from_py_npy_ulonglong(values[0]); if (unlikely((__pyx_v_num_samples == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_num_variables = __Pyx_PyInt_from_py_npy_ulonglong(values[1]); if (unlikely((__pyx_v_num_variables == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_penalty = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_penalty == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_sst = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_sst == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_num_samples = __Pyx_PyInt_from_py_npy_ulonglong(values[0]); if (unlikely((__pyx_v_num_samples == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_num_variables = __Pyx_PyInt_from_py_npy_ulonglong(values[1]); if (unlikely((__pyx_v_num_variables == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_penalty = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_penalty == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_sst = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_sst == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_v_xlabels = ((PyObject*)values[4]); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.earth._record.ForwardPassRecord.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xlabels), (&PyList_Type), 1, "xlabels", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xlabels), (&PyList_Type), 1, "xlabels", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord___init__(((struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *)__pyx_v_self), __pyx_v_num_samples, __pyx_v_num_variables, __pyx_v_penalty, __pyx_v_sst, __pyx_v_xlabels); goto __pyx_L0; __pyx_L1_error:; @@ -4531,7 +4539,7 @@ static int __pyx_pw_7sklearn_5earth_7_record_17ForwardPassRecord_1__init__(PyObj return __pyx_r; } -/* "sklearn/earth/_record.pyx":103 +/* "sklearn/earth/_record.pyx":106 * * cdef class ForwardPassRecord(Record): * def __init__(ForwardPassRecord self, INDEX_t num_samples, INDEX_t num_variables, FLOAT_t penalty, FLOAT_t sst, list xlabels): # <<<<<<<<<<<<<< @@ -4549,7 +4557,7 @@ static int __pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord___init__(struct int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__init__", 0); - /* "sklearn/earth/_record.pyx":104 + /* "sklearn/earth/_record.pyx":107 * cdef class ForwardPassRecord(Record): * def __init__(ForwardPassRecord self, INDEX_t num_samples, INDEX_t num_variables, FLOAT_t penalty, FLOAT_t sst, list xlabels): * self.num_samples = num_samples # <<<<<<<<<<<<<< @@ -4558,7 +4566,7 @@ static int __pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord___init__(struct */ __pyx_v_self->__pyx_base.num_samples = __pyx_v_num_samples; - /* "sklearn/earth/_record.pyx":105 + /* "sklearn/earth/_record.pyx":108 * def __init__(ForwardPassRecord self, INDEX_t num_samples, INDEX_t num_variables, FLOAT_t penalty, FLOAT_t sst, list xlabels): * self.num_samples = num_samples * self.num_variables = num_variables # <<<<<<<<<<<<<< @@ -4567,7 +4575,7 @@ static int __pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord___init__(struct */ __pyx_v_self->__pyx_base.num_variables = __pyx_v_num_variables; - /* "sklearn/earth/_record.pyx":106 + /* "sklearn/earth/_record.pyx":109 * self.num_samples = num_samples * self.num_variables = num_variables * self.penalty = penalty # <<<<<<<<<<<<<< @@ -4576,7 +4584,7 @@ static int __pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord___init__(struct */ __pyx_v_self->__pyx_base.penalty = __pyx_v_penalty; - /* "sklearn/earth/_record.pyx":107 + /* "sklearn/earth/_record.pyx":110 * self.num_variables = num_variables * self.penalty = penalty * self.sst = sst # <<<<<<<<<<<<<< @@ -4585,24 +4593,24 @@ static int __pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord___init__(struct */ __pyx_v_self->__pyx_base.sst = __pyx_v_sst; - /* "sklearn/earth/_record.pyx":108 + /* "sklearn/earth/_record.pyx":111 * self.penalty = penalty * self.sst = sst * self.iterations = [FirstForwardPassIteration(self.sst)] # <<<<<<<<<<<<<< * self.xlabels = xlabels * */ - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.sst); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.sst); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_FirstForwardPassIteration)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_FirstForwardPassIteration)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyList_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); @@ -4613,7 +4621,7 @@ static int __pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord___init__(struct __pyx_v_self->__pyx_base.iterations = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_record.pyx":109 + /* "sklearn/earth/_record.pyx":112 * self.sst = sst * self.iterations = [FirstForwardPassIteration(self.sst)] * self.xlabels = xlabels # <<<<<<<<<<<<<< @@ -4649,11 +4657,11 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_17ForwardPassRecord_3__reduce return __pyx_r; } -/* "sklearn/earth/_record.pyx":111 +/* "sklearn/earth/_record.pyx":114 * self.xlabels = xlabels * * def __reduce__(ForwardPassRecord self): # <<<<<<<<<<<<<< - * return (ForwardPassRecord, (self.num_samples,self.num_variables,self.penalty,self.sst,self.xlabels), self._getstate()) + * return (ForwardPassRecord, (self.num_samples, self.num_variables, self.penalty, self.sst, self.xlabels), self._getstate()) * */ @@ -4670,23 +4678,23 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_2__reduce int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce__", 0); - /* "sklearn/earth/_record.pyx":112 + /* "sklearn/earth/_record.pyx":115 * * def __reduce__(ForwardPassRecord self): - * return (ForwardPassRecord, (self.num_samples,self.num_variables,self.penalty,self.sst,self.xlabels), self._getstate()) # <<<<<<<<<<<<<< + * return (ForwardPassRecord, (self.num_samples, self.num_variables, self.penalty, self.sst, self.xlabels), self._getstate()) # <<<<<<<<<<<<<< * * def _getstate(ForwardPassRecord self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(__pyx_v_self->__pyx_base.num_samples); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->__pyx_base.num_samples); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromLong(__pyx_v_self->__pyx_base.num_variables); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_v_self->__pyx_base.num_variables); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.penalty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.penalty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.sst); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.sst); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); @@ -4703,12 +4711,12 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_2__reduce __pyx_t_2 = 0; __pyx_t_3 = 0; __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_ForwardPassRecord))); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_ForwardPassRecord))); @@ -4750,8 +4758,8 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_17ForwardPassRecord_5_getstat return __pyx_r; } -/* "sklearn/earth/_record.pyx":114 - * return (ForwardPassRecord, (self.num_samples,self.num_variables,self.penalty,self.sst,self.xlabels), self._getstate()) +/* "sklearn/earth/_record.pyx":117 + * return (ForwardPassRecord, (self.num_samples, self.num_variables, self.penalty, self.sst, self.xlabels), self._getstate()) * * def _getstate(ForwardPassRecord self): # <<<<<<<<<<<<<< * return {'num_samples': self.num_samples, @@ -4768,7 +4776,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_4_getstat int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_getstate", 0); - /* "sklearn/earth/_record.pyx":115 + /* "sklearn/earth/_record.pyx":118 * * def _getstate(ForwardPassRecord self): * return {'num_samples': self.num_samples, # <<<<<<<<<<<<<< @@ -4776,66 +4784,66 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_4_getstat * 'penalty': self.penalty, */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = PyInt_FromLong(__pyx_v_self->__pyx_base.num_samples); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_v_self->__pyx_base.num_samples); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__num_samples), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__num_samples), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_record.pyx":116 + /* "sklearn/earth/_record.pyx":119 * def _getstate(ForwardPassRecord self): * return {'num_samples': self.num_samples, * 'num_variables': self.num_variables, # <<<<<<<<<<<<<< * 'penalty': self.penalty, * 'sst': self.sst, */ - __pyx_t_2 = PyInt_FromLong(__pyx_v_self->__pyx_base.num_variables); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_v_self->__pyx_base.num_variables); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__num_variables), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__num_variables), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_record.pyx":117 + /* "sklearn/earth/_record.pyx":120 * return {'num_samples': self.num_samples, * 'num_variables': self.num_variables, * 'penalty': self.penalty, # <<<<<<<<<<<<<< * 'sst': self.sst, * 'iterations': self.iterations, */ - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.penalty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.penalty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__penalty), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__penalty), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_record.pyx":118 + /* "sklearn/earth/_record.pyx":121 * 'num_variables': self.num_variables, * 'penalty': self.penalty, * 'sst': self.sst, # <<<<<<<<<<<<<< * 'iterations': self.iterations, * 'xlabels': self.xlabels} */ - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.sst); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.sst); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__sst), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__sst), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_record.pyx":119 + /* "sklearn/earth/_record.pyx":122 * 'penalty': self.penalty, * 'sst': self.sst, * 'iterations': self.iterations, # <<<<<<<<<<<<<< * 'xlabels': self.xlabels} * */ - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__iterations), ((PyObject *)__pyx_v_self->__pyx_base.iterations)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__iterations), ((PyObject *)__pyx_v_self->__pyx_base.iterations)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/earth/_record.pyx":120 + /* "sklearn/earth/_record.pyx":123 * 'sst': self.sst, * 'iterations': self.iterations, * 'xlabels': self.xlabels} # <<<<<<<<<<<<<< * * def __setstate__(ForwardPassRecord self, dict state): */ - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__xlabels), ((PyObject *)__pyx_v_self->xlabels)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__xlabels), ((PyObject *)__pyx_v_self->xlabels)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; @@ -4862,7 +4870,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_17ForwardPassRecord_7__setsta PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), (&PyDict_Type), 1, "state", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), (&PyDict_Type), 1, "state", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_6__setstate__(((struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *)__pyx_v_self), ((PyObject*)__pyx_v_state)); goto __pyx_L0; __pyx_L1_error:; @@ -4872,7 +4880,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_17ForwardPassRecord_7__setsta return __pyx_r; } -/* "sklearn/earth/_record.pyx":122 +/* "sklearn/earth/_record.pyx":125 * 'xlabels': self.xlabels} * * def __setstate__(ForwardPassRecord self, dict state): # <<<<<<<<<<<<<< @@ -4891,7 +4899,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_6__setsta int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate__", 0); - /* "sklearn/earth/_record.pyx":123 + /* "sklearn/earth/_record.pyx":126 * * def __setstate__(ForwardPassRecord self, dict state): * self.num_samples = state['num_samples'] # <<<<<<<<<<<<<< @@ -4900,15 +4908,15 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_6__setsta */ if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__num_samples)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__num_samples)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->__pyx_base.num_samples = __pyx_t_2; - /* "sklearn/earth/_record.pyx":124 + /* "sklearn/earth/_record.pyx":127 * def __setstate__(ForwardPassRecord self, dict state): * self.num_samples = state['num_samples'] * self.num_variables = state['num_variables'] # <<<<<<<<<<<<<< @@ -4917,15 +4925,15 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_6__setsta */ if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__num_variables)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__num_variables)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->__pyx_base.num_variables = __pyx_t_2; - /* "sklearn/earth/_record.pyx":125 + /* "sklearn/earth/_record.pyx":128 * self.num_samples = state['num_samples'] * self.num_variables = state['num_variables'] * self.penalty = state['penalty'] # <<<<<<<<<<<<<< @@ -4934,15 +4942,15 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_6__setsta */ if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__penalty)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__penalty)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 125; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->__pyx_base.penalty = __pyx_t_3; - /* "sklearn/earth/_record.pyx":126 + /* "sklearn/earth/_record.pyx":129 * self.num_variables = state['num_variables'] * self.penalty = state['penalty'] * self.sst = state['sst'] # <<<<<<<<<<<<<< @@ -4951,15 +4959,15 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_6__setsta */ if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__sst)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__sst)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->__pyx_base.sst = __pyx_t_3; - /* "sklearn/earth/_record.pyx":127 + /* "sklearn/earth/_record.pyx":130 * self.penalty = state['penalty'] * self.sst = state['sst'] * self.iterations = state['iterations'] # <<<<<<<<<<<<<< @@ -4968,18 +4976,18 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_6__setsta */ if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__iterations)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__iterations)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->__pyx_base.iterations); __Pyx_DECREF(((PyObject *)__pyx_v_self->__pyx_base.iterations)); __pyx_v_self->__pyx_base.iterations = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_record.pyx":128 + /* "sklearn/earth/_record.pyx":131 * self.sst = state['sst'] * self.iterations = state['iterations'] * self.xlabels = state['xlabels'] # <<<<<<<<<<<<<< @@ -4988,11 +4996,11 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_6__setsta */ if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__xlabels)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__xlabels)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(PyList_CheckExact(__pyx_t_1))||((__pyx_t_1) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_1)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->xlabels); __Pyx_DECREF(((PyObject *)__pyx_v_self->xlabels)); @@ -5011,7 +5019,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_6__setsta return __pyx_r; } -/* "sklearn/earth/_record.pyx":130 +/* "sklearn/earth/_record.pyx":133 * self.xlabels = state['xlabels'] * * cpdef set_stopping_condition(ForwardPassRecord self, int stopping_condition): # <<<<<<<<<<<<<< @@ -5034,18 +5042,18 @@ static PyObject *__pyx_f_7sklearn_5earth_7_record_17ForwardPassRecord_set_stoppi if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_10); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_10); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_17ForwardPassRecord_9set_stopping_condition)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyInt_FromLong(__pyx_v_stopping_condition); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_v_stopping_condition); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; @@ -5056,7 +5064,7 @@ static PyObject *__pyx_f_7sklearn_5earth_7_record_17ForwardPassRecord_set_stoppi __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_record.pyx":131 + /* "sklearn/earth/_record.pyx":134 * * cpdef set_stopping_condition(ForwardPassRecord self, int stopping_condition): * self.stopping_condition = stopping_condition # <<<<<<<<<<<<<< @@ -5090,7 +5098,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_17ForwardPassRecord_9set_stop __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_stopping_condition (wrapper)", 0); assert(__pyx_arg_stopping_condition); { - __pyx_v_stopping_condition = __Pyx_PyInt_AsInt(__pyx_arg_stopping_condition); if (unlikely((__pyx_v_stopping_condition == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_stopping_condition = __Pyx_PyInt_AsInt(__pyx_arg_stopping_condition); if (unlikely((__pyx_v_stopping_condition == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -5103,7 +5111,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_17ForwardPassRecord_9set_stop return __pyx_r; } -/* "sklearn/earth/_record.pyx":130 +/* "sklearn/earth/_record.pyx":133 * self.xlabels = state['xlabels'] * * cpdef set_stopping_condition(ForwardPassRecord self, int stopping_condition): # <<<<<<<<<<<<<< @@ -5120,7 +5128,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_8set_stop int __pyx_clineno = 0; __Pyx_RefNannySetupContext("set_stopping_condition", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->set_stopping_condition(__pyx_v_self, __pyx_v_stopping_condition, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->set_stopping_condition(__pyx_v_self, __pyx_v_stopping_condition, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -5149,12 +5157,12 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_17ForwardPassRecord_11__str__ return __pyx_r; } -/* "sklearn/earth/_record.pyx":133 +/* "sklearn/earth/_record.pyx":136 * self.stopping_condition = stopping_condition * * def __str__(ForwardPassRecord self): # <<<<<<<<<<<<<< - * header = ['iter','parent','var','knot','mse','terms','gcv','rsq','grsq'] - * data = [] + * header = ['iter', 'parent', 'var', 'knot', + * 'mse', 'terms', 'gcv', 'rsq', 'grsq'] */ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_10__str__(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *__pyx_v_self) { @@ -5180,14 +5188,14 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_10__str__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - /* "sklearn/earth/_record.pyx":134 + /* "sklearn/earth/_record.pyx":137 * * def __str__(ForwardPassRecord self): - * header = ['iter','parent','var','knot','mse','terms','gcv','rsq','grsq'] # <<<<<<<<<<<<<< + * header = ['iter', 'parent', 'var', 'knot', # <<<<<<<<<<<<<< + * 'mse', 'terms', 'gcv', 'rsq', 'grsq'] * data = [] - * for i, iteration in enumerate(self.iterations): */ - __pyx_t_1 = PyList_New(9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyList_New(9); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_n_s__iter)); PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__iter)); @@ -5219,24 +5227,24 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_10__str__ __pyx_v_header = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_record.pyx":135 - * def __str__(ForwardPassRecord self): - * header = ['iter','parent','var','knot','mse','terms','gcv','rsq','grsq'] + /* "sklearn/earth/_record.pyx":139 + * header = ['iter', 'parent', 'var', 'knot', + * 'mse', 'terms', 'gcv', 'rsq', 'grsq'] * data = [] # <<<<<<<<<<<<<< * for i, iteration in enumerate(self.iterations): - * data.append([str(i)] + str(iteration).split('\t') + ('%.3f\t%.3f\t%.3f' % (self.gcv(i),self.rsq(i),self.grsq(i))).split('\t')) + * data.append( */ - __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyList_New(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_data = ((PyObject*)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_record.pyx":136 - * header = ['iter','parent','var','knot','mse','terms','gcv','rsq','grsq'] + /* "sklearn/earth/_record.pyx":140 + * 'mse', 'terms', 'gcv', 'rsq', 'grsq'] * data = [] * for i, iteration in enumerate(self.iterations): # <<<<<<<<<<<<<< - * data.append([str(i)] + str(iteration).split('\t') + ('%.3f\t%.3f\t%.3f' % (self.gcv(i),self.rsq(i),self.grsq(i))).split('\t')) - * result = '' + * data.append( + * [str(i)] + str(iteration).split('\t') + ('%.3f\t%.3f\t%.3f' % */ __Pyx_INCREF(__pyx_int_0); __pyx_t_1 = __pyx_int_0; @@ -5244,9 +5252,9 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_10__str__ for (;;) { if (__pyx_t_3 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_3); __Pyx_INCREF(__pyx_t_4); __pyx_t_3++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif __Pyx_XDECREF(__pyx_v_iteration); __pyx_v_iteration = __pyx_t_4; @@ -5254,60 +5262,68 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_10__str__ __Pyx_INCREF(__pyx_t_1); __Pyx_XDECREF(__pyx_v_i); __pyx_v_i = __pyx_t_1; - __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = __pyx_t_4; __pyx_t_4 = 0; - /* "sklearn/earth/_record.pyx":137 - * data = [] + /* "sklearn/earth/_record.pyx":142 * for i, iteration in enumerate(self.iterations): - * data.append([str(i)] + str(iteration).split('\t') + ('%.3f\t%.3f\t%.3f' % (self.gcv(i),self.rsq(i),self.grsq(i))).split('\t')) # <<<<<<<<<<<<<< + * data.append( + * [str(i)] + str(iteration).split('\t') + ('%.3f\t%.3f\t%.3f' % # <<<<<<<<<<<<<< + * (self.gcv(i), self.rsq(i), self.grsq(i))).split('\t')) * result = '' - * result += 'Forward Pass\n' */ - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_v_i); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_i); __Pyx_GIVEREF(__pyx_v_i); - __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyList_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyList_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_iteration); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_iteration); __Pyx_GIVEREF(__pyx_v_iteration); - __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__split); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_GetAttrStr(__pyx_t_6, __pyx_n_s__split); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_k_tuple_11), NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_t_4), __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_t_4), __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_7 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_i); if (unlikely((__pyx_t_7 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.gcv(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self), __pyx_t_7, 0)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/earth/_record.pyx":143 + * data.append( + * [str(i)] + str(iteration).split('\t') + ('%.3f\t%.3f\t%.3f' % + * (self.gcv(i), self.rsq(i), self.grsq(i))).split('\t')) # <<<<<<<<<<<<<< + * result = '' + * result += 'Forward Pass\n' + */ + __pyx_t_7 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_i); if (unlikely((__pyx_t_7 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.gcv(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self), __pyx_t_7, 0)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_7 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_i); if (unlikely((__pyx_t_7 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.rsq(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self), __pyx_t_7, 0)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_i); if (unlikely((__pyx_t_7 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.rsq(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self), __pyx_t_7, 0)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_i); if (unlikely((__pyx_t_7 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_8 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.grsq(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self), __pyx_t_7, 0)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_i); if (unlikely((__pyx_t_7 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord *)__pyx_v_self->__pyx_base.__pyx_vtab)->__pyx_base.grsq(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self), __pyx_t_7, 0)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_6); __Pyx_GIVEREF(__pyx_t_6); @@ -5318,28 +5334,28 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_10__str__ __pyx_t_6 = 0; __pyx_t_4 = 0; __pyx_t_8 = 0; - __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_12), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_12), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_t_8), __pyx_n_s__split); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_t_8), __pyx_n_s__split); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_t_9, ((PyObject *)__pyx_k_tuple_13), NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyNumber_Add(__pyx_t_5, __pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyNumber_Add(__pyx_t_5, __pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_data, __pyx_t_9); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyList_Append(__pyx_v_data, __pyx_t_9); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_record.pyx":138 - * for i, iteration in enumerate(self.iterations): - * data.append([str(i)] + str(iteration).split('\t') + ('%.3f\t%.3f\t%.3f' % (self.gcv(i),self.rsq(i),self.grsq(i))).split('\t')) + /* "sklearn/earth/_record.pyx":144 + * [str(i)] + str(iteration).split('\t') + ('%.3f\t%.3f\t%.3f' % + * (self.gcv(i), self.rsq(i), self.grsq(i))).split('\t')) * result = '' # <<<<<<<<<<<<<< * result += 'Forward Pass\n' * result += ascii_table(header, data) @@ -5347,51 +5363,51 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_10__str__ __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); __pyx_v_result = ((PyObject *)__pyx_kp_s_1); - /* "sklearn/earth/_record.pyx":139 - * data.append([str(i)] + str(iteration).split('\t') + ('%.3f\t%.3f\t%.3f' % (self.gcv(i),self.rsq(i),self.grsq(i))).split('\t')) + /* "sklearn/earth/_record.pyx":145 + * (self.gcv(i), self.rsq(i), self.grsq(i))).split('\t')) * result = '' * result += 'Forward Pass\n' # <<<<<<<<<<<<<< * result += ascii_table(header, data) - * result += '\nStopping Condition %d: %s\n' % (self.stopping_condition, stopping_conditions[self.stopping_condition]) + * result += '\nStopping Condition %d: %s\n' % ( */ - __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_14)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_14)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_v_result); __pyx_v_result = __pyx_t_1; __pyx_t_1 = 0; - /* "sklearn/earth/_record.pyx":140 + /* "sklearn/earth/_record.pyx":146 * result = '' * result += 'Forward Pass\n' * result += ascii_table(header, data) # <<<<<<<<<<<<<< - * result += '\nStopping Condition %d: %s\n' % (self.stopping_condition, stopping_conditions[self.stopping_condition]) - * return result + * result += '\nStopping Condition %d: %s\n' % ( + * self.stopping_condition, stopping_conditions[self.stopping_condition]) */ - __pyx_t_1 = __pyx_f_7sklearn_5earth_5_util_ascii_table(((PyObject *)__pyx_v_header), ((PyObject *)__pyx_v_data), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_f_7sklearn_5earth_5_util_ascii_table(((PyObject *)__pyx_v_header), ((PyObject *)__pyx_v_data), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_result, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_result, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_v_result); __pyx_v_result = __pyx_t_2; __pyx_t_2 = 0; - /* "sklearn/earth/_record.pyx":141 - * result += 'Forward Pass\n' + /* "sklearn/earth/_record.pyx":148 * result += ascii_table(header, data) - * result += '\nStopping Condition %d: %s\n' % (self.stopping_condition, stopping_conditions[self.stopping_condition]) # <<<<<<<<<<<<<< + * result += '\nStopping Condition %d: %s\n' % ( + * self.stopping_condition, stopping_conditions[self.stopping_condition]) # <<<<<<<<<<<<<< * return result * */ - __pyx_t_2 = PyInt_FromLong(__pyx_v_self->stopping_condition); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_v_self->stopping_condition); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (unlikely(((PyObject *)__pyx_v_7sklearn_5earth_8_forward_stopping_conditions) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_7sklearn_5earth_8_forward_stopping_conditions), __pyx_v_self->stopping_condition, sizeof(int), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_7sklearn_5earth_8_forward_stopping_conditions), __pyx_v_self->stopping_condition, sizeof(int), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); @@ -5399,19 +5415,19 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_10__str__ __Pyx_GIVEREF(__pyx_t_1); __pyx_t_2 = 0; __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_15), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_15), ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - __pyx_t_9 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_v_result); __pyx_v_result = __pyx_t_9; __pyx_t_9 = 0; - /* "sklearn/earth/_record.pyx":142 - * result += ascii_table(header, data) - * result += '\nStopping Condition %d: %s\n' % (self.stopping_condition, stopping_conditions[self.stopping_condition]) + /* "sklearn/earth/_record.pyx":149 + * result += '\nStopping Condition %d: %s\n' % ( + * self.stopping_condition, stopping_conditions[self.stopping_condition]) * return result # <<<<<<<<<<<<<< * * cdef class Iteration: @@ -5454,7 +5470,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_9Iteration_1__richcmp__(PyObj PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__richcmp__ (wrapper)", 0); - __pyx_v_method = PyInt_FromLong(__pyx_arg_method); if (unlikely(!__pyx_v_method)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_method = PyInt_FromLong(__pyx_arg_method); if (unlikely(!__pyx_v_method)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __Pyx_GOTREF(__pyx_v_method); goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -5468,7 +5484,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_9Iteration_1__richcmp__(PyObj return __pyx_r; } -/* "sklearn/earth/_record.pyx":146 +/* "sklearn/earth/_record.pyx":153 * cdef class Iteration: * * def __richcmp__(self, other, method): # <<<<<<<<<<<<<< @@ -5488,19 +5504,19 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_9Iteration___richcmp__(PyObje int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__richcmp__", 0); - /* "sklearn/earth/_record.pyx":147 + /* "sklearn/earth/_record.pyx":154 * * def __richcmp__(self, other, method): * if method == 2: # <<<<<<<<<<<<<< * return self._eq(other) * elif method == 3: */ - __pyx_t_1 = PyObject_RichCompare(__pyx_v_method, __pyx_int_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_v_method, __pyx_int_2, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_2) { - /* "sklearn/earth/_record.pyx":148 + /* "sklearn/earth/_record.pyx":155 * def __richcmp__(self, other, method): * if method == 2: * return self._eq(other) # <<<<<<<<<<<<<< @@ -5508,14 +5524,14 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_9Iteration___richcmp__(PyObje * return not self._eq(other) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s___eq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s___eq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_other); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_other); __Pyx_GIVEREF(__pyx_v_other); - __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; @@ -5525,19 +5541,19 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_9Iteration___richcmp__(PyObje goto __pyx_L3; } - /* "sklearn/earth/_record.pyx":149 + /* "sklearn/earth/_record.pyx":156 * if method == 2: * return self._eq(other) * elif method == 3: # <<<<<<<<<<<<<< * return not self._eq(other) * else: */ - __pyx_t_4 = PyObject_RichCompare(__pyx_v_method, __pyx_int_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_RichCompare(__pyx_v_method, __pyx_int_3, Py_EQ); __Pyx_XGOTREF(__pyx_t_4); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_4); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if (__pyx_t_2) { - /* "sklearn/earth/_record.pyx":150 + /* "sklearn/earth/_record.pyx":157 * return self._eq(other) * elif method == 3: * return not self._eq(other) # <<<<<<<<<<<<<< @@ -5545,20 +5561,20 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_9Iteration___richcmp__(PyObje * return NotImplemented */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s___eq); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_GetAttrStr(__pyx_v_self, __pyx_n_s___eq); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_other); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_other); __Pyx_GIVEREF(__pyx_v_other); - __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyBool_FromLong((!__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong((!__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -5567,7 +5583,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_9Iteration___richcmp__(PyObje } /*else*/ { - /* "sklearn/earth/_record.pyx":152 + /* "sklearn/earth/_record.pyx":159 * return not self._eq(other) * else: * return NotImplemented # <<<<<<<<<<<<<< @@ -5606,7 +5622,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_9Iteration_3_eq(PyObject *__p return __pyx_r; } -/* "sklearn/earth/_record.pyx":154 +/* "sklearn/earth/_record.pyx":161 * return NotImplemented * * def _eq(self, other): # <<<<<<<<<<<<<< @@ -5627,7 +5643,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_9Iteration_2_eq(struct __pyx_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_eq", 0); - /* "sklearn/earth/_record.pyx":155 + /* "sklearn/earth/_record.pyx":162 * * def _eq(self, other): * return self.__class__ is other.__class__ and self._getstate() == other._getstate() # <<<<<<<<<<<<<< @@ -5635,29 +5651,29 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_9Iteration_2_eq(struct __pyx_ * cpdef FLOAT_t get_mse(Iteration self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s____class__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s____class__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = (__pyx_t_1 == __pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_3) { __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_v_other, __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_t_4, __pyx_t_5, Py_EQ); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = __pyx_t_1; @@ -5685,7 +5701,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_9Iteration_2_eq(struct __pyx_ return __pyx_r; } -/* "sklearn/earth/_record.pyx":157 +/* "sklearn/earth/_record.pyx":164 * return self.__class__ is other.__class__ and self._getstate() == other._getstate() * * cpdef FLOAT_t get_mse(Iteration self): # <<<<<<<<<<<<<< @@ -5708,12 +5724,12 @@ static __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_f_7sklearn_5earth_7_record if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_mse); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_mse); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_9Iteration_5get_mse)) { - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -5722,7 +5738,7 @@ static __pyx_t_7sklearn_5earth_7_record_FLOAT_t __pyx_f_7sklearn_5earth_7_record __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_record.pyx":158 + /* "sklearn/earth/_record.pyx":165 * * cpdef FLOAT_t get_mse(Iteration self): * return self.mse # <<<<<<<<<<<<<< @@ -5755,7 +5771,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_9Iteration_5get_mse(PyObject return __pyx_r; } -/* "sklearn/earth/_record.pyx":157 +/* "sklearn/earth/_record.pyx":164 * return self.__class__ is other.__class__ and self._getstate() == other._getstate() * * cpdef FLOAT_t get_mse(Iteration self): # <<<<<<<<<<<<<< @@ -5772,7 +5788,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_9Iteration_4get_mse(struct __ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_mse", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_Iteration *)__pyx_v_self->__pyx_vtab)->get_mse(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_Iteration *)__pyx_v_self->__pyx_vtab)->get_mse(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -5790,7 +5806,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_9Iteration_4get_mse(struct __ return __pyx_r; } -/* "sklearn/earth/_record.pyx":160 +/* "sklearn/earth/_record.pyx":167 * return self.mse * * cpdef INDEX_t get_size(Iteration self): # <<<<<<<<<<<<<< @@ -5813,12 +5829,12 @@ static __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_f_7sklearn_5earth_7_record if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_9Iteration_7get_size)) { - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -5827,7 +5843,7 @@ static __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_f_7sklearn_5earth_7_record __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_record.pyx":161 + /* "sklearn/earth/_record.pyx":168 * * cpdef INDEX_t get_size(Iteration self): * return self.size # <<<<<<<<<<<<<< @@ -5860,7 +5876,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_9Iteration_7get_size(PyObject return __pyx_r; } -/* "sklearn/earth/_record.pyx":160 +/* "sklearn/earth/_record.pyx":167 * return self.mse * * cpdef INDEX_t get_size(Iteration self): # <<<<<<<<<<<<<< @@ -5877,7 +5893,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_9Iteration_6get_size(struct _ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_size", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_Iteration *)__pyx_v_self->__pyx_vtab)->get_size(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_Iteration *)__pyx_v_self->__pyx_vtab)->get_size(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 167; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -5928,16 +5944,16 @@ static int __pyx_pw_7sklearn_5earth_7_record_20PruningPassIteration_1__init__(Py case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mse)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -5946,13 +5962,13 @@ static int __pyx_pw_7sklearn_5earth_7_record_20PruningPassIteration_1__init__(Py values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } - __pyx_v_pruned = __Pyx_PyInt_from_py_npy_ulonglong(values[0]); if (unlikely((__pyx_v_pruned == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_size = __Pyx_PyInt_from_py_npy_ulonglong(values[1]); if (unlikely((__pyx_v_size == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_mse = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_mse == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_pruned = __Pyx_PyInt_from_py_npy_ulonglong(values[0]); if (unlikely((__pyx_v_pruned == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_size = __Pyx_PyInt_from_py_npy_ulonglong(values[1]); if (unlikely((__pyx_v_size == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_mse = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_mse == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.earth._record.PruningPassIteration.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -5963,7 +5979,7 @@ static int __pyx_pw_7sklearn_5earth_7_record_20PruningPassIteration_1__init__(Py return __pyx_r; } -/* "sklearn/earth/_record.pyx":164 +/* "sklearn/earth/_record.pyx":171 * * cdef class PruningPassIteration(Iteration): * def __init__(PruningPassIteration self, INDEX_t pruned, INDEX_t size, FLOAT_t mse): # <<<<<<<<<<<<<< @@ -5976,7 +5992,7 @@ static int __pyx_pf_7sklearn_5earth_7_record_20PruningPassIteration___init__(str __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); - /* "sklearn/earth/_record.pyx":165 + /* "sklearn/earth/_record.pyx":172 * cdef class PruningPassIteration(Iteration): * def __init__(PruningPassIteration self, INDEX_t pruned, INDEX_t size, FLOAT_t mse): * self.pruned = pruned # <<<<<<<<<<<<<< @@ -5985,7 +6001,7 @@ static int __pyx_pf_7sklearn_5earth_7_record_20PruningPassIteration___init__(str */ __pyx_v_self->pruned = __pyx_v_pruned; - /* "sklearn/earth/_record.pyx":166 + /* "sklearn/earth/_record.pyx":173 * def __init__(PruningPassIteration self, INDEX_t pruned, INDEX_t size, FLOAT_t mse): * self.pruned = pruned * self.size = size # <<<<<<<<<<<<<< @@ -5994,7 +6010,7 @@ static int __pyx_pf_7sklearn_5earth_7_record_20PruningPassIteration___init__(str */ __pyx_v_self->__pyx_base.size = __pyx_v_size; - /* "sklearn/earth/_record.pyx":167 + /* "sklearn/earth/_record.pyx":174 * self.pruned = pruned * self.size = size * self.mse = mse # <<<<<<<<<<<<<< @@ -6019,11 +6035,11 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_20PruningPassIteration_3__red return __pyx_r; } -/* "sklearn/earth/_record.pyx":169 +/* "sklearn/earth/_record.pyx":176 * self.mse = mse * * def __reduce__(PruningPassIteration self): # <<<<<<<<<<<<<< - * return (PruningPassIteration, (1,1,1.0), self._getstate()) + * return (PruningPassIteration, (1, 1, 1.0), self._getstate()) * */ @@ -6038,17 +6054,17 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_20PruningPassIteration_2__red int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce__", 0); - /* "sklearn/earth/_record.pyx":170 + /* "sklearn/earth/_record.pyx":177 * * def __reduce__(PruningPassIteration self): - * return (PruningPassIteration, (1,1,1.0), self._getstate()) # <<<<<<<<<<<<<< + * return (PruningPassIteration, (1, 1, 1.0), self._getstate()) # <<<<<<<<<<<<<< * * def _getstate(PruningPassIteration self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_1); @@ -6059,12 +6075,12 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_20PruningPassIteration_2__red PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_PruningPassIteration))); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_PruningPassIteration))); @@ -6104,8 +6120,8 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_20PruningPassIteration_5_gets return __pyx_r; } -/* "sklearn/earth/_record.pyx":172 - * return (PruningPassIteration, (1,1,1.0), self._getstate()) +/* "sklearn/earth/_record.pyx":179 + * return (PruningPassIteration, (1, 1, 1.0), self._getstate()) * * def _getstate(PruningPassIteration self): # <<<<<<<<<<<<<< * return {'pruned': self.pruned, @@ -6122,7 +6138,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_20PruningPassIteration_4_gets int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_getstate", 0); - /* "sklearn/earth/_record.pyx":173 + /* "sklearn/earth/_record.pyx":180 * * def _getstate(PruningPassIteration self): * return {'pruned': self.pruned, # <<<<<<<<<<<<<< @@ -6130,35 +6146,35 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_20PruningPassIteration_4_gets * 'mse': self.mse} */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->pruned); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->pruned); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__pruned), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__pruned), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_record.pyx":174 + /* "sklearn/earth/_record.pyx":181 * def _getstate(PruningPassIteration self): * return {'pruned': self.pruned, * 'size': self.size, # <<<<<<<<<<<<<< * 'mse': self.mse} * */ - __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->__pyx_base.size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->__pyx_base.size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__size), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__size), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_record.pyx":175 + /* "sklearn/earth/_record.pyx":182 * return {'pruned': self.pruned, * 'size': self.size, * 'mse': self.mse} # <<<<<<<<<<<<<< * * def __setstate__(PruningPassIteration self, dict state): */ - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.mse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.mse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__mse), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__mse), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; @@ -6186,7 +6202,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_20PruningPassIteration_7__set PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), (&PyDict_Type), 1, "state", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 177; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), (&PyDict_Type), 1, "state", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_5earth_7_record_20PruningPassIteration_6__setstate__(((struct __pyx_obj_7sklearn_5earth_7_record_PruningPassIteration *)__pyx_v_self), ((PyObject*)__pyx_v_state)); goto __pyx_L0; __pyx_L1_error:; @@ -6196,7 +6212,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_20PruningPassIteration_7__set return __pyx_r; } -/* "sklearn/earth/_record.pyx":177 +/* "sklearn/earth/_record.pyx":184 * 'mse': self.mse} * * def __setstate__(PruningPassIteration self, dict state): # <<<<<<<<<<<<<< @@ -6215,7 +6231,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_20PruningPassIteration_6__set int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate__", 0); - /* "sklearn/earth/_record.pyx":178 + /* "sklearn/earth/_record.pyx":185 * * def __setstate__(PruningPassIteration self, dict state): * self.pruned = state['pruned'] # <<<<<<<<<<<<<< @@ -6224,15 +6240,15 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_20PruningPassIteration_6__set */ if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__pruned)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__pruned)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->pruned = __pyx_t_2; - /* "sklearn/earth/_record.pyx":179 + /* "sklearn/earth/_record.pyx":186 * def __setstate__(PruningPassIteration self, dict state): * self.pruned = state['pruned'] * self.size = state['size'] # <<<<<<<<<<<<<< @@ -6241,15 +6257,15 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_20PruningPassIteration_6__set */ if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__size)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__size)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->__pyx_base.size = __pyx_t_2; - /* "sklearn/earth/_record.pyx":180 + /* "sklearn/earth/_record.pyx":187 * self.pruned = state['pruned'] * self.size = state['size'] * self.mse = state['mse'] # <<<<<<<<<<<<<< @@ -6258,11 +6274,11 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_20PruningPassIteration_6__set */ if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__mse)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__mse)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->__pyx_base.mse = __pyx_t_3; @@ -6278,7 +6294,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_20PruningPassIteration_6__set return __pyx_r; } -/* "sklearn/earth/_record.pyx":182 +/* "sklearn/earth/_record.pyx":189 * self.mse = state['mse'] * * cpdef INDEX_t get_pruned(PruningPassIteration self): # <<<<<<<<<<<<<< @@ -6301,12 +6317,12 @@ static __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_f_7sklearn_5earth_7_record if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_pruned); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_pruned); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_20PruningPassIteration_9get_pruned)) { - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -6315,7 +6331,7 @@ static __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_f_7sklearn_5earth_7_record __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_record.pyx":183 + /* "sklearn/earth/_record.pyx":190 * * cpdef INDEX_t get_pruned(PruningPassIteration self): * return self.pruned # <<<<<<<<<<<<<< @@ -6348,7 +6364,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_20PruningPassIteration_9get_p return __pyx_r; } -/* "sklearn/earth/_record.pyx":182 +/* "sklearn/earth/_record.pyx":189 * self.mse = state['mse'] * * cpdef INDEX_t get_pruned(PruningPassIteration self): # <<<<<<<<<<<<<< @@ -6365,7 +6381,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_20PruningPassIteration_8get_p int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_pruned", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassIteration *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_pruned(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassIteration *)__pyx_v_self->__pyx_base.__pyx_vtab)->get_pruned(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -6394,12 +6410,12 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_20PruningPassIteration_11__st return __pyx_r; } -/* "sklearn/earth/_record.pyx":185 +/* "sklearn/earth/_record.pyx":192 * return self.pruned * * def __str__(PruningPassIteration self): # <<<<<<<<<<<<<< - * result = '%s\t%s\t%s' % (str(self.pruned),self.size,'%.2f' % self.mse if self.mse is not None else None) - * return result + * result = '%s\t%s\t%s' % (str(self.pruned), self.size, '%.2f' % + * self.mse if self.mse is not None else None) */ static PyObject *__pyx_pf_7sklearn_5earth_7_record_20PruningPassIteration_10__str__(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassIteration *__pyx_v_self) { @@ -6417,42 +6433,66 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_20PruningPassIteration_10__st int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - /* "sklearn/earth/_record.pyx":186 + /* "sklearn/earth/_record.pyx":193 * * def __str__(PruningPassIteration self): - * result = '%s\t%s\t%s' % (str(self.pruned),self.size,'%.2f' % self.mse if self.mse is not None else None) # <<<<<<<<<<<<<< + * result = '%s\t%s\t%s' % (str(self.pruned), self.size, '%.2f' % # <<<<<<<<<<<<<< + * self.mse if self.mse is not None else None) * return result - * */ - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->pruned); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->pruned); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->__pyx_base.size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->__pyx_base.size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.mse); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/earth/_record.pyx":194 + * def __str__(PruningPassIteration self): + * result = '%s\t%s\t%s' % (str(self.pruned), self.size, '%.2f' % + * self.mse if self.mse is not None else None) # <<<<<<<<<<<<<< + * return result + * + */ + __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.mse); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_5 = (__pyx_t_4 != Py_None); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; if ((__pyx_t_5 != 0)) { - __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.mse); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/earth/_record.pyx":193 + * + * def __str__(PruningPassIteration self): + * result = '%s\t%s\t%s' % (str(self.pruned), self.size, '%.2f' % # <<<<<<<<<<<<<< + * self.mse if self.mse is not None else None) + * return result + */ + __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.mse); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_17), __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_17), __pyx_t_4); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_3 = ((PyObject *)__pyx_t_6); __pyx_t_6 = 0; } else { + + /* "sklearn/earth/_record.pyx":194 + * def __str__(PruningPassIteration self): + * result = '%s\t%s\t%s' % (str(self.pruned), self.size, '%.2f' % + * self.mse if self.mse is not None else None) # <<<<<<<<<<<<<< + * return result + * + */ __Pyx_INCREF(Py_None); __pyx_t_3 = Py_None; } - __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyTuple_New(3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); @@ -6463,15 +6503,15 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_20PruningPassIteration_10__st __pyx_t_1 = 0; __pyx_t_2 = 0; __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_16), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_16), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; __pyx_v_result = ((PyObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/earth/_record.pyx":187 - * def __str__(PruningPassIteration self): - * result = '%s\t%s\t%s' % (str(self.pruned),self.size,'%.2f' % self.mse if self.mse is not None else None) + /* "sklearn/earth/_record.pyx":195 + * result = '%s\t%s\t%s' % (str(self.pruned), self.size, '%.2f' % + * self.mse if self.mse is not None else None) * return result # <<<<<<<<<<<<<< * * cdef class FirstPruningPassIteration(PruningPassIteration): @@ -6529,11 +6569,11 @@ static int __pyx_pw_7sklearn_5earth_7_record_25FirstPruningPassIteration_1__init case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mse)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -6541,12 +6581,12 @@ static int __pyx_pw_7sklearn_5earth_7_record_25FirstPruningPassIteration_1__init values[0] = PyTuple_GET_ITEM(__pyx_args, 0); values[1] = PyTuple_GET_ITEM(__pyx_args, 1); } - __pyx_v_size = __Pyx_PyInt_from_py_npy_ulonglong(values[0]); if (unlikely((__pyx_v_size == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_mse = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_mse == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_size = __Pyx_PyInt_from_py_npy_ulonglong(values[0]); if (unlikely((__pyx_v_size == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_mse = __pyx_PyFloat_AsDouble(values[1]); if (unlikely((__pyx_v_mse == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.earth._record.FirstPruningPassIteration.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -6557,7 +6597,7 @@ static int __pyx_pw_7sklearn_5earth_7_record_25FirstPruningPassIteration_1__init return __pyx_r; } -/* "sklearn/earth/_record.pyx":190 +/* "sklearn/earth/_record.pyx":198 * * cdef class FirstPruningPassIteration(PruningPassIteration): * def __init__(PruningPassIteration self, INDEX_t size, FLOAT_t mse): # <<<<<<<<<<<<<< @@ -6570,7 +6610,7 @@ static int __pyx_pf_7sklearn_5earth_7_record_25FirstPruningPassIteration___init_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); - /* "sklearn/earth/_record.pyx":191 + /* "sklearn/earth/_record.pyx":199 * cdef class FirstPruningPassIteration(PruningPassIteration): * def __init__(PruningPassIteration self, INDEX_t size, FLOAT_t mse): * self.size = size # <<<<<<<<<<<<<< @@ -6579,7 +6619,7 @@ static int __pyx_pf_7sklearn_5earth_7_record_25FirstPruningPassIteration___init_ */ __pyx_v_self->__pyx_base.__pyx_base.size = __pyx_v_size; - /* "sklearn/earth/_record.pyx":192 + /* "sklearn/earth/_record.pyx":200 * def __init__(PruningPassIteration self, INDEX_t size, FLOAT_t mse): * self.size = size * self.mse = mse # <<<<<<<<<<<<<< @@ -6604,11 +6644,11 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_25FirstPruningPassIteration_3 return __pyx_r; } -/* "sklearn/earth/_record.pyx":194 +/* "sklearn/earth/_record.pyx":202 * self.mse = mse * * def __reduce__(FirstPruningPassIteration self): # <<<<<<<<<<<<<< - * return (FirstPruningPassIteration, (1,1.0), self._getstate()) + * return (FirstPruningPassIteration, (1, 1.0), self._getstate()) * */ @@ -6623,17 +6663,17 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_25FirstPruningPassIteration_2 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce__", 0); - /* "sklearn/earth/_record.pyx":195 + /* "sklearn/earth/_record.pyx":203 * * def __reduce__(FirstPruningPassIteration self): - * return (FirstPruningPassIteration, (1,1.0), self._getstate()) # <<<<<<<<<<<<<< + * return (FirstPruningPassIteration, (1, 1.0), self._getstate()) # <<<<<<<<<<<<<< * * def _getstate(FirstPruningPassIteration self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_1); @@ -6641,12 +6681,12 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_25FirstPruningPassIteration_2 PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_FirstPruningPassIteration))); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_FirstPruningPassIteration))); @@ -6686,8 +6726,8 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_25FirstPruningPassIteration_5 return __pyx_r; } -/* "sklearn/earth/_record.pyx":197 - * return (FirstPruningPassIteration, (1,1.0), self._getstate()) +/* "sklearn/earth/_record.pyx":205 + * return (FirstPruningPassIteration, (1, 1.0), self._getstate()) * * def _getstate(FirstPruningPassIteration self): # <<<<<<<<<<<<<< * return {'size': self.size, @@ -6704,7 +6744,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_25FirstPruningPassIteration_4 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_getstate", 0); - /* "sklearn/earth/_record.pyx":198 + /* "sklearn/earth/_record.pyx":206 * * def _getstate(FirstPruningPassIteration self): * return {'size': self.size, # <<<<<<<<<<<<<< @@ -6712,23 +6752,23 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_25FirstPruningPassIteration_4 * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->__pyx_base.__pyx_base.size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->__pyx_base.__pyx_base.size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__size), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__size), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_record.pyx":199 + /* "sklearn/earth/_record.pyx":207 * def _getstate(FirstPruningPassIteration self): * return {'size': self.size, * 'mse': self.mse} # <<<<<<<<<<<<<< * * def __setstate__(FirstPruningPassIteration self, dict state): */ - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.__pyx_base.mse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.__pyx_base.mse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__mse), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__mse), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; @@ -6756,7 +6796,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_25FirstPruningPassIteration_7 PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), (&PyDict_Type), 1, "state", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), (&PyDict_Type), 1, "state", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_5earth_7_record_25FirstPruningPassIteration_6__setstate__(((struct __pyx_obj_7sklearn_5earth_7_record_FirstPruningPassIteration *)__pyx_v_self), ((PyObject*)__pyx_v_state)); goto __pyx_L0; __pyx_L1_error:; @@ -6766,7 +6806,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_25FirstPruningPassIteration_7 return __pyx_r; } -/* "sklearn/earth/_record.pyx":201 +/* "sklearn/earth/_record.pyx":209 * 'mse': self.mse} * * def __setstate__(FirstPruningPassIteration self, dict state): # <<<<<<<<<<<<<< @@ -6785,7 +6825,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_25FirstPruningPassIteration_6 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate__", 0); - /* "sklearn/earth/_record.pyx":202 + /* "sklearn/earth/_record.pyx":210 * * def __setstate__(FirstPruningPassIteration self, dict state): * self.size = state['size'] # <<<<<<<<<<<<<< @@ -6794,15 +6834,15 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_25FirstPruningPassIteration_6 */ if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__size)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__size)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->__pyx_base.__pyx_base.size = __pyx_t_2; - /* "sklearn/earth/_record.pyx":203 + /* "sklearn/earth/_record.pyx":211 * def __setstate__(FirstPruningPassIteration self, dict state): * self.size = state['size'] * self.mse = state['mse'] # <<<<<<<<<<<<<< @@ -6811,11 +6851,11 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_25FirstPruningPassIteration_6 */ if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__mse)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__mse)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->__pyx_base.__pyx_base.mse = __pyx_t_3; @@ -6842,12 +6882,12 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_25FirstPruningPassIteration_9 return __pyx_r; } -/* "sklearn/earth/_record.pyx":205 +/* "sklearn/earth/_record.pyx":213 * self.mse = state['mse'] * * def __str__(PruningPassIteration self): # <<<<<<<<<<<<<< - * result = '%s\t%s\t%s' % ('-',self.size,'%.2f' % self.mse if self.mse is not None else None) - * return result + * result = '%s\t%s\t%s' % ('-', self.size, '%.2f' % + * self.mse if self.mse is not None else None) */ static PyObject *__pyx_pf_7sklearn_5earth_7_record_25FirstPruningPassIteration_8__str__(struct __pyx_obj_7sklearn_5earth_7_record_FirstPruningPassIteration *__pyx_v_self) { @@ -6864,32 +6904,56 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_25FirstPruningPassIteration_8 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - /* "sklearn/earth/_record.pyx":206 + /* "sklearn/earth/_record.pyx":214 * * def __str__(PruningPassIteration self): - * result = '%s\t%s\t%s' % ('-',self.size,'%.2f' % self.mse if self.mse is not None else None) # <<<<<<<<<<<<<< + * result = '%s\t%s\t%s' % ('-', self.size, '%.2f' % # <<<<<<<<<<<<<< + * self.mse if self.mse is not None else None) * return result - * */ - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->__pyx_base.__pyx_base.size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->__pyx_base.__pyx_base.size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.__pyx_base.mse); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/earth/_record.pyx":215 + * def __str__(PruningPassIteration self): + * result = '%s\t%s\t%s' % ('-', self.size, '%.2f' % + * self.mse if self.mse is not None else None) # <<<<<<<<<<<<<< + * return result + * + */ + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.__pyx_base.mse); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = (__pyx_t_3 != Py_None); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if ((__pyx_t_4 != 0)) { - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.__pyx_base.mse); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/earth/_record.pyx":214 + * + * def __str__(PruningPassIteration self): + * result = '%s\t%s\t%s' % ('-', self.size, '%.2f' % # <<<<<<<<<<<<<< + * self.mse if self.mse is not None else None) + * return result + */ + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.__pyx_base.mse); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_17), __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_17), __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_2 = ((PyObject *)__pyx_t_5); __pyx_t_5 = 0; } else { + + /* "sklearn/earth/_record.pyx":215 + * def __str__(PruningPassIteration self): + * result = '%s\t%s\t%s' % ('-', self.size, '%.2f' % + * self.mse if self.mse is not None else None) # <<<<<<<<<<<<<< + * return result + * + */ __Pyx_INCREF(Py_None); __pyx_t_2 = Py_None; } - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(((PyObject *)__pyx_kp_s_18)); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_18)); @@ -6900,15 +6964,15 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_25FirstPruningPassIteration_8 __Pyx_GIVEREF(__pyx_t_2); __pyx_t_1 = 0; __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_16), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_16), ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __pyx_v_result = ((PyObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_record.pyx":207 - * def __str__(PruningPassIteration self): - * result = '%s\t%s\t%s' % ('-',self.size,'%.2f' % self.mse if self.mse is not None else None) + /* "sklearn/earth/_record.pyx":216 + * result = '%s\t%s\t%s' % ('-', self.size, '%.2f' % + * self.mse if self.mse is not None else None) * return result # <<<<<<<<<<<<<< * * cdef class ForwardPassIteration(Iteration): @@ -6971,26 +7035,26 @@ static int __pyx_pw_7sklearn_5earth_7_record_20ForwardPassIteration_1__init__(Py case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__variable)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__knot)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__mse)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: if (likely((values[4] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__size)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, 4); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 5) { goto __pyx_L5_argtuple_error; @@ -7001,15 +7065,15 @@ static int __pyx_pw_7sklearn_5earth_7_record_20ForwardPassIteration_1__init__(Py values[3] = PyTuple_GET_ITEM(__pyx_args, 3); values[4] = PyTuple_GET_ITEM(__pyx_args, 4); } - __pyx_v_parent = __Pyx_PyInt_from_py_npy_ulonglong(values[0]); if (unlikely((__pyx_v_parent == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_variable = __Pyx_PyInt_from_py_npy_ulonglong(values[1]); if (unlikely((__pyx_v_variable == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_knot = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_knot == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_mse = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_mse == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_size = __Pyx_PyInt_from_py_npy_ulonglong(values[4]); if (unlikely((__pyx_v_size == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_parent = __Pyx_PyInt_from_py_npy_ulonglong(values[0]); if (unlikely((__pyx_v_parent == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_variable = __Pyx_PyInt_from_py_npy_ulonglong(values[1]); if (unlikely((__pyx_v_variable == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_knot = __Pyx_PyInt_AsInt(values[2]); if (unlikely((__pyx_v_knot == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_mse = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_mse == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_size = __Pyx_PyInt_from_py_npy_ulonglong(values[4]); if (unlikely((__pyx_v_size == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 5, 5, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.earth._record.ForwardPassIteration.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -7020,7 +7084,7 @@ static int __pyx_pw_7sklearn_5earth_7_record_20ForwardPassIteration_1__init__(Py return __pyx_r; } -/* "sklearn/earth/_record.pyx":210 +/* "sklearn/earth/_record.pyx":219 * * cdef class ForwardPassIteration(Iteration): * def __init__(ForwardPassIteration self, INDEX_t parent, INDEX_t variable, int knot, FLOAT_t mse, INDEX_t size): # <<<<<<<<<<<<<< @@ -7033,7 +7097,7 @@ static int __pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration___init__(str __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); - /* "sklearn/earth/_record.pyx":211 + /* "sklearn/earth/_record.pyx":220 * cdef class ForwardPassIteration(Iteration): * def __init__(ForwardPassIteration self, INDEX_t parent, INDEX_t variable, int knot, FLOAT_t mse, INDEX_t size): * self.parent = parent # <<<<<<<<<<<<<< @@ -7042,7 +7106,7 @@ static int __pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration___init__(str */ __pyx_v_self->parent = __pyx_v_parent; - /* "sklearn/earth/_record.pyx":212 + /* "sklearn/earth/_record.pyx":221 * def __init__(ForwardPassIteration self, INDEX_t parent, INDEX_t variable, int knot, FLOAT_t mse, INDEX_t size): * self.parent = parent * self.variable = variable # <<<<<<<<<<<<<< @@ -7051,7 +7115,7 @@ static int __pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration___init__(str */ __pyx_v_self->variable = __pyx_v_variable; - /* "sklearn/earth/_record.pyx":213 + /* "sklearn/earth/_record.pyx":222 * self.parent = parent * self.variable = variable * self.knot = knot # <<<<<<<<<<<<<< @@ -7060,7 +7124,7 @@ static int __pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration___init__(str */ __pyx_v_self->knot = __pyx_v_knot; - /* "sklearn/earth/_record.pyx":214 + /* "sklearn/earth/_record.pyx":223 * self.variable = variable * self.knot = knot * self.mse = mse # <<<<<<<<<<<<<< @@ -7069,7 +7133,7 @@ static int __pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration___init__(str */ __pyx_v_self->__pyx_base.mse = __pyx_v_mse; - /* "sklearn/earth/_record.pyx":215 + /* "sklearn/earth/_record.pyx":224 * self.knot = knot * self.mse = mse * self.size = size # <<<<<<<<<<<<<< @@ -7094,11 +7158,11 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_20ForwardPassIteration_3__red return __pyx_r; } -/* "sklearn/earth/_record.pyx":217 +/* "sklearn/earth/_record.pyx":226 * self.size = size * * def __reduce__(ForwardPassIteration self): # <<<<<<<<<<<<<< - * return (ForwardPassIteration, (1,1,1,1.0,1), self._getstate()) + * return (ForwardPassIteration, (1, 1, 1, 1.0, 1), self._getstate()) * */ @@ -7113,17 +7177,17 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration_2__red int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce__", 0); - /* "sklearn/earth/_record.pyx":218 + /* "sklearn/earth/_record.pyx":227 * * def __reduce__(ForwardPassIteration self): - * return (ForwardPassIteration, (1,1,1,1.0,1), self._getstate()) # <<<<<<<<<<<<<< + * return (ForwardPassIteration, (1, 1, 1, 1.0, 1), self._getstate()) # <<<<<<<<<<<<<< * * def _getstate(ForwardPassIteration self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_int_1); @@ -7140,12 +7204,12 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration_2__red PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_ForwardPassIteration))); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_ForwardPassIteration))); @@ -7185,8 +7249,8 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_20ForwardPassIteration_5_gets return __pyx_r; } -/* "sklearn/earth/_record.pyx":220 - * return (ForwardPassIteration, (1,1,1,1.0,1), self._getstate()) +/* "sklearn/earth/_record.pyx":229 + * return (ForwardPassIteration, (1, 1, 1, 1.0, 1), self._getstate()) * * def _getstate(ForwardPassIteration self): # <<<<<<<<<<<<<< * return {'parent': self.parent, @@ -7203,7 +7267,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration_4_gets int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_getstate", 0); - /* "sklearn/earth/_record.pyx":221 + /* "sklearn/earth/_record.pyx":230 * * def _getstate(ForwardPassIteration self): * return {'parent': self.parent, # <<<<<<<<<<<<<< @@ -7211,59 +7275,59 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration_4_gets * 'knot': self.knot, */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->parent); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->parent); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__parent), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__parent), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_record.pyx":222 + /* "sklearn/earth/_record.pyx":231 * def _getstate(ForwardPassIteration self): * return {'parent': self.parent, * 'variable': self.variable, # <<<<<<<<<<<<<< * 'knot': self.knot, * 'mse': self.mse, */ - __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->variable); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->variable); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__variable), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__variable), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_record.pyx":223 + /* "sklearn/earth/_record.pyx":232 * return {'parent': self.parent, * 'variable': self.variable, * 'knot': self.knot, # <<<<<<<<<<<<<< * 'mse': self.mse, * 'size': self.size} */ - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->knot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->knot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__knot), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__knot), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_record.pyx":224 + /* "sklearn/earth/_record.pyx":233 * 'variable': self.variable, * 'knot': self.knot, * 'mse': self.mse, # <<<<<<<<<<<<<< * 'size': self.size} * */ - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.mse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.mse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__mse), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__mse), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_record.pyx":225 + /* "sklearn/earth/_record.pyx":234 * 'knot': self.knot, * 'mse': self.mse, * 'size': self.size} # <<<<<<<<<<<<<< * * def __setstate__(ForwardPassIteration self, dict state): */ - __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->__pyx_base.size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->__pyx_base.size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__size), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__size), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; @@ -7291,7 +7355,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_20ForwardPassIteration_7__set PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), (&PyDict_Type), 1, "state", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), (&PyDict_Type), 1, "state", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 236; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration_6__setstate__(((struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration *)__pyx_v_self), ((PyObject*)__pyx_v_state)); goto __pyx_L0; __pyx_L1_error:; @@ -7301,7 +7365,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_20ForwardPassIteration_7__set return __pyx_r; } -/* "sklearn/earth/_record.pyx":227 +/* "sklearn/earth/_record.pyx":236 * 'size': self.size} * * def __setstate__(ForwardPassIteration self, dict state): # <<<<<<<<<<<<<< @@ -7320,7 +7384,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration_6__set int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate__", 0); - /* "sklearn/earth/_record.pyx":228 + /* "sklearn/earth/_record.pyx":237 * * def __setstate__(ForwardPassIteration self, dict state): * self.parent = state['parent'] # <<<<<<<<<<<<<< @@ -7329,15 +7393,15 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration_6__set */ if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__parent)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__parent)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->parent = __pyx_t_2; - /* "sklearn/earth/_record.pyx":229 + /* "sklearn/earth/_record.pyx":238 * def __setstate__(ForwardPassIteration self, dict state): * self.parent = state['parent'] * self.variable = state['variable'] # <<<<<<<<<<<<<< @@ -7346,15 +7410,15 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration_6__set */ if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__variable)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__variable)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->variable = __pyx_t_2; - /* "sklearn/earth/_record.pyx":230 + /* "sklearn/earth/_record.pyx":239 * self.parent = state['parent'] * self.variable = state['variable'] * self.knot = state['knot'] # <<<<<<<<<<<<<< @@ -7363,15 +7427,15 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration_6__set */ if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__knot)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__knot)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 230; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 239; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->knot = __pyx_t_3; - /* "sklearn/earth/_record.pyx":231 + /* "sklearn/earth/_record.pyx":240 * self.variable = state['variable'] * self.knot = state['knot'] * self.mse = state['mse'] # <<<<<<<<<<<<<< @@ -7380,15 +7444,15 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration_6__set */ if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__mse)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__mse)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_3 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 240; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->__pyx_base.mse = __pyx_t_3; - /* "sklearn/earth/_record.pyx":232 + /* "sklearn/earth/_record.pyx":241 * self.knot = state['knot'] * self.mse = state['mse'] * self.size = state['size'] # <<<<<<<<<<<<<< @@ -7397,11 +7461,11 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration_6__set */ if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__size)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__size)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->__pyx_base.size = __pyx_t_2; @@ -7428,12 +7492,12 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_20ForwardPassIteration_9__str return __pyx_r; } -/* "sklearn/earth/_record.pyx":234 +/* "sklearn/earth/_record.pyx":243 * self.size = state['size'] * * def __str__(self): # <<<<<<<<<<<<<< - * result = '%d\t%d\t%d\t%4f\t%d' % (self.parent,self.variable,self.knot,self.mse,self.size) - * return result + * result = '%d\t%d\t%d\t%4f\t%d' % ( + * self.parent, self.variable, self.knot, self.mse, self.size) */ static PyObject *__pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration_8__str__(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration *__pyx_v_self) { @@ -7451,24 +7515,24 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration_8__str int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - /* "sklearn/earth/_record.pyx":235 - * + /* "sklearn/earth/_record.pyx":245 * def __str__(self): - * result = '%d\t%d\t%d\t%4f\t%d' % (self.parent,self.variable,self.knot,self.mse,self.size) # <<<<<<<<<<<<<< + * result = '%d\t%d\t%d\t%4f\t%d' % ( + * self.parent, self.variable, self.knot, self.mse, self.size) # <<<<<<<<<<<<<< * return result * */ - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->parent); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->parent); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->variable); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->variable); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->knot); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->knot); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.mse); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.mse); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->__pyx_base.size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->__pyx_base.size); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_6 = PyTuple_New(5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyTuple_New(5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); @@ -7485,15 +7549,15 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration_8__str __pyx_t_3 = 0; __pyx_t_4 = 0; __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_19), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 235; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_19), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; __pyx_v_result = ((PyObject *)__pyx_t_5); __pyx_t_5 = 0; - /* "sklearn/earth/_record.pyx":236 - * def __str__(self): - * result = '%d\t%d\t%d\t%4f\t%d' % (self.parent,self.variable,self.knot,self.mse,self.size) + /* "sklearn/earth/_record.pyx":246 + * result = '%d\t%d\t%d\t%4f\t%d' % ( + * self.parent, self.variable, self.knot, self.mse, self.size) * return result # <<<<<<<<<<<<<< * * cpdef set_no_candidates(ForwardPassIteration self, bint value): @@ -7521,7 +7585,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration_8__str return __pyx_r; } -/* "sklearn/earth/_record.pyx":238 +/* "sklearn/earth/_record.pyx":248 * return result * * cpdef set_no_candidates(ForwardPassIteration self, bint value): # <<<<<<<<<<<<<< @@ -7544,18 +7608,18 @@ static PyObject *__pyx_f_7sklearn_5earth_7_record_20ForwardPassIteration_set_no_ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__set_no_candidates); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__set_no_candidates); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_20ForwardPassIteration_11set_no_candidates)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(__pyx_v_value); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; @@ -7566,7 +7630,7 @@ static PyObject *__pyx_f_7sklearn_5earth_7_record_20ForwardPassIteration_set_no_ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_record.pyx":239 + /* "sklearn/earth/_record.pyx":249 * * cpdef set_no_candidates(ForwardPassIteration self, bint value): * self.no_candidates = value # <<<<<<<<<<<<<< @@ -7600,7 +7664,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_20ForwardPassIteration_11set_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("set_no_candidates (wrapper)", 0); assert(__pyx_arg_value); { - __pyx_v_value = __Pyx_PyObject_IsTrue(__pyx_arg_value); if (unlikely((__pyx_v_value == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_value = __Pyx_PyObject_IsTrue(__pyx_arg_value); if (unlikely((__pyx_v_value == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -7613,7 +7677,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_20ForwardPassIteration_11set_ return __pyx_r; } -/* "sklearn/earth/_record.pyx":238 +/* "sklearn/earth/_record.pyx":248 * return result * * cpdef set_no_candidates(ForwardPassIteration self, bint value): # <<<<<<<<<<<<<< @@ -7630,7 +7694,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration_10set_ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("set_no_candidates", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassIteration *)__pyx_v_self->__pyx_base.__pyx_vtab)->set_no_candidates(__pyx_v_self, __pyx_v_value, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassIteration *)__pyx_v_self->__pyx_base.__pyx_vtab)->set_no_candidates(__pyx_v_self, __pyx_v_value, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -7648,7 +7712,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration_10set_ return __pyx_r; } -/* "sklearn/earth/_record.pyx":241 +/* "sklearn/earth/_record.pyx":251 * self.no_candidates = value * * cpdef no_further_candidates(ForwardPassIteration self): # <<<<<<<<<<<<<< @@ -7670,11 +7734,11 @@ static PyObject *__pyx_f_7sklearn_5earth_7_record_20ForwardPassIteration_no_furt if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_20); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_20); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_20ForwardPassIteration_13no_further_candidates)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -7684,7 +7748,7 @@ static PyObject *__pyx_f_7sklearn_5earth_7_record_20ForwardPassIteration_no_furt __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_record.pyx":242 + /* "sklearn/earth/_record.pyx":252 * * cpdef no_further_candidates(ForwardPassIteration self): * return self.no_candidates # <<<<<<<<<<<<<< @@ -7692,7 +7756,7 @@ static PyObject *__pyx_f_7sklearn_5earth_7_record_20ForwardPassIteration_no_furt * cdef class FirstForwardPassIteration(ForwardPassIteration): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->no_candidates); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong(__pyx_v_self->no_candidates); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -7722,7 +7786,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_20ForwardPassIteration_13no_f return __pyx_r; } -/* "sklearn/earth/_record.pyx":241 +/* "sklearn/earth/_record.pyx":251 * self.no_candidates = value * * cpdef no_further_candidates(ForwardPassIteration self): # <<<<<<<<<<<<<< @@ -7739,7 +7803,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_20ForwardPassIteration_12no_f int __pyx_clineno = 0; __Pyx_RefNannySetupContext("no_further_candidates", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassIteration *)__pyx_v_self->__pyx_base.__pyx_vtab)->no_further_candidates(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassIteration *)__pyx_v_self->__pyx_base.__pyx_vtab)->no_further_candidates(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -7785,18 +7849,18 @@ static int __pyx_pw_7sklearn_5earth_7_record_25FirstForwardPassIteration_1__init else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { goto __pyx_L5_argtuple_error; } else { values[0] = PyTuple_GET_ITEM(__pyx_args, 0); } - __pyx_v_mse = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_mse == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_mse = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_mse == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.earth._record.FirstForwardPassIteration.__init__", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); @@ -7807,7 +7871,7 @@ static int __pyx_pw_7sklearn_5earth_7_record_25FirstForwardPassIteration_1__init return __pyx_r; } -/* "sklearn/earth/_record.pyx":245 +/* "sklearn/earth/_record.pyx":255 * * cdef class FirstForwardPassIteration(ForwardPassIteration): * def __init__(FirstForwardPassIteration self, FLOAT_t mse): # <<<<<<<<<<<<<< @@ -7820,7 +7884,7 @@ static int __pyx_pf_7sklearn_5earth_7_record_25FirstForwardPassIteration___init_ __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__init__", 0); - /* "sklearn/earth/_record.pyx":246 + /* "sklearn/earth/_record.pyx":256 * cdef class FirstForwardPassIteration(ForwardPassIteration): * def __init__(FirstForwardPassIteration self, FLOAT_t mse): * self.mse = mse # <<<<<<<<<<<<<< @@ -7845,7 +7909,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_25FirstForwardPassIteration_3 return __pyx_r; } -/* "sklearn/earth/_record.pyx":248 +/* "sklearn/earth/_record.pyx":258 * self.mse = mse * * def __reduce__(FirstForwardPassIteration self): # <<<<<<<<<<<<<< @@ -7864,7 +7928,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_25FirstForwardPassIteration_2 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__reduce__", 0); - /* "sklearn/earth/_record.pyx":249 + /* "sklearn/earth/_record.pyx":259 * * def __reduce__(FirstForwardPassIteration self): * return (FirstForwardPassIteration, (1.0,), self._getstate()) # <<<<<<<<<<<<<< @@ -7872,19 +7936,19 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_25FirstForwardPassIteration_2 * def _getstate(FirstForwardPassIteration self): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s___getstate); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_FirstForwardPassIteration))); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_FirstForwardPassIteration))); @@ -7924,7 +7988,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_25FirstForwardPassIteration_5 return __pyx_r; } -/* "sklearn/earth/_record.pyx":251 +/* "sklearn/earth/_record.pyx":261 * return (FirstForwardPassIteration, (1.0,), self._getstate()) * * def _getstate(FirstForwardPassIteration self): # <<<<<<<<<<<<<< @@ -7942,7 +8006,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_25FirstForwardPassIteration_4 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("_getstate", 0); - /* "sklearn/earth/_record.pyx":252 + /* "sklearn/earth/_record.pyx":262 * * def _getstate(FirstForwardPassIteration self): * return {'mse': self.mse} # <<<<<<<<<<<<<< @@ -7950,11 +8014,11 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_25FirstForwardPassIteration_4 * def __setstate__(FirstForwardPassIteration self, dict state): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.__pyx_base.mse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.__pyx_base.mse); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__mse), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__mse), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; @@ -7982,7 +8046,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_25FirstForwardPassIteration_7 PyObject *__pyx_r = 0; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__setstate__ (wrapper)", 0); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), (&PyDict_Type), 1, "state", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_state), (&PyDict_Type), 1, "state", 1))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = __pyx_pf_7sklearn_5earth_7_record_25FirstForwardPassIteration_6__setstate__(((struct __pyx_obj_7sklearn_5earth_7_record_FirstForwardPassIteration *)__pyx_v_self), ((PyObject*)__pyx_v_state)); goto __pyx_L0; __pyx_L1_error:; @@ -7992,7 +8056,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_25FirstForwardPassIteration_7 return __pyx_r; } -/* "sklearn/earth/_record.pyx":254 +/* "sklearn/earth/_record.pyx":264 * return {'mse': self.mse} * * def __setstate__(FirstForwardPassIteration self, dict state): # <<<<<<<<<<<<<< @@ -8010,7 +8074,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_25FirstForwardPassIteration_6 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__setstate__", 0); - /* "sklearn/earth/_record.pyx":255 + /* "sklearn/earth/_record.pyx":265 * * def __setstate__(FirstForwardPassIteration self, dict state): * self.mse = state['mse'] # <<<<<<<<<<<<<< @@ -8019,11 +8083,11 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_25FirstForwardPassIteration_6 */ if (unlikely(((PyObject *)__pyx_v_state) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__mse)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_state), ((PyObject *)__pyx_n_s__mse)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_2 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 265; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_self->__pyx_base.__pyx_base.mse = __pyx_t_2; @@ -8039,7 +8103,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_25FirstForwardPassIteration_6 return __pyx_r; } -/* "sklearn/earth/_record.pyx":257 +/* "sklearn/earth/_record.pyx":267 * self.mse = state['mse'] * * cpdef INDEX_t get_size(FirstForwardPassIteration self): # <<<<<<<<<<<<<< @@ -8062,12 +8126,12 @@ static __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_f_7sklearn_5earth_7_record if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_size); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_7_record_25FirstForwardPassIteration_9get_size)) { - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_2); if (unlikely((__pyx_t_3 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -8076,7 +8140,7 @@ static __pyx_t_7sklearn_5earth_7_record_INDEX_t __pyx_f_7sklearn_5earth_7_record __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_record.pyx":258 + /* "sklearn/earth/_record.pyx":268 * * cpdef INDEX_t get_size(FirstForwardPassIteration self): * return 1 # <<<<<<<<<<<<<< @@ -8109,7 +8173,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_25FirstForwardPassIteration_9 return __pyx_r; } -/* "sklearn/earth/_record.pyx":257 +/* "sklearn/earth/_record.pyx":267 * self.mse = state['mse'] * * cpdef INDEX_t get_size(FirstForwardPassIteration self): # <<<<<<<<<<<<<< @@ -8126,7 +8190,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_25FirstForwardPassIteration_8 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_size", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_FirstForwardPassIteration *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.get_size(((struct __pyx_obj_7sklearn_5earth_7_record_Iteration *)__pyx_v_self), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_FirstForwardPassIteration *)__pyx_v_self->__pyx_base.__pyx_base.__pyx_vtab)->__pyx_base.__pyx_base.get_size(((struct __pyx_obj_7sklearn_5earth_7_record_Iteration *)__pyx_v_self), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -8155,11 +8219,11 @@ static PyObject *__pyx_pw_7sklearn_5earth_7_record_25FirstForwardPassIteration_1 return __pyx_r; } -/* "sklearn/earth/_record.pyx":260 +/* "sklearn/earth/_record.pyx":270 * return 1 * * def __str__(self): # <<<<<<<<<<<<<< - * result = '%s\t%s\t%s\t%4f\t%s' % ('-','-','-',self.mse,1) + * result = '%s\t%s\t%s\t%4f\t%s' % ('-', '-', '-', self.mse, 1) * return result */ @@ -8174,16 +8238,15 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_25FirstForwardPassIteration_1 int __pyx_clineno = 0; __Pyx_RefNannySetupContext("__str__", 0); - /* "sklearn/earth/_record.pyx":261 + /* "sklearn/earth/_record.pyx":271 * * def __str__(self): - * result = '%s\t%s\t%s\t%4f\t%s' % ('-','-','-',self.mse,1) # <<<<<<<<<<<<<< + * result = '%s\t%s\t%s\t%4f\t%s' % ('-', '-', '-', self.mse, 1) # <<<<<<<<<<<<<< * return result - * */ - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.__pyx_base.mse); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->__pyx_base.__pyx_base.mse); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_kp_s_18)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_18)); @@ -8200,17 +8263,16 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_25FirstForwardPassIteration_1 PyTuple_SET_ITEM(__pyx_t_2, 4, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 261; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_21), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_v_result = ((PyObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_record.pyx":262 + /* "sklearn/earth/_record.pyx":272 * def __str__(self): - * result = '%s\t%s\t%s\t%4f\t%s' % ('-','-','-',self.mse,1) + * result = '%s\t%s\t%s\t%4f\t%s' % ('-', '-', '-', self.mse, 1) * return result # <<<<<<<<<<<<<< - * */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_result); @@ -10957,8 +11019,8 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_NotImplemented = __Pyx_GetBuiltinName(__pyx_n_s__NotImplemented); if (!__pyx_builtin_NotImplemented) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; @@ -10970,39 +11032,47 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "sklearn/earth/_record.pyx":93 + /* "sklearn/earth/_record.pyx":95 * result = '' * result += 'Pruning Pass\n' * header = 'iter\tbf\tterms\tmse\tgcv\trsq\tgrsq'.split('\t') # <<<<<<<<<<<<<< * data = [] * for i, iteration in enumerate(self.iterations): */ - __pyx_k_tuple_5 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_5 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_5); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5)); - /* "sklearn/earth/_record.pyx":97 - * for i, iteration in enumerate(self.iterations): - * row = str(i) + '\t' + str(iteration) + '\t%.3f\t%.3f\t%.3f' % (self.gcv(i),self.rsq(i),self.grsq(i)) + /* "sklearn/earth/_record.pyx":100 + * row = str(i) + '\t' + str(iteration) + '\t%.3f\t%.3f\t%.3f' % ( + * self.gcv(i), self.rsq(i), self.grsq(i)) * data.append(row.split('\t')) # <<<<<<<<<<<<<< - * result += ascii_table(header,data) - * result += '\nSelected iteration: ' + str(self.selected) + '\n' + * result += ascii_table(header, data) + * result += '\nSelected iteration: ' + str(self.selected) + '\n' */ - __pyx_k_tuple_7 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_7 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_k_tuple_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_7); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_7)); - /* "sklearn/earth/_record.pyx":137 - * data = [] + /* "sklearn/earth/_record.pyx":142 * for i, iteration in enumerate(self.iterations): - * data.append([str(i)] + str(iteration).split('\t') + ('%.3f\t%.3f\t%.3f' % (self.gcv(i),self.rsq(i),self.grsq(i))).split('\t')) # <<<<<<<<<<<<<< + * data.append( + * [str(i)] + str(iteration).split('\t') + ('%.3f\t%.3f\t%.3f' % # <<<<<<<<<<<<<< + * (self.gcv(i), self.rsq(i), self.grsq(i))).split('\t')) * result = '' - * result += 'Forward Pass\n' */ - __pyx_k_tuple_11 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_k_tuple_11 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_k_tuple_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_11); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_11)); - __pyx_k_tuple_13 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "sklearn/earth/_record.pyx":143 + * data.append( + * [str(i)] + str(iteration).split('\t') + ('%.3f\t%.3f\t%.3f' % + * (self.gcv(i), self.rsq(i), self.grsq(i))).split('\t')) # <<<<<<<<<<<<<< + * result = '' + * result += 'Forward Pass\n' + */ + __pyx_k_tuple_13 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_k_tuple_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_k_tuple_13); __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_13)); @@ -11175,18 +11245,18 @@ PyMODINIT_FUNC PyInit__record(void) __pyx_vtabptr_7sklearn_5earth_7_record_Iteration = &__pyx_vtable_7sklearn_5earth_7_record_Iteration; __pyx_vtable_7sklearn_5earth_7_record_Iteration.get_mse = (__pyx_t_7sklearn_5earth_7_record_FLOAT_t (*)(struct __pyx_obj_7sklearn_5earth_7_record_Iteration *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_7_record_9Iteration_get_mse; __pyx_vtable_7sklearn_5earth_7_record_Iteration.get_size = (__pyx_t_7sklearn_5earth_7_record_INDEX_t (*)(struct __pyx_obj_7sklearn_5earth_7_record_Iteration *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_7_record_9Iteration_get_size; - if (PyType_Ready(&__pyx_type_7sklearn_5earth_7_record_Iteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_5earth_7_record_Iteration.tp_dict, __pyx_vtabptr_7sklearn_5earth_7_record_Iteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "Iteration", (PyObject *)&__pyx_type_7sklearn_5earth_7_record_Iteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_5earth_7_record_Iteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_5earth_7_record_Iteration.tp_dict, __pyx_vtabptr_7sklearn_5earth_7_record_Iteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "Iteration", (PyObject *)&__pyx_type_7sklearn_5earth_7_record_Iteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_5earth_7_record_Iteration = &__pyx_type_7sklearn_5earth_7_record_Iteration; __pyx_vtabptr_7sklearn_5earth_7_record_ForwardPassIteration = &__pyx_vtable_7sklearn_5earth_7_record_ForwardPassIteration; __pyx_vtable_7sklearn_5earth_7_record_ForwardPassIteration.__pyx_base = *__pyx_vtabptr_7sklearn_5earth_7_record_Iteration; __pyx_vtable_7sklearn_5earth_7_record_ForwardPassIteration.set_no_candidates = (PyObject *(*)(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration *, int, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_7_record_20ForwardPassIteration_set_no_candidates; __pyx_vtable_7sklearn_5earth_7_record_ForwardPassIteration.no_further_candidates = (PyObject *(*)(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassIteration *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_7_record_20ForwardPassIteration_no_further_candidates; __pyx_type_7sklearn_5earth_7_record_ForwardPassIteration.tp_base = __pyx_ptype_7sklearn_5earth_7_record_Iteration; - if (PyType_Ready(&__pyx_type_7sklearn_5earth_7_record_ForwardPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_5earth_7_record_ForwardPassIteration.tp_dict, __pyx_vtabptr_7sklearn_5earth_7_record_ForwardPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "ForwardPassIteration", (PyObject *)&__pyx_type_7sklearn_5earth_7_record_ForwardPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_5earth_7_record_ForwardPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_5earth_7_record_ForwardPassIteration.tp_dict, __pyx_vtabptr_7sklearn_5earth_7_record_ForwardPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "ForwardPassIteration", (PyObject *)&__pyx_type_7sklearn_5earth_7_record_ForwardPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_5earth_7_record_ForwardPassIteration = &__pyx_type_7sklearn_5earth_7_record_ForwardPassIteration; __pyx_vtabptr_7sklearn_5earth_7_record_Record = &__pyx_vtable_7sklearn_5earth_7_record_Record; __pyx_vtable_7sklearn_5earth_7_record_Record.append = (PyObject *(*)(struct __pyx_obj_7sklearn_5earth_7_record_Record *, struct __pyx_obj_7sklearn_5earth_7_record_Iteration *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_7_record_6Record_append; @@ -11202,32 +11272,32 @@ PyMODINIT_FUNC PyInit__record(void) __pyx_vtable_7sklearn_5earth_7_record_ForwardPassRecord.__pyx_base = *__pyx_vtabptr_7sklearn_5earth_7_record_Record; __pyx_vtable_7sklearn_5earth_7_record_ForwardPassRecord.set_stopping_condition = (PyObject *(*)(struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *, int, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_7_record_17ForwardPassRecord_set_stopping_condition; __pyx_type_7sklearn_5earth_7_record_ForwardPassRecord.tp_base = __pyx_ptype_7sklearn_5earth_7_record_Record; - if (PyType_Ready(&__pyx_type_7sklearn_5earth_7_record_ForwardPassRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_5earth_7_record_ForwardPassRecord.tp_dict, __pyx_vtabptr_7sklearn_5earth_7_record_ForwardPassRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "ForwardPassRecord", (PyObject *)&__pyx_type_7sklearn_5earth_7_record_ForwardPassRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_5earth_7_record_ForwardPassRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_5earth_7_record_ForwardPassRecord.tp_dict, __pyx_vtabptr_7sklearn_5earth_7_record_ForwardPassRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "ForwardPassRecord", (PyObject *)&__pyx_type_7sklearn_5earth_7_record_ForwardPassRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_5earth_7_record_ForwardPassRecord = &__pyx_type_7sklearn_5earth_7_record_ForwardPassRecord; __pyx_vtabptr_7sklearn_5earth_7_record_PruningPassIteration = &__pyx_vtable_7sklearn_5earth_7_record_PruningPassIteration; __pyx_vtable_7sklearn_5earth_7_record_PruningPassIteration.__pyx_base = *__pyx_vtabptr_7sklearn_5earth_7_record_Iteration; __pyx_vtable_7sklearn_5earth_7_record_PruningPassIteration.get_pruned = (__pyx_t_7sklearn_5earth_7_record_INDEX_t (*)(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassIteration *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_7_record_20PruningPassIteration_get_pruned; __pyx_type_7sklearn_5earth_7_record_PruningPassIteration.tp_base = __pyx_ptype_7sklearn_5earth_7_record_Iteration; - if (PyType_Ready(&__pyx_type_7sklearn_5earth_7_record_PruningPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_5earth_7_record_PruningPassIteration.tp_dict, __pyx_vtabptr_7sklearn_5earth_7_record_PruningPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "PruningPassIteration", (PyObject *)&__pyx_type_7sklearn_5earth_7_record_PruningPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_5earth_7_record_PruningPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_5earth_7_record_PruningPassIteration.tp_dict, __pyx_vtabptr_7sklearn_5earth_7_record_PruningPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "PruningPassIteration", (PyObject *)&__pyx_type_7sklearn_5earth_7_record_PruningPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_5earth_7_record_PruningPassIteration = &__pyx_type_7sklearn_5earth_7_record_PruningPassIteration; __pyx_vtabptr_7sklearn_5earth_7_record_FirstPruningPassIteration = &__pyx_vtable_7sklearn_5earth_7_record_FirstPruningPassIteration; __pyx_vtable_7sklearn_5earth_7_record_FirstPruningPassIteration.__pyx_base = *__pyx_vtabptr_7sklearn_5earth_7_record_PruningPassIteration; __pyx_type_7sklearn_5earth_7_record_FirstPruningPassIteration.tp_base = __pyx_ptype_7sklearn_5earth_7_record_PruningPassIteration; - if (PyType_Ready(&__pyx_type_7sklearn_5earth_7_record_FirstPruningPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_5earth_7_record_FirstPruningPassIteration.tp_dict, __pyx_vtabptr_7sklearn_5earth_7_record_FirstPruningPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "FirstPruningPassIteration", (PyObject *)&__pyx_type_7sklearn_5earth_7_record_FirstPruningPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_5earth_7_record_FirstPruningPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_5earth_7_record_FirstPruningPassIteration.tp_dict, __pyx_vtabptr_7sklearn_5earth_7_record_FirstPruningPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "FirstPruningPassIteration", (PyObject *)&__pyx_type_7sklearn_5earth_7_record_FirstPruningPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_5earth_7_record_FirstPruningPassIteration = &__pyx_type_7sklearn_5earth_7_record_FirstPruningPassIteration; __pyx_vtabptr_7sklearn_5earth_7_record_FirstForwardPassIteration = &__pyx_vtable_7sklearn_5earth_7_record_FirstForwardPassIteration; __pyx_vtable_7sklearn_5earth_7_record_FirstForwardPassIteration.__pyx_base = *__pyx_vtabptr_7sklearn_5earth_7_record_ForwardPassIteration; __pyx_vtable_7sklearn_5earth_7_record_FirstForwardPassIteration.__pyx_base.__pyx_base.get_size = (__pyx_t_7sklearn_5earth_7_record_INDEX_t (*)(struct __pyx_obj_7sklearn_5earth_7_record_Iteration *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_7_record_25FirstForwardPassIteration_get_size; __pyx_type_7sklearn_5earth_7_record_FirstForwardPassIteration.tp_base = __pyx_ptype_7sklearn_5earth_7_record_ForwardPassIteration; - if (PyType_Ready(&__pyx_type_7sklearn_5earth_7_record_FirstForwardPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_5earth_7_record_FirstForwardPassIteration.tp_dict, __pyx_vtabptr_7sklearn_5earth_7_record_FirstForwardPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "FirstForwardPassIteration", (PyObject *)&__pyx_type_7sklearn_5earth_7_record_FirstForwardPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_5earth_7_record_FirstForwardPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_5earth_7_record_FirstForwardPassIteration.tp_dict, __pyx_vtabptr_7sklearn_5earth_7_record_FirstForwardPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "FirstForwardPassIteration", (PyObject *)&__pyx_type_7sklearn_5earth_7_record_FirstForwardPassIteration) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_5earth_7_record_FirstForwardPassIteration = &__pyx_type_7sklearn_5earth_7_record_FirstForwardPassIteration; __pyx_vtabptr_7sklearn_5earth_7_record_PruningPassRecord = &__pyx_vtable_7sklearn_5earth_7_record_PruningPassRecord; __pyx_vtable_7sklearn_5earth_7_record_PruningPassRecord.__pyx_base = *__pyx_vtabptr_7sklearn_5earth_7_record_Record; @@ -11235,9 +11305,9 @@ PyMODINIT_FUNC PyInit__record(void) __pyx_vtable_7sklearn_5earth_7_record_PruningPassRecord.get_selected = (__pyx_t_7sklearn_5earth_7_record_INDEX_t (*)(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_7_record_17PruningPassRecord_get_selected; __pyx_vtable_7sklearn_5earth_7_record_PruningPassRecord.roll_back = (PyObject *(*)(struct __pyx_obj_7sklearn_5earth_7_record_PruningPassRecord *, struct __pyx_obj_7sklearn_5earth_6_basis_Basis *, int __pyx_skip_dispatch))__pyx_f_7sklearn_5earth_7_record_17PruningPassRecord_roll_back; __pyx_type_7sklearn_5earth_7_record_PruningPassRecord.tp_base = __pyx_ptype_7sklearn_5earth_7_record_Record; - if (PyType_Ready(&__pyx_type_7sklearn_5earth_7_record_PruningPassRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_7sklearn_5earth_7_record_PruningPassRecord.tp_dict, __pyx_vtabptr_7sklearn_5earth_7_record_PruningPassRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "PruningPassRecord", (PyObject *)&__pyx_type_7sklearn_5earth_7_record_PruningPassRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_7sklearn_5earth_7_record_PruningPassRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_7sklearn_5earth_7_record_PruningPassRecord.tp_dict, __pyx_vtabptr_7sklearn_5earth_7_record_PruningPassRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "PruningPassRecord", (PyObject *)&__pyx_type_7sklearn_5earth_7_record_PruningPassRecord) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_5earth_7_record_PruningPassRecord = &__pyx_type_7sklearn_5earth_7_record_PruningPassRecord; /*--- Type import code ---*/ __pyx_ptype_7cpython_4type_type = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "type", @@ -11260,8 +11330,8 @@ PyMODINIT_FUNC PyInit__record(void) __pyx_vtabptr_7sklearn_5earth_6_basis_HingeBasisFunction = (struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_6_basis_HingeBasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_6_basis_HingeBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_5earth_6_basis_LinearBasisFunction = __Pyx_ImportType("sklearn.earth._basis", "LinearBasisFunction", sizeof(struct __pyx_obj_7sklearn_5earth_6_basis_LinearBasisFunction), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_6_basis_LinearBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_vtabptr_7sklearn_5earth_6_basis_LinearBasisFunction = (struct __pyx_vtabstruct_7sklearn_5earth_6_basis_LinearBasisFunction*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_6_basis_LinearBasisFunction->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_6_basis_LinearBasisFunction)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_7sklearn_5earth_6_basis_Basis = __Pyx_ImportType("sklearn.earth._basis", "Basis", sizeof(struct __pyx_obj_7sklearn_5earth_6_basis_Basis), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_6_basis_Basis)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_vtabptr_7sklearn_5earth_6_basis_Basis = (struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_6_basis_Basis->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_6_basis_Basis)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_7sklearn_5earth_6_basis_Basis = __Pyx_ImportType("sklearn.earth._basis", "Basis", sizeof(struct __pyx_obj_7sklearn_5earth_6_basis_Basis), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_6_basis_Basis)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_vtabptr_7sklearn_5earth_6_basis_Basis = (struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_6_basis_Basis->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_6_basis_Basis)) {__pyx_filename = __pyx_f[3]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_7sklearn_5earth_8_forward_ForwardPasser = __Pyx_ImportType("sklearn.earth._forward", "ForwardPasser", sizeof(struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser), 1); if (unlikely(!__pyx_ptype_7sklearn_5earth_8_forward_ForwardPasser)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_vtabptr_7sklearn_5earth_8_forward_ForwardPasser = (struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser*)__Pyx_GetVtable(__pyx_ptype_7sklearn_5earth_8_forward_ForwardPasser->tp_dict); if (unlikely(!__pyx_vtabptr_7sklearn_5earth_8_forward_ForwardPasser)) {__pyx_filename = __pyx_f[4]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Variable import code ---*/ diff --git a/sklearn/earth/_record.pxd b/sklearn/earth/_record.pxd index 89bb628ce7ef0..062929cf9799b 100644 --- a/sklearn/earth/_record.pxd +++ b/sklearn/earth/_record.pxd @@ -10,16 +10,16 @@ cdef class Record: cdef int num_samples cdef int num_variables cdef FLOAT_t penalty - cdef FLOAT_t sst #Sum of squares total - + cdef FLOAT_t sst # Sum of squares total + cpdef append(Record self, Iteration iteration) - + cpdef FLOAT_t mse(Record self, INDEX_t iteration) - + cpdef FLOAT_t rsq(Record self, INDEX_t iteration) - + cpdef FLOAT_t gcv(Record self, INDEX_t iteration) - + cpdef FLOAT_t grsq(Record self, INDEX_t iteration) cdef class PruningPassRecord(Record): @@ -30,40 +30,40 @@ cdef class PruningPassRecord(Record): cpdef INDEX_t get_selected(PruningPassRecord self) cpdef roll_back(PruningPassRecord self, Basis basis) - + cdef class ForwardPassRecord(Record): cdef int stopping_condition - + cdef list xlabels - + cpdef set_stopping_condition(ForwardPassRecord self, int stopping_condition) - + cdef class Iteration: cdef FLOAT_t mse cdef INDEX_t size - + cpdef FLOAT_t get_mse(Iteration self) - + cpdef INDEX_t get_size(Iteration self) - + cdef class PruningPassIteration(Iteration): cdef INDEX_t pruned - + cpdef INDEX_t get_pruned(PruningPassIteration self) - + cdef class FirstPruningPassIteration(PruningPassIteration): pass - + cdef class ForwardPassIteration(Iteration): cdef INDEX_t parent cdef INDEX_t variable cdef FLOAT_t knot cdef int code cdef bint no_candidates - + cpdef set_no_candidates(ForwardPassIteration self, bint value) - + cpdef no_further_candidates(ForwardPassIteration self) - + cdef class FirstForwardPassIteration(ForwardPassIteration): - cpdef INDEX_t get_size(FirstForwardPassIteration self) \ No newline at end of file + cpdef INDEX_t get_size(FirstForwardPassIteration self) diff --git a/sklearn/earth/_record.pyx b/sklearn/earth/_record.pyx index 517bf5b95760e..aa27153e4917d 100644 --- a/sklearn/earth/_record.pyx +++ b/sklearn/earth/_record.pyx @@ -16,36 +16,38 @@ cdef class Record: return not self._eq(other) else: return NotImplemented - + def _eq(self, other): return self.__class__ is other.__class__ and self._getstate() == other._getstate() - + def __getitem__(Record self, int idx): return self.iterations[idx] - + def __len__(Record self): return len(self.iterations) - + cpdef append(Record self, Iteration iteration): self.iterations.append(iteration) - + cpdef FLOAT_t mse(Record self, INDEX_t iteration): return self.iterations[iteration].get_mse() - + cpdef FLOAT_t gcv(Record self, INDEX_t iteration): cdef Iteration it = self.iterations[iteration] cdef FLOAT_t mse = it.mse - return gcv(mse,it.get_size(),self.num_samples,self.penalty) - + return gcv(mse, it.get_size(), self.num_samples, self.penalty) + cpdef FLOAT_t rsq(Record self, INDEX_t iteration): - cdef FLOAT_t mse0 = self.sst#gcv(self.sst,1,self.num_samples,self.penalty) - cdef FLOAT_t mse = self.mse(iteration)#gcv(self.mse(iteration):,self.iterations[iteration].get_size(),self.num_samples,self.penalty)#self.gcv(iteration) + # gcv(self.sst,1,self.num_samples,self.penalty) + cdef FLOAT_t mse0 = self.sst + # gcv(self.mse(iteration):,self.iterations[iteration].get_size(),self.num_samples,self.penalty)#self.gcv(iteration) + cdef FLOAT_t mse = self.mse(iteration) return 1 - (mse / mse0) - + cpdef FLOAT_t grsq(Record self, INDEX_t iteration): - cdef FLOAT_t gcv0 = gcv(self.sst,1,self.num_samples,self.penalty) + cdef FLOAT_t gcv0 = gcv(self.sst, 1, self.num_samples, self.penalty) cdef FLOAT_t gcv_ = self.gcv(iteration) - return 1 - (gcv_/gcv0) + return 1 - (gcv_ / gcv0) cdef class PruningPassRecord(Record): def __init__(PruningPassRecord self, INDEX_t num_samples, INDEX_t num_variables, FLOAT_t penalty, FLOAT_t sst, INDEX_t size, FLOAT_t mse): @@ -54,19 +56,19 @@ cdef class PruningPassRecord(Record): self.penalty = penalty self.sst = sst self.iterations = [FirstPruningPassIteration(size, mse)] - + def __reduce__(PruningPassRecord self): - return (PruningPassRecord, (1,1,1.0,1.0,1,1.0), self._getstate()) - + return (PruningPassRecord, (1, 1, 1.0, 1.0, 1, 1.0), self._getstate()) + def _getstate(PruningPassRecord self): result = {'num_samples': self.num_samples, - 'num_variables': self.num_variables, - 'penalty': self.penalty, - 'sst': self.sst, - 'iterations': self.iterations, - 'selected': self.selected} + 'num_variables': self.num_variables, + 'penalty': self.penalty, + 'sst': self.sst, + 'iterations': self.iterations, + 'selected': self.selected} return result - + def __setstate__(PruningPassRecord self, dict state): self.num_samples = state['num_samples'] self.num_variables = state['num_variables'] @@ -74,31 +76,32 @@ cdef class PruningPassRecord(Record): self.sst = state['sst'] self.iterations = state['iterations'] self.selected = state['selected'] - + cpdef set_selected(PruningPassRecord self, INDEX_t selected): self.selected = selected - + cpdef INDEX_t get_selected(PruningPassRecord self): return self.selected - + cpdef roll_back(PruningPassRecord self, Basis basis): cdef INDEX_t n = len(self.iterations) cdef INDEX_t i for i in range(n - self.selected - 1): basis[self.iterations[n - i - 1].get_pruned()].unprune() - + def __str__(PruningPassRecord self): result = '' result += 'Pruning Pass\n' header = 'iter\tbf\tterms\tmse\tgcv\trsq\tgrsq'.split('\t') data = [] for i, iteration in enumerate(self.iterations): - row = str(i) + '\t' + str(iteration) + '\t%.3f\t%.3f\t%.3f' % (self.gcv(i),self.rsq(i),self.grsq(i)) + row = str(i) + '\t' + str(iteration) + '\t%.3f\t%.3f\t%.3f' % ( + self.gcv(i), self.rsq(i), self.grsq(i)) data.append(row.split('\t')) - result += ascii_table(header,data) - result += '\nSelected iteration: ' + str(self.selected) + '\n' + result += ascii_table(header, data) + result += '\nSelected iteration: ' + str(self.selected) + '\n' return result - + cdef class ForwardPassRecord(Record): def __init__(ForwardPassRecord self, INDEX_t num_samples, INDEX_t num_variables, FLOAT_t penalty, FLOAT_t sst, list xlabels): self.num_samples = num_samples @@ -107,10 +110,10 @@ cdef class ForwardPassRecord(Record): self.sst = sst self.iterations = [FirstForwardPassIteration(self.sst)] self.xlabels = xlabels - + def __reduce__(ForwardPassRecord self): - return (ForwardPassRecord, (self.num_samples,self.num_variables,self.penalty,self.sst,self.xlabels), self._getstate()) - + return (ForwardPassRecord, (self.num_samples, self.num_variables, self.penalty, self.sst, self.xlabels), self._getstate()) + def _getstate(ForwardPassRecord self): return {'num_samples': self.num_samples, 'num_variables': self.num_variables, @@ -118,7 +121,7 @@ cdef class ForwardPassRecord(Record): 'sst': self.sst, 'iterations': self.iterations, 'xlabels': self.xlabels} - + def __setstate__(ForwardPassRecord self, dict state): self.num_samples = state['num_samples'] self.num_variables = state['num_variables'] @@ -126,23 +129,27 @@ cdef class ForwardPassRecord(Record): self.sst = state['sst'] self.iterations = state['iterations'] self.xlabels = state['xlabels'] - + cpdef set_stopping_condition(ForwardPassRecord self, int stopping_condition): self.stopping_condition = stopping_condition - + def __str__(ForwardPassRecord self): - header = ['iter','parent','var','knot','mse','terms','gcv','rsq','grsq'] + header = ['iter', 'parent', 'var', 'knot', + 'mse', 'terms', 'gcv', 'rsq', 'grsq'] data = [] for i, iteration in enumerate(self.iterations): - data.append([str(i)] + str(iteration).split('\t') + ('%.3f\t%.3f\t%.3f' % (self.gcv(i),self.rsq(i),self.grsq(i))).split('\t')) + data.append( + [str(i)] + str(iteration).split('\t') + ('%.3f\t%.3f\t%.3f' % + (self.gcv(i), self.rsq(i), self.grsq(i))).split('\t')) result = '' result += 'Forward Pass\n' result += ascii_table(header, data) - result += '\nStopping Condition %d: %s\n' % (self.stopping_condition, stopping_conditions[self.stopping_condition]) + result += '\nStopping Condition %d: %s\n' % ( + self.stopping_condition, stopping_conditions[self.stopping_condition]) return result cdef class Iteration: - + def __richcmp__(self, other, method): if method == 2: return self._eq(other) @@ -150,13 +157,13 @@ cdef class Iteration: return not self._eq(other) else: return NotImplemented - + def _eq(self, other): return self.__class__ is other.__class__ and self._getstate() == other._getstate() - + cpdef FLOAT_t get_mse(Iteration self): return self.mse - + cpdef INDEX_t get_size(Iteration self): return self.size @@ -165,47 +172,49 @@ cdef class PruningPassIteration(Iteration): self.pruned = pruned self.size = size self.mse = mse - + def __reduce__(PruningPassIteration self): - return (PruningPassIteration, (1,1,1.0), self._getstate()) - + return (PruningPassIteration, (1, 1, 1.0), self._getstate()) + def _getstate(PruningPassIteration self): return {'pruned': self.pruned, 'size': self.size, 'mse': self.mse} - + def __setstate__(PruningPassIteration self, dict state): self.pruned = state['pruned'] self.size = state['size'] self.mse = state['mse'] - + cpdef INDEX_t get_pruned(PruningPassIteration self): return self.pruned - + def __str__(PruningPassIteration self): - result = '%s\t%s\t%s' % (str(self.pruned),self.size,'%.2f' % self.mse if self.mse is not None else None) + result = '%s\t%s\t%s' % (str(self.pruned), self.size, '%.2f' % + self.mse if self.mse is not None else None) return result - + cdef class FirstPruningPassIteration(PruningPassIteration): def __init__(PruningPassIteration self, INDEX_t size, FLOAT_t mse): self.size = size self.mse = mse - + def __reduce__(FirstPruningPassIteration self): - return (FirstPruningPassIteration, (1,1.0), self._getstate()) - + return (FirstPruningPassIteration, (1, 1.0), self._getstate()) + def _getstate(FirstPruningPassIteration self): return {'size': self.size, 'mse': self.mse} - + def __setstate__(FirstPruningPassIteration self, dict state): self.size = state['size'] self.mse = state['mse'] - + def __str__(PruningPassIteration self): - result = '%s\t%s\t%s' % ('-',self.size,'%.2f' % self.mse if self.mse is not None else None) + result = '%s\t%s\t%s' % ('-', self.size, '%.2f' % + self.mse if self.mse is not None else None) return result - + cdef class ForwardPassIteration(Iteration): def __init__(ForwardPassIteration self, INDEX_t parent, INDEX_t variable, int knot, FLOAT_t mse, INDEX_t size): self.parent = parent @@ -213,51 +222,51 @@ cdef class ForwardPassIteration(Iteration): self.knot = knot self.mse = mse self.size = size - + def __reduce__(ForwardPassIteration self): - return (ForwardPassIteration, (1,1,1,1.0,1), self._getstate()) - + return (ForwardPassIteration, (1, 1, 1, 1.0, 1), self._getstate()) + def _getstate(ForwardPassIteration self): return {'parent': self.parent, 'variable': self.variable, 'knot': self.knot, 'mse': self.mse, 'size': self.size} - + def __setstate__(ForwardPassIteration self, dict state): self.parent = state['parent'] self.variable = state['variable'] self.knot = state['knot'] self.mse = state['mse'] self.size = state['size'] - + def __str__(self): - result = '%d\t%d\t%d\t%4f\t%d' % (self.parent,self.variable,self.knot,self.mse,self.size) + result = '%d\t%d\t%d\t%4f\t%d' % ( + self.parent, self.variable, self.knot, self.mse, self.size) return result - + cpdef set_no_candidates(ForwardPassIteration self, bint value): self.no_candidates = value - + cpdef no_further_candidates(ForwardPassIteration self): return self.no_candidates - + cdef class FirstForwardPassIteration(ForwardPassIteration): def __init__(FirstForwardPassIteration self, FLOAT_t mse): self.mse = mse - + def __reduce__(FirstForwardPassIteration self): return (FirstForwardPassIteration, (1.0,), self._getstate()) - + def _getstate(FirstForwardPassIteration self): return {'mse': self.mse} - + def __setstate__(FirstForwardPassIteration self, dict state): self.mse = state['mse'] - + cpdef INDEX_t get_size(FirstForwardPassIteration self): return 1 - + def __str__(self): - result = '%s\t%s\t%s\t%4f\t%s' % ('-','-','-',self.mse,1) + result = '%s\t%s\t%s\t%4f\t%s' % ('-', '-', '-', self.mse, 1) return result - \ No newline at end of file diff --git a/sklearn/earth/_util.c b/sklearn/earth/_util.c index fe1a83a50ce71..2d1878b10737b 100644 --- a/sklearn/earth/_util.c +++ b/sklearn/earth/_util.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19.1 on Sat Jul 27 21:13:14 2013 */ +/* Generated by Cython 0.19.1 on Sat Jul 27 22:55:34 2013 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS @@ -1397,7 +1397,7 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_apply_weights_2d(PyArrayObject * * cdef INDEX_t n = B.shape[1] * for i in range(m): # <<<<<<<<<<<<<< * for j in range(n): - * B[i,j] *= sqrt(weights[i]) + * B[i, j] *= sqrt(weights[i]) */ __pyx_t_1 = __pyx_v_m; for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { @@ -1407,7 +1407,7 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_apply_weights_2d(PyArrayObject * * cdef INDEX_t n = B.shape[1] * for i in range(m): * for j in range(n): # <<<<<<<<<<<<<< - * B[i,j] *= sqrt(weights[i]) + * B[i, j] *= sqrt(weights[i]) * */ __pyx_t_3 = __pyx_v_n; @@ -1417,7 +1417,7 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_apply_weights_2d(PyArrayObject * /* "sklearn/earth/_util.pyx":20 * for i in range(m): * for j in range(n): - * B[i,j] *= sqrt(weights[i]) # <<<<<<<<<<<<<< + * B[i, j] *= sqrt(weights[i]) # <<<<<<<<<<<<<< * * cpdef apply_weights_1d(cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] weights): */ @@ -1580,7 +1580,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_5_util_apply_weights_2d(CYTHON_UNUSED } /* "sklearn/earth/_util.pyx":22 - * B[i,j] *= sqrt(weights[i]) + * B[i, j] *= sqrt(weights[i]) * * cpdef apply_weights_1d(cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] weights): # <<<<<<<<<<<<<< * cdef INDEX_t i @@ -1742,7 +1742,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_5_util_3apply_weights_1d(PyObject *__p } /* "sklearn/earth/_util.pyx":22 - * B[i,j] *= sqrt(weights[i]) + * B[i, j] *= sqrt(weights[i]) * * cpdef apply_weights_1d(cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] weights): # <<<<<<<<<<<<<< * cdef INDEX_t i @@ -1953,7 +1953,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_5_util_4gcv(CYTHON_UNUSED PyObject *__ * return mse * gcv_adjust(basis_size, data_size, penalty) * * cpdef FLOAT_t gcv_adjust(INDEX_t basis_size, INDEX_t data_size, FLOAT_t penalty): # <<<<<<<<<<<<<< - * return 1.0 / ((1 - ((basis_size + penalty*(basis_size - 1))/data_size)) ** 2) + * return 1.0 / ((1 - ((basis_size + penalty * (basis_size - 1)) / data_size)) ** 2) * */ @@ -1966,7 +1966,7 @@ static __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_f_7sklearn_5earth_5_util_gcv /* "sklearn/earth/_util.pyx":32 * * cpdef FLOAT_t gcv_adjust(INDEX_t basis_size, INDEX_t data_size, FLOAT_t penalty): - * return 1.0 / ((1 - ((basis_size + penalty*(basis_size - 1))/data_size)) ** 2) # <<<<<<<<<<<<<< + * return 1.0 / ((1 - ((basis_size + penalty * (basis_size - 1)) / data_size)) ** 2) # <<<<<<<<<<<<<< * * cpdef str_pad(string, length): */ @@ -2051,7 +2051,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_5_util_7gcv_adjust(PyObject *__pyx_sel * return mse * gcv_adjust(basis_size, data_size, penalty) * * cpdef FLOAT_t gcv_adjust(INDEX_t basis_size, INDEX_t data_size, FLOAT_t penalty): # <<<<<<<<<<<<<< - * return 1.0 / ((1 - ((basis_size + penalty*(basis_size - 1))/data_size)) ** 2) + * return 1.0 / ((1 - ((basis_size + penalty * (basis_size - 1)) / data_size)) ** 2) * */ @@ -2083,7 +2083,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_5_util_6gcv_adjust(CYTHON_UNUSED PyObj } /* "sklearn/earth/_util.pyx":34 - * return 1.0 / ((1 - ((basis_size + penalty*(basis_size - 1))/data_size)) ** 2) + * return 1.0 / ((1 - ((basis_size + penalty * (basis_size - 1)) / data_size)) ** 2) * * cpdef str_pad(string, length): # <<<<<<<<<<<<<< * if len(string) >= length: @@ -2125,7 +2125,7 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_str_pad(PyObject *__pyx_v_string * if len(string) >= length: * return string[0:length] # <<<<<<<<<<<<<< * pad = length - len(string) - * return string + ' '*pad + * return string + ' ' * pad */ __Pyx_XDECREF(__pyx_r); __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_string, 0, 0, NULL, &__pyx_v_length, NULL, 1, 0, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -2141,7 +2141,7 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_str_pad(PyObject *__pyx_v_string * if len(string) >= length: * return string[0:length] * pad = length - len(string) # <<<<<<<<<<<<<< - * return string + ' '*pad + * return string + ' ' * pad * */ __pyx_t_1 = PyObject_Length(__pyx_v_string); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -2156,7 +2156,7 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_str_pad(PyObject *__pyx_v_string /* "sklearn/earth/_util.pyx":38 * return string[0:length] * pad = length - len(string) - * return string + ' '*pad # <<<<<<<<<<<<<< + * return string + ' ' * pad # <<<<<<<<<<<<<< * * cpdef ascii_table(header, data): */ @@ -2244,7 +2244,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_5_util_9str_pad(PyObject *__pyx_self, } /* "sklearn/earth/_util.pyx":34 - * return 1.0 / ((1 - ((basis_size + penalty*(basis_size - 1))/data_size)) ** 2) + * return 1.0 / ((1 - ((basis_size + penalty * (basis_size - 1)) / data_size)) ** 2) * * cpdef str_pad(string, length): # <<<<<<<<<<<<<< * if len(string) >= length: @@ -2279,7 +2279,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_5_util_8str_pad(CYTHON_UNUSED PyObject } /* "sklearn/earth/_util.pyx":40 - * return string + ' '*pad + * return string + ' ' * pad * * cpdef ascii_table(header, data): # <<<<<<<<<<<<<< * ''' @@ -2631,7 +2631,7 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_ascii_table(PyObject *__pyx_v_he * * result = '' # <<<<<<<<<<<<<< * for j, col_width in enumerate(column_widths): - * result += '-'*col_width + '-' + * result += '-' * col_width + '-' */ __Pyx_INCREF(((PyObject *)__pyx_kp_s_2)); __pyx_v_result = ((PyObject *)__pyx_kp_s_2); @@ -2640,7 +2640,7 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_ascii_table(PyObject *__pyx_v_he * * result = '' * for j, col_width in enumerate(column_widths): # <<<<<<<<<<<<<< - * result += '-'*col_width + '-' + * result += '-' * col_width + '-' * result += '\n' */ __Pyx_INCREF(__pyx_int_0); @@ -2668,7 +2668,7 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_ascii_table(PyObject *__pyx_v_he /* "sklearn/earth/_util.pyx":58 * result = '' * for j, col_width in enumerate(column_widths): - * result += '-'*col_width + '-' # <<<<<<<<<<<<<< + * result += '-' * col_width + '-' # <<<<<<<<<<<<<< * result += '\n' * for j, head in enumerate(header): */ @@ -2689,10 +2689,10 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_ascii_table(PyObject *__pyx_v_he /* "sklearn/earth/_util.pyx":59 * for j, col_width in enumerate(column_widths): - * result += '-'*col_width + '-' + * result += '-' * col_width + '-' * result += '\n' # <<<<<<<<<<<<<< * for j, head in enumerate(header): - * result += str_pad(head,column_widths[j]) + ' ' + * result += str_pad(head, column_widths[j]) + ' ' */ __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -2701,10 +2701,10 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_ascii_table(PyObject *__pyx_v_he __pyx_t_2 = 0; /* "sklearn/earth/_util.pyx":60 - * result += '-'*col_width + '-' + * result += '-' * col_width + '-' * result += '\n' * for j, head in enumerate(header): # <<<<<<<<<<<<<< - * result += str_pad(head,column_widths[j]) + ' ' + * result += str_pad(head, column_widths[j]) + ' ' * result += '\n' */ __Pyx_INCREF(__pyx_int_0); @@ -2758,7 +2758,7 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_ascii_table(PyObject *__pyx_v_he /* "sklearn/earth/_util.pyx":61 * result += '\n' * for j, head in enumerate(header): - * result += str_pad(head,column_widths[j]) + ' ' # <<<<<<<<<<<<<< + * result += str_pad(head, column_widths[j]) + ' ' # <<<<<<<<<<<<<< * result += '\n' * for j, col_width in enumerate(column_widths): */ @@ -2782,10 +2782,10 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_ascii_table(PyObject *__pyx_v_he /* "sklearn/earth/_util.pyx":62 * for j, head in enumerate(header): - * result += str_pad(head,column_widths[j]) + ' ' + * result += str_pad(head, column_widths[j]) + ' ' * result += '\n' # <<<<<<<<<<<<<< * for j, col_width in enumerate(column_widths): - * result += '-'*col_width + '-' + * result += '-' * col_width + '-' */ __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -2794,10 +2794,10 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_ascii_table(PyObject *__pyx_v_he __pyx_t_2 = 0; /* "sklearn/earth/_util.pyx":63 - * result += str_pad(head,column_widths[j]) + ' ' + * result += str_pad(head, column_widths[j]) + ' ' * result += '\n' * for j, col_width in enumerate(column_widths): # <<<<<<<<<<<<<< - * result += '-'*col_width + '-' + * result += '-' * col_width + '-' * for i, row in enumerate(data): */ __Pyx_INCREF(__pyx_int_0); @@ -2825,7 +2825,7 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_ascii_table(PyObject *__pyx_v_he /* "sklearn/earth/_util.pyx":64 * result += '\n' * for j, col_width in enumerate(column_widths): - * result += '-'*col_width + '-' # <<<<<<<<<<<<<< + * result += '-' * col_width + '-' # <<<<<<<<<<<<<< * for i, row in enumerate(data): * result += '\n' */ @@ -2846,7 +2846,7 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_ascii_table(PyObject *__pyx_v_he /* "sklearn/earth/_util.pyx":65 * for j, col_width in enumerate(column_widths): - * result += '-'*col_width + '-' + * result += '-' * col_width + '-' * for i, row in enumerate(data): # <<<<<<<<<<<<<< * result += '\n' * for j, item in enumerate(row): @@ -2900,11 +2900,11 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_ascii_table(PyObject *__pyx_v_he __pyx_t_5 = 0; /* "sklearn/earth/_util.pyx":66 - * result += '-'*col_width + '-' + * result += '-' * col_width + '-' * for i, row in enumerate(data): * result += '\n' # <<<<<<<<<<<<<< * for j, item in enumerate(row): - * result += str_pad(item,column_widths[j]) + ' ' + * result += str_pad(item, column_widths[j]) + ' ' */ __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); @@ -2916,7 +2916,7 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_ascii_table(PyObject *__pyx_v_he * for i, row in enumerate(data): * result += '\n' * for j, item in enumerate(row): # <<<<<<<<<<<<<< - * result += str_pad(item,column_widths[j]) + ' ' + * result += str_pad(item, column_widths[j]) + ' ' * result += '\n' */ __Pyx_INCREF(__pyx_int_0); @@ -2970,7 +2970,7 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_ascii_table(PyObject *__pyx_v_he /* "sklearn/earth/_util.pyx":68 * result += '\n' * for j, item in enumerate(row): - * result += str_pad(item,column_widths[j]) + ' ' # <<<<<<<<<<<<<< + * result += str_pad(item, column_widths[j]) + ' ' # <<<<<<<<<<<<<< * result += '\n' * for j, col_width in enumerate(column_widths): */ @@ -2997,10 +2997,10 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_ascii_table(PyObject *__pyx_v_he /* "sklearn/earth/_util.pyx":69 * for j, item in enumerate(row): - * result += str_pad(item,column_widths[j]) + ' ' + * result += str_pad(item, column_widths[j]) + ' ' * result += '\n' # <<<<<<<<<<<<<< * for j, col_width in enumerate(column_widths): - * result += '-'*col_width + '-' + * result += '-' * col_width + '-' */ __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); @@ -3009,10 +3009,10 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_ascii_table(PyObject *__pyx_v_he __pyx_t_2 = 0; /* "sklearn/earth/_util.pyx":70 - * result += str_pad(item,column_widths[j]) + ' ' + * result += str_pad(item, column_widths[j]) + ' ' * result += '\n' * for j, col_width in enumerate(column_widths): # <<<<<<<<<<<<<< - * result += '-'*col_width + '-' + * result += '-' * col_width + '-' * return result */ __Pyx_INCREF(__pyx_int_0); @@ -3040,9 +3040,8 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_ascii_table(PyObject *__pyx_v_he /* "sklearn/earth/_util.pyx":71 * result += '\n' * for j, col_width in enumerate(column_widths): - * result += '-'*col_width + '-' # <<<<<<<<<<<<<< + * result += '-' * col_width + '-' # <<<<<<<<<<<<<< * return result - * */ __pyx_t_5 = PyNumber_Multiply(((PyObject *)__pyx_kp_s_3), __pyx_v_col_width); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); @@ -3061,10 +3060,8 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_ascii_table(PyObject *__pyx_v_he /* "sklearn/earth/_util.pyx":72 * for j, col_width in enumerate(column_widths): - * result += '-'*col_width + '-' + * result += '-' * col_width + '-' * return result # <<<<<<<<<<<<<< - * - * */ __Pyx_XDECREF(__pyx_r); __Pyx_INCREF(__pyx_v_result); @@ -3161,7 +3158,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_5_util_11ascii_table(PyObject *__pyx_s } /* "sklearn/earth/_util.pyx":40 - * return string + ' '*pad + * return string + ' ' * pad * * cpdef ascii_table(header, data): # <<<<<<<<<<<<<< * ''' diff --git a/sklearn/earth/_util.pxd b/sklearn/earth/_util.pxd index c51e091f88314..3a3215f1df719 100644 --- a/sklearn/earth/_util.pxd +++ b/sklearn/earth/_util.pxd @@ -7,7 +7,7 @@ ctypedef cnp.uint8_t BOOL_t cdef FLOAT_t log2(FLOAT_t x) cpdef apply_weights_2d(cnp.ndarray[FLOAT_t, ndim=2] B, cnp.ndarray[FLOAT_t, ndim=1] weights) - + cpdef apply_weights_1d(cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] weights) cpdef FLOAT_t gcv(FLOAT_t mse, INDEX_t basis_size, INDEX_t data_size, FLOAT_t penalty) @@ -16,4 +16,4 @@ cpdef FLOAT_t gcv_adjust(INDEX_t basis_size, INDEX_t data_size, FLOAT_t penalty) cpdef str_pad(string, length) -cpdef ascii_table(header, data) \ No newline at end of file +cpdef ascii_table(header, data) diff --git a/sklearn/earth/_util.pyx b/sklearn/earth/_util.pyx index 0b081f071a6ad..9b5c5d36f1b6f 100644 --- a/sklearn/earth/_util.pyx +++ b/sklearn/earth/_util.pyx @@ -17,8 +17,8 @@ cpdef apply_weights_2d(cnp.ndarray[FLOAT_t, ndim=2] B, cnp.ndarray[FLOAT_t, ndim cdef INDEX_t n = B.shape[1] for i in range(m): for j in range(n): - B[i,j] *= sqrt(weights[i]) - + B[i, j] *= sqrt(weights[i]) + cpdef apply_weights_1d(cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] weights): cdef INDEX_t i cdef INDEX_t m = y.shape[0] @@ -29,13 +29,13 @@ cpdef FLOAT_t gcv(FLOAT_t mse, INDEX_t basis_size, INDEX_t data_size, FLOAT_t pe return mse * gcv_adjust(basis_size, data_size, penalty) cpdef FLOAT_t gcv_adjust(INDEX_t basis_size, INDEX_t data_size, FLOAT_t penalty): - return 1.0 / ((1 - ((basis_size + penalty*(basis_size - 1))/data_size)) ** 2) + return 1.0 / ((1 - ((basis_size + penalty * (basis_size - 1)) / data_size)) ** 2) cpdef str_pad(string, length): if len(string) >= length: return string[0:length] pad = length - len(string) - return string + ' '*pad + return string + ' ' * pad cpdef ascii_table(header, data): ''' @@ -49,30 +49,24 @@ cpdef ascii_table(header, data): for j, col in enumerate(row): if len(col) > column_widths[j]: column_widths[j] = len(col) - + for j in range(n): column_widths[j] += 1 - + result = '' for j, col_width in enumerate(column_widths): - result += '-'*col_width + '-' + result += '-' * col_width + '-' result += '\n' for j, head in enumerate(header): - result += str_pad(head,column_widths[j]) + ' ' + result += str_pad(head, column_widths[j]) + ' ' result += '\n' for j, col_width in enumerate(column_widths): - result += '-'*col_width + '-' + result += '-' * col_width + '-' for i, row in enumerate(data): result += '\n' for j, item in enumerate(row): - result += str_pad(item,column_widths[j]) + ' ' + result += str_pad(item, column_widths[j]) + ' ' result += '\n' for j, col_width in enumerate(column_widths): - result += '-'*col_width + '-' + result += '-' * col_width + '-' return result - - - - - - diff --git a/sklearn/earth/earth.py b/sklearn/earth/earth.py index ea7089f6a4ef1..d11f864b86b6e 100644 --- a/sklearn/earth/earth.py +++ b/sklearn/earth/earth.py @@ -6,145 +6,149 @@ import numpy as np from scipy import sparse + class Earth(BaseEstimator, RegressorMixin, TransformerMixin): + ''' Multivariate Adaptive Regression Splines - - A flexible regression method that automatically searches for interactions and non-linear - relationships. Earth models can be thought of as linear models in a higher dimensional - basis space (specifically, a multivariate truncated power spline basis). Each term in an - Earth model is a product of so called "hinge functions". A hinge function is a function - that's equal to its argument where that argument is greater than zero and is zero everywhere + + A flexible regression method that automatically searches for interactions and non-linear + relationships. Earth models can be thought of as linear models in a higher dimensional + basis space (specifically, a multivariate truncated power spline basis). Each term in an + Earth model is a product of so called "hinge functions". A hinge function is a function + that's equal to its argument where that argument is greater than zero and is zero everywhere else. - - The multivariate adaptive regression splines algorithm has two stages. First, the - forward pass searches for terms in the truncated power spline basis that locally minimize - the squared error loss of the training set. Next, a pruning pass selects a subset of those - terms that produces a locally minimal generalized cross-validation (GCV) score. The GCV + + The multivariate adaptive regression splines algorithm has two stages. First, the + forward pass searches for terms in the truncated power spline basis that locally minimize + the squared error loss of the training set. Next, a pruning pass selects a subset of those + terms that produces a locally minimal generalized cross-validation (GCV) score. The GCV score is not actually based on cross-validation, but rather is meant to approximate a true cross-validation score by penalizing model complexity. The final result is a set of terms - that is nonlinear in the original feature space, may include interactions, and is likely to + that is nonlinear in the original feature space, may include interactions, and is likely to generalize well. - - The Earth class supports dense input only. Data structures from the pandas and patsy - modules are supported, but are copied into numpy arrays for computation. No copy is - made if the inputs are numpy float64 arrays. Earth objects can be serialized using the + + The Earth class supports dense input only. Data structures from the pandas and patsy + modules are supported, but are copied into numpy arrays for computation. No copy is + made if the inputs are numpy float64 arrays. Earth objects can be serialized using the pickle module and copied using the copy module. - - + + Parameters ---------- max_terms : int, optional (default=2*n + 10, where n is the number of features) The maximum number of terms generated by the forward pass. - - + + max_degree : int, optional (default=1) The maximum degree of terms generated by the forward pass. - - + + penalty : float, optional (default=3.0) - A smoothing parameter used to calculate GCV and GRSQ. Used during the pruning pass + A smoothing parameter used to calculate GCV and GRSQ. Used during the pruning pass and to determine whether to add a hinge or linear basis function during the forward pass. See the d parameter in equation 32, Friedman, 1991. - - + + endspan_alpha : float, optional, probability between 0 and 1 (default=0.05) - A parameter controlling the calculation of the endspan parameter (below). The + A parameter controlling the calculation of the endspan parameter (below). The endspan parameter is calculated as round(3 - log2(endspan_alpha/n)), where n is the - number of features. The endspan_alpha parameter represents the probability of a run + number of features. The endspan_alpha parameter represents the probability of a run of positive or negative error values on either end of the data vector of any feature in the data set. See equation 45, Friedman, 1991. - - + + endspan : int, optional (default=-1) - The number of extreme data values of each feature not eligible as knot locations. + The number of extreme data values of each feature not eligible as knot locations. If endspan is set to -1 (default) then the endspan parameter is calculated based on - endspan_alpah (above). If endspan is set to a positive integer then endspan_alpha + endspan_alpah (above). If endspan is set to a positive integer then endspan_alpha is ignored. - - + + minspan_alpha : float, optional, probability between 0 and 1 (default=0.05) - A parameter controlling the calculation of the minspan parameter (below). The - minspan parameter is calculated as - + A parameter controlling the calculation of the minspan parameter (below). The + minspan parameter is calculated as + (int) -log2(-(1.0/(n*count))*log(1.0-minspan_alpha)) / 2.5 - + where n is the number of features and count is the number of points at which the - parent term is non-zero. The minspan_alpha parameter represents the probability of - a run of positive or negative error values between adjacent knots separated by + parent term is non-zero. The minspan_alpha parameter represents the probability of + a run of positive or negative error values between adjacent knots separated by minspan intervening data points. See equation 43, Friedman, 1991. - - + + minspan : int, optional (default=-1) - The minimal number of data points between knots. If minspan is set to -1 (default) + The minimal number of data points between knots. If minspan is set to -1 (default) then the minspan parameter is calculated based on minspan_alpha (above). If minspan is set to a positive integer then minspan_alpha is ignored. - - + + thresh : float, optional (defaul=0.001) Parameter used when evaluating stopping conditions for the forward pass. If either RSQ > 1 - thresh or if RSQ increases by less than thresh for a forward pass iteration then the forward pass is terminated. - - + + min_searh_points : int, optional (default=100) - Used to calculate check_every (below). The minimum samples necessary for check_every + Used to calculate check_every (below). The minimum samples necessary for check_every to be greater than 1. The check_every parameter is calculated as - + (int) m / min_search_points - - if m > min_search_points, where m is the number of samples in the training set. If + + if m > min_search_points, where m is the number of samples in the training set. If m <= min_search_points then check_every is set to 1. - - + + check_every : int, optional (default=-1) - If check_every > 0, only one of every check_every sorted data points is considered as - a candidate knot. If check_every is set to -1 then the check_every parameter is + If check_every > 0, only one of every check_every sorted data points is considered as + a candidate knot. If check_every is set to -1 then the check_every parameter is calculated based on min_search_points (above). - - + + Attributes ---------- `coef_` : array, shape = [pruned basis length] The weights of the model terms that have not been pruned. - - + + `basis_` : _basis.Basis An object representing model terms. Each term is a product of constant, linear, and hinge - functions of the input features. - - + functions of the input features. + + `forward_pass_record_` : _record.ForwardPassRecord - An object containing information about the forward pass, such as training loss function + An object containing information about the forward pass, such as training loss function values after each iteration and the final stopping condition. - - + + `pruning_pass_record_` : _record.PruningPassRecord An object containing information about the pruning pass, such as training loss function values after each iteration and the selected optimal iteration. - + **References:** - Friedman, Jerome. Multivariate Adaptive Regression Splines. Annals of Statistics. Volume 19, + Friedman, Jerome. Multivariate Adaptive Regression Splines. Annals of Statistics. Volume 19, Number 1 (1991), 1-67. - + ''' - - forward_pass_arg_names = set(['endspan','minspan','endspan_alpha','minspan_alpha', - 'max_terms','max_degree','thresh','penalty','check_every', - 'min_searh_points']) + + forward_pass_arg_names = set( + ['endspan', 'minspan', 'endspan_alpha', 'minspan_alpha', + 'max_terms', 'max_degree', 'thresh', 'penalty', 'check_every', + 'min_searh_points']) pruning_pass_arg_names = set(['penalty']) - - def __init__(self, endspan=None, minspan=None, endspan_alpha=None, minspan_alpha=None, max_terms=None, max_degree=None, - thresh=None, penalty=None, check_every=None, min_search_points=None): + + def __init__( + self, endspan=None, minspan=None, endspan_alpha=None, minspan_alpha=None, max_terms=None, max_degree=None, + thresh=None, penalty=None, check_every=None, min_search_points=None): kwargs = {} call = locals() for name in self._get_param_names(): if call[name] is not None: kwargs[name] = call[name] - + self.set_params(**kwargs) - + def __eq__(self, other): if self.__class__ is not other.__class__: return False @@ -158,11 +162,11 @@ def __eq__(self, other): try: if v_self != v_other: return False - except ValueError:#Case of numpy arrays + except ValueError: # Case of numpy arrays if np.any(v_self != v_other): return False return True - + def _pull_forward_args(self, **kwargs): ''' Pull named arguments relevant to the forward pass. @@ -172,7 +176,7 @@ def _pull_forward_args(self, **kwargs): if name in kwargs: result[name] = kwargs[name] return result - + def _pull_pruning_args(self, **kwargs): ''' Pull named arguments relevant to the pruning pass. @@ -182,10 +186,10 @@ def _pull_pruning_args(self, **kwargs): if name in kwargs: result[name] = kwargs[name] return result - + def _pull_unknown_args(self, **kwargs): ''' - Pull unknown named arguments. Usually an exception is raised if any are + Pull unknown named arguments. Usually an exception is raised if any are actually found, but raising exceptions is the responsibility of the caller. ''' result = {} @@ -194,7 +198,7 @@ def _pull_unknown_args(self, **kwargs): if name not in known_args: result[name] = kwargs[name] return result - + def _scrape_labels(self, X): ''' Try to get labels from input data (for example, if X is a pandas DataFrame). Return None @@ -210,244 +214,248 @@ def _scrape_labels(self, X): labels = list(X.dtype.names) except TypeError: labels = None - + return labels - + def _scrub_x(self, X, **kwargs): ''' Sanitize input predictors and extract column names if appropriate. ''' - #Check for sparseness + # Check for sparseness if sparse.issparse(X): raise TypeError('A sparse matrix was passed, but dense data ' 'is required. Use X.toarray() to convert to dense.') - - #Convert to internally used data type - X = safe_asarray(X,dtype=np.float64) + + # Convert to internally used data type + X = safe_asarray(X, dtype=np.float64) if len(X.shape) == 1: X = X.reshape((X.shape[0], 1)) - - #Ensure correct number of columns - if hasattr(self,'basis_') and self.basis_ is not None: + + # Ensure correct number of columns + if hasattr(self, 'basis_') and self.basis_ is not None: if X.shape[1] != self.basis_.num_variables: raise ValueError('Wrong number of columns in X') - + return X - + def _scrub(self, X, y, sample_weight, **kwargs): ''' Sanitize input data. ''' - #Check for sparseness + # Check for sparseness if sparse.issparse(y): raise TypeError('A sparse matrix was passed, but dense data ' 'is required. Use y.toarray() to convert to dense.') if sparse.issparse(sample_weight): raise TypeError('A sparse matrix was passed, but dense data ' 'is required. Use sample_weight.toarray() to convert to dense.') - - #Check whether X is the output of patsy.dmatrices - if y is None and type(X) is tuple: + + # Check whether X is the output of patsy.dmatrices + if y is None and isinstance(X, tuple): y, X = X - - #Handle X separately + + # Handle X separately X = self._scrub_x(X, **kwargs) - - #Convert y to internally used data type - y = safe_asarray(y,dtype=np.float64) + + # Convert y to internally used data type + y = safe_asarray(y, dtype=np.float64) y = y.reshape(y.shape[0]) - - #Deal with sample_weight + + # Deal with sample_weight if sample_weight is None: sample_weight = np.ones(y.shape[0], dtype=y.dtype) else: sample_weight = safe_asarray(sample_weight) sample_weight = sample_weight.reshape(sample_weight.shape[0]) - - #Make sure dimensions match + + # Make sure dimensions match if y.shape[0] != X.shape[0]: raise ValueError('X and y do not have compatible dimensions.') if y.shape != sample_weight.shape: - raise ValueError('y and sample_weight do not have compatible dimensions.') - - #Make sure everything is finite + raise ValueError( + 'y and sample_weight do not have compatible dimensions.') + + # Make sure everything is finite assert_all_finite(X) assert_all_finite(y) assert_all_finite(sample_weight) - + return X, y, sample_weight - + def fit(self, X, y=None, sample_weight=None, xlabels=None, linvars=[]): ''' Fit an Earth model to the input data X and y. - - + + Parameters ---------- X : array-like, shape = [m, n] where m is the number of samples and n is the number of features - The training predictors. The X parameter can be a numpy array, a pandas DataFrame, a patsy + The training predictors. The X parameter can be a numpy array, a pandas DataFrame, a patsy DesignMatrix, or a tuple of patsy DesignMatrix objects as output by patsy.dmatrices. - - + + y : array-like, optional (default=None), shape = [m] where m is the number of samples - The training response. The y parameter can be a numpy array, a pandas DataFrame with one - column, a Patsy DesignMatrix, or can be left as None (default) if X was the output of a + The training response. The y parameter can be a numpy array, a pandas DataFrame with one + column, a Patsy DesignMatrix, or can be left as None (default) if X was the output of a call to patsy.dmatrices (in which case, X contains the response). - - + + sample_weight : array-like, optional (default=None), shape = [m] where m is the number of samples - Sample weights for training. Weights must be greater than or equal to zero. Rows with + Sample weights for training. Weights must be greater than or equal to zero. Rows with greater weights contribute more strongly to the fitted model. Rows with zero weight do not contribute at all. Weights are useful when dealing with heteroscedasticity. In such cases, the weight should be proportional to the inverse of the (known) variance. - - + + linvars : iterable of strings or ints, optional (empty by default) - Used to specify features that may only enter terms as linear basis functions (without - knots). Can include both column numbers and column names (see xlabels, below). If left + Used to specify features that may only enter terms as linear basis functions (without + knots). Can include both column numbers and column names (see xlabels, below). If left empty, some variables may still enter linearly during the forward pass if no knot would provide a reduction in GCV compared to the linear function. Note that this feature differs from the R package earth. - - + + xlabels : iterable of strings, optional (empty by default) The xlabels argument can be used to assign names to data columns. This argument is not - generally needed, as names can be captured automatically from most standard data - structures. If included, must have length n, where n is the number of features. Note - that column order is used to compute term values and make predictions, not column names. - - + generally needed, as names can be captured automatically from most standard data + structures. If included, must have length n, where n is the number of features. Note + that column order is used to compute term values and make predictions, not column names. + + ''' - - #Format and label the data + + # Format and label the data if xlabels is None: xlabels = self._scrape_labels(X) self.linvars_ = linvars - X, y, sample_weight = self._scrub(X,y,sample_weight) - - #Do the actual work + X, y, sample_weight = self._scrub(X, y, sample_weight) + + # Do the actual work self.forward_pass(X, y, sample_weight, xlabels, linvars) self.pruning_pass(X, y, sample_weight) self.linear_fit(X, y, sample_weight) return self - - def forward_pass(self, X, y=None, sample_weight=None, xlabels=None, linvars=[]): + + def forward_pass( + self, X, y=None, sample_weight=None, xlabels=None, linvars=[]): ''' Perform the forward pass of the multivariate adaptive regression splines algorithm. Users - will normally want to call the fit method instead, which performs the forward pass, the pruning + will normally want to call the fit method instead, which performs the forward pass, the pruning pass, and a linear fit to determine the final model coefficients. - - - Parameters + + + Parameters ---------- X : array-like, shape = [m, n] where m is the number of samples and n is the number of features - The training predictors. The X parameter can be a numpy array, a pandas DataFrame, a patsy + The training predictors. The X parameter can be a numpy array, a pandas DataFrame, a patsy DesignMatrix, or a tuple of patsy DesignMatrix objects as output by patsy.dmatrices. - - + + y : array-like, optional (default=None), shape = [m] where m is the number of samples - The training response. The y parameter can be a numpy array, a pandas DataFrame with one - column, a Patsy DesignMatrix, or can be left as None (default) if X was the output of a + The training response. The y parameter can be a numpy array, a pandas DataFrame with one + column, a Patsy DesignMatrix, or can be left as None (default) if X was the output of a call to patsy.dmatrices (in which case, X contains the response). - - + + sample_weight : array-like, optional (default=None), shape = [m] where m is the number of samples - Sample weights for training. Weights must be greater than or equal to zero. Rows with + Sample weights for training. Weights must be greater than or equal to zero. Rows with greater weights contribute more strongly to the fitted model. Rows with zero weight do not contribute at all. Weights are useful when dealing with heteroscedasticity. In such cases, the weight should be proportional to the inverse of the (known) variance. - - + + linvars : iterable of strings or ints, optional (empty by default) - Used to specify features that may only enter terms as linear basis functions (without + Used to specify features that may only enter terms as linear basis functions (without knots). Can include both column numbers an column names (see xlabels, below). - - + + xlabels : iterable of strings, optional (empty by default) The xlabels argument can be used to assign names to data columns. This argument is not - generally needed, as names can be captured automatically from most standard data - structures. If included, must have length n, where n is the number of features. Note + generally needed, as names can be captured automatically from most standard data + structures. If included, must have length n, where n is the number of features. Note that column order is used to compute term values and make predictions, not column names. - - + + ''' - - #Label and format data + + # Label and format data if xlabels is None: xlabels = self._scrape_labels(X) - X, y, sample_weight = self._scrub(X,y,sample_weight) - - #Do the actual work + X, y, sample_weight = self._scrub(X, y, sample_weight) + + # Do the actual work args = self._pull_forward_args(**self.__dict__) - forward_passer = ForwardPasser(X, y, sample_weight, xlabels=xlabels, linvars=linvars, **args) + forward_passer = ForwardPasser( + X, y, sample_weight, xlabels=xlabels, linvars=linvars, **args) forward_passer.run() self.forward_pass_record_ = forward_passer.trace() self.basis_ = forward_passer.get_basis() - - def pruning_pass(self, X, y = None, sample_weight = None): + + def pruning_pass(self, X, y=None, sample_weight=None): ''' Perform the pruning pass of the multivariate adaptive regression splines algorithm. Users - will normally want to call the fit method instead, which performs the forward pass, the pruning + will normally want to call the fit method instead, which performs the forward pass, the pruning pass, and a linear fit to determine the final model coefficients. - - - Parameters + + + Parameters ---------- X : array-like, shape = [m, n] where m is the number of samples and n is the number of features - The training predictors. The X parameter can be a numpy array, a pandas DataFrame, a patsy + The training predictors. The X parameter can be a numpy array, a pandas DataFrame, a patsy DesignMatrix, or a tuple of patsy DesignMatrix objects as output by patsy.dmatrices. - - + + y : array-like, optional (default=None), shape = [m] where m is the number of samples - The training response. The y parameter can be a numpy array, a pandas DataFrame with one - column, a Patsy DesignMatrix, or can be left as None (default) if X was the output of a + The training response. The y parameter can be a numpy array, a pandas DataFrame with one + column, a Patsy DesignMatrix, or can be left as None (default) if X was the output of a call to patsy.dmatrices (in which case, X contains the response). - - + + sample_weight : array-like, optional (default=None), shape = [m] where m is the number of samples - Sample weights for training. Weights must be greater than or equal to zero. Rows with + Sample weights for training. Weights must be greater than or equal to zero. Rows with greater weights contribute more strongly to the fitted model. Rows with zero weight do not contribute at all. Weights are useful when dealing with heteroscedasticity. In such cases, the weight should be proportional to the inverse of the (known) variance. - - + + ''' - #Format data - X, y, sample_weight = self._scrub(X,y,sample_weight) - - #Pull arguments from self + # Format data + X, y, sample_weight = self._scrub(X, y, sample_weight) + + # Pull arguments from self args = self._pull_pruning_args(**self.__dict__) - - #Do the actual work - pruning_passer = PruningPasser(self.basis_, X, y, sample_weight, **args) + + # Do the actual work + pruning_passer = PruningPasser( + self.basis_, X, y, sample_weight, **args) pruning_passer.run() self.pruning_pass_record_ = pruning_passer.trace() - - def unprune(self, X, y = None): + + def unprune(self, X, y=None): '''Unprune all pruned basis functions and fit coefficients to X and y using the unpruned basis.''' for bf in self.basis_: bf.unprune() del self.pruning_pass_record_ self.linear_fit(X, y) - + def forward_trace(self): '''Return information about the forward pass.''' try: return self.forward_pass_record_ except AttributeError: return None - + def pruning_trace(self): '''Return information about the pruning pass.''' try: return self.pruning_pass_record_ except AttributeError: return None - + def trace(self): '''Return information about the forward and pruning passes.''' - return EarthTrace(self.forward_trace(),self.pruning_trace()) - + return EarthTrace(self.forward_trace(), self.pruning_trace()) + def summary(self): '''Return a string describing the model.''' result = '' @@ -462,10 +470,11 @@ def summary(self): data = [] i = 0 for bf in self.basis_: - data.append([str(bf),'Yes' if bf.is_pruned() else 'No','%g'%self.coef_[i] if not bf.is_pruned() else 'None']) + data.append([str(bf), 'Yes' if bf.is_pruned() else 'No', '%g' % + self.coef_[i] if not bf.is_pruned() else 'None']) if not bf.is_pruned(): i += 1 - result += ascii_table(header,data) + result += ascii_table(header, data) if self.pruning_trace() is not None: record = self.pruning_trace() selection = record.get_selected() @@ -473,85 +482,86 @@ def summary(self): record = self.forward_trace() selection = len(record) - 1 result += '\n' - result += 'MSE: %.4f, GCV: %.4f, RSQ: %.4f, GRSQ: %.4f' % (record.mse(selection), record.gcv(selection), record.rsq(selection), record.grsq(selection)) + result += 'MSE: %.4f, GCV: %.4f, RSQ: %.4f, GRSQ: %.4f' % ( + record.mse(selection), record.gcv(selection), record.rsq(selection), record.grsq(selection)) return result - - def linear_fit(self, X, y = None, sample_weight = None): + + def linear_fit(self, X, y=None, sample_weight=None): ''' Solve the linear least squares problem to determine the coefficients of the unpruned basis functions. - - - Parameters + + + Parameters ---------- X : array-like, shape = [m, n] where m is the number of samples and n is the number of features - The training predictors. The X parameter can be a numpy array, a pandas DataFrame, a patsy + The training predictors. The X parameter can be a numpy array, a pandas DataFrame, a patsy DesignMatrix, or a tuple of patsy DesignMatrix objects as output by patsy.dmatrices. - - + + y : array-like, optional (default=None), shape = [m] where m is the number of samples - The training response. The y parameter can be a numpy array, a pandas DataFrame with one - column, a Patsy DesignMatrix, or can be left as None (default) if X was the output of a + The training response. The y parameter can be a numpy array, a pandas DataFrame with one + column, a Patsy DesignMatrix, or can be left as None (default) if X was the output of a call to patsy.dmatrices (in which case, X contains the response). - - + + sample_weight : array-like, optional (default=None), shape = [m] where m is the number of samples - Sample weights for training. Weights must be greater than or equal to zero. Rows with + Sample weights for training. Weights must be greater than or equal to zero. Rows with greater weights contribute more strongly to the fitted model. Rows with zero weight do not contribute at all. Weights are useful when dealing with heteroscedasticity. In such cases, the weight should be proportional to the inverse of the (known) variance. ''' - - #Format data - X, y, sample_weight = self._scrub(X,y,sample_weight) - - #Transform into basis space + + # Format data + X, y, sample_weight = self._scrub(X, y, sample_weight) + + # Transform into basis space B = self.transform(X) - - #Apply weights to B - apply_weights_2d(B,sample_weight) - - #Apply weights to y + + # Apply weights to B + apply_weights_2d(B, sample_weight) + + # Apply weights to y weighted_y = y.copy() - apply_weights_1d(weighted_y,sample_weight) - - #Solve the linear least squares problem - self.coef_ = np.linalg.lstsq(B,weighted_y)[0] - + apply_weights_1d(weighted_y, sample_weight) + + # Solve the linear least squares problem + self.coef_ = np.linalg.lstsq(B, weighted_y)[0] + def predict(self, X): ''' Predict the response based on the input data X. - - - Parameters + + + Parameters ---------- X : array-like, shape = [m, n] where m is the number of samples and n is the number of features - The training predictors. The X parameter can be a numpy array, a pandas DataFrame, or a + The training predictors. The X parameter can be a numpy array, a pandas DataFrame, or a patsy DesignMatrix. ''' X = self._scrub_x(X) B = self.transform(X) - return np.dot(B,self.coef_) - - def score(self, X, y = None, sample_weight = None): + return np.dot(B, self.coef_) + + def score(self, X, y=None, sample_weight=None): ''' Calculate the generalized r^2 of the model on data X and y. - - - Parameters + + + Parameters ---------- X : array-like, shape = [m, n] where m is the number of samples and n is the number of features - The training predictors. The X parameter can be a numpy array, a pandas DataFrame, a patsy + The training predictors. The X parameter can be a numpy array, a pandas DataFrame, a patsy DesignMatrix, or a tuple of patsy DesignMatrix objects as output by patsy.dmatrices. - - + + y : array-like, optional (default=None), shape = [m] where m is the number of samples - The training response. The y parameter can be a numpy array, a pandas DataFrame with one - column, a Patsy DesignMatrix, or can be left as None (default) if X was the output of a + The training response. The y parameter can be a numpy array, a pandas DataFrame with one + column, a Patsy DesignMatrix, or can be left as None (default) if X was the output of a call to patsy.dmatrices (in which case, X contains the response). - + sample_weight : array-like, optional (default=None), shape = [m] where m is the number of samples - Sample weights for training. Weights must be greater than or equal to zero. Rows with + Sample weights for training. Weights must be greater than or equal to zero. Rows with greater weights contribute more strongly to the fitted model. Rows with zero weight do not contribute at all. Weights are useful when dealing with heteroscedasticity. In such cases, the weight should be proportional to the inverse of the (known) variance. @@ -559,38 +569,39 @@ def score(self, X, y = None, sample_weight = None): X, y, sample_weight = self._scrub(X, y, sample_weight) y_hat = self.predict(X) m, _ = X.shape - residual = y-y_hat - mse = np.sum(sample_weight * (residual**2)) / m - mse0 = np.sum(sample_weight*((y -np.average(y,weights=sample_weight))**2)) / m - return 1 - (mse/mse0) - + residual = y - y_hat + mse = np.sum(sample_weight * (residual ** 2)) / m + mse0 = np.sum( + sample_weight * ((y - np.average(y, weights=sample_weight)) ** 2)) / m + return 1 - (mse / mse0) + def transform(self, X): ''' Transform X into the basis space. Normally, users will call the predict method instead, which - both transforms into basis space calculates the weighted sum of basis terms to produce a - prediction of the response. Users may wish to call transform directly in some cases. For - example, users may wish to apply other statistical or machine learning algorithms, such as + both transforms into basis space calculates the weighted sum of basis terms to produce a + prediction of the response. Users may wish to call transform directly in some cases. For + example, users may wish to apply other statistical or machine learning algorithms, such as generalized linear regression, in basis space. - - - Parameters + + + Parameters ---------- X : array-like, shape = [m, n] where m is the number of samples and n is the number of features - The training predictors. The X parameter can be a numpy array, a pandas DataFrame, or a + The training predictors. The X parameter can be a numpy array, a pandas DataFrame, or a patsy DesignMatrix. ''' X = self._scrub_x(X) - B = np.empty(shape=(X.shape[0],self.basis_.plen())) - self.basis_.transform(X,B) + B = np.empty(shape=(X.shape[0], self.basis_.plen())) + self.basis_.transform(X, B) return B - + def get_penalty(self): '''Get the penalty parameter being used. Default is 3.''' if 'penalty' in self.__dict__ and self.penalty is not None: return self.penalty else: return 3.0 - + def __repr__(self): result = 'Earth(' first = True @@ -602,19 +613,20 @@ def __repr__(self): result += '%s=%s' % (str(k), str(v)) result += ')' return result - + def __str__(self): return self.__repr__() + class EarthTrace(object): + def __init__(self, forward_trace, pruning_trace): self.forward_trace = forward_trace self.pruning_trace = pruning_trace - + def __eq__(self, other): return self.__class__ is other.__class__ and self.forward_trace == other.forward_trace and \ self.pruning_trace == other.pruning_trace - + def __str__(self): return str(self.forward_trace) + '\n' + str(self.pruning_trace) - diff --git a/sklearn/earth/setup.py b/sklearn/earth/setup.py index 06382706ec4a4..f1d6071494691 100644 --- a/sklearn/earth/setup.py +++ b/sklearn/earth/setup.py @@ -1,6 +1,7 @@ import numpy from numpy.distutils.misc_util import Configuration + def configuration(parent_package="", top_path=None): config = Configuration("earth", parent_package, top_path) config.add_extension("_basis", diff --git a/sklearn/earth/tests/test_basis.py b/sklearn/earth/tests/test_basis.py index 4051acd18ca62..29e3c0fdeb4e8 100644 --- a/sklearn/earth/tests/test_basis.py +++ b/sklearn/earth/tests/test_basis.py @@ -4,110 +4,123 @@ @author: jasonrudy ''' from nose.tools import assert_true, assert_false, assert_equal -from .._basis import Basis, ConstantBasisFunction, HingeBasisFunction, LinearBasisFunction +from .._basis import Basis, ConstantBasisFunction, HingeBasisFunction, \ + LinearBasisFunction import numpy import pickle import os + class BaseTestClass(object): + def __init__(self): numpy.random.seed(0) - data = numpy.genfromtxt(os.path.join(os.path.dirname(__file__),'test_data.csv'), - delimiter=',', skip_header=1) - self.y = numpy.array(data[:,5]) - self.X = numpy.array(data[:,0:5]) + data = numpy.genfromtxt( + os.path.join(os.path.dirname(__file__), 'test_data.csv'), + delimiter=',', skip_header=1) + self.y = numpy.array(data[:, 5]) + self.X = numpy.array(data[:, 0:5]) + class TestConstantBasisFunction(BaseTestClass): - + def __init__(self): - super(self.__class__,self).__init__() + super(self.__class__, self).__init__() self.bf = ConstantBasisFunction() - + def test_apply(self): - m,n = self.X.shape - B = numpy.empty(shape=(m,10)) - - assert_false(numpy.all(B[:,0] == 1)) - self.bf.apply(self.X,B[:,0]) - assert_true(numpy.all(B[:,0] == 1)) - + m, n = self.X.shape + B = numpy.empty(shape=(m, 10)) + + assert_false(numpy.all(B[:, 0] == 1)) + self.bf.apply(self.X, B[:, 0]) + assert_true(numpy.all(B[:, 0] == 1)) + def test_pickle_compatibility(self): bf_copy = pickle.loads(pickle.dumps(self.bf)) assert_true(self.bf == bf_copy) + class TestHingeBasisFunction(BaseTestClass): + def __init__(self): - super(self.__class__,self).__init__() + super(self.__class__, self).__init__() self.parent = ConstantBasisFunction() - self.bf = HingeBasisFunction(self.parent,1.0,10,1,False) - + self.bf = HingeBasisFunction(self.parent, 1.0, 10, 1, False) + def test_getters(self): - assert self.bf.get_reverse() == False + assert not self.bf.get_reverse() assert self.bf.get_knot() == 1.0 assert self.bf.get_variable() == 1 assert self.bf.get_knot_idx() == 10 assert self.bf.get_parent() == self.parent - + def test_apply(self): - m,n = self.X.shape - B = numpy.ones(shape=(m,10)) - self.bf.apply(self.X,B[:,0]) - assert_true(numpy.all(B[:,0] == (self.X[:,1] - 1.0) * (self.X[:,1] > 1.0))) - + m, n = self.X.shape + B = numpy.ones(shape=(m, 10)) + self.bf.apply(self.X, B[:, 0]) + assert_true( + numpy.all(B[:, 0] == (self.X[:, 1] - 1.0) * (self.X[:, 1] > 1.0))) + def test_degree(self): - assert_equal(self.bf.degree(),1) - + assert_equal(self.bf.degree(), 1) + def test_pickle_compatibility(self): bf_copy = pickle.loads(pickle.dumps(self.bf)) assert_true(self.bf == bf_copy) - + + class TestLinearBasisFunction(BaseTestClass): + def __init__(self): - super(self.__class__,self).__init__() + super(self.__class__, self).__init__() parent = ConstantBasisFunction() - self.bf = LinearBasisFunction(parent,1) - + self.bf = LinearBasisFunction(parent, 1) + def test_apply(self): - m,n = self.X.shape - B = numpy.ones(shape=(m,10)) - self.bf.apply(self.X,B[:,0]) - assert_true(numpy.all(B[:,0] == self.X[:,1])) - + m, n = self.X.shape + B = numpy.ones(shape=(m, 10)) + self.bf.apply(self.X, B[:, 0]) + assert_true(numpy.all(B[:, 0] == self.X[:, 1])) + def test_degree(self): - assert_equal(self.bf.degree(),1) - + assert_equal(self.bf.degree(), 1) + def test_pickle_compatibility(self): bf_copy = pickle.loads(pickle.dumps(self.bf)) assert_true(self.bf == bf_copy) - + + class TestBasis(BaseTestClass): + def __init__(self): - super(self.__class__,self).__init__() + super(self.__class__, self).__init__() self.basis = Basis(self.X.shape[1]) self.parent = ConstantBasisFunction() - self.bf = HingeBasisFunction(self.parent,1.0,10,1,False) + self.bf = HingeBasisFunction(self.parent, 1.0, 10, 1, False) self.basis.append(self.parent) self.basis.append(self.bf) - + def test_add(self): - assert_equal(len(self.basis),2) - + assert_equal(len(self.basis), 2) + def test_translate_and_scale(self): - m,n = self.X.shape + m, n = self.X.shape numpy.random.seed(1) - B = numpy.empty(shape=(m,self.basis.plen())) - self.basis.transform(self.X,B) - B_ = numpy.empty(shape=(m,self.basis.plen())) - mu = numpy.mean(self.X,axis=0) - sigma = numpy.std(self.X,axis=0) + B = numpy.empty(shape=(m, self.basis.plen())) + self.basis.transform(self.X, B) + B_ = numpy.empty(shape=(m, self.basis.plen())) + mu = numpy.mean(self.X, axis=0) + sigma = numpy.std(self.X, axis=0) coeff = numpy.random.normal(size=B.shape[1]) X_ = self.X * sigma + mu coeff_ = coeff.copy() - self.basis.translate(sigma,mu) - self.basis.scale(sigma,mu,coeff_) - self.basis.transform(X_,B_) - assert_true(numpy.all((numpy.dot(B,coeff) - numpy.dot(B_,coeff_))**2 < 1e-12)) - + self.basis.translate(sigma, mu) + self.basis.scale(sigma, mu, coeff_) + self.basis.transform(X_, B_) + assert_true( + numpy.all((numpy.dot(B, coeff) - numpy.dot(B_, coeff_)) ** 2 < 1e-12)) + def test_pickle_compat(self): basis_copy = pickle.loads(pickle.dumps(self.basis)) assert_true(self.basis == basis_copy) diff --git a/sklearn/earth/tests/test_earth.py b/sklearn/earth/tests/test_earth.py index c0f44b6091e44..e13bb4efd64ab 100644 --- a/sklearn/earth/tests/test_earth.py +++ b/sklearn/earth/tests/test_earth.py @@ -12,7 +12,8 @@ from .testing_utils import if_statsmodels, if_pandas, if_patsy from nose.tools import assert_equal, assert_not_equal, assert_true, assert_false, \ assert_almost_equal, assert_list_equal - + + class TestEarth(object): def __init__(self): @@ -20,60 +21,79 @@ def __init__(self): self.basis = Basis(10) constant = ConstantBasisFunction() self.basis.append(constant) - bf1 = HingeBasisFunction(constant,0.1,10,1,False,'x1') - bf2 = HingeBasisFunction(constant,0.1,10,1,True,'x1') - bf3 = LinearBasisFunction(bf1,2,'x2') + bf1 = HingeBasisFunction(constant, 0.1, 10, 1, False, 'x1') + bf2 = HingeBasisFunction(constant, 0.1, 10, 1, True, 'x1') + bf3 = LinearBasisFunction(bf1, 2, 'x2') self.basis.append(bf1) self.basis.append(bf2) self.basis.append(bf3) - self.X = numpy.random.normal(size=(100,10)) - self.B = numpy.empty(shape=(100,4),dtype=numpy.float64) - self.basis.transform(self.X,self.B) + self.X = numpy.random.normal(size=(100, 10)) + self.B = numpy.empty(shape=(100, 4), dtype=numpy.float64) + self.basis.transform(self.X, self.B) self.beta = numpy.random.normal(size=4) - self.y = numpy.empty(shape=100,dtype=numpy.float64) - self.y[:] = numpy.dot(self.B,self.beta) + numpy.random.normal(size=100) + self.y = numpy.empty(shape=100, dtype=numpy.float64) + self.y[:] = numpy.dot( + self.B, + self.beta) + numpy.random.normal(size=100) self.earth = Earth(penalty=1) - + def test_get_params(self): - assert_equal(Earth().get_params(), {'penalty': None, 'min_search_points': None, - 'endspan_alpha': None, 'check_every': None, - 'max_terms': None, 'max_degree': None, 'minspan_alpha': None, - 'thresh': None, 'minspan': None, 'endspan': None}) - assert_equal(Earth(max_degree=3).get_params(), {'penalty': None, 'min_search_points': None, - 'endspan_alpha': None, 'check_every': None, - 'max_terms': None, 'max_degree': 3, 'minspan_alpha': None, - 'thresh': None, 'minspan': None, 'endspan': None}) - + assert_equal( + Earth().get_params(), {'penalty': None, 'min_search_points': None, + 'endspan_alpha': None, + 'check_every': None, + 'max_terms': None, 'max_degree': + None, 'minspan_alpha': None, + 'thresh': None, 'minspan': None, 'endspan': None}) + assert_equal( + Earth( + max_degree=3).get_params(), {'penalty': None, 'min_search_points': None, + 'endspan_alpha': None, + 'check_every': None, + 'max_terms': None, 'max_degree': + 3, 'minspan_alpha': None, + 'thresh': None, 'minspan': None, 'endspan': None}) + @if_statsmodels def test_linear_fit(self): from statsmodels.regression.linear_model import GLS, OLS self.earth.fit(self.X, self.y) self.earth.linear_fit(self.X, self.y) soln = OLS(self.y, self.earth.transform(self.X)).fit().params - assert_almost_equal(numpy.mean((self.earth.coef_-soln)**2), 0.0) - + assert_almost_equal(numpy.mean((self.earth.coef_ - soln) ** 2), 0.0) + sample_weight = 1.0 / (numpy.random.normal(size=self.y.shape) ** 2) self.earth.fit(self.X, self.y) self.earth.linear_fit(self.X, self.y, sample_weight) - soln = GLS(self.y, self.earth.transform(self.X), 1.0 / sample_weight).fit().params - assert_almost_equal(numpy.mean((self.earth.coef_-soln)**2), 0.0) - + soln = GLS( + self.y, + self.earth.transform(self.X), + 1.0 / sample_weight).fit().params + assert_almost_equal(numpy.mean((self.earth.coef_ - soln) ** 2), 0.0) + def test_sample_weight(self): - group = numpy.random.binomial(1,.5,size=1000) == 1 - sample_weight = 1 / (group * 100 + 1.0) - x = numpy.random.uniform(-10,10,size=1000) + group = numpy.random.binomial(1, .5, size=1000) == 1 + sample_weight = 1 / (group * 100 + 1.0) + x = numpy.random.uniform(-10, 10, size=1000) y = numpy.abs(x) y[group] = numpy.abs(x[group] - 5) - y += numpy.random.normal(0,1,size=1000) - model = Earth().fit(x,y,sample_weight = sample_weight) - - #Check that the model fits better for the more heavily weighted group - assert_true(model.score(x[group],y[group]) < model.score(x[numpy.logical_not(group)],y[numpy.logical_not(group)])) - - #Make sure that the score function gives the same answer as the trace - assert_almost_equal(model.score(x,y,sample_weight=sample_weight), model.pruning_trace().rsq(model.pruning_trace().get_selected())) - - #Uncomment below to see what this test situation looks like + y += numpy.random.normal(0, 1, size=1000) + model = Earth().fit(x, y, sample_weight=sample_weight) + + # Check that the model fits better for the more heavily weighted group + assert_true( + model.score(x[group], + y[group]) < model.score(x[numpy.logical_not(group)], + y[numpy.logical_not(group)])) + + # Make sure that the score function gives the same answer as the trace + assert_almost_equal( + model.score(x, + y, + sample_weight=sample_weight), + model.pruning_trace().rsq(model.pruning_trace().get_selected())) + + # Uncomment below to see what this test situation looks like # from matplotlib import pyplot # print model.summary() # print model.score(x,y,sample_weight = sample_weight) @@ -81,58 +101,62 @@ def test_sample_weight(self): # pyplot.plot(x,y,'b.') # pyplot.plot(x,model.predict(x),'r.') # pyplot.show() - + def test_fit(self): self.earth.fit(self.X, self.y) res = str(self.earth.trace()) + '\n' + self.earth.summary() # with open('earth_regress.txt','w') as fl: # fl.write(res) - with open(os.path.join(os.path.dirname(__file__),'earth_regress.txt'),'r') as fl: + with open(os.path.join(os.path.dirname(__file__), 'earth_regress.txt'), 'r') as fl: prev = fl.read() - assert_equal(res,prev) - + assert_equal(res, prev) + def test_linvars(self): - self.earth.fit(self.X, self.y, linvars=[0,1,2,3,4,5,6,7,8,9]) + self.earth.fit(self.X, self.y, linvars=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9]) res = str(self.earth.trace()) + '\n' + self.earth.summary() # with open('earth_linvars_regress.txt','w') as fl: # fl.write(res) - with open(os.path.join(os.path.dirname(__file__),'earth_linvars_regress.txt'),'r') as fl: + with open(os.path.join(os.path.dirname(__file__), 'earth_linvars_regress.txt'), 'r') as fl: prev = fl.read() - assert_equal(res,prev) - + assert_equal(res, prev) + def test_score(self): model = self.earth.fit(self.X, self.y) record = model.pruning_trace() rsq = record.rsq(record.get_selected()) - assert_almost_equal(rsq,model.score(self.X,self.y)) - + assert_almost_equal(rsq, model.score(self.X, self.y)) + @if_pandas def test_pathological_cases(self): import pandas - directory = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'pathological_data') - cases = {'issue_44':{}} + directory = os.path.join( + os.path.dirname(os.path.abspath(__file__)), + 'pathological_data') + cases = {'issue_44': {}} for case, settings in cases.iteritems(): data = pandas.read_csv(os.path.join(directory, case + '.csv')) y = data['y'] del data['y'] X = data - model = Earth(**settings).fit(X,y) + model = Earth(**settings).fit(X, y) # with open(os.path.join('pathological_data', case + '.txt'), 'w') as outfile: # outfile.write(model.summary()) with open(os.path.join(directory, case + '.txt'), 'r') as infile: correct = infile.read() - assert_equal(model.summary(),correct) - + assert_equal(model.summary(), correct) + @if_pandas def test_pandas_compatibility(self): import pandas X = pandas.DataFrame(self.X) y = pandas.DataFrame(self.y) - colnames = ['xx'+str(i) for i in range(X.shape[1])] + colnames = ['xx' + str(i) for i in range(X.shape[1])] X.columns = colnames - model = self.earth.fit(X,y) - assert_list_equal(colnames,model.forward_trace()._getstate()['xlabels']) - + model = self.earth.fit(X, y) + assert_list_equal( + colnames, + model.forward_trace()._getstate()['xlabels']) + @if_patsy @if_pandas def test_patsy_compatibility(self): @@ -140,29 +164,34 @@ def test_patsy_compatibility(self): import patsy X = pandas.DataFrame(self.X) y = pandas.DataFrame(self.y) - colnames = ['xx'+str(i) for i in range(X.shape[1])] + colnames = ['xx' + str(i) for i in range(X.shape[1])] X.columns = colnames X['y'] = y - y, X = patsy.dmatrices('y ~ xx0 + xx1 + xx2 + xx3 + xx4 + xx5 + xx6 + xx7 + xx8 + xx9 - 1',data=X) - model = self.earth.fit(X,y) - assert_list_equal(colnames,model.forward_trace()._getstate()['xlabels']) - + y, X = patsy.dmatrices( + 'y ~ xx0 + xx1 + xx2 + xx3 + xx4 + xx5 + xx6 + xx7 + xx8 + xx9 - 1', data=X) + model = self.earth.fit(X, y) + assert_list_equal( + colnames, + model.forward_trace()._getstate()['xlabels']) + def test_pickle_compatibility(self): model = self.earth.fit(self.X, self.y) model_copy = pickle.loads(pickle.dumps(model)) assert_true(model_copy == model) - assert_true(numpy.all(model.predict(self.X) == model_copy.predict(self.X))) + assert_true( + numpy.all(model.predict(self.X) == model_copy.predict(self.X))) assert_true(model.basis_[0] is model.basis_[1]._get_root()) assert_true(model_copy.basis_[0] is model_copy.basis_[1]._get_root()) - + def test_copy_compatibility(self): model = self.earth.fit(self.X, self.y) model_copy = copy.copy(model) assert_true(model_copy == model) - assert_true(numpy.all(model.predict(self.X) == model_copy.predict(self.X))) + assert_true( + numpy.all(model.predict(self.X) == model_copy.predict(self.X))) assert_true(model.basis_[0] is model.basis_[1]._get_root()) assert_true(model_copy.basis_[0] is model_copy.basis_[1]._get_root()) - + if __name__ == '__main__': import nose nose.run(argv=[__file__, '-s', '-v']) diff --git a/sklearn/earth/tests/test_forward.py b/sklearn/earth/tests/test_forward.py index 4fd0141b1e403..d370322b687ae 100644 --- a/sklearn/earth/tests/test_forward.py +++ b/sklearn/earth/tests/test_forward.py @@ -8,48 +8,59 @@ import numpy import os from nose.tools import assert_true, assert_equal - + + class TestForwardPasser(object): + def __init__(self): numpy.random.seed(0) self.basis = Basis(10) constant = ConstantBasisFunction() self.basis.append(constant) - bf1 = HingeBasisFunction(constant,0.1,10,1,False,'x1') - bf2 = HingeBasisFunction(constant,0.1,10,1,True,'x1') - bf3 = LinearBasisFunction(bf1,2,'x2') + bf1 = HingeBasisFunction(constant, 0.1, 10, 1, False, 'x1') + bf2 = HingeBasisFunction(constant, 0.1, 10, 1, True, 'x1') + bf3 = LinearBasisFunction(bf1, 2, 'x2') self.basis.append(bf1) self.basis.append(bf2) self.basis.append(bf3) - self.X = numpy.random.normal(size=(100,10)) - self.B = numpy.empty(shape=(100,4),dtype=numpy.float64) - self.basis.transform(self.X,self.B) + self.X = numpy.random.normal(size=(100, 10)) + self.B = numpy.empty(shape=(100, 4), dtype=numpy.float64) + self.basis.transform(self.X, self.B) self.beta = numpy.random.normal(size=4) - self.y = numpy.empty(shape=100,dtype=numpy.float64) - self.y[:] = numpy.dot(self.B,self.beta) + numpy.random.normal(size=100) - self.forwardPasser = ForwardPasser(self.X,self.y,numpy.ones(self.y.shape),max_terms = 1000, penalty=1) - + self.y = numpy.empty(shape=100, dtype=numpy.float64) + self.y[:] = numpy.dot( + self.B, + self.beta) + numpy.random.normal(size=100) + self.forwardPasser = ForwardPasser( + self.X, + self.y, + numpy.ones(self.y.shape), + max_terms=1000, + penalty=1) + def test_orthonormal_update(self): numpy.set_printoptions(precision=4) - m,n = self.X.shape + m, n = self.X.shape B_orth = self.forwardPasser.get_B_orth() v = numpy.random.normal(size=m) - for i in range(1,10): + for i in range(1, 10): v_ = numpy.random.normal(size=m) - B_orth[:,i] = 10*v_ + v + B_orth[:, i] = 10 * v_ + v v = v_ self.forwardPasser.orthonormal_update(i) - assert_true(numpy.max(numpy.abs(numpy.dot(B_orth[:,0:i+1].transpose(),B_orth[:,0:i+1]) - numpy.eye(i+1))) < .0000001) - + assert_true( + numpy.max(numpy.abs(numpy.dot(B_orth[:, 0:i + 1].transpose(), B_orth[:, 0:i + 1]) - numpy.eye(i + 1))) < .0000001) + def test_run(self): self.forwardPasser.run() - res = str(self.forwardPasser.get_basis()) + '\n' + str(self.forwardPasser.trace()) + res = str(self.forwardPasser.get_basis()) + \ + '\n' + str(self.forwardPasser.trace()) # with open('forward_regress.txt','w') as fl: # fl.write(res) - with open(os.path.join(os.path.dirname(__file__), 'forward_regress.txt'),'r') as fl: + with open(os.path.join(os.path.dirname(__file__), 'forward_regress.txt'), 'r') as fl: prev = fl.read() - assert_equal(res,prev) + assert_equal(res, prev) if __name__ == '__main__': import nose - nose.run(argv=[__file__, '-s', '-v']) \ No newline at end of file + nose.run(argv=[__file__, '-s', '-v']) diff --git a/sklearn/earth/tests/test_pruning.py b/sklearn/earth/tests/test_pruning.py index 84df70454fd68..3800fbc83b2b0 100644 --- a/sklearn/earth/tests/test_pruning.py +++ b/sklearn/earth/tests/test_pruning.py @@ -10,4 +10,4 @@ def test(self): if __name__ == '__main__': import nose - nose.run(argv=[__file__, '-s', '-v']) \ No newline at end of file + nose.run(argv=[__file__, '-s', '-v']) diff --git a/sklearn/earth/tests/test_record.py b/sklearn/earth/tests/test_record.py index b3eb0163dbb91..05a07bd4b8ebb 100644 --- a/sklearn/earth/tests/test_record.py +++ b/sklearn/earth/tests/test_record.py @@ -2,67 +2,83 @@ from .._util import gcv from nose.tools import assert_true, assert_equal, assert_list_equal + class TestForwardPassRecord(object): def __init__(self): - #Create a record + # Create a record self.num_samples = 1000 self.num_variables = 10 self.penalty = 3.0 self.sst = 100.0 - self.record = ForwardPassRecord(self.num_samples, self.num_variables, self.penalty, self.sst, ['x'+str(i) for i in range(self.num_variables)]) + self.record = ForwardPassRecord( + self.num_samples, + self.num_variables, + self.penalty, + self.sst, + ['x' + str(i) for i in range(self.num_variables)]) self.record.append(ForwardPassIteration(0, 3, 3, 63.0, 3)) self.record.append(ForwardPassIteration(0, 3, 14, 34.0, 5)) self.record.append(ForwardPassIteration(3, 6, 12, 18.0, 7)) - self.mses = [self.sst,63.0,34.0,18.0] - self.sizes = [1,3,5,7] + self.mses = [self.sst, 63.0, 34.0, 18.0] + self.sizes = [1, 3, 5, 7] def test_statistics(self): mses = [self.record.mse(i) for i in range(len(self.record))] mses_ = [self.mses[i] for i in range(len(self.record))] gcvs = [self.record.gcv(i) for i in range(len(self.record))] - gcvs_ = [gcv(self.mses[i], self.sizes[i], self.num_samples, self.penalty) for i in range(len(self.record))] + gcvs_ = [gcv(self.mses[i], self.sizes[i], self.num_samples, self.penalty) + for i in range(len(self.record))] rsqs = [self.record.rsq(i) for i in range(len(self.record))] - rsqs_ = [1 - (self.mses[i] / self.sst) for i in range(len(self.record))] + rsqs_ = [1 - (self.mses[i] / self.sst) + for i in range(len(self.record))] grsqs = [self.record.grsq(i) for i in range(len(self.record))] - grsqs_ = [1 - (self.record.gcv(i) / gcv(self.sst, 1, self.num_samples, self.penalty)) for i in range(len(self.record))] - assert_list_equal(mses,mses_) - assert_list_equal(gcvs,gcvs_) - assert_list_equal(rsqs,rsqs_) - assert_list_equal(grsqs,grsqs_) - - + grsqs_ = [1 - (self.record.gcv(i) / gcv(self.sst, 1, self.num_samples, self.penalty)) + for i in range(len(self.record))] + assert_list_equal(mses, mses_) + assert_list_equal(gcvs, gcvs_) + assert_list_equal(rsqs, rsqs_) + assert_list_equal(grsqs, grsqs_) + + class TestPruningPassRecord(object): def __init__(self): - #Create a record + # Create a record self.num_samples = 1000 self.num_variables = 10 self.penalty = 3.0 self.sst = 100.0 - self.record = PruningPassRecord(self.num_samples, self.num_variables, self.penalty, self.sst, 7, 18.0) + self.record = PruningPassRecord( + self.num_samples, + self.num_variables, + self.penalty, + self.sst, + 7, + 18.0) self.record.append(PruningPassIteration(2, 6, 25.0)) self.record.append(PruningPassIteration(1, 5, 34.0)) self.record.append(PruningPassIteration(3, 4, 87.0)) - self.mses = [18.0,25.0,34.0,87.0] - self.sizes = [7,6,5,4] + self.mses = [18.0, 25.0, 34.0, 87.0] + self.sizes = [7, 6, 5, 4] def test_statistics(self): mses = [self.record.mse(i) for i in range(len(self.record))] mses_ = [self.mses[i] for i in range(len(self.record))] gcvs = [self.record.gcv(i) for i in range(len(self.record))] - gcvs_ = [gcv(self.mses[i], self.sizes[i], self.num_samples, self.penalty) for i in range(len(self.record))] + gcvs_ = [gcv(self.mses[i], self.sizes[i], self.num_samples, self.penalty) + for i in range(len(self.record))] rsqs = [self.record.rsq(i) for i in range(len(self.record))] - rsqs_ = [1 - (self.mses[i] / self.sst) for i in range(len(self.record))] + rsqs_ = [1 - (self.mses[i] / self.sst) + for i in range(len(self.record))] grsqs = [self.record.grsq(i) for i in range(len(self.record))] - grsqs_ = [1 - (self.record.gcv(i) / gcv(self.sst, 1, self.num_samples, self.penalty)) for i in range(len(self.record))] - assert_list_equal(mses,mses_) - assert_list_equal(gcvs,gcvs_) - assert_list_equal(rsqs,rsqs_) - assert_list_equal(grsqs,grsqs_) + grsqs_ = [1 - (self.record.gcv(i) / gcv(self.sst, 1, self.num_samples, self.penalty)) + for i in range(len(self.record))] + assert_list_equal(mses, mses_) + assert_list_equal(gcvs, gcvs_) + assert_list_equal(rsqs, rsqs_) + assert_list_equal(grsqs, grsqs_) if __name__ == '__main__': import nose nose.run(argv=[__file__, '-s', '-v']) - - \ No newline at end of file diff --git a/sklearn/earth/tests/test_util.py b/sklearn/earth/tests/test_util.py index d354300f255e1..5faa884ba34a3 100644 --- a/sklearn/earth/tests/test_util.py +++ b/sklearn/earth/tests/test_util.py @@ -10,4 +10,4 @@ def test(self): if __name__ == '__main__': import nose - nose.run(argv=[__file__, '-s', '-v']) \ No newline at end of file + nose.run(argv=[__file__, '-s', '-v']) diff --git a/sklearn/earth/tests/testing_utils.py b/sklearn/earth/tests/testing_utils.py index 0ebacc4bb0f36..b9cd880a03e0c 100644 --- a/sklearn/earth/tests/testing_utils.py +++ b/sklearn/earth/tests/testing_utils.py @@ -1,6 +1,7 @@ from functools import wraps from nose import SkipTest + def if_statsmodels(func): """Test decorator that skips test if statsmodels not installed. """ @@ -14,6 +15,7 @@ def run_test(*args, **kwargs): return func(*args, **kwargs) return run_test + def if_pandas(func): """Test decorator that skips test if pandas not installed. """ @@ -27,6 +29,7 @@ def run_test(*args, **kwargs): return func(*args, **kwargs) return run_test + def if_patsy(func): """Test decorator that skips test if patsy not installed. """ From 0ef9d186d64b44adde3fa1a2a6d0c58d285a1a20 Mon Sep 17 00:00:00 2001 From: Jason Rudy Date: Sat, 7 Sep 2013 17:39:51 -0700 Subject: [PATCH 13/19] Fixed white space --- doc/modules/earth.rst | 7 ------- 1 file changed, 7 deletions(-) diff --git a/doc/modules/earth.rst b/doc/modules/earth.rst index c8070bccc3329..1dcdfdc4b6107 100644 --- a/doc/modules/earth.rst +++ b/doc/modules/earth.rst @@ -46,11 +46,6 @@ generalize well. .. image:: ../images/piecewise_linear.png - - - - - A Simple Earth Example ---------------------- @@ -112,5 +107,3 @@ A Simple Earth Example References 7, 2, 1, 3, and 4 contain discussions likely to be useful to users. References 1, 2, 6, 5, 8, 3, and 4 are useful in understanding the implementation. - - From e2c027e62ab2be879bf9b75ebf1a05bcd262d940 Mon Sep 17 00:00:00 2001 From: Jason Rudy Date: Tue, 29 Oct 2013 13:03:05 -0700 Subject: [PATCH 14/19] Merged classifier comparison and removed benchmark vs the R package --- examples/earth/classifier_comp.py | 134 ------------------ examples/earth/pyearth_vs_earth.py | 186 ------------------------- examples/plot_classifier_comparison.py | 16 ++- 3 files changed, 11 insertions(+), 325 deletions(-) delete mode 100644 examples/earth/classifier_comp.py delete mode 100644 examples/earth/pyearth_vs_earth.py diff --git a/examples/earth/classifier_comp.py b/examples/earth/classifier_comp.py deleted file mode 100644 index e0593a6ffc8a8..0000000000000 --- a/examples/earth/classifier_comp.py +++ /dev/null @@ -1,134 +0,0 @@ -''' -==================================== -Classification comparison with Earth -==================================== - - -This script recreates the scikit-learn classifier comparison example found at http://scikit-learn.org/dev/auto_examples/plot_classifier_comparison.html. -It has been modified to include an :class:`Earth` based classifier. The Earth based classifier is made up of a Pipeline -that uses an Earth model as a transformer and a LogisticRegression model as a predictor. -''' - -# Code source: Gael Varoqueux -# Andreas Mueller -# Modified for Documentation merge by Jaques Grobler -# License: BSD 3 clause -# Modified to include Earth by Jason Rudy - -from __future__ import print_function -import numpy as np -import pylab as pl -from matplotlib.colors import ListedColormap -from sklearn.cross_validation import train_test_split -from sklearn.preprocessing import StandardScaler -from sklearn.datasets import make_moons, make_circles, make_classification -from sklearn.neighbors import KNeighborsClassifier -from sklearn.svm import SVC -from sklearn.tree import DecisionTreeClassifier -from sklearn.ensemble import RandomForestClassifier -from sklearn.naive_bayes import GaussianNB -from sklearn.lda import LDA -from sklearn.qda import QDA - -print(__doc__) - -h = .02 # step size in the mesh - -from sklearn.earth import Earth -from sklearn.linear_model.logistic import LogisticRegression -from sklearn.metrics import accuracy_score -from sklearn.pipeline import Pipeline - -np.random.seed(1) - -# Combine Earth with LogisticRegression in a pipeline to do classification -earth_classifier = Pipeline([('earth', Earth(max_degree=3, penalty=1.5)), - ('logistic', LogisticRegression())]) - -names = ["Nearest Neighbors", "Linear SVM", "RBF SVM", "Decision Tree", - "Random Forest", "Naive Bayes", "LDA", "QDA", "Earth"] -classifiers = [ - KNeighborsClassifier(3), - SVC(kernel="linear", C=0.025), - SVC(gamma=2, C=1), - DecisionTreeClassifier(max_depth=5), - RandomForestClassifier(max_depth=5, n_estimators=10, max_features=1), - GaussianNB(), - LDA(), - QDA(), - earth_classifier] - -X, y = make_classification(n_features=2, n_redundant=0, n_informative=2, - random_state=1, n_clusters_per_class=1) -rng = np.random.RandomState(2) -X += 2 * rng.uniform(size=X.shape) -linearly_separable = (X, y) - -datasets = [make_moons(noise=0.3, random_state=0), - make_circles(noise=0.2, factor=0.5, random_state=1), - linearly_separable - ] - -figure = pl.figure(figsize=(27, 9)) -i = 1 -# iterate over datasets -for ds in datasets: - # preprocess dataset, split into training and test part - X, y = ds - X = StandardScaler().fit_transform(X) - X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=.4) - - x_min, x_max = X[:, 0].min() - .5, X[:, 0].max() + .5 - y_min, y_max = X[:, 1].min() - .5, X[:, 1].max() + .5 - xx, yy = np.meshgrid(np.arange(x_min, x_max, h), - np.arange(y_min, y_max, h)) - - # just plot the dataset first - cm = pl.cm.RdBu - cm_bright = ListedColormap(['#FF0000', '#0000FF']) - ax = pl.subplot(len(datasets), len(classifiers) + 1, i) - # Plot the training points - ax.scatter(X_train[:, 0], X_train[:, 1], c=y_train, cmap=cm_bright) - # and testing points - ax.scatter(X_test[:, 0], X_test[:, 1], c=y_test, cmap=cm_bright, alpha=0.6) - ax.set_xlim(xx.min(), xx.max()) - ax.set_ylim(yy.min(), yy.max()) - ax.set_xticks(()) - ax.set_yticks(()) - i += 1 - - # iterate over classifiers - for name, clf in zip(names, classifiers): - ax = pl.subplot(len(datasets), len(classifiers) + 1, i) - clf.fit(X_train, y_train) - score = clf.score(X_test, y_test) - - # Plot the decision boundary. For that, we will assign a color to each - # point in the mesh [x_min, m_max]x[y_min, y_max]. - try: - Z = clf.predict_proba(np.c_[xx.ravel(), yy.ravel()])[:, 1] - except NotImplementedError: - Z = clf.decision_function(np.c_[xx.ravel(), yy.ravel()]) - - # Put the result into a color plot - Z = Z.reshape(xx.shape) - ax.contourf(xx, yy, Z, cmap=cm, alpha=.8) - - # Plot also the training points - ax.scatter(X_train[:, 0], X_train[:, 1], c=y_train, cmap=cm_bright) - # and testing points - ax.scatter(X_test[:, 0], X_test[:, 1], c=y_test, cmap=cm_bright, - alpha=0.6) - - ax.set_xlim(xx.min(), xx.max()) - ax.set_ylim(yy.min(), yy.max()) - ax.set_xticks(()) - ax.set_yticks(()) - ax.set_title(name) - ax.text(xx.max() - .3, yy.min() + .3, ('%.2f' % score).lstrip('0'), - size=15, horizontalalignment='right') - i += 1 - -figure.subplots_adjust(left=.02, right=.98) -pl.savefig('classifier_comp.pdf', transparent=True) -pl.show() diff --git a/examples/earth/pyearth_vs_earth.py b/examples/earth/pyearth_vs_earth.py deleted file mode 100644 index 48792e4141293..0000000000000 --- a/examples/earth/pyearth_vs_earth.py +++ /dev/null @@ -1,186 +0,0 @@ -''' -============================= -Comparison with the R package -============================= - - -This script randomly generates earth-style models, then randomly generates data from those models and -fits earth models to those data using both the python (:class:`Earth`) and R implementations. It records the sample size, -m, the number of input dimensions, n, the number of forward pass iterations, the runtime, and the r^2 -statistic for each fit and writes the result to a CSV file. This script requires pandas, rpy2, and a -functioning R installation with the earth package installed. -''' -from __future__ import print_function -import numpy -import pandas.rpy.common as com -import rpy2.robjects as robjects -import time -import pandas -from sklearn.earth import Earth - -print(__doc__) - - -class DataGenerator(object): - - def __init__(self): - pass - - def generate(self, m): - pass - - -class NoiseGenerator(DataGenerator): - - def __init__(self, n): - self.n = n - - def generate(self, m): - X = numpy.random.normal(size=(m, self.n)) - y = numpy.random.normal(size=m) - return X, y - - -class LinearGenerator(DataGenerator): - - def __init__(self, n): - self.n = n - - def generate(self, m): - X = numpy.random.normal(size=(m, self.n)) - beta = numpy.random.normal(size=self.n) - y = numpy.dot(X, beta) + numpy.random.normal(m) - return X, y - - -class VFunctionGenerator(DataGenerator): - - def __init__(self, n): - self.n = n - - def generate(self, m): - X = numpy.random.normal(size=(m, self.n)) - var = numpy.random.randint(self.n) - y = 10 * abs(X[:, var]) + numpy.random.normal(m) - return X, y - - -class UFunctionGenerator(DataGenerator): - - def __init__(self, n): - self.n = n - - def generate(self, m): - X = numpy.random.normal(size=(m, self.n)) - var = numpy.random.randint(self.n) - y = 10 * (X[:, var] ** 2) + numpy.random.normal(m) - return X, y - - -class RandomComplexityGenerator(DataGenerator): - - def __init__(self, n, max_terms=10, max_degree=2): - self.n = n - self.max_terms = max_terms - self.max_degree = max_degree - - def generate(self, m): - X = numpy.random.normal(size=(m, self.n)) - #Including the intercept - num_terms = numpy.random.randint(2, self.max_terms) - coef = 10 * numpy.random.normal(size=num_terms) - B = numpy.ones(shape=(m, num_terms)) - B[:, 0] += coef[0] - for i in range(1, num_terms): - degree = numpy.random.randint(1, self.max_degree) - for bf in range(degree): - knot = numpy.random.normal() - dir = 1 - 2 * numpy.random.binomial(1, .5) - var = numpy.random.randint(0, self.n) - B[:, i] *= (dir * (X[:, var] - knot)) * \ - (dir * (X[:, var] - knot) > 0) - y = numpy.dot(B, coef) + numpy.random.normal(size=m) - return X, y - - -def run_earth(X, y, **kwargs): - '''Run with the R package earth. Return prediction value, training time, and number of forward pass iterations.''' - r = robjects.r - m, n = X.shape - data = pandas.DataFrame(X) - data['y'] = y - r_data = com.convert_to_r_dataframe(data) - r('library(earth)') - r_func = ''' - run <- function(data, degree=1, fast.k=0, penalty=3.0){ - time = system.time(model <- earth(y~.,data=data,degree=degree,penalty=penalty))[3] - forward_terms = dim(summary(model)$prune.terms)[1] - y_pred = predict(model,data) - return(list(y_pred, time, forward_terms, model)) - } - ''' - r(r_func) - run = r('run') - r_list = run( - **{'data': r_data, - 'degree': kwargs['max_degree'], - 'fast.k': 0, - 'penalty': kwargs['penalty']}) - y_pred = numpy.array(r_list[0]).reshape(m) - time = r_list[1][0] - forward_terms = r_list[2][0] - return y_pred, time, (forward_terms - 1) / 2 - - -def run_pyearth(X, y, **kwargs): - '''Run with pyearth. Return prediction value, training time, and number of forward pass iterations.''' - model = Earth(**kwargs) - t0 = time.time() - model.fit(X, y) - t1 = time.time() - y_pred = model.predict(X) - forward_iterations = len(model.forward_trace()) - 1 - return y_pred, t1 - t0, forward_iterations - - -def compare(generator_class, sample_sizes, dimensions, repetitions, **kwargs): - '''Return a data table that includes m, n, pyearth or earth, training time, and number of forward pass iterations.''' - header = [ - 'm', - 'n', - 'pyearth', - 'earth', - 'time', - 'forward_iterations', - 'rsq'] - data = [] - for n in dimensions: - generator = generator_class(n=n) - for m in sample_sizes: - for rep in range(repetitions): - X, y = generator.generate(m=m) - y_pred_r, time_r, iter_r = run_earth(X, y, **kwargs) - rsq_r = 1 - (numpy.sum((y - y_pred_r) ** 2)) / ( - numpy.sum((y - numpy.mean(y)) ** 2)) - data.append([m, n, 0, 1, time_r, iter_r, rsq_r]) - y_pred_py, time_py, iter_py = run_pyearth(X, y, **kwargs) - rsq_py = 1 - \ - (numpy.sum((y - y_pred_py) ** 2)) / ( - numpy.sum((y - numpy.mean(y)) ** 2)) - data.append([m, n, 1, 0, time_py, iter_py, rsq_py]) - return pandas.DataFrame(data, columns=header) - -if __name__ == '__main__': - sample_sizes = [100, 200, 300, 500] - dimensions = [10, 20, 30] - rep = 5 - numpy.random.seed(1) - data = compare( - RandomComplexityGenerator, - sample_sizes, - dimensions, - rep, - max_degree=2, - penalty=3.0) - print(data) - data.to_csv('comparison.csv') diff --git a/examples/plot_classifier_comparison.py b/examples/plot_classifier_comparison.py index bc6ddcac0cc41..aa0babbe4e07d 100644 --- a/examples/plot_classifier_comparison.py +++ b/examples/plot_classifier_comparison.py @@ -26,6 +26,7 @@ # Code source: Gael Varoqueux # Andreas Mueller # Modified for Documentation merge by Jaques Grobler +# Modified to include Earth by Jason Rudy # License: BSD 3 clause import numpy as np @@ -41,11 +42,14 @@ from sklearn.naive_bayes import GaussianNB from sklearn.lda import LDA from sklearn.qda import QDA +from sklearn.earth import Earth +from sklearn.linear_model.logistic import LogisticRegression +from sklearn.pipeline import Pipeline h = .02 # step size in the mesh names = ["Nearest Neighbors", "Linear SVM", "RBF SVM", "Decision Tree", - "Random Forest", "AdaBoost", "Naive Bayes", "LDA", "QDA"] + "Random Forest", "AdaBoost", "Naive Bayes", "LDA", "QDA", "Earth"] classifiers = [ KNeighborsClassifier(3), SVC(kernel="linear", C=0.025), @@ -55,7 +59,9 @@ AdaBoostClassifier(), GaussianNB(), LDA(), - QDA()] + QDA(), + Pipeline([('earth', Earth(max_degree=3, penalty=1.5)), + ('logistic', LogisticRegression())])] X, y = make_classification(n_features=2, n_redundant=0, n_informative=2, random_state=1, n_clusters_per_class=1) @@ -104,10 +110,10 @@ # Plot the decision boundary. For that, we will assign a color to each # point in the mesh [x_min, m_max]x[y_min, y_max]. - if hasattr(clf, "decision_function"): - Z = clf.decision_function(np.c_[xx.ravel(), yy.ravel()]) - else: + try: Z = clf.predict_proba(np.c_[xx.ravel(), yy.ravel()])[:, 1] + except NotImplementedError: + Z = clf.decision_function(np.c_[xx.ravel(), yy.ravel()]) # Put the result into a color plot Z = Z.reshape(xx.shape) From d0997d57e1206c6575ff79e2207da9a07fca453a Mon Sep 17 00:00:00 2001 From: Jason Rudy Date: Tue, 29 Oct 2013 16:12:55 -0700 Subject: [PATCH 15/19] Changed name of Earth to EarthRegressor --- doc/modules/earth.rst | 20 ++++++++-------- examples/earth/sine_wave.py | 10 ++++---- examples/earth/v_function.py | 8 +++---- examples/plot_classifier_comparison.py | 6 ++--- sklearn/earth/__init__.py | 4 ++-- sklearn/earth/earth.py | 24 +++++++++---------- sklearn/earth/tests/earth_linvars_regress.txt | 2 +- sklearn/earth/tests/earth_regress.txt | 2 +- .../tests/pathological_data/issue_44.txt | 2 +- sklearn/earth/tests/test_earth.py | 12 +++++----- 10 files changed, 45 insertions(+), 45 deletions(-) diff --git a/doc/modules/earth.rst b/doc/modules/earth.rst index 1dcdfdc4b6107..2c38c4df2c010 100644 --- a/doc/modules/earth.rst +++ b/doc/modules/earth.rst @@ -6,9 +6,9 @@ Multivariate Adaptive Regression Splines .. currentmodule:: sklearn.earth -Multivariate adaptive regression splines, implemented by the :class:`Earth` class, is a method for supervised -learning that is most commonly used for feature extraction and selection. ``Earth`` models can be thought of as linear models in a higher dimensional -basis space. ``Earth`` automatically searches for interactions and non-linear relationships. Each term in an ``Earth`` model is a +Multivariate adaptive regression splines, implemented by the :class:`EarthRegressor` class, is a method for supervised +learning that is most commonly used for feature extraction and selection. ``EarthRegressor`` models can be thought of as linear models in a higher dimensional +basis space. ``EarthRegressor`` automatically searches for interactions and non-linear relationships. Each term in an ``EarthRegressor`` model is a product of so called "hinge functions". A hinge function is a function that's equal to its argument where that argument is greater than zero and is zero everywhere else. @@ -20,7 +20,7 @@ is greater than zero and is zero everywhere else. .. image:: ../images/hinge.png -An ``Earth`` model is a linear combination of basis functions, each of which is a product of one +An ``EarthRegressor`` model is a linear combination of basis functions, each of which is a product of one or more of the following: 1. A constant @@ -28,7 +28,7 @@ or more of the following: 3. Hinge functions of input variables For example, a simple piecewise linear function in one variable can be expressed -as a linear combination of two hinge functions and a constant (see below). During fitting, the ``Earth`` class +as a linear combination of two hinge functions and a constant (see below). During fitting, the ``EarthRegressor`` class automatically determines which variables and basis functions to use. The algorithm has two stages. First, the forward pass searches for terms that locally minimize squared error loss on the training set. Next, a pruning pass selects a subset of those @@ -46,14 +46,14 @@ generalize well. .. image:: ../images/piecewise_linear.png -A Simple Earth Example +A Simple EarthRegressor Example ---------------------- :: import numpy - from pyearth import Earth + from sklearn.earth import EarthRegressor from matplotlib import pyplot #Create some fake data @@ -63,8 +63,8 @@ A Simple Earth Example X = 80*numpy.random.uniform(size=(m,n)) - 40 y = numpy.abs(X[:,6] - 4.0) + 1*numpy.random.normal(size=m) - #Fit an Earth model - model = Earth() + #Fit an EarthRegressor model + model = EarthRegressor() model.fit(X,y) #Print the model @@ -78,7 +78,7 @@ A Simple Earth Example pyplot.plot(X[:,6],y_hat,'b.') pyplot.xlabel('x_6') pyplot.ylabel('y') - pyplot.title('Simple Earth Example') + pyplot.title('Simple EarthRegressor Example') pyplot.show() .. image:: ../images/simple_earth_example.png diff --git a/examples/earth/sine_wave.py b/examples/earth/sine_wave.py index 7c3d0aa6e9766..f804469d9e032 100644 --- a/examples/earth/sine_wave.py +++ b/examples/earth/sine_wave.py @@ -1,16 +1,16 @@ ''' ===================================== -Fitting an Earth model to a sine wave +Fitting an EarthRegressor model to a sine wave ===================================== -In this example, a simple sine model is used to generate an artificial data set. An :class:`Earth` model +In this example, a simple sine model is used to generate an artificial data set. An :class:`EarthRegressor` model is then fitted to that data set and the resulting predictions are plotted against the original data. ''' from __future__ import print_function import numpy -from sklearn.earth import Earth +from sklearn.earth import EarthRegressor from matplotlib import pyplot print(__doc__) @@ -24,8 +24,8 @@ numpy.abs(numpy.sin((X[:, 6]) / 10) - 4.0) + \ 20 * numpy.random.normal(size=m) -# Fit an Earth model -model = Earth(max_degree=3, minspan_alpha=.5) +# Fit an EarthRegressor model +model = EarthRegressor(max_degree=3, minspan_alpha=.5) model.fit(X, y) # Print the model diff --git a/examples/earth/v_function.py b/examples/earth/v_function.py index 7533059c356f4..ce8a523e63776 100644 --- a/examples/earth/v_function.py +++ b/examples/earth/v_function.py @@ -1,6 +1,6 @@ ''' ============================================= -Fitting an Earth model to a v-shaped function +Fitting an EarthRegressor model to a v-shaped function ============================================= @@ -10,7 +10,7 @@ ''' from __future__ import print_function import numpy -from sklearn.earth import Earth +from sklearn.earth import EarthRegressor from matplotlib import pyplot print(__doc__) @@ -22,8 +22,8 @@ X = 80 * numpy.random.uniform(size=(m, n)) - 40 y = numpy.abs(X[:, 6] - 4.0) + 5 * numpy.random.normal(size=m) -# Fit an Earth model -model = Earth(max_degree=1) +# Fit an EarthRegressor model +model = EarthRegressor(max_degree=1) model.fit(X, y) # Print the model diff --git a/examples/plot_classifier_comparison.py b/examples/plot_classifier_comparison.py index aa0babbe4e07d..40ae265126506 100644 --- a/examples/plot_classifier_comparison.py +++ b/examples/plot_classifier_comparison.py @@ -26,7 +26,7 @@ # Code source: Gael Varoqueux # Andreas Mueller # Modified for Documentation merge by Jaques Grobler -# Modified to include Earth by Jason Rudy +# Modified to include EarthRegressor by Jason Rudy # License: BSD 3 clause import numpy as np @@ -42,7 +42,7 @@ from sklearn.naive_bayes import GaussianNB from sklearn.lda import LDA from sklearn.qda import QDA -from sklearn.earth import Earth +from sklearn.earth import EarthRegressor from sklearn.linear_model.logistic import LogisticRegression from sklearn.pipeline import Pipeline @@ -60,7 +60,7 @@ GaussianNB(), LDA(), QDA(), - Pipeline([('earth', Earth(max_degree=3, penalty=1.5)), + Pipeline([('earth', EarthRegressor(max_degree=3, penalty=1.5)), ('logistic', LogisticRegression())])] X, y = make_classification(n_features=2, n_redundant=0, n_informative=2, diff --git a/sklearn/earth/__init__.py b/sklearn/earth/__init__.py index b7c88f1725b9b..c56eba674fd47 100644 --- a/sklearn/earth/__init__.py +++ b/sklearn/earth/__init__.py @@ -3,6 +3,6 @@ adaptive regression splines. """ -from .earth import Earth +from .earth import EarthRegressor -__all__ = ['Earth'] +__all__ = ['EarthRegressor'] diff --git a/sklearn/earth/earth.py b/sklearn/earth/earth.py index d11f864b86b6e..c8d3208f0d480 100644 --- a/sklearn/earth/earth.py +++ b/sklearn/earth/earth.py @@ -7,15 +7,15 @@ from scipy import sparse -class Earth(BaseEstimator, RegressorMixin, TransformerMixin): +class EarthRegressor(BaseEstimator, RegressorMixin, TransformerMixin): ''' Multivariate Adaptive Regression Splines A flexible regression method that automatically searches for interactions and non-linear - relationships. Earth models can be thought of as linear models in a higher dimensional + relationships. EarthRegressor models can be thought of as linear models in a higher dimensional basis space (specifically, a multivariate truncated power spline basis). Each term in an - Earth model is a product of so called "hinge functions". A hinge function is a function + EarthRegressor model is a product of so called "hinge functions". A hinge function is a function that's equal to its argument where that argument is greater than zero and is zero everywhere else. @@ -28,9 +28,9 @@ class Earth(BaseEstimator, RegressorMixin, TransformerMixin): that is nonlinear in the original feature space, may include interactions, and is likely to generalize well. - The Earth class supports dense input only. Data structures from the pandas and patsy + The EarthRegressor class supports dense input only. Data structures from the pandas and patsy modules are supported, but are copied into numpy arrays for computation. No copy is - made if the inputs are numpy float64 arrays. Earth objects can be serialized using the + made if the inputs are numpy float64 arrays. EarthRegressor objects can be serialized using the pickle module and copied using the copy module. @@ -284,7 +284,7 @@ def _scrub(self, X, y, sample_weight, **kwargs): def fit(self, X, y=None, sample_weight=None, xlabels=None, linvars=[]): ''' - Fit an Earth model to the input data X and y. + Fit an EarthRegressor model to the input data X and y. Parameters @@ -454,18 +454,18 @@ def pruning_trace(self): def trace(self): '''Return information about the forward and pruning passes.''' - return EarthTrace(self.forward_trace(), self.pruning_trace()) + return EarthRegressorTrace(self.forward_trace(), self.pruning_trace()) def summary(self): '''Return a string describing the model.''' result = '' if self.forward_trace() is None: - result += 'Untrained Earth Model' + result += 'Untrained EarthRegressor Model' return result elif self.pruning_trace() is None: - result += 'Unpruned Earth Model\n' + result += 'Unpruned EarthRegressor Model\n' else: - result += 'Earth Model\n' + result += 'EarthRegressor Model\n' header = ['Basis Function', 'Pruned', 'Coefficient'] data = [] i = 0 @@ -603,7 +603,7 @@ def get_penalty(self): return 3.0 def __repr__(self): - result = 'Earth(' + result = 'EarthRegressor(' first = True for k, v in self.get_params().iteritems(): if not first: @@ -618,7 +618,7 @@ def __str__(self): return self.__repr__() -class EarthTrace(object): +class EarthRegressorTrace(object): def __init__(self, forward_trace, pruning_trace): self.forward_trace = forward_trace diff --git a/sklearn/earth/tests/earth_linvars_regress.txt b/sklearn/earth/tests/earth_linvars_regress.txt index 319b30faa791d..ae3862ad029ae 100644 --- a/sklearn/earth/tests/earth_linvars_regress.txt +++ b/sklearn/earth/tests/earth_linvars_regress.txt @@ -30,7 +30,7 @@ iter bf terms mse gcv rsq grsq -------------------------------------------- Selected iteration: 6 -Earth Model +EarthRegressor Model ------------------------------------- Basis Function Pruned Coefficient ------------------------------------- diff --git a/sklearn/earth/tests/earth_regress.txt b/sklearn/earth/tests/earth_regress.txt index 368630051f125..d7aded29e176f 100644 --- a/sklearn/earth/tests/earth_regress.txt +++ b/sklearn/earth/tests/earth_regress.txt @@ -32,7 +32,7 @@ iter bf terms mse gcv rsq grsq -------------------------------------------- Selected iteration: 7 -Earth Model +EarthRegressor Model ------------------------------------- Basis Function Pruned Coefficient ------------------------------------- diff --git a/sklearn/earth/tests/pathological_data/issue_44.txt b/sklearn/earth/tests/pathological_data/issue_44.txt index 6d6254296d88a..858e5c9a3ab38 100644 --- a/sklearn/earth/tests/pathological_data/issue_44.txt +++ b/sklearn/earth/tests/pathological_data/issue_44.txt @@ -1,4 +1,4 @@ -Earth Model +EarthRegressor Model ------------------------------------- Basis Function Pruned Coefficient ------------------------------------- diff --git a/sklearn/earth/tests/test_earth.py b/sklearn/earth/tests/test_earth.py index e13bb4efd64ab..41d45dcc2bec1 100644 --- a/sklearn/earth/tests/test_earth.py +++ b/sklearn/earth/tests/test_earth.py @@ -5,7 +5,7 @@ ''' import numpy from .._basis import Basis, ConstantBasisFunction, HingeBasisFunction, LinearBasisFunction -from .. import Earth +from .. import EarthRegressor import pickle import copy import os @@ -35,18 +35,18 @@ def __init__(self): self.y[:] = numpy.dot( self.B, self.beta) + numpy.random.normal(size=100) - self.earth = Earth(penalty=1) + self.earth = EarthRegressor(penalty=1) def test_get_params(self): assert_equal( - Earth().get_params(), {'penalty': None, 'min_search_points': None, + EarthRegressor().get_params(), {'penalty': None, 'min_search_points': None, 'endspan_alpha': None, 'check_every': None, 'max_terms': None, 'max_degree': None, 'minspan_alpha': None, 'thresh': None, 'minspan': None, 'endspan': None}) assert_equal( - Earth( + EarthRegressor( max_degree=3).get_params(), {'penalty': None, 'min_search_points': None, 'endspan_alpha': None, 'check_every': None, @@ -78,7 +78,7 @@ def test_sample_weight(self): y = numpy.abs(x) y[group] = numpy.abs(x[group] - 5) y += numpy.random.normal(0, 1, size=1000) - model = Earth().fit(x, y, sample_weight=sample_weight) + model = EarthRegressor().fit(x, y, sample_weight=sample_weight) # Check that the model fits better for the more heavily weighted group assert_true( @@ -138,7 +138,7 @@ def test_pathological_cases(self): y = data['y'] del data['y'] X = data - model = Earth(**settings).fit(X, y) + model = EarthRegressor(**settings).fit(X, y) # with open(os.path.join('pathological_data', case + '.txt'), 'w') as outfile: # outfile.write(model.summary()) with open(os.path.join(directory, case + '.txt'), 'r') as infile: From f32bfd5a4e1fe40e3af7b75ae24b1f5da410d327 Mon Sep 17 00:00:00 2001 From: Jason Rudy Date: Tue, 29 Oct 2013 20:57:40 -0700 Subject: [PATCH 16/19] Fixed the remaining examples to be more consistent with the rest of sklearn and to work with gen_rst --- .../earth/{sine_wave.py => plot_sine_wave.py} | 25 +++++++++---------- .../{v_function.py => plot_v_function.py} | 23 ++++++++--------- 2 files changed, 23 insertions(+), 25 deletions(-) rename examples/earth/{sine_wave.py => plot_sine_wave.py} (66%) rename examples/earth/{v_function.py => plot_v_function.py} (68%) diff --git a/examples/earth/sine_wave.py b/examples/earth/plot_sine_wave.py similarity index 66% rename from examples/earth/sine_wave.py rename to examples/earth/plot_sine_wave.py index f804469d9e032..76fcdb84c68db 100644 --- a/examples/earth/sine_wave.py +++ b/examples/earth/plot_sine_wave.py @@ -8,21 +8,20 @@ is then fitted to that data set and the resulting predictions are plotted against the original data. ''' -from __future__ import print_function -import numpy -from sklearn.earth import EarthRegressor -from matplotlib import pyplot - print(__doc__) +import numpy as np +import pylab as pl +from sklearn.earth import EarthRegressor + # Create some fake data -numpy.random.seed(2) +np.random.seed(2) m = 10000 n = 10 -X = 80 * numpy.random.uniform(size=(m, n)) - 40 +X = 80 * np.random.uniform(size=(m, n)) - 40 y = 100 * \ - numpy.abs(numpy.sin((X[:, 6]) / 10) - 4.0) + \ - 20 * numpy.random.normal(size=m) + np.abs(np.sin((X[:, 6]) / 10) - 4.0) + \ + 20 * np.random.normal(size=m) # Fit an EarthRegressor model model = EarthRegressor(max_degree=3, minspan_alpha=.5) @@ -33,8 +32,8 @@ print(model.summary()) # Plot the model +pl.figure() y_hat = model.predict(X) -pyplot.figure() -pyplot.plot(X[:, 6], y, 'r.') -pyplot.plot(X[:, 6], y_hat, 'b.') -pyplot.show() +pl.plot(X[:, 6], y, 'r.') +pl.plot(X[:, 6], y_hat, 'b.') +pl.show() diff --git a/examples/earth/v_function.py b/examples/earth/plot_v_function.py similarity index 68% rename from examples/earth/v_function.py rename to examples/earth/plot_v_function.py index ce8a523e63776..37fbb0fde975a 100644 --- a/examples/earth/v_function.py +++ b/examples/earth/plot_v_function.py @@ -8,19 +8,18 @@ is then fitted to that data set and the resulting predictions are plotted against the original data. ''' -from __future__ import print_function -import numpy -from sklearn.earth import EarthRegressor -from matplotlib import pyplot - print(__doc__) +import numpy as np +from sklearn.earth import EarthRegressor +import pylab as pl + # Create some fake data -numpy.random.seed(2) +np.random.seed(2) m = 1000 n = 10 -X = 80 * numpy.random.uniform(size=(m, n)) - 40 -y = numpy.abs(X[:, 6] - 4.0) + 5 * numpy.random.normal(size=m) +X = 80 * np.random.uniform(size=(m, n)) - 40 +y = np.abs(X[:, 6] - 4.0) + 5 * np.random.normal(size=m) # Fit an EarthRegressor model model = EarthRegressor(max_degree=1) @@ -32,7 +31,7 @@ # Plot the model y_hat = model.predict(X) -pyplot.figure() -pyplot.plot(X[:, 6], y, 'r.') -pyplot.plot(X[:, 6], y_hat, 'b.') -pyplot.show() +pl.figure() +pl.plot(X[:, 6], y, 'r.') +pl.plot(X[:, 6], y_hat, 'b.') +pl.show() From 4e22199e791f8d69c76d361d44eec589c2c2e134 Mon Sep 17 00:00:00 2001 From: Jason Rudy Date: Wed, 30 Oct 2013 13:25:22 -0700 Subject: [PATCH 17/19] Fixed titles of examples --- examples/earth/plot_sine_wave.py | 4 ++-- examples/earth/plot_v_function.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/examples/earth/plot_sine_wave.py b/examples/earth/plot_sine_wave.py index 76fcdb84c68db..c2e7d3c49c144 100644 --- a/examples/earth/plot_sine_wave.py +++ b/examples/earth/plot_sine_wave.py @@ -1,7 +1,7 @@ ''' -===================================== +============================================== Fitting an EarthRegressor model to a sine wave -===================================== +============================================== In this example, a simple sine model is used to generate an artificial data set. An :class:`EarthRegressor` model diff --git a/examples/earth/plot_v_function.py b/examples/earth/plot_v_function.py index 37fbb0fde975a..f040e59a376ce 100644 --- a/examples/earth/plot_v_function.py +++ b/examples/earth/plot_v_function.py @@ -1,7 +1,7 @@ ''' -============================================= +====================================================== Fitting an EarthRegressor model to a v-shaped function -============================================= +====================================================== In this example, a simple piecewise linear model is used to generate an artificial data set. An :class:`Earth` model From 0db8e5a2b40a41767a946a9dc2bef03949252626 Mon Sep 17 00:00:00 2001 From: Jason Rudy Date: Wed, 30 Oct 2013 13:26:18 -0700 Subject: [PATCH 18/19] Changed doc page so that example is pulled from plot_v_functio.py --- doc/images/simple_earth_example.png | Bin 40513 -> 0 bytes doc/modules/earth.rst | 39 +++++----------------------- 2 files changed, 7 insertions(+), 32 deletions(-) delete mode 100644 doc/images/simple_earth_example.png diff --git a/doc/images/simple_earth_example.png b/doc/images/simple_earth_example.png deleted file mode 100644 index 17f572d3c34473332f66d00255834788e679a405..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 40513 zcmeFZ^;=b4*fmN@C@mleY`VJ}q>)k@N$KwHl8}~e6#?n)7L*3*?vn1VGdIusp6mQ@ z{)6w^mt49xYtJ?3J?|Lzm}43KPEi^Sl@JvM1_n)5MnV||2A&iK22K-pIyb;5~}HjFuA&48}+35A08od&O#dkbFPs^^)H$5W}S zsS+Qtf6J7Aoo6rjz@%5ly^32~8&&&iJn&^t@vN(M(Zik*#MY{1Pkljmf$6}=OREOQ z{(bG_bVU84B^KGNA(Ogx9Kq+XcO(9k@F@c?IJPdkdCU&t(|gx1e1%B_zwkK?rE-w* znF(**-g^rt+01d1KfNTE33uQzvA`>?LL4^i>Gd)S?&%XOIzmL!r>m4XQAH)7uOH?w z{hzLp8KH%NehVw^`+J!G87c?n=^Ba8QvY|Lo}aabzfpCV@fkEqiFU+$?dNRjRva7L zS3co~+`J1(=-*hqI~|7XbiS%dV$u%j-!SZsCKmUhB`22!rZ$!c?_Qhtd%Vx^I%pvB zSdU9cN@BMdr4+vIRdPI^&^WzXi!m#<(^5ZK(ya8kb=6_kh&A*TIFOgi4jzk6*qhqH&Z%rYfiT+T5`uKyMk7q8#!ma$xUOG^I! z3K6dmfnm|EjkFlc+weJPJ{@A%sd#}@YlCr478Yjw4)_MepPh*!kDKlMR3R_!-N_Q8 zU%@B@!*0&bggX`aNN6@@|Cz^aFe_|)PK;%r7*=dCS z9h|>-DEe{Bp-)U&8ew05e=3(1p2$@PhNIr)^;Wi$;-SZOZgPr%8*^e}qI-)TbK^g9 zJ&%n<;g(^ZCGU8X{v6qP>1k-epz4#DbIp4PJXs8znYp_LSiDD z%`9i@Nn%;K)l_N5`PkCspQzW@cUvOEandBIcOC*N&6W8U69Dov#R(W+X%;tFe)PvP>VNy(0*z;rP#M zzKdxiItGTdE*z!x5oyTajK`CkU2&cj@=YgRf%`YnJW9otvBc2aB^`~SWeJy4rTVcwVr0KbK5l^KLaktv6bb;jIZy_CQamkVApof-F7ok=6=#k z<8gP~eLY|%9Dn-3#>QrRVq)doQ>)q>%j@!B!|(CZ5BfWCIl1Th*L@nup`B1~ASH~d z^gOpLtzSje^FEe**tC0~HuH-Sx_AZMf@D2UI;b(yxoy5TG^Ey8O`U*XT0On?^nMHw z^|vZ*2st@%WNui;&Qr{M%lb6@LT8`Ip&70XsMjujoqoTI;Q?g273BE zj$y$uTRS@?;W|)&nyRbEg@LKqFKS%(Kg?A!fz%$xtRQ zdG40fnrK}#y6k@G7rt7CZ>p>uEiEjpN&Hi#csckot zWHJNd`l6(6G3|0G#_w(|(#CavHu1R1Uhs5)!&O!`{Jy5lr)2rI^|1B!grwV{o7hY# zTexM}fqzcl=X`=dB%5c^y_1B;HpAx^3eDNh{cNpGHps`&iBy{Oqqc4>G`X2spY~A1 zOoN*N7pho0uD}2D+HN|O*fm90SJ$TPa?y)mx3;cs4s6|^$3mun+bnRrNFT7l_}+dq zB2ACi*^jahS-OtBRIZfRvcg+;=tJ2eB1W&b+-86|!fCR4+z%GL4r_n~S(=Z2MQ+F? zGeh4j`QGlYS2AhWPTSVal@=6KJl;&TnHE3JI}OiJQBm=gF_E*!f@0khb^@JXJdKi~ zFJ={Ezc6^ae|@?&7bEiEK6JByNXnetzgTOdJ;XhhuT-bYoZJG;l(97=a3~0Nh;yy8 z^7PI8*6D`O=IM|C3(a&7zCWXW>wGO^|HBG~Uy7T^l)hh!jaCwL;p;xanK=H=mn;IY zJ43QGna0B@Y!pVRr>#xTKYQZ%gY>kx*yiUqJuG}{U8XnYuwOGZ3#@(Ee5$y3>9*V+5V>*e zJ`dd`=y-LDo(yJwz)}0JJp|hNowkMswM0l_<~YoT22i+95J`s)M;`B&9yfeg^zT;j z_dx~PAgT)M5gmESh(++8xoM9bTJC0RtSl@nK7w(qr^^GNSAsun(7fC-MEtY3ctD%{ zBE=|rWxsA|vwBRi-{Zgta{CG-ao`ag9w+OOTbl!^@s}<`LYF!quXY!ewa(f&o`Lj* z&<_6HXH&P3blMybU+Hmb8ZGj06?iMl1FA@^&D>;>3#@v{hu@!Z8LrkKk22cYuaDgY zuQR&WdYcAQ&9Y{8@3&M`R62pTJ0&S)^5f3c&eYjKfWv8)U0wo6aY={bbA7VWe6<>J zciZ+T0JHRPQI{&Yy&lGU6na>cx&yb6JuC&)3G6i z(*m2AnAn5C)dyhCwT)!`A+HxR9*RQ`LtqQQ6#qb1P|;1IeRR*?W;QJHDA;zpaOju? z;L0U{E!H!YpP+HL>?t+%n4~K|p&J z)7`lxe95QhckeQ9%L7fM*={Y_k9S*)n&tjb+~9G#$>y{vk1ld&50D!$jmbiziv)RG z#(v|i(C$G4fD;=&wqJdR4_a>z0(W0*9;Swc0jx}L3@%UBbtNckd*ENXUAzR<$fgV~ zHsAt8?uKrw*QM>(t*qBWr)4b{gxObJG|w)UJ&zu44^Oi}{AW0i%0jn`&utIl`R`lc zT=bcg+iPy?<%6cfJWwPjC)Gi9R}wl`9r9edKX8Lqb7%#tsi`3t-k+_BaM_*2-Ec=* zy&R}yoSmCHjTQ_Kd%>N!f*bd~^P1HJ$~&;C}nAIaD59W}E|7d#kfHt~mO zD}fyiv6;KuUwW`nJgNW@BdoCYRzq2t{U60E$ZueFt$KShl9p^6NRvJK*4~(p@9d(=sL|RCP%WTi+p@r>==d(T!QmHaD14ylJ~0v~vfS zvnSn8`Q78s)!M9qcsi``KHzCRMgtzhGj9+7?H%pbwK-?n-g|O#_E(&UauQOJQLlL% zffp+4>JHABWoODS`s|j}K}Y(xx3>;(C^;G$8sxg>hU2s2h$OzlS`^R8dc2Y&DD+h> zyXqufdu#xlq9DKt+4=$WaPluFhTZSMTll;{$pJthM^JnWwD3T}Lx-Z3+l&3RP7IN~ zbGH4tIu<*zrksk3xV313XxVt`<6IV>aAMANYP$QfOyY9=NZSxuH3bikE1 zY!bFde!oA<7uhJT8Zun@^{M%0r>K`G@wIJzK$-7(QHEn5osQ>rZvBGohYug7n>{!H zv~gGr34us{Tk42lX-xsq&H)x?I+W21O(7sj{O$_Jae`a+wzRSW>%Y49RTMmyfZ}jV zOUtm|hI`W$LBMl4KO3y0_pz*Y!A;oC^ z9a`r4WjH*h4_)6SBiL&z7#R*Tw+{}~@n`e$x1LPe&s28=b%YrtQ@U+qIB2Dg+u<>ci=o?Kf4Si1wBRzea(U|k zKru}HW||e~0ze7QfM!r=+TwHCEO*>^OX73(ezI6=Y}d#oIzRvNi;}oF{FIIpn%les zl9J#t0zko>oSgPhplvl-thc|_$56H&pM6L9_;C0*1WKL<0Nbxbd<6kQc>x8v8afV= z*^3cjGWwbq?-Y_qzGeA6cmVSTHV@webT~*W-2m#BZT-qKu;H{!OdBAb2|gY}9^>{l z8Od{kob>AVYv<~pS~`2FdGN_+52sDTF*nh{0^=&+8+~r-1V{Uf##Y zM@oABIZHEU_HZ{vjG%IH=S!@(_utF-*vQE{6Qx9N3P5S4hE+mBm>rSS zXZ_e+6SPFxxAR-PJ3n)-fVBpMF6TSJugeeQj;cLVS*A4-&{}%;Qyz;PraEv$Hb{wPvrny81IwX=!Oi zm`bx@k}TgFi#&yNDG!fp($?otwq`pfIvTy!ZfVF&_>@46d!Gi86y5+}6&-*-??BJm zUAu35gc&a3IO);|yY-wEIszVxo?tx^1C-=}%oM5>)t~e+fK^FRg6|rG4nZR4JvxbC zN`~i#{O`AyplGo>tadezmE|dAqo?TqTZ<9#wa0KzXn45U)oS&=eh2vz_B~tc@!!^@ z+fC|ujIXUv{(o{np^8510i}tSg~jad>KNMC78cU$`Ce~ioO9dG z_w3D7ogQ?iX1M?)?X**nkG^vp%?S8`neIPX6z&1qW#0aN>_8;1mnX;t=p2NJDoSW4 zSSankK0Ob;!IUDpAGnbgscRh@F7`Wf+7)7mr5mYNh@=$ZOBhy@qO9hv^vF=t#9>Ln z_Skd!`93Uv&qe&8J$PACvRMK3mmcKrFvh&I6%>!i(z?W|YN>}sg#$+aeMbU(C($mL z0@MG-^XPhDO4PtSS^=7#eq{eaJBO8l{UpWv()qtp^1vwk7n=1)Vu-JwHhhN`h9KJa z!HM^L{F^Z9(}1w~ME^f*ZAgxo&wrGy6z_)r3-PTz_t<{OqNG6(1|x$ST2bzA@3M7g z=l}%YUV`5vrHZN;lf4$p$68-2cVVbszzlD1^)YppcmthDSfprLAeXgP@X^W^tPG|6 z5$yHrmrs!qiHRy2!WBV%M~&?8(()bPFM(UanWIjYn+0Mv<02Hc<@`52f)Q{VIoC;} z2;5tIOmlr!N@t1;3kt_;hX(|6X^dmgp$L565)CM0df`sJ!JmUhd zM(EOB-~fYC)V=<-k`WhSfN47DNTStS#`acatYY3ag@3~P@HnMxCyNuw%W5$tz zd)Hf8^y&}NWBM~`YwA?R4ZO!>4d1r)e%**7tomI8I%0@FSW#)|kbG`nvq~Xc2j94+ zb}xQ#uo$+qG$G_A|Pijp|=Skb61WKh9BV7cnS3UGiB5 zgxRKiB5J6LkPs?zf^U=*Ts?0>?KlD@1~>69jS7L9;acvnZUszbtpa*2s5O;2*FtV! ze!OnUq@Ngt%gjWmNA*`@q?V#ntop^fHjO8Y>i0VbfnWU%qiJnK_n3AO)TUuC_@n$^ zm|dTUoT!x*7Rf0VpxWcU?=wH+R{6qBh;2qx^ecHe=AIVU+59FEdi_f<_m$$JdD}`F zfRIO{5I3a{m|sYx=rF2~+k8ao7j|NwwplVCm~NN8PLA~NeL}GT zW)fqsxxp*obFzbSx=|>DelEd|Y35xb`wa&{80RR^9gKVP6=t2H5%dN24LZ;UlW*8& zu{kw@xiJg{hnm%4RU(N|>ldg#H;;xw3G0K%>KT$9eDe0vm9FdG={Q3_e}*f|5hjD0 zgahbg-(ubb|-Qn1BSP*rW`&RJ%wh z)^p{vqkR-%#O5pd)VYo!Hcs>3=7kp;_#iCZOx9h2W@7N0c&MWkH#j)>ANYo&k|z(l zJisw*3>brA&5A(KDm41B%&H89aCnZ)qTXHvEGd13YrV#>plE+A zl7FGAVODEnqxSv3NTQAMKN|zsP81Lh{mCo<+hkzHZf=_H?C!>QAhmzO*9!x@2cV+~ zn&JC-Jh6~5Gp@Cgv=Gy9|Kza8wdj zM&$0QTf`Kc``n$1JUT6IE%{vP!cZ$^Wt`3f6nMQHgmIINq%7k(<=hWf#>3?q$4!sD zd}#gyg$IjWTAcCM1p){1s0wx?y>U2jEEy3x01;cfE*(LKV-J47E_XHWLV@A3gB1BF zIH@ox<}et|e~NS$Q$-LN{gqz^QCot0(Z$lz+Us_jKE?l4Ba?$}lQ10Bx66@1o~42J z(!{?(U!-lH2`FM1^0>W|y1z3ssTGRCfcO&vkc*%nk6EV&z>Vh+O}Fs10DqL1A3hAc zED1s)BgtRj4@C8Xd~6n_4>hsc)AY6`ld(ByReie2pRkD{jVjOcok$bVA&EP4=7hq< z3L}3KgPwdr8yrBFQYX8)x?)F3d4P`U*t4a#Kx0U?*cmXk%%JCowgcXo8~w>p1bDH( zJQ@_)*f`(iu;pM=LeK(JZZo@}c9kzAtzxd|sFsfX@JpT}v8a;WNxv`_x(P-St*_ht zK-SvYymOv%2)P#HTy52BaT!Ra+oH$bLQ^ty_ZqCXhBBdzyQ;dnBWN-!{2qM)w`ChG zbfF2w+RZBE8DuS>FU>tvDfeXXK~={S!T1}TeddkX`N#IINflj|H>1fxEzuKNmV16` zBn(^SWE2{p!Sq);5@IQ)vVQ{P6qHl5ZQQ0lXxJhFvFC9yW7ahI_{w=3x1z64Sx8)v z1dd9-SB0SesN^mhMTZ=#N|*b;iY3DWkOT~rORS?2mrS|7rnpr5GK^DCESWL)1AultVXYoD_&JO#RxNR+<}wON{KtL;__ z>5l|O!-OvjY%SFoK5^+;m=RSjIBij}z+N`bn zP1kM{e;0(pS|2+0rIy5Fx*tS`ntit;*V}8)6Yk}{H+%X^`1IzqXan2 zZIQMm%Jk&aWur7J8ocmQ8k_d-bgH3chHj>gO$&)U-~Z>*XmBYc8-v9AuWDnZ&5U zjQL`8qL?)^LJbg3F?Xy^4i*-s=rT8)ObWxmN^#$Q3{wRGb;ViK5=N1FZXgD0uE&@Z zJE5gsPO!Me>zOXY@;{~B!|wFo#ljSmET($uYrJc#cr09NUF*YlwB-C_+MIzW~a z4JjUnT5&r9gu~Q0(ikDoNmKb0TW{*2Gy}8BmO+hkBrJx>lbriI#RHRq@z3m{tY-V4JO+sR8}tcSV%@5aL*Y@B6V!B$1=}@-ux_(jS4m& z$_2N3sq$@@qevrtm`+KEtGb&9l@=zhmBHDJRKHSv7UF>Rrc(ONYNQcW|B)BTTSUT+ zuf0qo8FJvJbhX~uW@+i)s>T>2q(Tp-rBJ|q-9Gh=Zlr%typSd;P79h^c;kxspC)P@sMkusT0&ZS$#aiCZB~mpM$LeXRp>kEJwQ z(=LK>9v5wnD*D6khJz^eLYlZd3A;Tnko%V^r3OlitxsW5O^i%cW%so7i(==S%b?qE0=bho1Ezm43O}5VB!$BIYm|zx^yuvcM7)KGef2Wv z-L?m}VEez5x8lFXPwfbeN=L>&?J|ID{LH7Q(PS!+iL*aD! z4Mn8rf{~2S9)D4zbw|gyt(RhZFPK;WwTuSLBuB$De8J~d`HhU+^SwnhVq#VsLfkoh zDtW%^JY7j2n$yr|bl-DD2MnL;5oBPJZ+QW_W92aR4akbT#60g$qJq2j9P;?p^$9V# zdD55R2c~>o1YZI_z$$6rK}1qS?CKnO8BwKGyAb9AOB#{t0AV zpYz{+aVLd|zzdjqZp#zgDRKPrh1jo;ul-K966~S)qGjz;oHNaHZ~n?zSPsUQgj51; zW~`JEo6|EL<*UU!yd-p|bcquZQxE(5*q!*`V1Jelncv{#7K?`KMdTgjUI}5OhHiV1 zU2nSP#gw}XKJh4##7s;DGnfX#81iWeBd0l^s(N|$>EEjFX=6>Qg%{}XU(?pzsr0nO>f~-wQC5Nr;(g%?m$RLWELcE zs+*Br#BSP@JH%Ay1uqy%5ZnwaT88p6hPUOjngUw=K$%%=3_cNxR)rsID_X$#LuR~$ zS$^v9HUhc9rVafS*lGf=jFU#&x@$sY${=irU1cJn^;_0#t^pCA_usi_3c4OifdcCH zSh_IrwvSj6vqI^TqRAp@S1sAg9n07(GXyGvF!O0ukRJC=ZoicbsxDYt$qmIGN$ODq zmldru`#=Li7j(JEptGufqX0Fdn-71ZcAK0fzq)Ic7*6oj_J^fig$-}s5859m z=nw` zVmqZZaDH1;cfti8*4$1>ZNd=_tDoIXh!YzO$9`k7^@)Tx*0XP-s}qU2H$9raf9~zy zQ`yt@jX?MLy|tCl^Xrc=bTDx%EU)A@f;I7Acj+yWD5bFpXo$CT#9~&wCcQKT+_Di;AjXpB(EP>$NDVsIjrVqu5)y zj#?DubQR*FDh{SvdqoMD2z;~6tZ7%<0zD9G1gYM_?niGR^$XT%7CmqOYTmnmag6SnZ}1srv)`z}*CWBTX3jRNNF z*giB1t01?9H_X=}Tx;D?M*XHvPD<=VU)}l^{2e(|_`OA0DMX*~G8gg=$>zym-VlFOH6NT@3 zsOvf#qLS~0mLgUEve9zFkyAv(>l~bK3Yy^M4sUZ(khQi6S_EPg?XIsKrzENkYeVPu z_V7_n*|4%_ZcgFhnWzoZ!)NJJYx6ZKd4a@60zL`oGRObMrbTZYi;BbV?=MqJxng3! z9cTyGL+@w5NuhRi9m7+A^p4&}Fll}1BR{0?*u{8&2Yg5@-_6G{8GqMd%7sWGF#r=O z;+-mcEYV-u+|ifj-B!@aYR`N}5gBCsx*$a7B;wmf_yUy5NY(4o1tzAe4^vf9sa*u2 zl0@m)Z+W|3>@vY|Jw9`Z__E8dJCf@TU7rT20UXlS`bdqn)?fr+eQGKtU$LmKi^q$v zj-$Gzy~HgHOI(zMo(Y8rEgiT7A7LFf4%?~(rqjx4${zh}98W095{B>j3X*B0j$-oI zr22Fniw6<~W(K^kW&?Z9A?6TfG45h0F*Dn#WafH}x2(Bvc0nmtjM<((bWoaX46zl^ z)lv}|vOS9X7ky0}KVP&^{aKhInU94@(D2~{YL*}z>{uNpw$|&^o26XmwD#{mtP0g# zvC~v$%bH-Il=Cwsh#46#)0@h{qXV*c=P{cBPAy7G1{&m^BNhk}Ql*Xj9PA^rY5X2P zHk=V)1f48CGg3BPxJ4@K5Rp4v#qn+2_|K2}Qc>~q0pq=tYt=%3$7)wq%~>}qobpSv z!+`6GUV&q^uW!7z51yDE1lu|)0=p7PEWcLEJ$IKO0=9zna&`4VKKk?5__()A-&$5~ z<|(VsmY*#jb-FkL6hW7?r-eQ^n73mxS#8CN$ZR9vhEILfUcBqfU~463Q?z>%3sf}( zGjOmfhXR;Af?AT~y$G?Sko*wRJV874Y)mh>*2JY=1+nJ{1G?B|pOdj$VM(UG>BbV{Ai(CfoNxC z0z5QVy&Sbe;O9$Md@L)qm=cBrcQ&LqE?9IR(JmPQ9+*5QbS$=K_fsW%RdF$+%P%VxSuDXAA|h;^RYNjiike`gpt5(B9yd|#LyAs9m)BogN%T)MgT-dVA>4Ql zpf~!xjrM%P-Ch$2P$QX#GKTi%W0UYWq~<22ysW5%r_{y534WZ2F{)Q#mZMbbnM^KK zN}^aohb<75^&zdBme)91zAQ1bx-w^X66hd*^UDpcoa)lW84aQig6p5^KZ!BicL@8# z%7iyKY;WV0T$G3C@q+R*L>J1MmY@{5xAVe=neo!Qy+&%DM-y(>Axe^TlhViDg0O%IxrG63zCa`lt@`{Zdl;C9tGeX?2gGU$_%Oh);O z-d-p}9;sk2r@mGT)=?&*_Po$0gpI2p^NOZ3R;@?nywfifmD=!}K1Q$U&|lH_KrhzI zoTEWdrWy7g28)&XxIMKoq=+N9-jLLoc5sL)%$N~VQj2E$o%(9|aQQD;Ri%?I3j+r( zo7%DE^eBjXv}<|`(Let_Iek9SXzoty(fPoaX7Ec|WlPx-8Qc2aee+!@;cGDRnbM8R zOq>f7lgsaN0%_NpqC)zgOQ)Eyw}%68b0P3Z1DAR%oSd{ruQowuG7@hkT;A3lAFHh%YZxNi&xHz=2&P55@7eLSF={X38OU5Y5Dg6QA!YP#4crj?1L zHKrXia!x#!=B$WD`~nJap5mR$E%*fBB^{kK*8PPXLiWZ7bflK#{V2%Qu~=Vs<>xd&<_#k3K@g5K3|Zo?bqcoytfx2MBa; zZf=Z^VC{kW2WWKNfhZ_sl{FV4yVgO<$!)60!lhIESuZKA3iVUI>$%}9;Dma9CS``E zy4uLM$#3cu=I;-*xNbF-Ua$|VgaA_W{tO8Ep@INl-L|9qL%(dOUdHb#)DOmBs#LeS zw$>5I^S7+s{t%dz1NDg^q*V0bt!B$S(DKc1IP}{ny1uK2$at@9=EpS5V@$m6p1V{peVSp&U+wWn^ z&vB4z3g!rW1jh=5k{SDe?;Zd`7Ewk#6_TEJ|8_IuO3Btlb%_Tj9Ra~DuNIB4whuo( z=~*zhpdc)Bqv=R#_`pXazmN+mMFpt(zXQRKZU#Nf$>7ydvWfk@h! zIgB({`$iD`_F`lR)!W)sV2m~&Cx)2p)!7MtYtOUV6oiJo0^Jt#YD!RY==nS#O>X&x zjn29l4CZpX_F335`8Mfg_VN(yS(7Vem{BF5)f=Bo`|oUWQqX zq>w<%b;d3cq~n<>ZCxCvjFD3Kgr3PNDPdeKhe0YxqLNv-%MlyHbNUPd!(ry?qw@1< zK1ff}{1#7_Kb5t$wQqa|D@0*?U@Xkdmw|R|0}%f5iY<A@iGW9hFP{qDFAgzhpHKp z`+s)}U$FhZRQue2R6Fyby71nb_K{E#Aly+=01BKn*+)jc08a6f%ZJ%7S(EWk z5QcCMkfQM&cj3TtkXM=x61pDDr|KMnXG|zwqB_i&B;)S8=Vp&8dCMiW&zNn=_oAw2 zN6hg{xMEiJ=>>yRnh12FcZq=8BUrfe9ecq_#Qo^H=ik?746{Nbs`4}1yCXFD9-+r6 zb3Cf)y_`z<&A&9O(vOc1_t1x2h@1x4_7+>xLrFZt3|M7=3J(alVZ3kWmNv~qZV7;D zQy7T0h@t5Z#LXtq4(3%II(vJAQdZ0D_Eue&c!bIJZ3!*gy#FW3j8`O+_H3XD zZ&%AJmUeR5e0XX&q~ep3jH8hZ@^rQEtY-q34ilyaTMuoXF#X?EhSiR~cVoyh5T9*1 z{a+i7$57E^+v9B;INRJ9NMQ>y%kl^T1%PrYo!tZ#`WO$84b3}`DFDH_5cEl+y{h5D zn+cf&ySM5Z-S(p@dh_p8qSe0kQF2V>iqG7mDEdxJr<>gfgchwywCi<@k4oUgmZ+nBofN zZxf}z$ltucP`J|iZTKBcUv8g9-!2vj!pTQXfMWn4bjUk>sol)2%;xS=D-%h?l!Cr( zl`?C~;u3`Y()Sp1A^USGu+pt3P3(n$C;ve+6eh`Qeemyx+-m|9)q9Hbs>QDTX9Cyx zCfH-T3YYl@n?GXmcvl_bjlMStfv6|?5i@yNyXH=6P$*nmm%f~HCjM(humkB$U@lFr zlsw~eL$*`?!9hz--e=%Zxoz2RAJ$`4azPK#x%zuXpuF7SJ)!qthE9j|+PP^dUd*lp zsNS98Zd0v#KWXn{!J)?9a;HK9DTF8IF*i4*$<=kog|x~u>BcnbEohlWSI&lAI)qPyO{lOQ`BPhmr2q}dC z5e;qA%dAgLEwSMZ68$)PA02dpB8{a|Im?yUx+)cbX+nnNu3Rcq{Ypw2C~h8A{-2Th zYgkHP%Pcrk1or7Eu3&hbd*tgt9eooD7tIDZ9vQo{wcwPWd|9J^ce`k*yeNNEZ+A;r z3CC$)cYb4U0ahFL^t#_pD^+{*`eSp7RaWL*8jiPrsw)wCdV6l`;@NF1n>ZgSdC>35 zFy)YR^9!6V`?a|TXVW8xqpv7}H}O}14r9l>QGu%~jaDWHvCP{co#TbOKZ*6JPVM`3 z3V^-F<<4qN9|q{zn{webgAK=MsY)#36s1p3UfWAQD6dc2Z^%!gy#^N5`zm8foJwYU6dt308smA>BV1T`apAASN zE6z5bX{yJrUX~1NTTaPMt2VubY-bBESWhjYN8nL0$XFI0PXp;oT*tVJG8)X){y;l36TudIvtcw{Y+L=rzRD<9O=#5fnwoZ&xy2c&)KySrdq#zDG~=iKVFDFj(hjBH3y z_3nGROf6iJZ^7b>4rSEk?j>+&+i_B&VD$Yi;^jjbR&*XVaP%yX`Gu|LiCCpeI{5Op zsZ<)bdIJGsz!B7jnerfn2pMGn4>5iw6N>$Zom&JaqmDV+ywf?}c@WYG!t&YY_@(#e z<3gD2`ZF17miQT#8gGVaT;k1Q;z z;nMJLb^VEph1Hwiz{j=G_g)!pW5e_&aVeXKl+T{ji7N&viHTu0u8%ecY(&TMyjmZR zXL+xfiZ>j94FtF#f4FUwmRrr*@jb-l>F>I>bykn z3o&`OnOC_9qb?QYjPZ;=H-kZofxnH0IEFK{a4=3U=pP}jyWy(BD2GU3VgT|S!3!Uz z>~wBJ?A%BxICqO~6yX;UuWX&-%A4R`a?t>7ZL19Ao01Z*e)B6qk~=|BoT%x9SUxIE z3JAMBcv|U2k|<2Ab+4c{{#*Is9USas`q_d30<;Roh}jcjC`XKFsR%S?K5;@~ZSD@0 zZ*zvLGO6#@eFduv3bq?F_@>yhl_cN)SOP=6lyf6CJv~QpXbAI+`C~&2H}LoJz4RMa zoxz|HhNFf$3r5hyqRO>xZ+K&*Qk=om)IiTMQ8nU)c3`>n+>km*Q>Q9Qv`_ViB|O35 zgiM7oO`d>SIZ*(Ns)jiEM-m$Bce)DBGaBVSHRJNrne&3S$>mIJ#3HD|5)za#X9g=P zp$a)~XbfOD#4vhY#8zZITn$03y^j~1%5e3S zy~g*3i@wRIv6O2RX$PKMnK8hh;M~5C#MO0^Wq9{8eZ$3tU>6BH%DQ|9`F*_3LhZNj zXX3N@*@h&VN!PQJrp)XDt|{GdVViCqQ^pqRc`J4=cxGINjf?Y#;^-&ro-w6at+DDr9K~+bIy1)S-F zRbPK}y@(OriN-fi(E**q(Y3+j!?;mQw~pVat>yJSW;AhNF%gZ^EjgIQHdm zt0W};K#MvbAq+9`rWK`OV}{5b>tK=aK$C?+)OK9@``(Hsa{9lQiyG{kpyYv*yA6*f zZMPLMoN`7T6GE629#LDKthnX3y+cQ_TFXKmYup&vWDHr0_>jp#z)X;3NZ(r{Bh1!cv5y&qyhQ zV^C+!W8~R&ZRchORAxFi(6>s}tr)@pMSD zBIo86HDn`ccK)WMl`TCuPVrJhoR~S*vUB#u+1wWkX<`5u=O1Fv!(txgX z2$r?Q2px3lyNvZ6eaRRX*RvHgs*KImt)gNSx5%{6ivr4^T3_AYmqm?@s;$T=q!Rcz zSaER-ULQ)9V#>~##4Z@+m*W~uRTDpH={(TFqRMwD4BwkuaZE*qJlpWu1EXJ>uOh* zPRlrFp7%~|b&|g!bu@9*1*%eC=^M17v-y}kUs7^N0C*z(1&vT5|JiLv;?{6&Rs6r; zoXWRnfgISYTLE`DuZMO&b*Adh0{CUzGqkarroQXOHDb&{p??I+9iFzvk+1CHydLfP zvoY}nHpsf2vaKrzds~@J+8)(BSH~YdRyv8L9j!$)ClziT3}75=pM#dhUGA_06qQg& z^wK@4LU=B;okBMBiecqx%vk=!Sj%A z_;~7$G_LA7Tz6RvG5NOGlG~zVwY?#tj}Bw`PPnw3Tf%`IP~%^ZtSH|=Jz@=FfEzUrt9PHcMv@(i~% z1|*el^`jP{9zGTU%86>-_u9#fHVhK^(oHMfCABOe-Kpv#>=+c~*;)4dE7PSrOY>Lb zb>!bEo#R&W@<~bWulJtIe5f?|dZIsFe(zoTC%W^GN!p6y6^x)-D$1vsvgAyJGE0C1 z#TkS~nu{9MDreO`tbzcU{v*#WEn+=y8)5E26|91?L!e^oQkqN-PS@F$P4r`Tb_d(4 zpUcGVnbuDvG`eCL5giDHhCQ1v@WG{BNjcV3K$VpE%p#y)R)Pkgdp*PPJmk?%{n%uc z0J3l0tQT?dOr$tE56?@mLB+Pp&X#Wqd+QuGr3VJE%IwOxg~M4?Ed;g}biK+gY;#d2 z0SlV-!A5^1OKWh|OW2n#Iich)JWUgkt%=Fb<~uc9T(4SeQ#gZ`%@E6!zfF6`$DWAaI1nTM z`s0mc&mm6^IsFC$IeUG^XElSNV;Jq)@|GNaE6McVS*CD0Cbp!KIeAm@Ht9}YN{G^x zMND}}%!LWG@DeKJ5>l1kD&Iy=#VSMkb0Y3F6)>EID!=H9k1wxchTjwo-r(XE6lfmT zhwIQYsB}Ko+DwK^Da5WK&^C&K=NU<|F=}ms+=(9N>PAPK(@#z;(TU$KP@H%&!J)N< z;AInBBZm&+#K~N$lo8FKY=5PzWnTuq8cE$^Zfve1hG-Kki#8JkWLWBBO6A&?3exk= z8ylOYT257|Zbay2laX~cI6r=rd!uDTks=Za&*}$R^|s@y-vaPFOnF7V;KzL zjHwUJn)pmWbrEYvZzK1-YYnK-sqd;CISmfD)HKqk$y@#*8w~X-l0Z_t(G}toKSEQv zIZpV?tSzft%TA8Th)en}fc`>EDf?11$ba>!@@}N_l&M8IDwqhXj z{&9It%dq=#(@I=C`*{+02o$82oKH?8sG%H(?zu%pw~u=Ze)c+UK99FsS{`m2(~F6+ z!5c6g6)n4*qSOkjFmVAWbmF$}XBX+oXn#h#*rzD=a*{ds#ng7Xp)yt9(VC>lv7kxU zI;;jrIL#T-x~0j#HhdG$>EPL5;5GH0Xe%_4o@b=gp?IO@VqQeps~WJy6D)E?`eogb z(u)gK-Q5fpm(9al_c@ytClYw3njdf8JB>9NZtCk=*l-1O+tj^b&R-UnFfQek$*pnd zN#aovF#fAUVR?mTJvT9~rOWt5Qi6+=y#KfAIpp2_@=TlGcbYP};8#WoVJl@Q9w8;0 zWe?%oX_sW=>}`P@B09;&luCE3?P@Y;3iL9vsQy)<7VIO9OFPc;3Kh}|79XcdBD zH9WU;_$69My99pZ>FX=H;{`8VYZ{Vmn6!pI;3IH5%f{x*6wPoud(6_r2k15pxC#lq zZTliA4vfn%LJ1K|jlPT<5FvS`ifrJ}e5StlK+GEsTjj}~=?O%YsTqggqxT;ukQ&0{ zj(J9BQP+&NXsb{o*tL7VtW@rtDrTg3E}`-pV~wJQg^lm*QBKXi2^8!|#7suMKa2Z+ z*!#+_s-mu6l#=d{=155?oq}|ObazREbP3X-z#*j!Qo6hQP)Z8YUDDm$b$s6Uj(3bZ z?muwHJs>-UTdzo<}cTw2Eb*pphtVZl{>!NvlfHc zK#|(|Vw^`r68dk11wHjl- zrL4N(aH|!+6uuBiP*ZntPZjMuzdT& z1C-w6$C)2$+1RYsv){a|JNv?-00@TAB)aJ!&+)t+hrz|F~AZ2Iv24L)4^(WZ+jK19CkSaCeOLKe!* z%*hMg#T#3n+msBL(LmnX%TxoItqm+|_UBu1^vXc({TZifDgUcOmtEQ9@HK2rP`1~I z(OB=3=#%FurUwf<`;wActWN7@7D!)wu~AS=y22tGDCMLXt=K4kwL#q)D_8I){ye=F zVXd41TNK_idrP|0c#5?s5^hZK>zgi5Mo8tZ_d#k`7lQ-3;+^z&gezg*i^{J?^4*6E zLWYn}n`p|%;LC{xD3X$7t`z(pL$|M9Za&j)4r~=+IkmaFWAC@%!hR!Z0X>}ZB#fR+ z!#XhCx1_F9hbTLs|0O&@YPm2)rmp-50tK`m**g3(2)B=;C;p7}*gM5-rY`mmHnZ^8 z&8P_O=r$vB`ynKnNTljoGuIb)ryNxAUh%TrvTgXfy=+)atV> z^6!TQ9zi{>S;W4MTGK5>R7agdyjNnqV>_kAis-Mcwt%_F5?s^a;N(jV%nsIp-v$fZ zK;w^nt>f%7nHXoFRIhZL7i4cf6bJS2ewMQ4N(33UcT_>IHra~E2tUTAiw{EaC_L1y zh@MwUKHHp5i;CO!qIMsz0XoU=F5mDl-%mV}mQ3rYrA-aFIVfv;xq>4fbYPgQsb0px zuk%3s#FD_Ty2aJ1s7YQX$x_m=+-l1SSl3)${R;TWRyWs4q;1eqpq_vEyRNlIQ`@iy z4j>)Z*0o>-k{Ee?xM;m-ftvxm043`T5&tx}3LWm#0r&V}B>TjE_#kP4a@!MIi}g!b z{ia}M%*?T_E@Aunox5*Sg2e{faWQ>|&AaNhSmOO>(sqbs*eysQD!G zz+kKE^I?ICe-x1CSJ`TwER3CEU{-pI92Bw^C_zP14ojfv6c{Mx zoNaX66CpO*xKr(u>Ed68PzSAa1qgc@ByG zAbM6+Gg)0wIN_$q$Tm@{RFF>cf^dLCkUz9*-}Vq!(IIokUuFA8UnCA*C8D-w|^pF+%%G!1l}G+J*9!Poj$73V{KD(&vDA5CWKi#DQM0bZt9&hn`t!3psS7 zPk;AIQ6OLB3&k1^u<z($A+W~jU+8-hpT^Qz2jgQR;|oAQsH;9`LM7c-~2Lj zNz9$9GKlpWa{3bP?g3mBKJ%xdUTy~5Tere(VJ0=TE1VWZ*xPQ8y+vb|mrX@ZzvEQA zzw@E;I}|G(@c9dz!X7aZqPzckT9i}bH5<|ZB-J){c0~v0Q<4K(i zeACo+)3o2-9;nYsJg-);CUV%0xUau(Oza8VH%{IQgKzIAX&Y@Dxs6KgL!ZgmQuzX? z-e9nDuFP+p#r@acy*>9AjaykG{vtq{&%Olz_vGCWL}_$tvvIrniY!jHzEn=}$9<$U zOM2dT4NlH@&5c5?L0!wdFmY^?qg~OJudnY`8$E=R#ovEpm>K%{xP_j~-H-`&VQRo} zU|?w9-zNS-MOWCZ)#IM{4jm?XH!kV|^kXiEOJeAuk7w(gHV=TU!xcy}S*`fu;N0n)Pi>G;fqYDc^fjyk+#athCKn4i; z?~GzqEX0)F^}k3dGTbU>T{P&d^>vwPvMam4;ybtc6j;D@#H1-ExuGZQxS(&FY-2~C zuyMyye+-2v^vS}ut8>8d3;v(NVCb=|6Wu&LUBROn0Z+Kd8>;u0rj>tK>*n4KHdBHGdNV0j zGJ8^$=Gn8CZ(H(P2ctz9ef;K-Xib!{n+X+jnIm8ZY0_-cf`&r*BhGShj9s;IUs)gu z-%!>7En)*e?qAQ(5BxTTHr<_<^F_{{|8w#HgL4E7GRgxU?$i2OmNs3#-caBOA0ohI zQ*bg$zRK4P7UL^)_+0}Ri4zY$NVGC6Q0xHmwXU86PXcLH6&okr1SEUpH8q;3R6(|2 z58qc(jfN^~Z833lG&}TiJG-osMs3Ts2C9#}IRj0keuy>l$AW~#3_Nw314&%yVbsZY+N$9Xh;fQz z+agg;#VVmaXuKU;KjhkuRgAu}miZLgbV4fM4Ikfi7^m#x)5=3LcX>Kc;a3SG_Qz|C zV5K#kH;eNm>2&~Al+*rcriRRUH8{0mE0joLz7>@EaHjt`sM7VgVLidR* z4@6>R7mk8h>3rICM;|{f=`=k(XbRS_cycH|uE?CMDH3jYU0Z;Nw%S&x%QR89HCY%D z@p|>*2ktia=|%eAr@8nUEHbij*@LelsQ6H`Ajj`qzldD#}Q*-lJzvs76xetX_-w}Gu_H6qx%Y33>oU4=m;3t^A zT2!`9?(-LInULlmsFmEEp;K&X(ZZu zn;qq+xBfS57z67wlkv~5ucKj{8&0VAGj`x*3s*X!*kmSzyB89GmEO*yn@e{GKadS!b2O8q_5xrx^29DNTrPx z0UO{7CVDfA{neT3lisPlPv?ZcTOn3G>bHFuIg(!>i z%1JBfFWM8Eaa2LFil7jdK@A%%BZ7}{WIRGwG`=^31oIt5Ly4~WXUgLXLZl`?8bV>k z&w-oN#*{tcqcTTxlR(T_xeb+gMzL~+?)1-JmO0fQRGCwSqa?zIlH~Ao@2zIuW*sl! z-?y6O;J-*%)?=!-%AM3-KU^69cZb!F!LdSL82d`N;heBw3oU3{#{^2R`Os|tyShqM zF9deXmvA~LzoQ}e;I+E+3^~;R)y?g5@6$JJ1K$%>pt|GW1$$YQ8br+PMw_BVMu zwM5=I;w$$q2U-eV)YM7nlNTG8&2T~ma)2X=ZZla9zr{Ps9JP)FRE!kj>k2tnxY~Fg zTt)YfJ$YEzkS)r~_F+OD%4t}M+gw+Ufwx0f%W|G6@-BqaPVW&Ow5Oya{5`|?TeAwO zWNwcfYU@D~_enL2TylzTI~Ss51IzY;uL_A~JfU0wSqiUvoP|LOaaCrafmEJO^V-i! zm(DUk1Is&4U**Q`6y`=K4m~SGp`M%^f3kYI{3d4-i83<8hGbzpd*vO}8yw6flZhV= z%We)BJ$a=QA*NmE3H_l0l6W>j1ECSmh2{mY`$q}fJ5cNAej2HB{T_R)UnkCPO*Q7` z3iSq3Iq>ZO>tgXo^0{FI<0sy(cF#oUUnV0%VDFYnd@wN;?a&)C-&dO+s-6#+^z|uS6TNM0kWGM} zadUhAeoT^mZD%(uAuuDWlaHuU4ol|616kJYY4&7OetIh{1moGI(2j8?6JcT70~UIZ z1Npi2qTGBj&T*ptRGOLVufy`IowoMxkKLf&a4+a&sy>c}nOCnEaF3MfW@h{M8q+oA zP28gKInJ#X9e!FSTG3Y4hu+1YjK46iI23o8?Nt_mbs&1ncb7A1Q@!kviQyezF4QR& z**vuw*K%?m8M=G(s1eo-4+;t?BoT8S`om}v3=;HD3Y7YotD;`{zDWy(nUS0ekr`xe z?Ux?7Sf}%telhidn;@XV*Gx`?~RLtr}u3p#>-ua z5#}5sN2d#|q{{mnGaY&QwG$|`RECMTsldZX(!%=*8a}6xz1nY=oksH{_I5||A74P! zPh`!ti{uV}@N{sic45{KcGO~tp)R{>QOu{+pXv6>t)I&ceY<9`H-1OL!ufREhmVX$ z?31miWSVrsh?K?liL!yTG_Wfx6zl8=wwQY#|1qBNLmR34h)=8l-iI0JPDjyK`6+yx zn5Bc6>$Azl(Q*d^PqW#zFHUiu9S=eaodP~n_XOCYC}cV6mYkDqv$fl$noL7I57Lqh z-@$&Sd)*m?wCLYK+_JZ~F=si;JDyjSN6JHW@#<|6ON?xl;-=?tn-aZ0Go^s?f+5ND zh^6bAK*lXw4NHo8uDVYVi{2h#sy2MN<(5^A7yEtuIPs<4>!PMMKH4y7*z>8dFOQ=s zPj)ut$B*q?&FK=tN@0UTu2E8?WSmuxjC_Z40^HnfI4fa(t{JvJUXj9a%Y?$~&|M}U2h+U0(jtxB4jPXrID$vuoVBh1d$xLhg zRCw_)5AVc+Ej6RZn;IkbJeiV)tQI6p z1_U_gjRS-CYDnnw&|i`n!oUuf51-WGh0BIP2rXVcA z2RnJ=_qy0bBHbgYF_Ask<*-KmNY!t$mgS~&W>IR8NH2cuw+$`n4is`66pFbq3y$(v!OM?=?1R)?^2OWa?-=YuA7Qt zJJX*VUWs7;DgF~4F(m4AE+dGgUl-<4jhOO7GwuF9s0%|XXB$3#$HWS8T$?q@Ne-K;kT)xb@U6byLL9 zQ!r+*W8P1H9`|HzXQ&Ht%om4rlLiBjTTEdv=LQdodruUbTHRQJiTsg+xbpbXQYFh# zKq_Ggd`Cpem5E|S`?uasHsd_qd75X^2E`Ihs2ZdqNh>N;x3&T^g~$)A8EohwETN*v z$4ecyh2I;9MZoaC!S|c{JauQ=*;DDV{I*k7 z+p^)$G<2_SpFGXa-WMQ19FvyGPtk%@#v^G9{|2WBlV7s;nu<%R#wQigulRSvI=D0V zRZFJc8M^9A67v8o29i`%tz1COH2RC(R>kihKwx8xY81fktDtaqD2|6lz0dc0v4Qr# zxd6JuGW0JiT%2vt{=jl~GaIX`KL?tRGgKWfJCS{lMu0@8!H0eQcq|VEg`spz&=0eY zUV1`MyUv^UZ~VtKrKrC9yGfR&)zv~AJT$IMLfP3c3w&&fKt+_MwuD!At7o&zV=`^2 z{9DL(+1cghsP^-=8|RV`2BN=9V!0AgtY+{PoYdbIG&-YqGkwY5(=F9~{4D9#HCAfD zP=@seBdS^%Q#!k4eu%V!Rp|{eTH5XfZ6u`>ESs9Ggoy>dwW z%`+V138_5%w+2XfeQ9fqy-Liu<&Zz)@ISrXEEOM!GMf%EcRBBi+a#(Th*) zkGof==M+SFJG7brI-}z>R@y${eHjeI2q(Uq5A(hISBDrWRViCCCFw|#uI_^UtXl+&W|)spM_3!BQ?7q$foOmVOxYky z6@&4Fs=TR7o5Y$^)lia{63pF7PHw>?CpQSe+Ay%fwS-dMomQ)!68zG4rHH#7WS-#h5*xh_aw>94osi!B2vqICv?jNX6ykk4;u5#leCSKl(n@H zKUhzT>l{KM5;447!+w>T*hCr8tTylgwoKoV>}AOdP1~!@>0A^!*%wqNc+6n(r%|&+ z%+m77UshDB^{y#LzJ8|l#&Mh!CaLi~bj4>81?<>AmJBTV)zFh8WU~oAoA}FWPf3pY zpg4u4O?{b4yKKxq#FOoIZhUW0BKnl{B}fMcHOqga4;{ohtv~D4v8=atXqt}{p#BmQ z({EQNX(0zspk<$_6E<3LF6F%_`Wv&3zr2+Cw*u!(^WbCOaOAX`;Q0^tGFHv|^Lj+Y z$wg{1RBC^IhRX;IWx2fZ0%gf$Zg{}>q?j*~Q=lFK zwk^5a2+33TAcFA=3!#d6-+W`#tn;i<@o~5o0ADRze!$XOxr>l^~Ntyj-mdlP)iwr5JD1CmHlOXg+R!3$w;qYt+V1vc@oUHfSEpHa(7+e`e)KeBN-A9 zw`AkQDBu(1w;j~p%W%mwhOX6J>_>>6P|CUEDQ@9C3Wf+~k5o3Wzlc+-1Tj@@LSK2; z?1r{&eedoQT5bD+Sph0)SW!cSk2V(iz{q_m>pTNkrZXD)T3$OzGHnEqLEyZB2mN#S z)mbFO`hG4rBf^5cNGk#Pwhi5UCVY{x2% z0Z2+?-uX}I0_~2wqV-Z(C444=i|K{zFFFO`eAYqhuSuOKCJmKeW($PJJ5IC)1K9oT zb3;azG%?3e@jE1dDDrBTII{fu)bmZ_I4?sxKa&wZFDAp`!=n&3Hu)laT~m0N1N$WwJ>z}t6cNrS9U;HY23&`hgG-b$H!>00AMZiN`1VPJC&Q! zYoZMb8q!J%w|9Aq% z^Yb;x^-!3ksza&QqevtqZSm{vXNH#tJI>-S87(723Z5T*jOiSFQG``66x(k#&#mW< zfu?81LBJSZGc#P=TKS&3a2r<_xco&#WV|?ta)g-v?3B+<(}WsehSzHRPOEVE4pD%vPEeu0GBI}rp)Wq5@-(Wb}tfLJmTM8mSGt9R%ieY@6Sjyg6&J@ zB4tD2FS=ogKQBS0+#?%O_t)`y1vQZK{`L}|BYv$=tmn^lA{(ghCxSZp@4TX3&N_#_74i+KPPLz1En} zI$P_p(t+Zj8awg_kqB5+9&a-Q;@V?3Jo_WJU^UK#hWNSaJMCp-wC#g%iP1J1^_?Q9}yDV>Mqa^{Z=<&qmnv?AW`>g@gE1g47w+aK_LF5^F9oq77m;OE!?gL2$5XO+K< zjJxH!pZ;wWtP)-jvS3$Qr7No6hs0kctjR5XO^Rc4fJlFUBoW0br57>=Equgps6dj;#y|9}rrTn68-O$HS7pHnFhq|JlmkAqX zB_#xuOQ){PkWX)s!Tpt9X|o0;456YjqEAwKxJFP~$gSdt8$cxaWxOpkdFJIAT{(^I zXOWt6@iDPd|8O7GUtKxaq{=o`q8kN=w9~n=0!%%qqgv~gq=jDfV@?U{pBc+=hhboX z^~}kui#$RS0(`9a-2N|6<=EOYVrX8veZ9W*X7@MoK+F^n%*tQR(+5dC{o=1BwaM9b zD_XX?nzsN8Xv*!Wjz-xD#@YHS;R=3FnlNx^1O|IzeA!9D@3Bh?9I)sSk~JT~Zh<}d z;lf30%J=WIt*5y!ju-=u8E>~_L{|{0FA;LD!?q!n86oan$7*^AyiTPkv`73s$vh0x zPmpL4vj)Z% z#8*R;Eah{FckBpp({^0!D-`|vNex>{Qv5B@?}FwoPJXN8kDR+o$uu!BF-ImRdGP!Y z;2n2z#% zI6uGel%TIJkTv zZ)bZ{%v5hFHOUMmy#@X{`x12}Tu=1v=%l zMd5vXod1CmN0Bhdny6}Vu`T~D$~WrtC3zUGet824<2@Qdi2bZpYfMZbIaDK*D8kbt z?Q1L)FCku&DUQll@Fgync!_h@j`;v zu2d2StAHFjfzE=9GhyGY+=l-|L~&qpZCg7Oz+iE%GEjyA0*oiLRJNKE3kRkY2WPhwFmXR!SCuG2oxe!dylmmD zA$w`8Ne(eZUTNiSnf~&S5Z@HF6mp`O=nTQy&;(>julXBqJG*iD^oXGdwQ{RvxRoXV z7@JSW6cBC)+io!!RlXoC!F|5v=Gc#ZvmMtjviP z$5@h>d^RkBv4~A|s)Wn?+Q?tVnlZ+eYoUGn{(V3=MEx_B`A4%sGMy@vpBWrCKKI_T z48z5EnKY#a_XjO6CVz>59DE7Uz$aTYP_4ly#j>MNv)m@(s!3adQ^ZI=m=3~;l`Qm! z`xTly=p%9rz^O+jnhRcrQ$3Zepx1ydyonG3AYvH9?W&!(MreU+CiV45_~p!0t8`Nx z1=Z3zAsi1ae1xYfH#8EuvnToZUBk}aYg2DJ{M!0u{9H+nyO^E+@A)l;d#XLtwGJzr z&w5GegXYPAd^_5pu8iUN<%zk<@n;zNHvl!|6UFIz0Y}07nt6Du65z<6;4MOir~5m| z@S}aYVN*ss^OMg>aZLTY1Zy*OT6SWu&uG*p|Hxfm#`Y)kg$r-R)2OhgAla(d1kNNk z?bI?rHpSp6E=EaHlOSnn&E(v9h#SW{3h-i0^m2bIEB{0SV!E&H~u%c&3u7re3t4c*A>4mDK8 zu2n3lo^$7|=RXqdB=Z(1=OPH1o)@5SOY)II(`7@n-S@TX7G3OGjgR^Qmf`y0*MxGd zRtUH|c)nsb!u0wuzv*(*4=CUD$qPmaEELk8vR7QP_1>46ckYz4xfK(-Kl}1v1BI+`Y?Xn=H8t}O~p)wImOYaI4~0jO4T-}(q&IRf`kU4iL~$fKD>8@ zkR{JNi&oGnB%1I)uqUtlvy`AzWXR|ed!-B8wEiMZ#A|2>ct-F%zjB(VafL#-ixuQg zVZ$w_<^-&YzY=KrnFMBb9zLm|?Y9{hK@`Mv3N;0>BqXdjuZ~u`uiKO&N$;y!oGX|T zqH87kawk6|Rmo+K{R)l9Km{c+FbbyH8KBg@i?*0Cp990M#Rs5JTK4jTGN=YN+(oAZ zV23+s2jjFee?38_)@V(ZgK|i1rStL_N#WtyJcb`46~qohPC&&=Q1cD9eBQy}r|}Be zbT`(QQhN*SonFm?xT=h~7lq@i#S^oYPc_?G3-9xr0`Q;$dGH05o7d4CP6lrM zjN&Q#GdMq`003t59p9&`EVPVm)ZU>ZyH38!Ed7b0`f|*G%ih&)_RYKO557tr-l>`+ zP~MxvvUlDrtnxJkP-J)+$>RAjDza&ZtTkhXur2|pL(zkiFm61XLnpg`OIjWm=i{Wue=d}6&&>N-b!(jyL12aqh4$`L z6EQA1IWo&CcZ)U71_^ngu2rM(XG$@KNV_n9^j&ns5XmI`m0PMS^|aod+gh{GSeNu= zDe5RiNIey5!~rR#NPdmxbHQQWPuM!!YcKEa_PgsA+-b=KWQ^TJdtk_uSZ8+xP$^kZ zpnxd+aoa(@-SaU_;Vg=9W*_0`_uG4M_Bh>n4rfACd*iD^`iHpC$HEsG4KK>|pvu^; z!Vl875-79!CvFX>F6cr^BOD^wMcNXcby`A_7Nh@;>uSWjIU@jy$r$p{(?ejY0+33l zmiW1KS&2ygnOK=%u+w9u;uHTC0FAx%yJFTGJo&gh38 z{^y+hY}94giPfy?q*(`_B3RWx(MK}5Y6)GA0kC=JJjf-p>#IYGLv+@3WdsE$yfmd; z>3$kdGsDYm_j#3ip$_Q>#;hpY+yL;@CwP!Zgy;)6GGxSlN=2X}E6E$)_I>tWH@D7S zFTPS^V%S0!2q~fMLRa!#0Px9#u@p{e;SZSi23ZM202{E$G(k%Yny-EPi(;T2swZy^ zR)jJVZBMHx-S|D#N%Oe}LG$VP4*arT;Ln`Y9k8O$s+_ZDF|#NE@%df%{kh}MroRzq z55eAFJbS1Z%7mZ=N|P+2m#IZ)d zB>utjdx$?qx8N{LBqm17SZJ0Z_3lMw&P(d?`-9NIJdNV_0fmEjP*$^_C6A)JYm;Y!{bbi^H;K_`WOL&z`;$6+*E1jH>~1<4$$G>D73m`IrGmfj#E-U zcqeOS3O(95NFuOF4RJ`PVaNYaX;Yw3AuA}LxG?|vjE66a@Of<;vWMFv+Oj?F#|mKc z6Mqhzp77Jellnoost;I7xcJK%PZKwBz#?8G`c*Uq+brrp1-WRNeXGbNLW+hnO7?l94^PW!^n2pYDI#A)4%7zAbxo;Z-+8NgwDS=zq<+G&nFn-W*=4Ub=6BO-`a3! zpW{$*v(R1nxwkQYAc)HIS(p%>zEwx?+oiH&wn7LLj<9B2!`s3o$3;1F3+P{2+`MHdo zR|9n&FlC8wCxb|nd_J{YJ!F_|Cf(1nh=xLYC7h#jyEuu^>ke!@_&0X$w%+OVsbJ-MX^q@Y zkM}A%!CPhTLR@`V$|6-25Q1Rx9GSX!_cyf;MSH*3)N_)aY&zQ<&D)Jtm=Q90+?l!? zFW5$0xO+|S`aYlF89K7Z61rpZtvX;}-D5V*WSH{hBXAWVzOe%oCSg#2co<)m;+Oz4*9&_wC%PYCK^{jSc6!l&}X}0 z(&a5n`FHL#=;;c7M^Ba_^fKdK2v9y!L5#smH4t`$M2(KlXyhn{eN4}L;T};=vzBVj z9B?$nRjjK%`fGhL3{YL7g|I}x69{lw z=GVg5=H?ssP&|H@tVW0`dqVan5sEPia|{WBY|-<*qKRNkY^|?2RsmcB+eV5dHeI%= zV>TyWOK$VWE3Esi40{c$2)Q|vO`J{Y8~wkV?AUSVs7h*)!eb$9t(m~T45h2dcJViF z#beHj=S`2Mdn+QF`ub?oLy2R`>5o}ckALrIKK!8?^h+x|D}8YH+80Pjt~Eu(#8M)h z&hHD5^YA0M_h_N-c9Te+<2@twql2YuHI!yenw+fvq&ST z#do;>#?Lb{O>VQu`b+AQM6=xS?<~}+e<>QG)n1CP#u#@5SQnZDQUwG2R0F%R(Wu|c zeABcqS@efcw=(CjEND#*SI9HW=$;@SmtXZo%4VB_#>+r?Z7s{&4}lL4TYo(?sr?Y@ z2?tfno2-c6Fm2&NiQr}Hh>Wl0XzTY0J}-LEVdZQ&>WNbQpT@rKA+^Ss&vR6?c-J4_ zUdbz=qr3qbYY^r`RP^89x1ya*hGHSEb6+kQm#mNpArPz|Pk?FLPZgcz+J~G4YDEO_ zY>`{K?O3}^om3v0D(4-9PEPZJZR5Z0GRuP8nHHi3xr1<=8!}t?{p>yZDn8HPfyDLM zzx8s3fr4_ciMQATSd@EIg*^V5){_ zE{~$`#c`m!&<*N?3iERFaGUUS*@@D6er$mCvkuUz@KTojJ91P;7F&%edkG@qN=YUI zV{U-Oh&Cr&E220y4I@3Po7XaQ;rEK8aG-;&B2$NjDj>1ABKaQpD&Z_z<Ui zm=s1x9uj3t{ks1AwvL>8-o)&GUhSdTgf6E@BZl|d`9}#_Mc|XW_1TIOW2c`cohU`P zwR@Iv$m69nNnWW2*Lt$Kh3cbsdU|;zii)0aEfy#IlpvY*E1+kw5)>%qoY0B$^iR$C z7}*Lsm_q`n%)$js_Yn{%tK=lbG?EmU0ZUKDJt;rGFUQflh>?x0-23D-IMO7J0aB?5 z7fC@kPD(Es@vTN^-o$iAsO5+}`9Nx36T0jAhht!tL?gD~O}og1i~>fYe8;NGwgP5c zKT=GW%h0svi+TG^Wdb0!m&J1Lzy~#o<(j`|%436;QPud%6zq740|^CKU9pXP3X4Au^1`ok4$+HZtk0;xDStj8_<={Z9STZEWvME zKB?bsO+Fh>$G4g7t-y3wl!s4xR*Hb5v%R`>Ge@8R{2F69`t^VzRa6)BVLK8Kx>9M9 zA%{btU6G0 z_apZ;ZDOGGQrSz-NF2(P-(IBKR5V1u(BZrvNn)H?-VVv!1dRs&XZ{5eNaGdloT1w$ zTF;KXr|X;`Ua7~6ha}~(u?ZG{Uk8|=>@}28Qqwg>yq2u^93A0N!%~uYz~BblKlZ&? zV6tVSYE8|uPLqEZ`m4N`ulnDfm2OW2dp$@qfZ}TV-9-ZXU63#uS-zn|(LUdFOOZj? z=;#KfJmG&wk(DKCBz`U3d46wv&ZqC7d?t_MW@zYCvP7Ps{SF2-DPjm7*F@KaQx3+% zE1TiI?hx09_mrrDf`xrQ9=n0U4RAsR>4Jna?$V#CNo>t^PIk8Mq1!xS5l(?LCPA_O zH{UckT_xpnBL%V5Pw2*g0!Vh4`PC6gM>(tOU5!>6^l#C~-6KpST4kYD80?9tX?uK5V0VbwOc-@$-T zbr4)3qAC`u+ZD-W52RN!aTS;M)O`ng%b$moEbXF4R+fZMI6n;>^8 zy}|jQ%w^zg(OvB9=C0&l3~q@{?@_8usQ3p!q8~T#JL)lT?m%w-Yk08oJ)BB!s|z1b zmy80{$7hIHLM7HFRbS3`hUh`0rijJ_eLTDS`r-TezK;D$8Se!Uaem<~O!(bVbj5_v zC$;m92uOjwvxwrnt3i7h6cm)pHAYc6=A^8)wy%r#dy5-zUBk9UYk350B8c(67ArWI zKNH90?b4ma3HcADY)&!Ru>q)pf!U5M7*Uyv@*>9@CS;!mobcGxrsk|;^S+JE2RcY) z=W|eO293G-7a#5~u6DHB20(*I#CGc24(daohsuP@JS^W(sslOkPm(wbl=vKP;heZ; zHG+6i-90npY3Td8cm6Y)PN%5+tDb?{$9Sy#B%n-^OIYlE4B81*f-dwT_eZfRb0o2S zSJQnWy}ttPT>;e6gDfnF2VJM_vOHbJO^!)|7nl&bNweGhggUZL-cEGF6|l&g>y>Jy zASgotfb#D0&~$8@8^{Jr8UlbS20{1^^jdNO$EiUXPrmBfmGX2#U4YK8+OYQiXYa z)8t&|7nb3?6JW5Fx7B)W;JFjI175Wq`sCNI+7AfQn7=qrnL{ zNq&g2x&i=}3ILZ#)2!U#I1_v8uG$anC} zHZ%LPkI;0c67b6K-gW$BIbyhhU% z8z(!0Hv|A90h0lrVGFit>c%a6d8k&?4AiWEgbrpPyk{-Y-~dU?VrqTa8>W%P#a~Se zXY30=AH=pa8X3X*tON2cFb2E58?y&uA-JHeRCkPm6@8B0Q+B zD*A6gK%cQ|08L;ocdbPSA8vm=lv@rGpYP8P_9rlI9~>BObrIm{iU0Ex)~6I3Zs$nLXe&II>Kd-a*l@1GMlQiw4I#b8uMF__xjFvJ}6bQ|LMl!uz4rWNQby81sySJ@CW7 zb6zeBslC^uP|8ozZ&@1kiqjF@EPNV=d zRS#?$9WUM=VSuh`eLPbJ>aGFYWb5!g*oVtq7;YB-h5{;v~P@x9s%~F9uaua;D z=U-;jLPo>g{*;`26)0<;_%DFwzZkEboDQlV*a{lq0Qfa-GR41P{@<7UuR+=ehPJ>~ znElk0RgQ%h;p)@kB^GE4&sE|eBq(TA?eyYoK%wVY2s|gePy5!1$YlpkCFuXg>oCKO z*9{*o*a`&_1aH7L9BFE5?O+%oL^*ha`&P*|fH)n!2xPT6GY^SuWHq7E*QTr|87q3ee&4BRx z_Ij%AOZ|iI;tdtx_>8^;4ig~KRj^LE&xeXcVBq7AX2~ zBKmcDAG|lXpxFR4tAn?42jl|`Ke%zX|A8;{!*$t1BX0P={&$tY3~1;L9ezh8tHD&} zCAx_&G1%dFX0frckGE9<((=FfL`gzA!bNXQ;k=#-tKqaz{(t>(p~(4!#ZQ@220zBe zPWhePQ%(H&(+|2Y!L4+Ygqd>r~>KC%nG=_5Pd-?r;uoDGl6< z;d)WKg<{H`0A@HT@DN4@0UUE~X|>F|L8N6YtFDuH()+Ae^qpFg?0NO;N{skcftdk45a43y*V>y7 zr|}p7VeUU+IiR4p&+hQp?Uvo|lz}^JUZp(v;j36S%i2)+Lm2ogJ93k`YnK`AEdc9a z_gHEXziGf&aesI?-xp=rxsFA=Jdwz7p<$wNe*GMiARzGj$_s8fDXej#D6@1M^@-dM zY7*%JbwdSp2}IHo8_lji~N^xzN~=2K3|+uPeUFvpXCy~AJ>5leS}zZ^H&r^LiW(p^hO zcjYg_&!e&;+S=MeLP8?4nBIZ>FTpoeHyDK3DEZuY%faM+(AAudj!sg8ImyD(Qn!&O zy6OF0Blr~&5s_oi1Trd%3H~Os{X;`T$FgN`y!UFREI?mXcrbHuae;pOMpIB)TKjr4 znFp-YqvPXv;K~d;-Rg3n(z-4>r3Iz~nXHMRJV zurT;9fF0mY#Oil_XQy~YU0q74VUs+l@s5(Y+EHTDXyw$_YDvdXJm=uxSXo^)e}@1X z9pE}SIgQ%ZTM63Fo89yrla$t%+ksVe(S&=qUy|!4OkfPjc&W4)HF8>S5#Fc=vG;6 z+YOc2@bK{96B5$B@;#rJ`mDQ}m7Ps5ENsx(*-1x3({A#qp@s?-mjyn;+rLZF!F!Vh zG4>-$9B|i;1}_LS6D6N0Dk|y$k=xA7Z0Jv^Ci;^nao~Wm{er7%!^Pb_=?Cy_0PMn^Z8AxK$wg7(H(!T;<*8N`feO(-) zRn&95K3HMagYMey1)`xvRCqXWhLf0cIa@ld91_#KK$sc|fZ(X2ySXAQ#8 z%1{*Al{8vL%CVg&atte{Sfh4xoF-ABqREb9X_*vihn!ET#vzB~6ca}H?$>_b_y70% z=1=o_JkN6DY!O+lQwMU)F1M8Vowy=s$vuccWVKyOEnT#40POL=R#pv? z4jCR^#<#Kwggu&?oolP7Y5B0grr@c5&WEVA6jsfu9Lx%N`RCcc5gm4YM@NT}fq~52 z=$nRUjPP$=SuSq_`y{ax2B^H&aX6US+1Zq-`{wMhm8`Cu{8sO4X=(g^0ozI6lUrNj z(SRUe=bop*+5oci6Wq_e5|Wa+?c+NX6pC5873m(H+i35ree@Cp5CtVwE@1=vf=olh z!Um__J#85ebhz(0LTh?(_ujqS%1Y-o>=L)B6bk8`E)}$m2wW>cU465dj0RH6m19Hs zAtfcn1AJ8NhE4h-K3;^FhE%+vAB)LUK$Hv(We*=d+{5;=|3lRG>{%6r2dTgy)P+Bx zo!xcDX*z0c880Cr;o#r^Le}L}n1gN)_yNIMBeIRI?aLaXrLVX4dAjXU{s9`NB*=%El8XPW%y``Og7h*vRvq5)Ve1 zp_-cLWx+fLvVx9p#~w&%232mwPQuZzL>-QUUU@~u`OrG2+r+HSZ~!p=hd0?oF{q>J z2VW*%XE4P6eF6dH%o$}7aa`i?@R=)R^lTRweLoxPrXpg8Z_u6n9ju?)Zv~l>o)zft zRafV{JzulU%ggKYhZ=lR9zvz1%q}b>)YOIi8c9-usLK1~rC!o(D$?DXwgq&fIk4C=QPW!)v7>qjvqk&gbwePG6DzCrdQO@v$s3YsikJNYbX%?w-+qEr~o zW<0O7D&m_`pZ1x#H|F1|sU>8sSi8C^LK2UE@xoF{T6%l}uC?&dBdf?rvzs?>X1d4+ zfI}%NDrSS7rKAuf-;U{9>U8SVRyQ{{WmQ#zmXxVPSBs$k_3PIzo z@0)X8X3?`x`fZilw+SY!h?P<_aS952K1dS_Au%yA8l8P&b#LFw(`dBD=4J!R@=&U| z@h|bP<4l<14_QARGS58ZWhxU+*&g+MR#q;A|LyW}8Niyv6!)@ zbfgO{3fp(v*iVBd(vKBaSL4jT%?Jw#3l9trZ-~xX=|&&%X;bd64wVE`&CJc|SEW{! z;q?7>NK40MXUnZHTz`F%p?>%7UFwTO?9A7%<M)!Ss zK^QK$!aMnD{oj?UTFBXGD--dlF%`M;J#K7RbTM@y?dUDHJ;=#%40)RCdVLEi9iY+fD# zbrFb*21pFIJAF&s>qO>1_e%Em_A;kFD%fUdk$?PABL7I%=`WmjMJL%vbQMWOPfr3c zBR4k}Le1jv;mvJrZ78PPxFNNo{~R(jfU1L&Q#|N{OaSt3(+Cll@U`&pvXI5Tdj0zM zV|T2s!mn@NzWr)SN?KCV7X4uFlOH0Ni>rZ%4vvhd?oG1+>SReKzsiYP^|@fK{}3qo zcLoLqd3%ytGgvHEYvhQN^)ac-H2YC64-b#hjI7T4Ko??TH_Xn@OPQFM>@tf8DKM7* z#$H@p+=;Wc$Ga^pEeS5e1*TnBU3@Wck zAg~7zi}g;5XC3B0-wAI*%NA_bHqjmH&*;gEE3H3s#sGH!iYbDPt!;__fJI1n_`zbQ zy6$dSU{~oh5azw5?_z5Rof)RRyZdgd6uFJ^^70y#(oOH*zpo4!68V$O)_f<2#ge?% z*ZB-;>xo)FKT$FGBhd{{lykAsg34O9wmYccb@#EtY!PD>K3JTP$ zQWaDB`ue=y+X2+jarJIXPr+-vBjB3s7m#cUF)<5h^EU<6}0v4#*!m4ho*zZEA`GJ^43tTIg%C z>I6bM4c-)V#Thfjf$J0&79JpzH;QcC84aMaZ&?7G_@Ir=79k-a|M51J%Ony>Vfxv^ zdS-_BC8c&;h}}f_>wl@4*9nK$o$xu}OZ!a(akCfP3f^T9e6~t}dCHwbk&a zd>c#4t_1Wh%6ee36VmZamt<&ILGI>%`67e>|JvE%7B;Q|ZpDL*Pqr(=p;guoO~}yt z8P(R&1>%av8dx_3Mi#MIcpPpkvS;sJy+Q!&A)sge7ccsCN5bx&_#?Z)YVG5Ji_o2) zfj$JaJ^$#Tqesa;KI%Zc8JFeV-QE3zgRLnPIYslxB340uejeoJp@!5b#bTJeoyJ2Q zvFYneSvMZgvFCIJ6CRHjU0Ztq3iB=M>gte{{MocS5Z^tI-Gx_|M)6PpoQA7Abm-85 zbLTWH4j$BnCiQ59Hn`~Ti|Wo`K8?{gISq-}?;d-%5&*3}O@MmQ&ixmZlaiAI_@9m& z?cYzF_}bRqj+$+Fco;?3_5%9`sGA0OyqW4LA-EIFf1N*Kv&=t%ky3n5UWt%L|Dm8g zx2UM-6$!FY0+Y$iGKP5Zdw~X0-%B_|5|BZIDm5Ze8c@vOCu``nrYtI=W|W2WW)!s= z@kh8|VS0Otl}A1ub}bhGw}^h&1B@0ZRNzPFjH1_jpVxcQ8~*3J|2bm+kA)a(!rmj@ Uw&zt%Y!UbzCfiv)vY^KN3!*p$(*OVf diff --git a/doc/modules/earth.rst b/doc/modules/earth.rst index 2c38c4df2c010..1497cefd77255 100644 --- a/doc/modules/earth.rst +++ b/doc/modules/earth.rst @@ -49,39 +49,14 @@ generalize well. A Simple EarthRegressor Example ---------------------- +.. literalinclude:: ../auto_examples/earth/plot_v_function.py + :lines: 13- -:: - - import numpy - from sklearn.earth import EarthRegressor - from matplotlib import pyplot - - #Create some fake data - numpy.random.seed(0) - m = 1000 - n = 10 - X = 80*numpy.random.uniform(size=(m,n)) - 40 - y = numpy.abs(X[:,6] - 4.0) + 1*numpy.random.normal(size=m) - - #Fit an EarthRegressor model - model = EarthRegressor() - model.fit(X,y) - - #Print the model - print model.trace() - print model.summary() - - #Plot the model - y_hat = model.predict(X) - pyplot.figure() - pyplot.plot(X[:,6],y,'r.') - pyplot.plot(X[:,6],y_hat,'b.') - pyplot.xlabel('x_6') - pyplot.ylabel('y') - pyplot.title('Simple EarthRegressor Example') - pyplot.show() - -.. image:: ../images/simple_earth_example.png + +.. figure:: ../auto_examples/earth/images/plot_v_function_1.png + :target: ../auto_examples/earth/plot_v_function.html + :align: center + :scale: 75% .. topic:: Bibliography: From 8c079709ebd911e172f1aad85ed04c1229552ed2 Mon Sep 17 00:00:00 2001 From: Jason Rudy Date: Sat, 30 Nov 2013 17:35:51 -0500 Subject: [PATCH 19/19] Incorporated some new features and bug fixes from py-earth 1. Added allow_linear argument 2. Fixed a bug in the way endspan argument was processed 3. Fixed a bug in the way sample_weights were being applied 4. Added simple test case for 3 (test needs to be improved, may be platform dependent) 5. Fixed a typo where min_search_points was accidentally min_searh_points --- sklearn/earth/_basis.c | 87 +- sklearn/earth/_forward.c | 2759 +++++++++-------- sklearn/earth/_forward.pxd | 1 + sklearn/earth/_forward.pyx | 29 +- sklearn/earth/_pruning.c | 51 +- sklearn/earth/_record.c | 85 +- sklearn/earth/_util.c | 818 +++-- sklearn/earth/_util.pxd | 2 + sklearn/earth/_util.pyx | 8 + sklearn/earth/earth.py | 15 +- .../tests/pathological_data/issue_50.csv | 8 + .../tests/pathological_data/issue_50.txt | 11 + .../pathological_data/issue_50_weight.csv | 8 + .../earth/tests/pathological_data/readme.txt | 9 +- sklearn/earth/tests/test_earth.py | 32 +- sklearn/earth/tests/test_forward.py | 5 - 16 files changed, 2196 insertions(+), 1732 deletions(-) create mode 100644 sklearn/earth/tests/pathological_data/issue_50.csv create mode 100644 sklearn/earth/tests/pathological_data/issue_50.txt create mode 100644 sklearn/earth/tests/pathological_data/issue_50_weight.csv diff --git a/sklearn/earth/_basis.c b/sklearn/earth/_basis.c index daf52366492b8..04d8ba4f41787 100644 --- a/sklearn/earth/_basis.c +++ b/sklearn/earth/_basis.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19.1 on Sat Jul 27 22:55:34 2013 */ +/* Generated by Cython 0.19.2 on Sat Nov 30 16:32:13 2013 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS @@ -264,7 +264,7 @@ #ifndef CYTHON_RESTRICT #if defined(__GNUC__) #define CYTHON_RESTRICT __restrict__ - #elif defined(_MSC_VER) + #elif defined(_MSC_VER) && _MSC_VER >= 1400 #define CYTHON_RESTRICT __restrict #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_RESTRICT restrict @@ -1196,6 +1196,14 @@ static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFun #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ +#define __Pyx_XDECREF_SET(r, v) do { \ + PyObject *tmp = (PyObject *) r; \ + r = v; __Pyx_XDECREF(tmp); \ + } while (0) +#define __Pyx_DECREF_SET(r, v) do { \ + PyObject *tmp = (PyObject *) r; \ + r = v; __Pyx_DECREF(tmp); \ + } while (0) #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) @@ -4396,8 +4404,7 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_13BasisFunction_knots(struct __ __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_v_idx); __Pyx_INCREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_XDECREF(((PyObject *)__pyx_v_child)); - __pyx_v_child = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_2); + __Pyx_XDECREF_SET(__pyx_v_child, ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_2)); __pyx_t_2 = 0; /* "sklearn/earth/_basis.pyx":130 @@ -8770,8 +8777,7 @@ static __pyx_t_7sklearn_5earth_6_basis_FLOAT_t __pyx_f_7sklearn_5earth_6_basis_1 __pyx_t_3 = __Pyx_PyNumber_InPlaceDivide(__pyx_v_result, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_v_result); - __pyx_v_result = __pyx_t_3; + __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_3); __pyx_t_3 = 0; /* "sklearn/earth/_basis.pyx":376 @@ -9037,8 +9043,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_14__str__ __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_3), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_v_result); - __pyx_v_result = ((PyObject *)__pyx_t_1); + __Pyx_DECREF_SET(__pyx_v_result, ((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; goto __pyx_L5; } @@ -9064,8 +9069,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_14__str__ __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_4), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_v_result); - __pyx_v_result = ((PyObject *)__pyx_t_1); + __Pyx_DECREF_SET(__pyx_v_result, ((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; } __pyx_L5:; @@ -9093,8 +9097,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_14__str__ __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 387; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_v_result); - __pyx_v_result = ((PyObject *)__pyx_t_1); + __Pyx_DECREF_SET(__pyx_v_result, ((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; } __pyx_L4:; @@ -9177,8 +9180,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_18HingeBasisFunction_14__str__ __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_v_result); - __pyx_v_result = __pyx_t_1; + __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_1); __pyx_t_1 = 0; goto __pyx_L6; } @@ -10890,8 +10892,7 @@ static __pyx_t_7sklearn_5earth_6_basis_FLOAT_t __pyx_f_7sklearn_5earth_6_basis_1 __pyx_t_3 = __Pyx_PyNumber_InPlaceDivide(__pyx_v_result, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_v_result); - __pyx_v_result = __pyx_t_3; + __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_3); __pyx_t_3 = 0; /* "sklearn/earth/_basis.pyx":458 @@ -11148,8 +11149,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_19LinearBasisFunction_12__str_ __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_result, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 464; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_v_result); - __pyx_v_result = __pyx_t_1; + __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_1); __pyx_t_1 = 0; goto __pyx_L3; } @@ -12249,9 +12249,8 @@ static PyObject *__pyx_gb_7sklearn_5earth_6_basis_5Basis_14generator(__pyx_Gener __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif __Pyx_XGOTREF(__pyx_cur_scope->__pyx_v_bf); - __Pyx_XDECREF(__pyx_cur_scope->__pyx_v_bf); + __Pyx_XDECREF_SET(__pyx_cur_scope->__pyx_v_bf, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); - __pyx_cur_scope->__pyx_v_bf = __pyx_t_3; __pyx_t_3 = 0; /* "sklearn/earth/_basis.pyx":515 @@ -12400,8 +12399,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_15__str__(struct __pyx_ __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_result, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_DECREF(__pyx_v_result); - __pyx_v_result = __pyx_t_5; + __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_5); __pyx_t_5 = 0; /* "sklearn/earth/_basis.pyx":524 @@ -12413,8 +12411,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_6_basis_5Basis_15__str__(struct __pyx_ */ __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_8)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_v_result); - __pyx_v_result = __pyx_t_5; + __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_5); __pyx_t_5 = 0; } @@ -13964,8 +13961,7 @@ static PyObject *__pyx_f_7sklearn_5earth_6_basis_5Basis_transform(struct __pyx_o if (!(likely(((PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i)) == Py_None) || likely(__Pyx_TypeTest(PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i), __pyx_ptype_7sklearn_5earth_6_basis_BasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_3 = PyList_GET_ITEM(__pyx_v_self->order, __pyx_v_i); __Pyx_INCREF(__pyx_t_3); - __Pyx_XDECREF(((PyObject *)__pyx_v_bf)); - __pyx_v_bf = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_3); + __Pyx_XDECREF_SET(__pyx_v_bf, ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_3)); __pyx_t_3 = 0; /* "sklearn/earth/_basis.pyx":577 @@ -15679,8 +15675,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx #else __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif - __Pyx_XDECREF(__pyx_v_childname); - __pyx_v_childname = __pyx_t_3; + __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3); __pyx_t_3 = 0; /* "numpy.pxd":795 @@ -15693,8 +15688,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); - __pyx_v_fields = ((PyObject*)__pyx_t_3); + __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3)); __pyx_t_3 = 0; /* "numpy.pxd":796 @@ -15751,11 +15745,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_L6_unpacking_done:; } if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_XDECREF(((PyObject *)__pyx_v_child)); - __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); + __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_v_new_offset); - __pyx_v_new_offset = __pyx_t_4; + __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4); __pyx_t_4 = 0; /* "numpy.pxd":798 @@ -15923,8 +15915,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_v_t); - __pyx_v_t = __pyx_t_3; + __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_3); __pyx_t_3 = 0; /* "numpy.pxd":822 @@ -16624,6 +16615,9 @@ static PyTypeObject __pyx_type_7sklearn_5earth_6_basis_Basis = { #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif + #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) + 0, /*tp_finalize*/ + #endif }; static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction __pyx_vtable_7sklearn_5earth_6_basis_BasisFunction; @@ -16762,6 +16756,9 @@ static PyTypeObject __pyx_type_7sklearn_5earth_6_basis_BasisFunction = { #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif + #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) + 0, /*tp_finalize*/ + #endif }; static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction __pyx_vtable_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFunction; @@ -16832,6 +16829,9 @@ static PyTypeObject __pyx_type_7sklearn_5earth_6_basis_PicklePlaceHolderBasisFun #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif + #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) + 0, /*tp_finalize*/ + #endif }; static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_ConstantBasisFunction __pyx_vtable_7sklearn_5earth_6_basis_ConstantBasisFunction; @@ -16911,6 +16911,9 @@ static PyTypeObject __pyx_type_7sklearn_5earth_6_basis_ConstantBasisFunction = { #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif + #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) + 0, /*tp_finalize*/ + #endif }; static struct __pyx_obj_7sklearn_5earth_6_basis___pyx_scope_struct__piter *__pyx_freelist_7sklearn_5earth_6_basis___pyx_scope_struct__piter[8]; @@ -17036,6 +17039,9 @@ static PyTypeObject __pyx_type_7sklearn_5earth_6_basis___pyx_scope_struct__piter #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif + #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) + 0, /*tp_finalize*/ + #endif }; static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_HingeBasisFunction __pyx_vtable_7sklearn_5earth_6_basis_HingeBasisFunction; @@ -17146,6 +17152,9 @@ static PyTypeObject __pyx_type_7sklearn_5earth_6_basis_HingeBasisFunction = { #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif + #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) + 0, /*tp_finalize*/ + #endif }; static struct __pyx_vtabstruct_7sklearn_5earth_6_basis_LinearBasisFunction __pyx_vtable_7sklearn_5earth_6_basis_LinearBasisFunction; @@ -17252,6 +17261,9 @@ static PyTypeObject __pyx_type_7sklearn_5earth_6_basis_LinearBasisFunction = { #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif + #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) + 0, /*tp_finalize*/ + #endif }; static PyMethodDef __pyx_methods[] = { @@ -20484,6 +20496,9 @@ static PyTypeObject __pyx_GeneratorType_type = { #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif +#if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) + 0, /*tp_finalize*/ +#endif }; static __pyx_GeneratorObject *__Pyx_Generator_New(__pyx_generator_body_t body, PyObject *closure) { diff --git a/sklearn/earth/_forward.c b/sklearn/earth/_forward.c index 32e03b5a378aa..50790c1cb1f28 100644 --- a/sklearn/earth/_forward.c +++ b/sklearn/earth/_forward.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19.1 on Sat Jul 27 22:55:34 2013 */ +/* Generated by Cython 0.19.2 on Sat Nov 30 16:32:13 2013 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS @@ -264,7 +264,7 @@ #ifndef CYTHON_RESTRICT #if defined(__GNUC__) #define CYTHON_RESTRICT __restrict__ - #elif defined(_MSC_VER) + #elif defined(_MSC_VER) && _MSC_VER >= 1400 #define CYTHON_RESTRICT __restrict #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_RESTRICT restrict @@ -1112,6 +1112,7 @@ struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser { __pyx_t_7sklearn_5earth_8_forward_FLOAT_t endspan_alpha; __pyx_t_7sklearn_5earth_8_forward_FLOAT_t minspan_alpha; int max_terms; + int allow_linear; int max_degree; __pyx_t_7sklearn_5earth_8_forward_FLOAT_t thresh; __pyx_t_7sklearn_5earth_8_forward_FLOAT_t penalty; @@ -1551,6 +1552,14 @@ static struct __pyx_vtabstruct_7sklearn_5earth_7_record_FirstPruningPassIteratio #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ +#define __Pyx_XDECREF_SET(r, v) do { \ + PyObject *tmp = (PyObject *) r; \ + r = v; __Pyx_XDECREF(tmp); \ + } while (0) +#define __Pyx_DECREF_SET(r, v) do { \ + PyObject *tmp = (PyObject *) r; \ + r = v; __Pyx_DECREF(tmp); \ + } while (0) #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) @@ -1962,6 +1971,7 @@ static PyTypeObject *__pyx_ptype_7sklearn_5earth_7_record_FirstForwardPassIterat /* Module declarations from 'sklearn.earth._util' */ static __pyx_t_7sklearn_5earth_5_util_FLOAT_t (*__pyx_f_7sklearn_5earth_5_util_log2)(__pyx_t_7sklearn_5earth_5_util_FLOAT_t); /*proto*/ +static PyObject *(*__pyx_f_7sklearn_5earth_5_util_apply_weights_slice)(PyArrayObject *, PyArrayObject *, __pyx_t_7sklearn_5earth_5_util_INDEX_t, int __pyx_skip_dispatch); /*proto*/ static PyObject *(*__pyx_f_7sklearn_5earth_5_util_apply_weights_1d)(PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); /*proto*/ static __pyx_t_7sklearn_5earth_5_util_FLOAT_t (*__pyx_f_7sklearn_5earth_5_util_gcv_adjust)(__pyx_t_7sklearn_5earth_5_util_INDEX_t, __pyx_t_7sklearn_5earth_5_util_INDEX_t, __pyx_t_7sklearn_5earth_5_util_FLOAT_t, int __pyx_skip_dispatch); /*proto*/ @@ -1992,21 +2002,21 @@ static PyObject *__pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_14trace(stru static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ static PyObject *__pyx_tp_new_7sklearn_5earth_8_forward_ForwardPasser(PyTypeObject *t, PyObject *a, PyObject *k); /*proto*/ -static char __pyx_k_1[] = "Unknown variable selected in linvars argument."; -static char __pyx_k_3[] = "init_linear_variables"; -static char __pyx_k_6[] = "no_further_candidates"; -static char __pyx_k_7[] = "orthonormal_downdate"; -static char __pyx_k_23[] = "ndarray is not C contiguous"; -static char __pyx_k_25[] = "ndarray is not Fortran contiguous"; -static char __pyx_k_27[] = "Non-native byte order not supported"; -static char __pyx_k_29[] = "unknown dtype code in numpy.pxd (%d)"; -static char __pyx_k_30[] = "Format string allocated too short, see comment in numpy.pxd"; -static char __pyx_k_33[] = "Format string allocated too short."; -static char __pyx_k_35[] = "Reached maximum number of terms"; -static char __pyx_k_36[] = "Achieved RSQ value within threshold of 1"; -static char __pyx_k_37[] = "Improvement below threshold"; -static char __pyx_k_38[] = "GRSQ too low"; -static char __pyx_k_39[] = "No remaining candidate knot locations"; +static char __pyx_k_4[] = "Unknown variable selected in linvars argument."; +static char __pyx_k_6[] = "init_linear_variables"; +static char __pyx_k_9[] = "no_further_candidates"; +static char __pyx_k_10[] = "orthonormal_downdate"; +static char __pyx_k_26[] = "ndarray is not C contiguous"; +static char __pyx_k_28[] = "ndarray is not Fortran contiguous"; +static char __pyx_k_30[] = "Non-native byte order not supported"; +static char __pyx_k_32[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_33[] = "Format string allocated too short, see comment in numpy.pxd"; +static char __pyx_k_36[] = "Format string allocated too short."; +static char __pyx_k_38[] = "Reached maximum number of terms"; +static char __pyx_k_39[] = "Achieved RSQ value within threshold of 1"; +static char __pyx_k_40[] = "Improvement below threshold"; +static char __pyx_k_41[] = "GRSQ too low"; +static char __pyx_k_42[] = "No remaining candidate knot locations"; static char __pyx_k__B[] = "B"; static char __pyx_k__C[] = "C"; static char __pyx_k__H[] = "H"; @@ -2067,6 +2077,7 @@ static char __pyx_k__max_degree[] = "max_degree"; static char __pyx_k__check_every[] = "check_every"; static char __pyx_k__RuntimeError[] = "RuntimeError"; static char __pyx_k____pyx_capi__[] = "__pyx_capi__"; +static char __pyx_k__allow_linear[] = "allow_linear"; static char __pyx_k__endspan_alpha[] = "endspan_alpha"; static char __pyx_k__minspan_alpha[] = "minspan_alpha"; static char __pyx_k__sample_weight[] = "sample_weight"; @@ -2077,21 +2088,21 @@ static char __pyx_k__set_no_candidates[] = "set_no_candidates"; static char __pyx_k__orthonormal_update[] = "orthonormal_update"; static char __pyx_k____pyx_releasebuffer[] = "__pyx_releasebuffer"; static char __pyx_k__stopping_conditions[] = "stopping_conditions"; -static PyObject *__pyx_kp_s_1; -static PyObject *__pyx_kp_u_23; -static PyObject *__pyx_kp_u_25; -static PyObject *__pyx_kp_u_27; -static PyObject *__pyx_kp_u_29; -static PyObject *__pyx_n_s_3; +static PyObject *__pyx_n_s_10; +static PyObject *__pyx_kp_u_26; +static PyObject *__pyx_kp_u_28; static PyObject *__pyx_kp_u_30; +static PyObject *__pyx_kp_u_32; static PyObject *__pyx_kp_u_33; -static PyObject *__pyx_kp_s_35; -static PyObject *__pyx_kp_s_36; -static PyObject *__pyx_kp_s_37; +static PyObject *__pyx_kp_u_36; static PyObject *__pyx_kp_s_38; static PyObject *__pyx_kp_s_39; +static PyObject *__pyx_kp_s_4; +static PyObject *__pyx_kp_s_40; +static PyObject *__pyx_kp_s_41; +static PyObject *__pyx_kp_s_42; static PyObject *__pyx_n_s_6; -static PyObject *__pyx_n_s_7; +static PyObject *__pyx_n_s_9; static PyObject *__pyx_n_s__C; static PyObject *__pyx_n_s__IndexError; static PyObject *__pyx_n_s__RuntimeError; @@ -2105,6 +2116,7 @@ static PyObject *__pyx_n_s____pyx_getbuffer; static PyObject *__pyx_n_s____pyx_releasebuffer; static PyObject *__pyx_n_s____pyx_vtable__; static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s__allow_linear; static PyObject *__pyx_n_s__argsort; static PyObject *__pyx_n_s__check_every; static PyObject *__pyx_n_s__copy; @@ -2151,12 +2163,12 @@ static PyObject *__pyx_int_2; static PyObject *__pyx_int_neg_1; static PyObject *__pyx_int_15; static PyObject *__pyx_int_100; -static PyObject *__pyx_k_slice_4; -static PyObject *__pyx_k_slice_5; +static PyObject *__pyx_k_slice_1; +static PyObject *__pyx_k_slice_2; +static PyObject *__pyx_k_slice_7; static PyObject *__pyx_k_slice_8; -static PyObject *__pyx_k_slice_9; -static PyObject *__pyx_k_tuple_2; -static PyObject *__pyx_k_slice_10; +static PyObject *__pyx_k_tuple_3; +static PyObject *__pyx_k_tuple_5; static PyObject *__pyx_k_slice_11; static PyObject *__pyx_k_slice_12; static PyObject *__pyx_k_slice_13; @@ -2169,12 +2181,15 @@ static PyObject *__pyx_k_slice_19; static PyObject *__pyx_k_slice_20; static PyObject *__pyx_k_slice_21; static PyObject *__pyx_k_slice_22; -static PyObject *__pyx_k_tuple_24; -static PyObject *__pyx_k_tuple_26; -static PyObject *__pyx_k_tuple_28; +static PyObject *__pyx_k_slice_23; +static PyObject *__pyx_k_slice_24; +static PyObject *__pyx_k_slice_25; +static PyObject *__pyx_k_tuple_27; +static PyObject *__pyx_k_tuple_29; static PyObject *__pyx_k_tuple_31; -static PyObject *__pyx_k_tuple_32; static PyObject *__pyx_k_tuple_34; +static PyObject *__pyx_k_tuple_35; +static PyObject *__pyx_k_tuple_37; /* Python wrapper */ static int __pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_1__init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ @@ -2542,8 +2557,8 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ * 'minspan_alpha'] if 'minspan_alpha' in kwargs else .05 * self.max_terms = kwargs[ * 'max_terms'] if 'max_terms' in kwargs else 2 * self.n + 10 # <<<<<<<<<<<<<< + * self.allow_linear = kwargs['allow_linear'] if 'allow_linear' in kwargs else True * self.max_degree = kwargs['max_degree'] if 'max_degree' in kwargs else 1 - * self.thresh = kwargs['thresh'] if 'thresh' in kwargs else 0.001 */ __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__max_terms), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if ((__pyx_t_4 != 0)) { @@ -2553,7 +2568,7 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ * 'minspan_alpha'] if 'minspan_alpha' in kwargs else .05 * self.max_terms = kwargs[ # <<<<<<<<<<<<<< * 'max_terms'] if 'max_terms' in kwargs else 2 * self.n + 10 - * self.max_degree = kwargs['max_degree'] if 'max_degree' in kwargs else 1 + * self.allow_linear = kwargs['allow_linear'] if 'allow_linear' in kwargs else True */ __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__max_terms)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); @@ -2565,8 +2580,8 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ * 'minspan_alpha'] if 'minspan_alpha' in kwargs else .05 * self.max_terms = kwargs[ * 'max_terms'] if 'max_terms' in kwargs else 2 * self.n + 10 # <<<<<<<<<<<<<< + * self.allow_linear = kwargs['allow_linear'] if 'allow_linear' in kwargs else True * self.max_degree = kwargs['max_degree'] if 'max_degree' in kwargs else 1 - * self.thresh = kwargs['thresh'] if 'thresh' in kwargs else 0.001 */ __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(((2 * __pyx_v_self->n) + 10)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); @@ -2581,20 +2596,43 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ * 'minspan_alpha'] if 'minspan_alpha' in kwargs else .05 * self.max_terms = kwargs[ # <<<<<<<<<<<<<< * 'max_terms'] if 'max_terms' in kwargs else 2 * self.n + 10 - * self.max_degree = kwargs['max_degree'] if 'max_degree' in kwargs else 1 + * self.allow_linear = kwargs['allow_linear'] if 'allow_linear' in kwargs else True */ __pyx_v_self->max_terms = __pyx_t_5; /* "sklearn/earth/_forward.pyx":41 * self.max_terms = kwargs[ * 'max_terms'] if 'max_terms' in kwargs else 2 * self.n + 10 + * self.allow_linear = kwargs['allow_linear'] if 'allow_linear' in kwargs else True # <<<<<<<<<<<<<< + * self.max_degree = kwargs['max_degree'] if 'max_degree' in kwargs else 1 + * self.thresh = kwargs['thresh'] if 'thresh' in kwargs else 0.001 + */ + __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__allow_linear), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if ((__pyx_t_4 != 0)) { + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__allow_linear)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; + __pyx_t_1 = 0; + } else { + __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __pyx_t_1; + __pyx_t_1 = 0; + } + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_v_self->allow_linear = __pyx_t_4; + + /* "sklearn/earth/_forward.pyx":42 + * 'max_terms'] if 'max_terms' in kwargs else 2 * self.n + 10 + * self.allow_linear = kwargs['allow_linear'] if 'allow_linear' in kwargs else True * self.max_degree = kwargs['max_degree'] if 'max_degree' in kwargs else 1 # <<<<<<<<<<<<<< * self.thresh = kwargs['thresh'] if 'thresh' in kwargs else 0.001 * self.penalty = kwargs['penalty'] if 'penalty' in kwargs else 3.0 */ - __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__max_degree), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__max_degree), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if ((__pyx_t_4 != 0)) { - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__max_degree)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__max_degree)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_1 = 0; @@ -2602,74 +2640,74 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ __Pyx_INCREF(__pyx_int_1); __pyx_t_3 = __pyx_int_1; } - __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_self->max_degree = __pyx_t_5; - /* "sklearn/earth/_forward.pyx":42 - * 'max_terms'] if 'max_terms' in kwargs else 2 * self.n + 10 + /* "sklearn/earth/_forward.pyx":43 + * self.allow_linear = kwargs['allow_linear'] if 'allow_linear' in kwargs else True * self.max_degree = kwargs['max_degree'] if 'max_degree' in kwargs else 1 * self.thresh = kwargs['thresh'] if 'thresh' in kwargs else 0.001 # <<<<<<<<<<<<<< * self.penalty = kwargs['penalty'] if 'penalty' in kwargs else 3.0 * self.check_every = kwargs[ */ - __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__thresh), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__thresh), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if ((__pyx_t_4 != 0)) { - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__thresh)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__thresh)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_1 = 0; } else { - __pyx_t_1 = PyFloat_FromDouble(0.001); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(0.001); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_1 = 0; } - __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_self->thresh = __pyx_t_6; - /* "sklearn/earth/_forward.pyx":43 + /* "sklearn/earth/_forward.pyx":44 * self.max_degree = kwargs['max_degree'] if 'max_degree' in kwargs else 1 * self.thresh = kwargs['thresh'] if 'thresh' in kwargs else 0.001 * self.penalty = kwargs['penalty'] if 'penalty' in kwargs else 3.0 # <<<<<<<<<<<<<< * self.check_every = kwargs[ * 'check_every'] if 'check_every' in kwargs else -1 */ - __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__penalty), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__penalty), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if ((__pyx_t_4 != 0)) { - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__penalty)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__penalty)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_1 = 0; } else { - __pyx_t_1 = PyFloat_FromDouble(3.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(3.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_1 = 0; } - __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_self->penalty = __pyx_t_6; - /* "sklearn/earth/_forward.pyx":45 + /* "sklearn/earth/_forward.pyx":46 * self.penalty = kwargs['penalty'] if 'penalty' in kwargs else 3.0 * self.check_every = kwargs[ * 'check_every'] if 'check_every' in kwargs else -1 # <<<<<<<<<<<<<< * self.min_search_points = kwargs[ * 'min_search_points'] if 'min_search_points' in kwargs else 100 */ - __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__check_every), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__check_every), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if ((__pyx_t_4 != 0)) { - /* "sklearn/earth/_forward.pyx":44 + /* "sklearn/earth/_forward.pyx":45 * self.thresh = kwargs['thresh'] if 'thresh' in kwargs else 0.001 * self.penalty = kwargs['penalty'] if 'penalty' in kwargs else 3.0 * self.check_every = kwargs[ # <<<<<<<<<<<<<< * 'check_every'] if 'check_every' in kwargs else -1 * self.min_search_points = kwargs[ */ - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__check_every)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__check_every)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_1 = 0; @@ -2677,28 +2715,28 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ __Pyx_INCREF(__pyx_int_neg_1); __pyx_t_3 = __pyx_int_neg_1; } - __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_self->check_every = __pyx_t_5; - /* "sklearn/earth/_forward.pyx":47 + /* "sklearn/earth/_forward.pyx":48 * 'check_every'] if 'check_every' in kwargs else -1 * self.min_search_points = kwargs[ * 'min_search_points'] if 'min_search_points' in kwargs else 100 # <<<<<<<<<<<<<< * self.xlabels = kwargs['xlabels'] if 'xlabels' in kwargs else None * if self.xlabels is None: */ - __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__min_search_points), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__min_search_points), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if ((__pyx_t_4 != 0)) { - /* "sklearn/earth/_forward.pyx":46 + /* "sklearn/earth/_forward.pyx":47 * self.check_every = kwargs[ * 'check_every'] if 'check_every' in kwargs else -1 * self.min_search_points = kwargs[ # <<<<<<<<<<<<<< * 'min_search_points'] if 'min_search_points' in kwargs else 100 * self.xlabels = kwargs['xlabels'] if 'xlabels' in kwargs else None */ - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__min_search_points)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__min_search_points)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_1 = 0; @@ -2706,20 +2744,20 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ __Pyx_INCREF(__pyx_int_100); __pyx_t_3 = __pyx_int_100; } - __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_self->min_search_points = __pyx_t_5; - /* "sklearn/earth/_forward.pyx":48 + /* "sklearn/earth/_forward.pyx":49 * self.min_search_points = kwargs[ * 'min_search_points'] if 'min_search_points' in kwargs else 100 * self.xlabels = kwargs['xlabels'] if 'xlabels' in kwargs else None # <<<<<<<<<<<<<< * if self.xlabels is None: * self.xlabels = ['x' + str(i) for i in range(self.n)] */ - __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__xlabels), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__xlabels), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if ((__pyx_t_4 != 0)) { - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__xlabels)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__xlabels)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = __pyx_t_1; __pyx_t_1 = 0; @@ -2727,14 +2765,14 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ __Pyx_INCREF(Py_None); __pyx_t_3 = Py_None; } - if (!(likely(PyList_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(PyList_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected list, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_3); __Pyx_GOTREF(__pyx_v_self->xlabels); __Pyx_DECREF(((PyObject *)__pyx_v_self->xlabels)); __pyx_v_self->xlabels = ((PyObject*)__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/earth/_forward.pyx":49 + /* "sklearn/earth/_forward.pyx":50 * 'min_search_points'] if 'min_search_points' in kwargs else 100 * self.xlabels = kwargs['xlabels'] if 'xlabels' in kwargs else None * if self.xlabels is None: # <<<<<<<<<<<<<< @@ -2745,32 +2783,32 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ __pyx_t_7 = (__pyx_t_4 != 0); if (__pyx_t_7) { - /* "sklearn/earth/_forward.pyx":50 + /* "sklearn/earth/_forward.pyx":51 * self.xlabels = kwargs['xlabels'] if 'xlabels' in kwargs else None * if self.xlabels is None: * self.xlabels = ['x' + str(i) for i in range(self.n)] # <<<<<<<<<<<<<< * if self.check_every < 0: * self.check_every = (self.m / self.min_search_points) if self.m > self.min_search_points else 1 */ - __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyList_New(0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_8 = __pyx_v_self->n; for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { __pyx_v_i = __pyx_t_9; - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)(&PyString_Type))), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Add(((PyObject *)__pyx_n_s__x), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Add(((PyObject *)__pyx_n_s__x), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_ListComp_Append(__pyx_t_3, (PyObject*)__pyx_t_2))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); @@ -2782,7 +2820,7 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ } __pyx_L3:; - /* "sklearn/earth/_forward.pyx":51 + /* "sklearn/earth/_forward.pyx":52 * if self.xlabels is None: * self.xlabels = ['x' + str(i) for i in range(self.n)] * if self.check_every < 0: # <<<<<<<<<<<<<< @@ -2792,7 +2830,7 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ __pyx_t_7 = ((__pyx_v_self->check_every < 0) != 0); if (__pyx_t_7) { - /* "sklearn/earth/_forward.pyx":52 + /* "sklearn/earth/_forward.pyx":53 * self.xlabels = ['x' + str(i) for i in range(self.n)] * if self.check_every < 0: * self.check_every = (self.m / self.min_search_points) if self.m > self.min_search_points else 1 # <<<<<<<<<<<<<< @@ -2809,19 +2847,19 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ } __pyx_L6:; - /* "sklearn/earth/_forward.pyx":53 + /* "sklearn/earth/_forward.pyx":54 * if self.check_every < 0: * self.check_every = (self.m / self.min_search_points) if self.m > self.min_search_points else 1 * self.sst = (np.dot(self.y, self.y) - # <<<<<<<<<<<<<< * (np.dot(np.sqrt(self.sample_weight), self.y) / np.sqrt(np.sum(self.sample_weight))) ** 2) / self.m * self.y_squared = np.dot(self.y, self.y) */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_self->y)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self->y)); @@ -2829,38 +2867,38 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ __Pyx_INCREF(((PyObject *)__pyx_v_self->y)); PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_self->y)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self->y)); - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - /* "sklearn/earth/_forward.pyx":54 + /* "sklearn/earth/_forward.pyx":55 * self.check_every = (self.m / self.min_search_points) if self.m > self.min_search_points else 1 * self.sst = (np.dot(self.y, self.y) - * (np.dot(np.sqrt(self.sample_weight), self.y) / np.sqrt(np.sum(self.sample_weight))) ** 2) / self.m # <<<<<<<<<<<<<< * self.y_squared = np.dot(self.y, self.y) * self.record = ForwardPassRecord( */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__sqrt); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__sqrt); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_self->sample_weight)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self->sample_weight)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self->sample_weight)); - __pyx_t_12 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_12); __Pyx_GIVEREF(__pyx_t_12); @@ -2868,59 +2906,59 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ PyTuple_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_v_self->y)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self->y)); __pyx_t_12 = 0; - __pyx_t_12 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__sqrt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__sqrt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__sum); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__sum); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_self->sample_weight)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_self->sample_weight)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self->sample_weight)); - __pyx_t_13 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_13); __Pyx_GIVEREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_12, __pyx_t_13); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_12, __pyx_t_13); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = PyNumber_Power(__pyx_t_3, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyNumber_Power(__pyx_t_3, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_13); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_13); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); - __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_13); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_13); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_6 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_6 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_forward.pyx":53 + /* "sklearn/earth/_forward.pyx":54 * if self.check_every < 0: * self.check_every = (self.m / self.min_search_points) if self.m > self.min_search_points else 1 * self.sst = (np.dot(self.y, self.y) - # <<<<<<<<<<<<<< @@ -2929,19 +2967,19 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ */ __pyx_v_self->sst = __pyx_t_6; - /* "sklearn/earth/_forward.pyx":55 + /* "sklearn/earth/_forward.pyx":56 * self.sst = (np.dot(self.y, self.y) - * (np.dot(np.sqrt(self.sample_weight), self.y) / np.sqrt(np.sum(self.sample_weight))) ** 2) / self.m * self.y_squared = np.dot(self.y, self.y) # <<<<<<<<<<<<<< * self.record = ForwardPassRecord( * self.m, self.n, self.penalty, self.sst, self.xlabels) */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__dot); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__dot); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_self->y)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_self->y)); @@ -2949,30 +2987,30 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ __Pyx_INCREF(((PyObject *)__pyx_v_self->y)); PyTuple_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_v_self->y)); __Pyx_GIVEREF(((PyObject *)__pyx_v_self->y)); - __pyx_t_3 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely((__pyx_t_6 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_self->y_squared = __pyx_t_6; - /* "sklearn/earth/_forward.pyx":57 + /* "sklearn/earth/_forward.pyx":58 * self.y_squared = np.dot(self.y, self.y) * self.record = ForwardPassRecord( * self.m, self.n, self.penalty, self.sst, self.xlabels) # <<<<<<<<<<<<<< * self.basis = Basis(self.n) * self.basis.append(ConstantBasisFunction()) */ - __pyx_t_3 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_13 = PyFloat_FromDouble(__pyx_v_self->penalty); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyFloat_FromDouble(__pyx_v_self->penalty); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); - __pyx_t_12 = PyFloat_FromDouble(__pyx_v_self->sst); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyFloat_FromDouble(__pyx_v_self->sst); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); @@ -2989,11 +3027,11 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ __pyx_t_1 = 0; __pyx_t_13 = 0; __pyx_t_12 = 0; - __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_ForwardPassRecord)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_ForwardPassRecord)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - /* "sklearn/earth/_forward.pyx":56 + /* "sklearn/earth/_forward.pyx":57 * (np.dot(np.sqrt(self.sample_weight), self.y) / np.sqrt(np.sum(self.sample_weight))) ** 2) / self.m * self.y_squared = np.dot(self.y, self.y) * self.record = ForwardPassRecord( # <<<<<<<<<<<<<< @@ -3006,21 +3044,21 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ __pyx_v_self->record = ((struct __pyx_obj_7sklearn_5earth_7_record_ForwardPassRecord *)__pyx_t_12); __pyx_t_12 = 0; - /* "sklearn/earth/_forward.pyx":58 + /* "sklearn/earth/_forward.pyx":59 * self.record = ForwardPassRecord( * self.m, self.n, self.penalty, self.sst, self.xlabels) * self.basis = Basis(self.n) # <<<<<<<<<<<<<< * self.basis.append(ConstantBasisFunction()) * */ - __pyx_t_12 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->n); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->n); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_12); __Pyx_GIVEREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_Basis)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_Basis)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __Pyx_GIVEREF(__pyx_t_12); @@ -3029,162 +3067,162 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ __pyx_v_self->basis = ((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)__pyx_t_12); __pyx_t_12 = 0; - /* "sklearn/earth/_forward.pyx":59 + /* "sklearn/earth/_forward.pyx":60 * self.m, self.n, self.penalty, self.sst, self.xlabels) * self.basis = Basis(self.n) * self.basis.append(ConstantBasisFunction()) # <<<<<<<<<<<<<< * * self.sorting = np.empty(shape=self.m, dtype=np.int) */ - __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_ConstantBasisFunction)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_ConstantBasisFunction)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - __pyx_t_2 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->append(__pyx_v_self->basis, ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_12), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->append(__pyx_v_self->basis, ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_12), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_forward.pyx":61 + /* "sklearn/earth/_forward.pyx":62 * self.basis.append(ConstantBasisFunction()) * * self.sorting = np.empty(shape=self.m, dtype=np.int) # <<<<<<<<<<<<<< * self.mwork = np.empty(shape=self.m, dtype=np.int) * self.u = np.empty(shape=self.max_terms, dtype=float) */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_13 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__shape), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__shape), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s__int); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s__int); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->sorting); __Pyx_DECREF(((PyObject *)__pyx_v_self->sorting)); __pyx_v_self->sorting = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_forward.pyx":62 + /* "sklearn/earth/_forward.pyx":63 * * self.sorting = np.empty(shape=self.m, dtype=np.int) * self.mwork = np.empty(shape=self.m, dtype=np.int) # <<<<<<<<<<<<<< * self.u = np.empty(shape=self.max_terms, dtype=float) * self.B_orth_times_parent_cum = np.empty( */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_12 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__shape), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__shape), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__int); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__int); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_13) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_13) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_13, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_13) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_13, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_13); __Pyx_GOTREF(__pyx_v_self->mwork); __Pyx_DECREF(((PyObject *)__pyx_v_self->mwork)); __pyx_v_self->mwork = ((PyArrayObject *)__pyx_t_13); __pyx_t_13 = 0; - /* "sklearn/earth/_forward.pyx":63 + /* "sklearn/earth/_forward.pyx":64 * self.sorting = np.empty(shape=self.m, dtype=np.int) * self.mwork = np.empty(shape=self.m, dtype=np.int) * self.u = np.empty(shape=self.max_terms, dtype=float) # <<<<<<<<<<<<<< * self.B_orth_times_parent_cum = np.empty( * shape=self.max_terms, dtype=np.float) */ - __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_13, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = PyDict_New(); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_13)); - __pyx_t_2 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__shape), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__shape), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)(&PyFloat_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_13, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)(&PyFloat_Type)))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_13)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_2); __Pyx_GOTREF(__pyx_v_self->u); __Pyx_DECREF(((PyObject *)__pyx_v_self->u)); __pyx_v_self->u = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_forward.pyx":64 + /* "sklearn/earth/_forward.pyx":65 * self.mwork = np.empty(shape=self.m, dtype=np.int) * self.u = np.empty(shape=self.max_terms, dtype=float) * self.B_orth_times_parent_cum = np.empty( # <<<<<<<<<<<<<< * shape=self.max_terms, dtype=np.float) * self.B = np.ones( */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - /* "sklearn/earth/_forward.pyx":65 + /* "sklearn/earth/_forward.pyx":66 * self.u = np.empty(shape=self.max_terms, dtype=float) * self.B_orth_times_parent_cum = np.empty( * shape=self.max_terms, dtype=np.float) # <<<<<<<<<<<<<< * self.B = np.ones( * shape=(self.m, self.max_terms), order='C', dtype=np.float) */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__shape), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__shape), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__float); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__float); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_Call(__pyx_t_13, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/earth/_forward.pyx":64 + /* "sklearn/earth/_forward.pyx":65 * self.mwork = np.empty(shape=self.m, dtype=np.int) * self.u = np.empty(shape=self.max_terms, dtype=float) * self.B_orth_times_parent_cum = np.empty( # <<<<<<<<<<<<<< @@ -3197,33 +3235,33 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ __pyx_v_self->B_orth_times_parent_cum = ((PyArrayObject *)__pyx_t_12); __pyx_t_12 = 0; - /* "sklearn/earth/_forward.pyx":66 + /* "sklearn/earth/_forward.pyx":67 * self.B_orth_times_parent_cum = np.empty( * shape=self.max_terms, dtype=np.float) * self.B = np.ones( # <<<<<<<<<<<<<< * shape=(self.m, self.max_terms), order='C', dtype=np.float) - * self.basis.weighted_transform(self.X, self.B, self.sample_weight) + * self.basis.weighted_transform(self.X, self.B[:,0:1], self.sample_weight) */ - __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__ones); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__ones); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_12)); - /* "sklearn/earth/_forward.pyx":67 + /* "sklearn/earth/_forward.pyx":68 * shape=self.max_terms, dtype=np.float) * self.B = np.ones( * shape=(self.m, self.max_terms), order='C', dtype=np.float) # <<<<<<<<<<<<<< - * self.basis.weighted_transform(self.X, self.B, self.sample_weight) + * self.basis.weighted_transform(self.X, self.B[:,0:1], self.sample_weight) * # An orthogonal matrix with the same column space as B */ - __pyx_t_13 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_13); - __pyx_t_1 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_13); __Pyx_GIVEREF(__pyx_t_13); @@ -3231,28 +3269,28 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ __Pyx_GIVEREF(__pyx_t_1); __pyx_t_13 = 0; __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__shape), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__shape), ((PyObject *)__pyx_t_3)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__C)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__float); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__float); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/earth/_forward.pyx":66 + /* "sklearn/earth/_forward.pyx":67 * self.B_orth_times_parent_cum = np.empty( * shape=self.max_terms, dtype=np.float) * self.B = np.ones( # <<<<<<<<<<<<<< * shape=(self.m, self.max_terms), order='C', dtype=np.float) - * self.basis.weighted_transform(self.X, self.B, self.sample_weight) + * self.basis.weighted_transform(self.X, self.B[:,0:1], self.sample_weight) */ __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->B); @@ -3260,154 +3298,155 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ __pyx_v_self->B = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_forward.pyx":68 + /* "sklearn/earth/_forward.pyx":69 * self.B = np.ones( * shape=(self.m, self.max_terms), order='C', dtype=np.float) - * self.basis.weighted_transform(self.X, self.B, self.sample_weight) # <<<<<<<<<<<<<< + * self.basis.weighted_transform(self.X, self.B[:,0:1], self.sample_weight) # <<<<<<<<<<<<<< * # An orthogonal matrix with the same column space as B * self.B_orth = self.B.copy() */ __pyx_t_1 = ((PyObject *)__pyx_v_self->X); __Pyx_INCREF(__pyx_t_1); - __pyx_t_12 = ((PyObject *)__pyx_v_self->B); - __Pyx_INCREF(__pyx_t_12); + __pyx_t_12 = PyObject_GetItem(((PyObject *)__pyx_v_self->B), ((PyObject *)__pyx_k_tuple_3)); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_2 = ((PyObject *)__pyx_v_self->sample_weight); __Pyx_INCREF(__pyx_t_2); - __pyx_t_3 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->weighted_transform(__pyx_v_self->basis, ((PyArrayObject *)__pyx_t_1), ((PyArrayObject *)__pyx_t_12), ((PyArrayObject *)__pyx_t_2), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->weighted_transform(__pyx_v_self->basis, ((PyArrayObject *)__pyx_t_1), ((PyArrayObject *)__pyx_t_12), ((PyArrayObject *)__pyx_t_2), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/earth/_forward.pyx":70 - * self.basis.weighted_transform(self.X, self.B, self.sample_weight) + /* "sklearn/earth/_forward.pyx":71 + * self.basis.weighted_transform(self.X, self.B[:,0:1], self.sample_weight) * # An orthogonal matrix with the same column space as B * self.B_orth = self.B.copy() # <<<<<<<<<<<<<< * self.u = np.empty(shape=self.max_terms, dtype=np.float) * self.c = np.empty(shape=self.max_terms, dtype=np.float) */ - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->B), __pyx_n_s__copy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->B), __pyx_n_s__copy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_2); __Pyx_GOTREF(__pyx_v_self->B_orth); __Pyx_DECREF(((PyObject *)__pyx_v_self->B_orth)); __pyx_v_self->B_orth = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_forward.pyx":71 + /* "sklearn/earth/_forward.pyx":72 * # An orthogonal matrix with the same column space as B * self.B_orth = self.B.copy() * self.u = np.empty(shape=self.max_terms, dtype=np.float) # <<<<<<<<<<<<<< * self.c = np.empty(shape=self.max_terms, dtype=np.float) * self.norms = np.empty(shape=self.max_terms, dtype=np.float) */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_12 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__shape), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__shape), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__float); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__float); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->u); __Pyx_DECREF(((PyObject *)__pyx_v_self->u)); __pyx_v_self->u = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_forward.pyx":72 + /* "sklearn/earth/_forward.pyx":73 * self.B_orth = self.B.copy() * self.u = np.empty(shape=self.max_terms, dtype=np.float) * self.c = np.empty(shape=self.max_terms, dtype=np.float) # <<<<<<<<<<<<<< * self.norms = np.empty(shape=self.max_terms, dtype=np.float) * self.c_squared = 0.0 */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __pyx_t_3 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__shape), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__shape), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__float); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__float); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_12); __Pyx_GOTREF(__pyx_v_self->c); __Pyx_DECREF(((PyObject *)__pyx_v_self->c)); __pyx_v_self->c = ((PyArrayObject *)__pyx_t_12); __pyx_t_12 = 0; - /* "sklearn/earth/_forward.pyx":73 + /* "sklearn/earth/_forward.pyx":74 * self.u = np.empty(shape=self.max_terms, dtype=np.float) * self.c = np.empty(shape=self.max_terms, dtype=np.float) * self.norms = np.empty(shape=self.max_terms, dtype=np.float) # <<<<<<<<<<<<<< * self.c_squared = 0.0 * self.sort_tracker = np.empty(shape=self.m, dtype=np.int) */ - __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_12)); - __pyx_t_2 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__shape), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__shape), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__float); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__float); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__dtype), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_3); __Pyx_GOTREF(__pyx_v_self->norms); __Pyx_DECREF(((PyObject *)__pyx_v_self->norms)); __pyx_v_self->norms = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/earth/_forward.pyx":74 + /* "sklearn/earth/_forward.pyx":75 * self.c = np.empty(shape=self.max_terms, dtype=np.float) * self.norms = np.empty(shape=self.max_terms, dtype=np.float) * self.c_squared = 0.0 # <<<<<<<<<<<<<< @@ -3416,43 +3455,43 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ */ __pyx_v_self->c_squared = 0.0; - /* "sklearn/earth/_forward.pyx":75 + /* "sklearn/earth/_forward.pyx":76 * self.norms = np.empty(shape=self.max_terms, dtype=np.float) * self.c_squared = 0.0 * self.sort_tracker = np.empty(shape=self.m, dtype=np.int) # <<<<<<<<<<<<<< * for i in range(self.m): * self.sort_tracker[i] = i */ - __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyObject_GetAttrStr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->m); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__shape), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__shape), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__int); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__int); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_12, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_2); __Pyx_GOTREF(__pyx_v_self->sort_tracker); __Pyx_DECREF(((PyObject *)__pyx_v_self->sort_tracker)); __pyx_v_self->sort_tracker = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_forward.pyx":76 + /* "sklearn/earth/_forward.pyx":77 * self.c_squared = 0.0 * self.sort_tracker = np.empty(shape=self.m, dtype=np.int) * for i in range(self.m): # <<<<<<<<<<<<<< @@ -3463,20 +3502,20 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_8; __pyx_t_9+=1) { __pyx_v_i = __pyx_t_9; - /* "sklearn/earth/_forward.pyx":77 + /* "sklearn/earth/_forward.pyx":78 * self.sort_tracker = np.empty(shape=self.m, dtype=np.int) * for i in range(self.m): * self.sort_tracker[i] = i # <<<<<<<<<<<<<< * self.zero_tol = 1e-6 * */ - __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_i); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (__Pyx_SetItemInt(((PyObject *)__pyx_v_self->sort_tracker), __pyx_v_i, __pyx_t_2, sizeof(__pyx_t_7sklearn_5earth_8_forward_INDEX_t)+1, __Pyx_PyInt_to_py_npy_ulonglong, 0, 0, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetItemInt(((PyObject *)__pyx_v_self->sort_tracker), __pyx_v_i, __pyx_t_2, sizeof(__pyx_t_7sklearn_5earth_8_forward_INDEX_t)+1, __Pyx_PyInt_to_py_npy_ulonglong, 0, 0, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } - /* "sklearn/earth/_forward.pyx":78 + /* "sklearn/earth/_forward.pyx":79 * for i in range(self.m): * self.sort_tracker[i] = i * self.zero_tol = 1e-6 # <<<<<<<<<<<<<< @@ -3485,78 +3524,78 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ */ __pyx_v_self->zero_tol = 1e-6; - /* "sklearn/earth/_forward.pyx":80 + /* "sklearn/earth/_forward.pyx":81 * self.zero_tol = 1e-6 * * self.linear_variables = np.zeros(shape=self.n, dtype=np.int) # <<<<<<<<<<<<<< * self.init_linear_variables() * */ - __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s__zeros); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_12 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->n); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->n); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__shape), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__shape), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__int); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_12, __pyx_n_s__int); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 80; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_self->linear_variables); __Pyx_DECREF(((PyObject *)__pyx_v_self->linear_variables)); __pyx_v_self->linear_variables = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_forward.pyx":81 + /* "sklearn/earth/_forward.pyx":82 * * self.linear_variables = np.zeros(shape=self.n, dtype=np.int) * self.init_linear_variables() # <<<<<<<<<<<<<< * * # Add in user selected linear variables */ - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->init_linear_variables(__pyx_v_self, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->init_linear_variables(__pyx_v_self, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_forward.pyx":84 + /* "sklearn/earth/_forward.pyx":85 * * # Add in user selected linear variables * if 'linvars' in kwargs: # <<<<<<<<<<<<<< * for linvar in kwargs['linvars']: * if linvar in self.xlabels: */ - __pyx_t_7 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__linvars), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = (__Pyx_PyDict_Contains(((PyObject *)__pyx_n_s__linvars), ((PyObject *)__pyx_v_kwargs), Py_EQ)); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = (__pyx_t_7 != 0); if (__pyx_t_4) { - /* "sklearn/earth/_forward.pyx":85 + /* "sklearn/earth/_forward.pyx":86 * # Add in user selected linear variables * if 'linvars' in kwargs: * for linvar in kwargs['linvars']: # <<<<<<<<<<<<<< * if linvar in self.xlabels: * self.linear_variables[self.xlabels.index(linvar)] = 1 */ - __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__linvars)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyDict_GetItem(((PyObject *)__pyx_v_kwargs), ((PyObject *)__pyx_n_s__linvars)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) { __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); __pyx_t_14 = 0; __pyx_t_15 = NULL; } else { - __pyx_t_14 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_15 = Py_TYPE(__pyx_t_2)->tp_iternext; } @@ -3565,112 +3604,111 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ if (!__pyx_t_15 && PyList_CheckExact(__pyx_t_2)) { if (__pyx_t_14 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_14); __Pyx_INCREF(__pyx_t_1); __pyx_t_14++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_14); __Pyx_INCREF(__pyx_t_1); __pyx_t_14++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else if (!__pyx_t_15 && PyTuple_CheckExact(__pyx_t_2)) { if (__pyx_t_14 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_14); __Pyx_INCREF(__pyx_t_1); __pyx_t_14++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_14); __Pyx_INCREF(__pyx_t_1); __pyx_t_14++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySequence_ITEM(__pyx_t_2, __pyx_t_14); __pyx_t_14++; if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_1 = __pyx_t_15(__pyx_t_2); if (unlikely(!__pyx_t_1)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 85; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } __Pyx_GOTREF(__pyx_t_1); } - __Pyx_XDECREF(__pyx_v_linvar); - __pyx_v_linvar = __pyx_t_1; + __Pyx_XDECREF_SET(__pyx_v_linvar, __pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_forward.pyx":86 + /* "sklearn/earth/_forward.pyx":87 * if 'linvars' in kwargs: * for linvar in kwargs['linvars']: * if linvar in self.xlabels: # <<<<<<<<<<<<<< * self.linear_variables[self.xlabels.index(linvar)] = 1 * elif linvar in range(self.n): */ - __pyx_t_4 = (__Pyx_PySequence_Contains(__pyx_v_linvar, ((PyObject *)__pyx_v_self->xlabels), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = (__Pyx_PySequence_Contains(__pyx_v_linvar, ((PyObject *)__pyx_v_self->xlabels), Py_EQ)); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_7 = (__pyx_t_4 != 0); if (__pyx_t_7) { - /* "sklearn/earth/_forward.pyx":87 + /* "sklearn/earth/_forward.pyx":88 * for linvar in kwargs['linvars']: * if linvar in self.xlabels: * self.linear_variables[self.xlabels.index(linvar)] = 1 # <<<<<<<<<<<<<< * elif linvar in range(self.n): * self.linear_variables[linvar] = 1 */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->xlabels), __pyx_n_s__index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->xlabels), __pyx_n_s__index); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_linvar); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_linvar); __Pyx_GIVEREF(__pyx_v_linvar); - __pyx_t_12 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (PyObject_SetItem(((PyObject *)__pyx_v_self->linear_variables), __pyx_t_12, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(((PyObject *)__pyx_v_self->linear_variables), __pyx_t_12, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; goto __pyx_L12; } - /* "sklearn/earth/_forward.pyx":88 + /* "sklearn/earth/_forward.pyx":89 * if linvar in self.xlabels: * self.linear_variables[self.xlabels.index(linvar)] = 1 * elif linvar in range(self.n): # <<<<<<<<<<<<<< * self.linear_variables[linvar] = 1 * else: */ - __pyx_t_12 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->n); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_self->n); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_12); __Pyx_GIVEREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_7 = (__Pyx_PySequence_Contains(__pyx_v_linvar, __pyx_t_12, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = (__Pyx_PySequence_Contains(__pyx_v_linvar, __pyx_t_12, Py_EQ)); if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; __pyx_t_4 = (__pyx_t_7 != 0); if (__pyx_t_4) { - /* "sklearn/earth/_forward.pyx":89 + /* "sklearn/earth/_forward.pyx":90 * self.linear_variables[self.xlabels.index(linvar)] = 1 * elif linvar in range(self.n): * self.linear_variables[linvar] = 1 # <<<<<<<<<<<<<< * else: * raise IndexError( */ - if (PyObject_SetItem(((PyObject *)__pyx_v_self->linear_variables), __pyx_v_linvar, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(((PyObject *)__pyx_v_self->linear_variables), __pyx_v_linvar, __pyx_int_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L12; } /*else*/ { - /* "sklearn/earth/_forward.pyx":91 + /* "sklearn/earth/_forward.pyx":92 * self.linear_variables[linvar] = 1 * else: * raise IndexError( # <<<<<<<<<<<<<< * 'Unknown variable selected in linvars argument.') * */ - __pyx_t_12 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_2), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_Call(__pyx_builtin_IndexError, ((PyObject *)__pyx_k_tuple_5), NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_Raise(__pyx_t_12, 0, 0, 0); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L12:; } @@ -3679,7 +3717,7 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ } __pyx_L9:; - /* "sklearn/earth/_forward.pyx":96 + /* "sklearn/earth/_forward.pyx":97 * # Initialize B_orth, c, and c_squared (assuming column 0 of B_orth is * # already filled with 1) * self.orthonormal_update(0) # <<<<<<<<<<<<<< @@ -3716,7 +3754,7 @@ static int __pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser___init__(struct __ return __pyx_r; } -/* "sklearn/earth/_forward.pyx":98 +/* "sklearn/earth/_forward.pyx":99 * self.orthonormal_update(0) * * cpdef Basis get_basis(ForwardPasser self): # <<<<<<<<<<<<<< @@ -3738,13 +3776,13 @@ static struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_f_7sklearn_5earth_8 if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_basis); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__get_basis); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_3get_basis)) { __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7sklearn_5earth_6_basis_Basis))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_7sklearn_5earth_6_basis_Basis))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((struct __pyx_obj_7sklearn_5earth_6_basis_Basis *)__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -3753,7 +3791,7 @@ static struct __pyx_obj_7sklearn_5earth_6_basis_Basis *__pyx_f_7sklearn_5earth_8 __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_forward.pyx":99 + /* "sklearn/earth/_forward.pyx":100 * * cpdef Basis get_basis(ForwardPasser self): * return self.basis # <<<<<<<<<<<<<< @@ -3789,7 +3827,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_3get_basis(P return __pyx_r; } -/* "sklearn/earth/_forward.pyx":98 +/* "sklearn/earth/_forward.pyx":99 * self.orthonormal_update(0) * * cpdef Basis get_basis(ForwardPasser self): # <<<<<<<<<<<<<< @@ -3806,7 +3844,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_2get_basis(s int __pyx_clineno = 0; __Pyx_RefNannySetupContext("get_basis", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->get_basis(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->get_basis(__pyx_v_self, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3824,7 +3862,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_2get_basis(s return __pyx_r; } -/* "sklearn/earth/_forward.pyx":101 +/* "sklearn/earth/_forward.pyx":102 * return self.basis * * cpdef init_linear_variables(ForwardPasser self): # <<<<<<<<<<<<<< @@ -3858,10 +3896,10 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_init_linear_v PyArrayObject *__pyx_t_5 = NULL; int __pyx_t_6; __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_7; - __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_8; - PyObject *__pyx_t_9 = NULL; - PyArrayObject *__pyx_t_10 = NULL; - int __pyx_t_11; + int __pyx_t_8; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_9; + PyObject *__pyx_t_10 = NULL; + PyArrayObject *__pyx_t_11 = NULL; PyObject *__pyx_t_12 = NULL; PyObject *__pyx_t_13 = NULL; PyObject *__pyx_t_14 = NULL; @@ -3892,11 +3930,11 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_init_linear_v if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_5init_linear_variables)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -3906,7 +3944,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_init_linear_v __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_forward.pyx":105 + /* "sklearn/earth/_forward.pyx":106 * cdef INDEX_t endspan * cdef cnp.ndarray[INT_t, ndim = 1] order * cdef cnp.ndarray[INT_t, ndim = 1] linear_variables = self.linear_variables # <<<<<<<<<<<<<< @@ -3918,7 +3956,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_init_linear_v __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_linear_variables.rcbuffer->pybuffer, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_linear_variables = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_linear_variables.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_linear_variables.diminfo[0].strides = __pyx_pybuffernd_linear_variables.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_linear_variables.diminfo[0].shape = __pyx_pybuffernd_linear_variables.rcbuffer->pybuffer.shape[0]; } } @@ -3926,7 +3964,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_init_linear_v __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->linear_variables))); __pyx_v_linear_variables = ((PyArrayObject *)__pyx_v_self->linear_variables); - /* "sklearn/earth/_forward.pyx":106 + /* "sklearn/earth/_forward.pyx":107 * cdef cnp.ndarray[INT_t, ndim = 1] order * cdef cnp.ndarray[INT_t, ndim = 1] linear_variables = self.linear_variables * cdef cnp.ndarray[FLOAT_t, ndim = 2] B = self.B # <<<<<<<<<<<<<< @@ -3938,7 +3976,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_init_linear_v __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { __pyx_v_B = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_B.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_B.diminfo[0].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B.diminfo[0].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B.diminfo[1].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B.diminfo[1].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[1]; } } @@ -3946,7 +3984,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_init_linear_v __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->B))); __pyx_v_B = ((PyArrayObject *)__pyx_v_self->B); - /* "sklearn/earth/_forward.pyx":107 + /* "sklearn/earth/_forward.pyx":108 * cdef cnp.ndarray[INT_t, ndim = 1] linear_variables = self.linear_variables * cdef cnp.ndarray[FLOAT_t, ndim = 2] B = self.B * cdef cnp.ndarray[FLOAT_t, ndim = 2] X = self.X # <<<<<<<<<<<<<< @@ -3958,7 +3996,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_init_linear_v __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { __pyx_v_X = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; } } @@ -3966,108 +4004,120 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_init_linear_v __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->X))); __pyx_v_X = ((PyArrayObject *)__pyx_v_self->X); - /* "sklearn/earth/_forward.pyx":108 + /* "sklearn/earth/_forward.pyx":109 * cdef cnp.ndarray[FLOAT_t, ndim = 2] B = self.B * cdef cnp.ndarray[FLOAT_t, ndim = 2] X = self.X * if self.endspan < 0: # <<<<<<<<<<<<<< * endspan = round(3 - log2(self.endspan_alpha / self.n)) - * cdef ConstantBasisFunction root_basis_function = self.basis[0] + * else: */ __pyx_t_6 = ((__pyx_v_self->endspan < 0) != 0); if (__pyx_t_6) { - /* "sklearn/earth/_forward.pyx":109 + /* "sklearn/earth/_forward.pyx":110 * cdef cnp.ndarray[FLOAT_t, ndim = 2] X = self.X * if self.endspan < 0: * endspan = round(3 - log2(self.endspan_alpha / self.n)) # <<<<<<<<<<<<<< - * cdef ConstantBasisFunction root_basis_function = self.basis[0] - * for variable in range(self.n): + * else: + * endspan = self.endspan */ - __pyx_t_1 = PyFloat_FromDouble((3.0 - __pyx_f_7sklearn_5earth_5_util_log2((__pyx_v_self->endspan_alpha / __pyx_v_self->n)))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble((3.0 - __pyx_f_7sklearn_5earth_5_util_log2((__pyx_v_self->endspan_alpha / __pyx_v_self->n)))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_round, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_round, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_7 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_7 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_7 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_endspan = __pyx_t_7; goto __pyx_L3; } - __pyx_L3:; + /*else*/ { - /* "sklearn/earth/_forward.pyx":110 - * if self.endspan < 0: + /* "sklearn/earth/_forward.pyx":112 * endspan = round(3 - log2(self.endspan_alpha / self.n)) + * else: + * endspan = self.endspan # <<<<<<<<<<<<<< + * cdef ConstantBasisFunction root_basis_function = self.basis[0] + * for variable in range(self.n): + */ + __pyx_t_8 = __pyx_v_self->endspan; + __pyx_v_endspan = __pyx_t_8; + } + __pyx_L3:; + + /* "sklearn/earth/_forward.pyx":113 + * else: + * endspan = self.endspan * cdef ConstantBasisFunction root_basis_function = self.basis[0] # <<<<<<<<<<<<<< * for variable in range(self.n): * order = np.argsort(X[:, variable])[::-1] */ - __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->basis), 0, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->basis), 0, sizeof(long), PyInt_FromLong, 0, 0, 0); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7sklearn_5earth_6_basis_ConstantBasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_7sklearn_5earth_6_basis_ConstantBasisFunction))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_root_basis_function = ((struct __pyx_obj_7sklearn_5earth_6_basis_ConstantBasisFunction *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_forward.pyx":111 - * endspan = round(3 - log2(self.endspan_alpha / self.n)) + /* "sklearn/earth/_forward.pyx":114 + * endspan = self.endspan * cdef ConstantBasisFunction root_basis_function = self.basis[0] * for variable in range(self.n): # <<<<<<<<<<<<<< * order = np.argsort(X[:, variable])[::-1] * if root_basis_function.valid_knots(B[order, 0], X[order, variable], */ __pyx_t_7 = __pyx_v_self->n; - for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { - __pyx_v_variable = __pyx_t_8; + for (__pyx_t_9 = 0; __pyx_t_9 < __pyx_t_7; __pyx_t_9+=1) { + __pyx_v_variable = __pyx_t_9; - /* "sklearn/earth/_forward.pyx":112 + /* "sklearn/earth/_forward.pyx":115 * cdef ConstantBasisFunction root_basis_function = self.basis[0] * for variable in range(self.n): * order = np.argsort(X[:, variable])[::-1] # <<<<<<<<<<<<<< * if root_basis_function.valid_knots(B[order, 0], X[order, variable], * variable, self.check_every, endspan, */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__argsort); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__argsort); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __Pyx_INCREF(__pyx_k_slice_4); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_k_slice_4); - __Pyx_GIVEREF(__pyx_k_slice_4); - PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_1); + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_INCREF(__pyx_k_slice_7); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_k_slice_7); + __Pyx_GIVEREF(__pyx_k_slice_7); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_X), ((PyObject *)__pyx_t_9)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_X), ((PyObject *)__pyx_t_10)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_9), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - __pyx_t_9 = PyObject_GetItem(__pyx_t_1, __pyx_k_slice_5); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __pyx_t_10 = PyObject_GetItem(__pyx_t_1, __pyx_k_slice_8); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_10 = ((PyArrayObject *)__pyx_t_9); + if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = ((PyArrayObject *)__pyx_t_10); { __Pyx_BufFmt_StackElem __pyx_stack[1]; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_order.rcbuffer->pybuffer); - __pyx_t_11 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_order.rcbuffer->pybuffer, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_11 < 0)) { + __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_order.rcbuffer->pybuffer, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); + if (unlikely(__pyx_t_8 < 0)) { PyErr_Fetch(&__pyx_t_12, &__pyx_t_13, &__pyx_t_14); if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_order.rcbuffer->pybuffer, (PyObject*)__pyx_v_order, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14); @@ -4077,48 +4127,47 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_init_linear_v } } __pyx_pybuffernd_order.diminfo[0].strides = __pyx_pybuffernd_order.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_order.diminfo[0].shape = __pyx_pybuffernd_order.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_11 = 0; + __Pyx_XDECREF_SET(__pyx_v_order, ((PyArrayObject *)__pyx_t_10)); __pyx_t_10 = 0; - __Pyx_XDECREF(((PyObject *)__pyx_v_order)); - __pyx_v_order = ((PyArrayObject *)__pyx_t_9); - __pyx_t_9 = 0; - /* "sklearn/earth/_forward.pyx":113 + /* "sklearn/earth/_forward.pyx":116 * for variable in range(self.n): * order = np.argsort(X[:, variable])[::-1] * if root_basis_function.valid_knots(B[order, 0], X[order, variable], # <<<<<<<<<<<<<< * variable, self.check_every, endspan, * self.minspan, self.minspan_alpha, */ - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); + __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); __Pyx_INCREF(((PyObject *)__pyx_v_order)); - PyTuple_SET_ITEM(__pyx_t_9, 0, ((PyObject *)__pyx_v_order)); + PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_v_order)); __Pyx_GIVEREF(((PyObject *)__pyx_v_order)); __Pyx_INCREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_int_0); __Pyx_GIVEREF(__pyx_int_0); - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_9)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_10)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_9 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_order)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_order)); __Pyx_GIVEREF(((PyObject *)__pyx_v_order)); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_9); - __Pyx_GIVEREF(__pyx_t_9); - __pyx_t_9 = 0; - __pyx_t_9 = PyObject_GetItem(((PyObject *)__pyx_v_X), ((PyObject *)__pyx_t_2)); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + __pyx_t_10 = 0; + __pyx_t_10 = PyObject_GetItem(((PyObject *)__pyx_v_X), ((PyObject *)__pyx_t_2)); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/earth/_forward.pyx":116 + /* "sklearn/earth/_forward.pyx":119 * variable, self.check_every, endspan, * self.minspan, self.minspan_alpha, * self.n, self.mwork).shape[0] == 0: # <<<<<<<<<<<<<< @@ -4127,16 +4176,16 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_init_linear_v */ __pyx_t_2 = ((PyObject *)__pyx_v_self->mwork); __Pyx_INCREF(__pyx_t_2); - __pyx_t_15 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_ConstantBasisFunction *)__pyx_v_root_basis_function->__pyx_base.__pyx_vtab)->__pyx_base.valid_knots(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_root_basis_function), ((PyArrayObject *)__pyx_t_1), ((PyArrayObject *)__pyx_t_9), __pyx_v_variable, __pyx_v_self->check_every, __pyx_v_endspan, __pyx_v_self->minspan, __pyx_v_self->minspan_alpha, __pyx_v_self->n, ((PyArrayObject *)__pyx_t_2), 0)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_ConstantBasisFunction *)__pyx_v_root_basis_function->__pyx_base.__pyx_vtab)->__pyx_base.valid_knots(((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_root_basis_function), ((PyArrayObject *)__pyx_t_1), ((PyArrayObject *)__pyx_t_10), __pyx_v_variable, __pyx_v_self->check_every, __pyx_v_endspan, __pyx_v_self->minspan, __pyx_v_self->minspan_alpha, __pyx_v_self->n, ((PyArrayObject *)__pyx_t_2), 0)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_6 = (((((PyArrayObject *)__pyx_t_15)->dimensions[0]) == 0) != 0); __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; if (__pyx_t_6) { - /* "sklearn/earth/_forward.pyx":117 + /* "sklearn/earth/_forward.pyx":120 * self.minspan, self.minspan_alpha, * self.n, self.mwork).shape[0] == 0: * linear_variables[variable] = 1 # <<<<<<<<<<<<<< @@ -4149,7 +4198,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_init_linear_v } /*else*/ { - /* "sklearn/earth/_forward.pyx":119 + /* "sklearn/earth/_forward.pyx":122 * linear_variables[variable] = 1 * else: * linear_variables[variable] = 0 # <<<<<<<<<<<<<< @@ -4167,7 +4216,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_init_linear_v __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); __Pyx_XDECREF(__pyx_t_15); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); @@ -4206,7 +4255,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_5init_linear return __pyx_r; } -/* "sklearn/earth/_forward.pyx":101 +/* "sklearn/earth/_forward.pyx":102 * return self.basis * * cpdef init_linear_variables(ForwardPasser self): # <<<<<<<<<<<<<< @@ -4223,7 +4272,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_4init_linear int __pyx_clineno = 0; __Pyx_RefNannySetupContext("init_linear_variables", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->init_linear_variables(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->init_linear_variables(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4252,7 +4301,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_7get_B_orth( return __pyx_r; } -/* "sklearn/earth/_forward.pyx":121 +/* "sklearn/earth/_forward.pyx":124 * linear_variables[variable] = 0 * * def get_B_orth(ForwardPasser self): # <<<<<<<<<<<<<< @@ -4265,7 +4314,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_6get_B_orth( __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("get_B_orth", 0); - /* "sklearn/earth/_forward.pyx":122 + /* "sklearn/earth/_forward.pyx":125 * * def get_B_orth(ForwardPasser self): * return self.B_orth # <<<<<<<<<<<<<< @@ -4284,7 +4333,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_6get_B_orth( return __pyx_r; } -/* "sklearn/earth/_forward.pyx":124 +/* "sklearn/earth/_forward.pyx":127 * return self.B_orth * * cpdef run(ForwardPasser self): # <<<<<<<<<<<<<< @@ -4307,11 +4356,11 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_run(struct __ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__run); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__run); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_9run)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -4321,7 +4370,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_run(struct __ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_forward.pyx":126 + /* "sklearn/earth/_forward.pyx":129 * cpdef run(ForwardPasser self): * cdef INDEX_t i * while True: # <<<<<<<<<<<<<< @@ -4331,31 +4380,31 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_run(struct __ while (1) { if (!1) break; - /* "sklearn/earth/_forward.pyx":127 + /* "sklearn/earth/_forward.pyx":130 * cdef INDEX_t i * while True: * self.next_pair() # <<<<<<<<<<<<<< * if self.stop_check(): * break */ - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->next_pair(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->next_pair(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_forward.pyx":128 + /* "sklearn/earth/_forward.pyx":131 * while True: * self.next_pair() * if self.stop_check(): # <<<<<<<<<<<<<< * break * */ - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->stop_check(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->stop_check(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_3) { - /* "sklearn/earth/_forward.pyx":129 + /* "sklearn/earth/_forward.pyx":132 * self.next_pair() * if self.stop_check(): * break # <<<<<<<<<<<<<< @@ -4393,7 +4442,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_9run(PyObjec return __pyx_r; } -/* "sklearn/earth/_forward.pyx":124 +/* "sklearn/earth/_forward.pyx":127 * return self.B_orth * * cpdef run(ForwardPasser self): # <<<<<<<<<<<<<< @@ -4410,7 +4459,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_8run(struct int __pyx_clineno = 0; __Pyx_RefNannySetupContext("run", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->run(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->run(__pyx_v_self, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4428,7 +4477,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_8run(struct return __pyx_r; } -/* "sklearn/earth/_forward.pyx":131 +/* "sklearn/earth/_forward.pyx":134 * break * * cdef stop_check(ForwardPasser self): # <<<<<<<<<<<<<< @@ -4452,25 +4501,25 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_stop_check(st int __pyx_clineno = 0; __Pyx_RefNannySetupContext("stop_check", 0); - /* "sklearn/earth/_forward.pyx":132 + /* "sklearn/earth/_forward.pyx":135 * * cdef stop_check(ForwardPasser self): * last = self.record.__len__() - 1 # <<<<<<<<<<<<<< * if self.record.iterations[last].get_size() + 2 > self.max_terms: * self.record.stopping_condition = MAXTERMS */ - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->record), __pyx_n_s____len__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self->record), __pyx_n_s____len__); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Subtract(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_last = __pyx_t_1; __pyx_t_1 = 0; - /* "sklearn/earth/_forward.pyx":133 + /* "sklearn/earth/_forward.pyx":136 * cdef stop_check(ForwardPasser self): * last = self.record.__len__() - 1 * if self.record.iterations[last].get_size() + 2 > self.max_terms: # <<<<<<<<<<<<<< @@ -4479,29 +4528,29 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_stop_check(st */ if (unlikely(((PyObject *)__pyx_v_self->record->__pyx_base.iterations) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self->record->__pyx_base.iterations), __pyx_v_last); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self->record->__pyx_base.iterations), __pyx_v_last); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__get_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__get_size); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_int_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_int_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_self->max_terms); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_GT); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_4) { - /* "sklearn/earth/_forward.pyx":134 + /* "sklearn/earth/_forward.pyx":137 * last = self.record.__len__() - 1 * if self.record.iterations[last].get_size() + 2 > self.max_terms: * self.record.stopping_condition = MAXTERMS # <<<<<<<<<<<<<< @@ -4510,7 +4559,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_stop_check(st */ __pyx_v_self->record->stopping_condition = __pyx_e_7sklearn_5earth_8_forward_MAXTERMS; - /* "sklearn/earth/_forward.pyx":135 + /* "sklearn/earth/_forward.pyx":138 * if self.record.iterations[last].get_size() + 2 > self.max_terms: * self.record.stopping_condition = MAXTERMS * return True # <<<<<<<<<<<<<< @@ -4518,7 +4567,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_stop_check(st * if rsq > 1 - self.thresh: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; @@ -4527,35 +4576,35 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_stop_check(st } __pyx_L3:; - /* "sklearn/earth/_forward.pyx":136 + /* "sklearn/earth/_forward.pyx":139 * self.record.stopping_condition = MAXTERMS * return True * rsq = self.record.rsq(last) # <<<<<<<<<<<<<< * if rsq > 1 - self.thresh: * self.record.stopping_condition = MAXRSQ */ - __pyx_t_5 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_last); if (unlikely((__pyx_t_5 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->__pyx_base.rsq(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self->record), __pyx_t_5, 0)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_last); if (unlikely((__pyx_t_5 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->__pyx_base.rsq(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self->record), __pyx_t_5, 0)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_v_rsq = __pyx_t_3; __pyx_t_3 = 0; - /* "sklearn/earth/_forward.pyx":137 + /* "sklearn/earth/_forward.pyx":140 * return True * rsq = self.record.rsq(last) * if rsq > 1 - self.thresh: # <<<<<<<<<<<<<< * self.record.stopping_condition = MAXRSQ * return True */ - __pyx_t_3 = PyFloat_FromDouble((1.0 - __pyx_v_self->thresh)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble((1.0 - __pyx_v_self->thresh)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_RichCompare(__pyx_v_rsq, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_RichCompare(__pyx_v_rsq, __pyx_t_3, Py_GT); __Pyx_XGOTREF(__pyx_t_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_1); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_4) { - /* "sklearn/earth/_forward.pyx":138 + /* "sklearn/earth/_forward.pyx":141 * rsq = self.record.rsq(last) * if rsq > 1 - self.thresh: * self.record.stopping_condition = MAXRSQ # <<<<<<<<<<<<<< @@ -4564,7 +4613,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_stop_check(st */ __pyx_v_self->record->stopping_condition = __pyx_e_7sklearn_5earth_8_forward_MAXRSQ; - /* "sklearn/earth/_forward.pyx":139 + /* "sklearn/earth/_forward.pyx":142 * if rsq > 1 - self.thresh: * self.record.stopping_condition = MAXRSQ * return True # <<<<<<<<<<<<<< @@ -4572,7 +4621,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_stop_check(st * if rsq - previous_rsq < self.thresh: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4581,41 +4630,41 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_stop_check(st } __pyx_L4:; - /* "sklearn/earth/_forward.pyx":140 + /* "sklearn/earth/_forward.pyx":143 * self.record.stopping_condition = MAXRSQ * return True * previous_rsq = self.record.rsq(last - 1) # <<<<<<<<<<<<<< * if rsq - previous_rsq < self.thresh: * self.record.stopping_condition = NOIMPRV */ - __pyx_t_1 = PyNumber_Subtract(__pyx_v_last, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Subtract(__pyx_v_last, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_5 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_5 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->__pyx_base.rsq(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self->record), __pyx_t_5, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(((struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->__pyx_base.rsq(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self->record), __pyx_t_5, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_previous_rsq = __pyx_t_1; __pyx_t_1 = 0; - /* "sklearn/earth/_forward.pyx":141 + /* "sklearn/earth/_forward.pyx":144 * return True * previous_rsq = self.record.rsq(last - 1) * if rsq - previous_rsq < self.thresh: # <<<<<<<<<<<<<< * self.record.stopping_condition = NOIMPRV * return True */ - __pyx_t_1 = PyNumber_Subtract(__pyx_v_rsq, __pyx_v_previous_rsq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Subtract(__pyx_v_rsq, __pyx_v_previous_rsq); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->thresh); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_self->thresh); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_LT); __Pyx_XGOTREF(__pyx_t_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_4) { - /* "sklearn/earth/_forward.pyx":142 + /* "sklearn/earth/_forward.pyx":145 * previous_rsq = self.record.rsq(last - 1) * if rsq - previous_rsq < self.thresh: * self.record.stopping_condition = NOIMPRV # <<<<<<<<<<<<<< @@ -4624,7 +4673,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_stop_check(st */ __pyx_v_self->record->stopping_condition = __pyx_e_7sklearn_5earth_8_forward_NOIMPRV; - /* "sklearn/earth/_forward.pyx":143 + /* "sklearn/earth/_forward.pyx":146 * if rsq - previous_rsq < self.thresh: * self.record.stopping_condition = NOIMPRV * return True # <<<<<<<<<<<<<< @@ -4632,7 +4681,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_stop_check(st * self.record.stopping_condition = LOWGRSQ */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -4641,18 +4690,18 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_stop_check(st } __pyx_L5:; - /* "sklearn/earth/_forward.pyx":144 + /* "sklearn/earth/_forward.pyx":147 * self.record.stopping_condition = NOIMPRV * return True * if self.record.grsq(last) < -10: # <<<<<<<<<<<<<< * self.record.stopping_condition = LOWGRSQ * return True */ - __pyx_t_5 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_last); if (unlikely((__pyx_t_5 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_v_last); if (unlikely((__pyx_t_5 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = ((((struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->__pyx_base.grsq(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self->record), __pyx_t_5, 0) < -10.0) != 0); if (__pyx_t_4) { - /* "sklearn/earth/_forward.pyx":145 + /* "sklearn/earth/_forward.pyx":148 * return True * if self.record.grsq(last) < -10: * self.record.stopping_condition = LOWGRSQ # <<<<<<<<<<<<<< @@ -4661,7 +4710,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_stop_check(st */ __pyx_v_self->record->stopping_condition = __pyx_e_7sklearn_5earth_8_forward_LOWGRSQ; - /* "sklearn/earth/_forward.pyx":146 + /* "sklearn/earth/_forward.pyx":149 * if self.record.grsq(last) < -10: * self.record.stopping_condition = LOWGRSQ * return True # <<<<<<<<<<<<<< @@ -4669,7 +4718,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_stop_check(st * self.record.stopping_condition = NOCAND */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -4678,7 +4727,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_stop_check(st } __pyx_L6:; - /* "sklearn/earth/_forward.pyx":147 + /* "sklearn/earth/_forward.pyx":150 * self.record.stopping_condition = LOWGRSQ * return True * if self.record.iterations[last].no_further_candidates(): # <<<<<<<<<<<<<< @@ -4687,21 +4736,21 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_stop_check(st */ if (unlikely(((PyObject *)__pyx_v_self->record->__pyx_base.iterations) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_self->record->__pyx_base.iterations), __pyx_v_last); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_self->record->__pyx_base.iterations), __pyx_v_last); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetAttrStr(__pyx_t_2, __pyx_n_s_9); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_4) { - /* "sklearn/earth/_forward.pyx":148 + /* "sklearn/earth/_forward.pyx":151 * return True * if self.record.iterations[last].no_further_candidates(): * self.record.stopping_condition = NOCAND # <<<<<<<<<<<<<< @@ -4710,7 +4759,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_stop_check(st */ __pyx_v_self->record->stopping_condition = __pyx_e_7sklearn_5earth_8_forward_NOCAND; - /* "sklearn/earth/_forward.pyx":149 + /* "sklearn/earth/_forward.pyx":152 * if self.record.iterations[last].no_further_candidates(): * self.record.stopping_condition = NOCAND * return True # <<<<<<<<<<<<<< @@ -4718,7 +4767,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_stop_check(st * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -4727,7 +4776,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_stop_check(st } __pyx_L7:; - /* "sklearn/earth/_forward.pyx":150 + /* "sklearn/earth/_forward.pyx":153 * self.record.stopping_condition = NOCAND * return True * return False # <<<<<<<<<<<<<< @@ -4735,7 +4784,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_stop_check(st * cpdef int orthonormal_update(ForwardPasser self, INDEX_t k): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_r = __pyx_t_2; __pyx_t_2 = 0; @@ -4758,7 +4807,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_stop_check(st return __pyx_r; } -/* "sklearn/earth/_forward.pyx":152 +/* "sklearn/earth/_forward.pyx":155 * return False * * cpdef int orthonormal_update(ForwardPasser self, INDEX_t k): # <<<<<<<<<<<<<< @@ -4851,20 +4900,20 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__orthonormal_update); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s__orthonormal_update); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_11orthonormal_update)) { - __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_4; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -4873,7 +4922,7 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_forward.pyx":157 + /* "sklearn/earth/_forward.pyx":160 * # TODO: Optimize - replace some for loops with calls to blas * * cdef cnp.ndarray[FLOAT_t, ndim = 2] B_orth = self.B_orth # <<<<<<<<<<<<<< @@ -4885,7 +4934,7 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B_orth.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { __pyx_v_B_orth = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_B_orth.diminfo[0].strides = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B_orth.diminfo[0].shape = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B_orth.diminfo[1].strides = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B_orth.diminfo[1].shape = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.shape[1]; } } @@ -4893,7 +4942,7 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->B_orth))); __pyx_v_B_orth = ((PyArrayObject *)__pyx_v_self->B_orth); - /* "sklearn/earth/_forward.pyx":158 + /* "sklearn/earth/_forward.pyx":161 * * cdef cnp.ndarray[FLOAT_t, ndim = 2] B_orth = self.B_orth * cdef cnp.ndarray[FLOAT_t, ndim = 1] c = self.c # <<<<<<<<<<<<<< @@ -4905,7 +4954,7 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_c.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_c = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_c.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_c.diminfo[0].strides = __pyx_pybuffernd_c.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_c.diminfo[0].shape = __pyx_pybuffernd_c.rcbuffer->pybuffer.shape[0]; } } @@ -4913,7 +4962,7 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->c))); __pyx_v_c = ((PyArrayObject *)__pyx_v_self->c); - /* "sklearn/earth/_forward.pyx":159 + /* "sklearn/earth/_forward.pyx":162 * cdef cnp.ndarray[FLOAT_t, ndim = 2] B_orth = self.B_orth * cdef cnp.ndarray[FLOAT_t, ndim = 1] c = self.c * cdef cnp.ndarray[FLOAT_t, ndim = 1] y = self.y # <<<<<<<<<<<<<< @@ -4925,7 +4974,7 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_y = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_y.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_y.diminfo[0].strides = __pyx_pybuffernd_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y.diminfo[0].shape = __pyx_pybuffernd_y.rcbuffer->pybuffer.shape[0]; } } @@ -4933,7 +4982,7 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->y))); __pyx_v_y = ((PyArrayObject *)__pyx_v_self->y); - /* "sklearn/earth/_forward.pyx":160 + /* "sklearn/earth/_forward.pyx":163 * cdef cnp.ndarray[FLOAT_t, ndim = 1] c = self.c * cdef cnp.ndarray[FLOAT_t, ndim = 1] y = self.y * cdef cnp.ndarray[FLOAT_t, ndim = 1] norms = self.norms # <<<<<<<<<<<<<< @@ -4945,7 +4994,7 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_norms.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_norms = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_norms.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_norms.diminfo[0].strides = __pyx_pybuffernd_norms.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_norms.diminfo[0].shape = __pyx_pybuffernd_norms.rcbuffer->pybuffer.shape[0]; } } @@ -4953,7 +5002,7 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->norms))); __pyx_v_norms = ((PyArrayObject *)__pyx_v_self->norms); - /* "sklearn/earth/_forward.pyx":169 + /* "sklearn/earth/_forward.pyx":172 * * # Get the original norm * nrm0 = 0.0 # <<<<<<<<<<<<<< @@ -4962,7 +5011,7 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( */ __pyx_v_nrm0 = 0.0; - /* "sklearn/earth/_forward.pyx":170 + /* "sklearn/earth/_forward.pyx":173 * # Get the original norm * nrm0 = 0.0 * for i in range(self.m): # <<<<<<<<<<<<<< @@ -4973,7 +5022,7 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { __pyx_v_i = __pyx_t_10; - /* "sklearn/earth/_forward.pyx":171 + /* "sklearn/earth/_forward.pyx":174 * nrm0 = 0.0 * for i in range(self.m): * nrm0 += B_orth[i, k] * B_orth[i, k] # <<<<<<<<<<<<<< @@ -4987,7 +5036,7 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( __pyx_v_nrm0 = (__pyx_v_nrm0 + ((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_11, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_12, __pyx_pybuffernd_B_orth.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_13, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_14, __pyx_pybuffernd_B_orth.diminfo[1].strides)))); } - /* "sklearn/earth/_forward.pyx":172 + /* "sklearn/earth/_forward.pyx":175 * for i in range(self.m): * nrm0 += B_orth[i, k] * B_orth[i, k] * nrm0 = sqrt(nrm0) # <<<<<<<<<<<<<< @@ -4996,7 +5045,7 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( */ __pyx_v_nrm0 = sqrt(__pyx_v_nrm0); - /* "sklearn/earth/_forward.pyx":175 + /* "sklearn/earth/_forward.pyx":178 * * # Orthogonalize * if k > 0: # <<<<<<<<<<<<<< @@ -5006,7 +5055,7 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( __pyx_t_15 = ((__pyx_v_k > 0) != 0); if (__pyx_t_15) { - /* "sklearn/earth/_forward.pyx":176 + /* "sklearn/earth/_forward.pyx":179 * # Orthogonalize * if k > 0: * for i in range(k): # <<<<<<<<<<<<<< @@ -5017,7 +5066,7 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { __pyx_v_i = __pyx_t_10; - /* "sklearn/earth/_forward.pyx":177 + /* "sklearn/earth/_forward.pyx":180 * if k > 0: * for i in range(k): * dot_prod = 0.0 # <<<<<<<<<<<<<< @@ -5026,7 +5075,7 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( */ __pyx_v_dot_prod = 0.0; - /* "sklearn/earth/_forward.pyx":178 + /* "sklearn/earth/_forward.pyx":181 * for i in range(k): * dot_prod = 0.0 * for j in range(self.m): # <<<<<<<<<<<<<< @@ -5037,7 +5086,7 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { __pyx_v_j = __pyx_t_17; - /* "sklearn/earth/_forward.pyx":179 + /* "sklearn/earth/_forward.pyx":182 * dot_prod = 0.0 * for j in range(self.m): * dot_prod += B_orth[j, k] * B_orth[j, i] # <<<<<<<<<<<<<< @@ -5051,7 +5100,7 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( __pyx_v_dot_prod = (__pyx_v_dot_prod + ((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_B_orth.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_B_orth.diminfo[1].strides)))); } - /* "sklearn/earth/_forward.pyx":180 + /* "sklearn/earth/_forward.pyx":183 * for j in range(self.m): * dot_prod += B_orth[j, k] * B_orth[j, i] * for j in range(self.m): # <<<<<<<<<<<<<< @@ -5062,7 +5111,7 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { __pyx_v_j = __pyx_t_17; - /* "sklearn/earth/_forward.pyx":181 + /* "sklearn/earth/_forward.pyx":184 * dot_prod += B_orth[j, k] * B_orth[j, i] * for j in range(self.m): * B_orth[j, k] -= B_orth[j, i] * dot_prod # <<<<<<<<<<<<<< @@ -5080,7 +5129,7 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( } __pyx_L5:; - /* "sklearn/earth/_forward.pyx":184 + /* "sklearn/earth/_forward.pyx":187 * * # Normalize * nrm = 0.0 # <<<<<<<<<<<<<< @@ -5089,7 +5138,7 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( */ __pyx_v_nrm = 0.0; - /* "sklearn/earth/_forward.pyx":185 + /* "sklearn/earth/_forward.pyx":188 * # Normalize * nrm = 0.0 * for i in range(self.m): # <<<<<<<<<<<<<< @@ -5100,7 +5149,7 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { __pyx_v_i = __pyx_t_10; - /* "sklearn/earth/_forward.pyx":186 + /* "sklearn/earth/_forward.pyx":189 * nrm = 0.0 * for i in range(self.m): * nrm += B_orth[i, k] * B_orth[i, k] # <<<<<<<<<<<<<< @@ -5114,7 +5163,7 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( __pyx_v_nrm = (__pyx_v_nrm + ((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_17, __pyx_pybuffernd_B_orth.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_B_orth.diminfo[1].strides)))); } - /* "sklearn/earth/_forward.pyx":187 + /* "sklearn/earth/_forward.pyx":190 * for i in range(self.m): * nrm += B_orth[i, k] * B_orth[i, k] * nrm = sqrt(nrm) # <<<<<<<<<<<<<< @@ -5123,7 +5172,7 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( */ __pyx_v_nrm = sqrt(__pyx_v_nrm); - /* "sklearn/earth/_forward.pyx":188 + /* "sklearn/earth/_forward.pyx":191 * nrm += B_orth[i, k] * B_orth[i, k] * nrm = sqrt(nrm) * norms[k] = nrm # <<<<<<<<<<<<<< @@ -5133,7 +5182,7 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( __pyx_t_9 = __pyx_v_k; *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_norms.rcbuffer->pybuffer.buf, __pyx_t_9, __pyx_pybuffernd_norms.diminfo[0].strides) = __pyx_v_nrm; - /* "sklearn/earth/_forward.pyx":190 + /* "sklearn/earth/_forward.pyx":193 * norms[k] = nrm * * if nrm0 <= self.zero_tol or nrm / nrm0 <= self.zero_tol: # <<<<<<<<<<<<<< @@ -5149,7 +5198,7 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( } if (__pyx_t_29) { - /* "sklearn/earth/_forward.pyx":191 + /* "sklearn/earth/_forward.pyx":194 * * if nrm0 <= self.zero_tol or nrm / nrm0 <= self.zero_tol: * for i in range(self.m): # <<<<<<<<<<<<<< @@ -5160,7 +5209,7 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( for (__pyx_t_30 = 0; __pyx_t_30 < __pyx_t_10; __pyx_t_30+=1) { __pyx_v_i = __pyx_t_30; - /* "sklearn/earth/_forward.pyx":192 + /* "sklearn/earth/_forward.pyx":195 * if nrm0 <= self.zero_tol or nrm / nrm0 <= self.zero_tol: * for i in range(self.m): * B_orth[i, k] = 0.0 # <<<<<<<<<<<<<< @@ -5172,7 +5221,7 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( *__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_32, __pyx_pybuffernd_B_orth.diminfo[1].strides) = 0.0; } - /* "sklearn/earth/_forward.pyx":193 + /* "sklearn/earth/_forward.pyx":196 * for i in range(self.m): * B_orth[i, k] = 0.0 * c[k] = 0.0 # <<<<<<<<<<<<<< @@ -5182,7 +5231,7 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( __pyx_t_10 = __pyx_v_k; *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_c.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_c.diminfo[0].strides) = 0.0; - /* "sklearn/earth/_forward.pyx":195 + /* "sklearn/earth/_forward.pyx":198 * c[k] = 0.0 * # The new column is in the column space of the previous columns * return 1 # <<<<<<<<<<<<<< @@ -5195,7 +5244,7 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( } __pyx_L14:; - /* "sklearn/earth/_forward.pyx":196 + /* "sklearn/earth/_forward.pyx":199 * # The new column is in the column space of the previous columns * return 1 * for i in range(self.m): # <<<<<<<<<<<<<< @@ -5206,7 +5255,7 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( for (__pyx_t_33 = 0; __pyx_t_33 < __pyx_t_30; __pyx_t_33+=1) { __pyx_v_i = __pyx_t_33; - /* "sklearn/earth/_forward.pyx":197 + /* "sklearn/earth/_forward.pyx":200 * return 1 * for i in range(self.m): * B_orth[i, k] /= nrm # <<<<<<<<<<<<<< @@ -5218,7 +5267,7 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( *__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_35, __pyx_pybuffernd_B_orth.diminfo[1].strides) /= __pyx_v_nrm; } - /* "sklearn/earth/_forward.pyx":200 + /* "sklearn/earth/_forward.pyx":203 * * # Update c * c[k] = 0.0 # <<<<<<<<<<<<<< @@ -5228,7 +5277,7 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( __pyx_t_30 = __pyx_v_k; *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_c.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_c.diminfo[0].strides) = 0.0; - /* "sklearn/earth/_forward.pyx":201 + /* "sklearn/earth/_forward.pyx":204 * # Update c * c[k] = 0.0 * for i in range(self.m): # <<<<<<<<<<<<<< @@ -5239,7 +5288,7 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( for (__pyx_t_36 = 0; __pyx_t_36 < __pyx_t_33; __pyx_t_36+=1) { __pyx_v_i = __pyx_t_36; - /* "sklearn/earth/_forward.pyx":202 + /* "sklearn/earth/_forward.pyx":205 * c[k] = 0.0 * for i in range(self.m): * c[k] += B_orth[i, k] * y[i] # <<<<<<<<<<<<<< @@ -5253,7 +5302,7 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_c.rcbuffer->pybuffer.buf, __pyx_t_40, __pyx_pybuffernd_c.diminfo[0].strides) += ((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_38, __pyx_pybuffernd_B_orth.diminfo[1].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_39, __pyx_pybuffernd_y.diminfo[0].strides))); } - /* "sklearn/earth/_forward.pyx":203 + /* "sklearn/earth/_forward.pyx":206 * for i in range(self.m): * c[k] += B_orth[i, k] * y[i] * self.c_squared += c[k] ** 2 # <<<<<<<<<<<<<< @@ -5263,7 +5312,7 @@ static int __pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_update( __pyx_t_33 = __pyx_v_k; __pyx_v_self->c_squared = (__pyx_v_self->c_squared + pow((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_c.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_c.diminfo[0].strides)), 2.0)); - /* "sklearn/earth/_forward.pyx":205 + /* "sklearn/earth/_forward.pyx":208 * self.c_squared += c[k] ** 2 * * return 0 # No problems # <<<<<<<<<<<<<< @@ -5315,7 +5364,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_11orthonorma __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("orthonormal_update (wrapper)", 0); assert(__pyx_arg_k); { - __pyx_v_k = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_arg_k); if (unlikely((__pyx_v_k == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_k = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_arg_k); if (unlikely((__pyx_v_k == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -5328,7 +5377,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_11orthonorma return __pyx_r; } -/* "sklearn/earth/_forward.pyx":152 +/* "sklearn/earth/_forward.pyx":155 * return False * * cpdef int orthonormal_update(ForwardPasser self, INDEX_t k): # <<<<<<<<<<<<<< @@ -5345,7 +5394,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_10orthonorma int __pyx_clineno = 0; __Pyx_RefNannySetupContext("orthonormal_update", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_update(__pyx_v_self, __pyx_v_k, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_update(__pyx_v_self, __pyx_v_k, 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -5363,7 +5412,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_10orthonorma return __pyx_r; } -/* "sklearn/earth/_forward.pyx":207 +/* "sklearn/earth/_forward.pyx":210 * return 0 # No problems * * cpdef orthonormal_downdate(ForwardPasser self, INDEX_t k): # <<<<<<<<<<<<<< @@ -5387,18 +5436,18 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_d if (unlikely(__pyx_skip_dispatch)) ; /* Check if overridden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_7); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(((PyObject *)__pyx_v_self), __pyx_n_s_10); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (PyCFunction)__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_13orthonormal_downdate)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; @@ -5409,25 +5458,25 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_orthonormal_d __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "sklearn/earth/_forward.pyx":214 + /* "sklearn/earth/_forward.pyx":217 * can simply be ignored until they are overwritten). * ''' * self.c_squared -= self.c[k] ** 2 # <<<<<<<<<<<<<< * * def trace(self): */ - __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->c_squared); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_self->c_squared); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->c), __pyx_v_k, sizeof(__pyx_t_7sklearn_5earth_8_forward_INDEX_t)+1, __Pyx_PyInt_to_py_npy_ulonglong, 0, 0, 0); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->c), __pyx_v_k, sizeof(__pyx_t_7sklearn_5earth_8_forward_INDEX_t)+1, __Pyx_PyInt_to_py_npy_ulonglong, 0, 0, 0); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Power(__pyx_t_2, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Power(__pyx_t_2, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_InPlaceSubtract(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_InPlaceSubtract(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_4 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_v_self->c_squared = __pyx_t_4; @@ -5457,7 +5506,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_13orthonorma __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("orthonormal_downdate (wrapper)", 0); assert(__pyx_arg_k); { - __pyx_v_k = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_arg_k); if (unlikely((__pyx_v_k == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_k = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_arg_k); if (unlikely((__pyx_v_k == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -5470,7 +5519,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_13orthonorma return __pyx_r; } -/* "sklearn/earth/_forward.pyx":207 +/* "sklearn/earth/_forward.pyx":210 * return 0 # No problems * * cpdef orthonormal_downdate(ForwardPasser self, INDEX_t k): # <<<<<<<<<<<<<< @@ -5487,7 +5536,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_12orthonorma int __pyx_clineno = 0; __Pyx_RefNannySetupContext("orthonormal_downdate", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_downdate(__pyx_v_self, __pyx_v_k, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_downdate(__pyx_v_self, __pyx_v_k, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -5516,7 +5565,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_8_forward_13ForwardPasser_15trace(PyOb return __pyx_r; } -/* "sklearn/earth/_forward.pyx":216 +/* "sklearn/earth/_forward.pyx":219 * self.c_squared -= self.c[k] ** 2 * * def trace(self): # <<<<<<<<<<<<<< @@ -5529,7 +5578,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_14trace(stru __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("trace", 0); - /* "sklearn/earth/_forward.pyx":217 + /* "sklearn/earth/_forward.pyx":220 * * def trace(self): * return self.record # <<<<<<<<<<<<<< @@ -5548,7 +5597,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_8_forward_13ForwardPasser_14trace(stru return __pyx_r; } -/* "sklearn/earth/_forward.pyx":219 +/* "sklearn/earth/_forward.pyx":222 * return self.record * * cdef next_pair(ForwardPasser self): # <<<<<<<<<<<<<< @@ -5589,6 +5638,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str CYTHON_UNUSED PyArrayObject *__pyx_v_y = 0; PyArrayObject *__pyx_v_linear_variables = 0; PyArrayObject *__pyx_v_sorting = 0; + PyArrayObject *__pyx_v_sample_weight = 0; PyObject *__pyx_v_label = NULL; __Pyx_LocalBuf_ND __pyx_pybuffernd_B; __Pyx_Buffer __pyx_pybuffer_B; @@ -5600,6 +5650,8 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str __Pyx_Buffer __pyx_pybuffer_candidates_idx; __Pyx_LocalBuf_ND __pyx_pybuffernd_linear_variables; __Pyx_Buffer __pyx_pybuffer_linear_variables; + __Pyx_LocalBuf_ND __pyx_pybuffernd_sample_weight; + __Pyx_Buffer __pyx_pybuffer_sample_weight; __Pyx_LocalBuf_ND __pyx_pybuffernd_sorting; __Pyx_Buffer __pyx_pybuffer_sorting; __Pyx_LocalBuf_ND __pyx_pybuffernd_y; @@ -5614,13 +5666,13 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str PyArrayObject *__pyx_t_6 = NULL; PyArrayObject *__pyx_t_7 = NULL; PyArrayObject *__pyx_t_8 = NULL; - int __pyx_t_9; - PyObject *__pyx_t_10 = NULL; - __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_11; + PyArrayObject *__pyx_t_9 = NULL; + int __pyx_t_10; + PyObject *__pyx_t_11 = NULL; __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_12; - PyObject *__pyx_t_13 = NULL; + int __pyx_t_13; __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_14; - __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_15; + PyObject *__pyx_t_15 = NULL; __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_16; __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_17; __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_18; @@ -5633,16 +5685,17 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_25; __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_26; __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_27; - PyObject *__pyx_t_28 = NULL; - int __pyx_t_29; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_28; + __pyx_t_7sklearn_5earth_8_forward_INDEX_t __pyx_t_29; PyObject *__pyx_t_30 = NULL; PyObject *__pyx_t_31 = NULL; PyObject *__pyx_t_32 = NULL; - Py_ssize_t __pyx_t_33; - PyObject *__pyx_t_34 = NULL; - int __pyx_t_35; - int __pyx_t_36; - PyObject *__pyx_t_37 = NULL; + PyObject *__pyx_t_33 = NULL; + int __pyx_t_34; + Py_ssize_t __pyx_t_35; + PyObject *__pyx_t_36 = NULL; + int __pyx_t_37; + PyObject *__pyx_t_38 = NULL; int __pyx_lineno = 0; const char *__pyx_filename = NULL; int __pyx_clineno = 0; @@ -5675,8 +5728,12 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str __pyx_pybuffer_sorting.refcount = 0; __pyx_pybuffernd_sorting.data = NULL; __pyx_pybuffernd_sorting.rcbuffer = &__pyx_pybuffer_sorting; + __pyx_pybuffer_sample_weight.pybuffer.buf = NULL; + __pyx_pybuffer_sample_weight.refcount = 0; + __pyx_pybuffernd_sample_weight.data = NULL; + __pyx_pybuffernd_sample_weight.rcbuffer = &__pyx_pybuffer_sample_weight; - /* "sklearn/earth/_forward.pyx":235 + /* "sklearn/earth/_forward.pyx":238 * cdef BasisFunction parent_choice * cdef INDEX_t variable_choice * cdef bint first = True # <<<<<<<<<<<<<< @@ -5685,7 +5742,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str */ __pyx_v_first = 1; - /* "sklearn/earth/_forward.pyx":238 + /* "sklearn/earth/_forward.pyx":241 * cdef BasisFunction bf1 * cdef BasisFunction bf2 * cdef INDEX_t k = len(self.basis) # <<<<<<<<<<<<<< @@ -5694,11 +5751,11 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str */ __pyx_t_1 = ((PyObject *)__pyx_v_self->basis); __Pyx_INCREF(__pyx_t_1); - __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 238; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 241; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_k = __pyx_t_2; - /* "sklearn/earth/_forward.pyx":242 + /* "sklearn/earth/_forward.pyx":245 * cdef bint linear_dependence * cdef bint dependent * cdef FLOAT_t gcv_factor_k_plus_1 = gcv_adjust(k + 1, self.m, self.penalty) # <<<<<<<<<<<<<< @@ -5707,7 +5764,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str */ __pyx_v_gcv_factor_k_plus_1 = __pyx_f_7sklearn_5earth_5_util_gcv_adjust((__pyx_v_k + 1), __pyx_v_self->m, __pyx_v_self->penalty, 0); - /* "sklearn/earth/_forward.pyx":243 + /* "sklearn/earth/_forward.pyx":246 * cdef bint dependent * cdef FLOAT_t gcv_factor_k_plus_1 = gcv_adjust(k + 1, self.m, self.penalty) * cdef FLOAT_t gcv_factor_k_plus_2 = gcv_adjust(k + 2, self.m, self.penalty) # <<<<<<<<<<<<<< @@ -5716,7 +5773,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str */ __pyx_v_gcv_factor_k_plus_2 = __pyx_f_7sklearn_5earth_5_util_gcv_adjust((__pyx_v_k + 2), __pyx_v_self->m, __pyx_v_self->penalty, 0); - /* "sklearn/earth/_forward.pyx":248 + /* "sklearn/earth/_forward.pyx":251 * cdef INDEX_t i * * cdef cnp.ndarray[FLOAT_t, ndim = 2] X = self.X # <<<<<<<<<<<<<< @@ -5728,7 +5785,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { __pyx_v_X = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; } } @@ -5736,7 +5793,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->X))); __pyx_v_X = ((PyArrayObject *)__pyx_v_self->X); - /* "sklearn/earth/_forward.pyx":249 + /* "sklearn/earth/_forward.pyx":252 * * cdef cnp.ndarray[FLOAT_t, ndim = 2] X = self.X * cdef cnp.ndarray[FLOAT_t, ndim = 2] B = self.B # <<<<<<<<<<<<<< @@ -5748,7 +5805,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { __pyx_v_B = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_B.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_B.diminfo[0].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B.diminfo[0].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B.diminfo[1].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B.diminfo[1].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[1]; } } @@ -5756,7 +5813,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->B))); __pyx_v_B = ((PyArrayObject *)__pyx_v_self->B); - /* "sklearn/earth/_forward.pyx":250 + /* "sklearn/earth/_forward.pyx":253 * cdef cnp.ndarray[FLOAT_t, ndim = 2] X = self.X * cdef cnp.ndarray[FLOAT_t, ndim = 2] B = self.B * cdef cnp.ndarray[FLOAT_t, ndim = 2] B_orth = self.B_orth # <<<<<<<<<<<<<< @@ -5768,7 +5825,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B_orth.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) { __pyx_v_B_orth = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 250; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_B_orth.diminfo[0].strides = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B_orth.diminfo[0].shape = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B_orth.diminfo[1].strides = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B_orth.diminfo[1].shape = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.shape[1]; } } @@ -5776,7 +5833,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->B_orth))); __pyx_v_B_orth = ((PyArrayObject *)__pyx_v_self->B_orth); - /* "sklearn/earth/_forward.pyx":251 + /* "sklearn/earth/_forward.pyx":254 * cdef cnp.ndarray[FLOAT_t, ndim = 2] B = self.B * cdef cnp.ndarray[FLOAT_t, ndim = 2] B_orth = self.B_orth * cdef cnp.ndarray[FLOAT_t, ndim = 1] y = self.y # <<<<<<<<<<<<<< @@ -5788,7 +5845,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_y = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_y.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_y.diminfo[0].strides = __pyx_pybuffernd_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y.diminfo[0].shape = __pyx_pybuffernd_y.rcbuffer->pybuffer.shape[0]; } } @@ -5796,19 +5853,19 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->y))); __pyx_v_y = ((PyArrayObject *)__pyx_v_self->y); - /* "sklearn/earth/_forward.pyx":252 + /* "sklearn/earth/_forward.pyx":255 * cdef cnp.ndarray[FLOAT_t, ndim = 2] B_orth = self.B_orth * cdef cnp.ndarray[FLOAT_t, ndim = 1] y = self.y * cdef cnp.ndarray[INT_t, ndim = 1] linear_variables = self.linear_variables # <<<<<<<<<<<<<< * cdef cnp.ndarray[INT_t, ndim = 1] sorting = self.sorting - * + * cdef cnp.ndarray[FLOAT_t, ndim = 1] sample_weight = self.sample_weight */ __pyx_t_7 = ((PyArrayObject *)__pyx_v_self->linear_variables); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_linear_variables.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_linear_variables = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_linear_variables.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_linear_variables.diminfo[0].strides = __pyx_pybuffernd_linear_variables.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_linear_variables.diminfo[0].shape = __pyx_pybuffernd_linear_variables.rcbuffer->pybuffer.shape[0]; } } @@ -5816,19 +5873,19 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->linear_variables))); __pyx_v_linear_variables = ((PyArrayObject *)__pyx_v_self->linear_variables); - /* "sklearn/earth/_forward.pyx":253 + /* "sklearn/earth/_forward.pyx":256 * cdef cnp.ndarray[FLOAT_t, ndim = 1] y = self.y * cdef cnp.ndarray[INT_t, ndim = 1] linear_variables = self.linear_variables * cdef cnp.ndarray[INT_t, ndim = 1] sorting = self.sorting # <<<<<<<<<<<<<< + * cdef cnp.ndarray[FLOAT_t, ndim = 1] sample_weight = self.sample_weight * - * if self.endspan < 0: */ __pyx_t_8 = ((PyArrayObject *)__pyx_v_self->sorting); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sorting.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_sorting = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_sorting.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_sorting.diminfo[0].strides = __pyx_pybuffernd_sorting.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sorting.diminfo[0].shape = __pyx_pybuffernd_sorting.rcbuffer->pybuffer.shape[0]; } } @@ -5836,103 +5893,135 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->sorting))); __pyx_v_sorting = ((PyArrayObject *)__pyx_v_self->sorting); - /* "sklearn/earth/_forward.pyx":255 + /* "sklearn/earth/_forward.pyx":257 + * cdef cnp.ndarray[INT_t, ndim = 1] linear_variables = self.linear_variables * cdef cnp.ndarray[INT_t, ndim = 1] sorting = self.sorting + * cdef cnp.ndarray[FLOAT_t, ndim = 1] sample_weight = self.sample_weight # <<<<<<<<<<<<<< + * + * if self.endspan < 0: + */ + __pyx_t_9 = ((PyArrayObject *)__pyx_v_self->sample_weight); + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_sample_weight.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + __pyx_v_sample_weight = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_sample_weight.rcbuffer->pybuffer.buf = NULL; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } else {__pyx_pybuffernd_sample_weight.diminfo[0].strides = __pyx_pybuffernd_sample_weight.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_sample_weight.diminfo[0].shape = __pyx_pybuffernd_sample_weight.rcbuffer->pybuffer.shape[0]; + } + } + __pyx_t_9 = 0; + __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->sample_weight))); + __pyx_v_sample_weight = ((PyArrayObject *)__pyx_v_self->sample_weight); + + /* "sklearn/earth/_forward.pyx":259 + * cdef cnp.ndarray[FLOAT_t, ndim = 1] sample_weight = self.sample_weight * * if self.endspan < 0: # <<<<<<<<<<<<<< * endspan = round(3 - log2(self.endspan_alpha / self.n)) - * + * else: */ - __pyx_t_9 = ((__pyx_v_self->endspan < 0) != 0); - if (__pyx_t_9) { + __pyx_t_10 = ((__pyx_v_self->endspan < 0) != 0); + if (__pyx_t_10) { - /* "sklearn/earth/_forward.pyx":256 + /* "sklearn/earth/_forward.pyx":260 * * if self.endspan < 0: * endspan = round(3 - log2(self.endspan_alpha / self.n)) # <<<<<<<<<<<<<< - * - * # Iterate over variables + * else: + * endspan = self.endspan */ - __pyx_t_1 = PyFloat_FromDouble((3.0 - __pyx_f_7sklearn_5earth_5_util_log2((__pyx_v_self->endspan_alpha / __pyx_v_self->n)))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble((3.0 - __pyx_f_7sklearn_5earth_5_util_log2((__pyx_v_self->endspan_alpha / __pyx_v_self->n)))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_1); + __pyx_t_11 = PyTuple_New(1); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_round, ((PyObject *)__pyx_t_10), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_round, ((PyObject *)__pyx_t_11), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - __pyx_t_11 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_11 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; + __pyx_t_12 = __Pyx_PyInt_from_py_npy_ulonglong(__pyx_t_1); if (unlikely((__pyx_t_12 == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_v_endspan = __pyx_t_11; + __pyx_v_endspan = __pyx_t_12; goto __pyx_L3; } + /*else*/ { + + /* "sklearn/earth/_forward.pyx":262 + * endspan = round(3 - log2(self.endspan_alpha / self.n)) + * else: + * endspan = self.endspan # <<<<<<<<<<<<<< + * + * # Iterate over variables + */ + __pyx_t_13 = __pyx_v_self->endspan; + __pyx_v_endspan = __pyx_t_13; + } __pyx_L3:; - /* "sklearn/earth/_forward.pyx":259 + /* "sklearn/earth/_forward.pyx":265 * * # Iterate over variables * for variable in range(self.n): # <<<<<<<<<<<<<< * * # Sort the data */ - __pyx_t_11 = __pyx_v_self->n; - for (__pyx_t_12 = 0; __pyx_t_12 < __pyx_t_11; __pyx_t_12+=1) { - __pyx_v_variable = __pyx_t_12; + __pyx_t_12 = __pyx_v_self->n; + for (__pyx_t_14 = 0; __pyx_t_14 < __pyx_t_12; __pyx_t_14+=1) { + __pyx_v_variable = __pyx_t_14; - /* "sklearn/earth/_forward.pyx":263 + /* "sklearn/earth/_forward.pyx":269 * # Sort the data * # TODO: eliminate Python call / data copy * sorting[:] = np.argsort(X[:, variable])[::-1] # <<<<<<<<<<<<<< * * # Iterate over parents */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__argsort); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__argsort); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_13 = PyTuple_New(2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_13); - __Pyx_INCREF(__pyx_k_slice_8); - PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_k_slice_8); - __Pyx_GIVEREF(__pyx_k_slice_8); - PyTuple_SET_ITEM(__pyx_t_13, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_X), ((PyObject *)__pyx_t_13)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PyTuple_New(2); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_INCREF(__pyx_k_slice_11); + PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_k_slice_11); + __Pyx_GIVEREF(__pyx_k_slice_11); + PyTuple_SET_ITEM(__pyx_t_15, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_X), ((PyObject *)__pyx_t_15)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; - __pyx_t_13 = PyTuple_New(1); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_13); - PyTuple_SET_ITEM(__pyx_t_13, 0, __pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; + __pyx_t_15 = PyTuple_New(1); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + PyTuple_SET_ITEM(__pyx_t_15, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_13), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_15), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_13)); __pyx_t_13 = 0; - __pyx_t_13 = PyObject_GetItem(__pyx_t_1, __pyx_k_slice_9); if (!__pyx_t_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_13); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_15)); __pyx_t_15 = 0; + __pyx_t_15 = PyObject_GetItem(__pyx_t_1, __pyx_k_slice_12); if (!__pyx_t_15) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__Pyx_PyObject_SetSlice(((PyObject *)__pyx_v_sorting), __pyx_t_13, 0, 0, NULL, NULL, &__pyx_k_slice_10, 0, 0, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + if (__Pyx_PyObject_SetSlice(((PyObject *)__pyx_v_sorting), __pyx_t_15, 0, 0, NULL, NULL, &__pyx_k_slice_13, 0, 0, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; - /* "sklearn/earth/_forward.pyx":266 + /* "sklearn/earth/_forward.pyx":272 * * # Iterate over parents * for parent_idx in range(k): # <<<<<<<<<<<<<< * linear_dependence = False * */ - __pyx_t_14 = __pyx_v_k; - for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { - __pyx_v_parent_idx = __pyx_t_15; + __pyx_t_16 = __pyx_v_k; + for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { + __pyx_v_parent_idx = __pyx_t_17; - /* "sklearn/earth/_forward.pyx":267 + /* "sklearn/earth/_forward.pyx":273 * # Iterate over parents * for parent_idx in range(k): * linear_dependence = False # <<<<<<<<<<<<<< @@ -5941,30 +6030,29 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str */ __pyx_v_linear_dependence = 0; - /* "sklearn/earth/_forward.pyx":269 + /* "sklearn/earth/_forward.pyx":275 * linear_dependence = False * * parent = self.basis.get(parent_idx) # <<<<<<<<<<<<<< * if self.max_degree >= 0: * parent_degree = parent.degree() */ - __pyx_t_13 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->get(__pyx_v_self->basis, __pyx_v_parent_idx, 0)); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_13); - __Pyx_XDECREF(((PyObject *)__pyx_v_parent)); - __pyx_v_parent = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_13); - __pyx_t_13 = 0; + __pyx_t_15 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->get(__pyx_v_self->basis, __pyx_v_parent_idx, 0)); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 275; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_XDECREF_SET(__pyx_v_parent, ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_15)); + __pyx_t_15 = 0; - /* "sklearn/earth/_forward.pyx":270 + /* "sklearn/earth/_forward.pyx":276 * * parent = self.basis.get(parent_idx) * if self.max_degree >= 0: # <<<<<<<<<<<<<< * parent_degree = parent.degree() * if parent_degree >= self.max_degree: */ - __pyx_t_9 = ((__pyx_v_self->max_degree >= 0) != 0); - if (__pyx_t_9) { + __pyx_t_10 = ((__pyx_v_self->max_degree >= 0) != 0); + if (__pyx_t_10) { - /* "sklearn/earth/_forward.pyx":271 + /* "sklearn/earth/_forward.pyx":277 * parent = self.basis.get(parent_idx) * if self.max_degree >= 0: * parent_degree = parent.degree() # <<<<<<<<<<<<<< @@ -5973,17 +6061,17 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str */ __pyx_v_parent_degree = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_parent->__pyx_vtab)->degree(__pyx_v_parent, 0); - /* "sklearn/earth/_forward.pyx":272 + /* "sklearn/earth/_forward.pyx":278 * if self.max_degree >= 0: * parent_degree = parent.degree() * if parent_degree >= self.max_degree: # <<<<<<<<<<<<<< * continue * if not parent.is_splittable(): */ - __pyx_t_9 = ((__pyx_v_parent_degree >= __pyx_v_self->max_degree) != 0); - if (__pyx_t_9) { + __pyx_t_10 = ((__pyx_v_parent_degree >= __pyx_v_self->max_degree) != 0); + if (__pyx_t_10) { - /* "sklearn/earth/_forward.pyx":273 + /* "sklearn/earth/_forward.pyx":279 * parent_degree = parent.degree() * if parent_degree >= self.max_degree: * continue # <<<<<<<<<<<<<< @@ -5998,17 +6086,17 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str } __pyx_L8:; - /* "sklearn/earth/_forward.pyx":274 + /* "sklearn/earth/_forward.pyx":280 * if parent_degree >= self.max_degree: * continue * if not parent.is_splittable(): # <<<<<<<<<<<<<< * continue * */ - __pyx_t_9 = ((!(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_parent->__pyx_vtab)->is_splittable(__pyx_v_parent, 0) != 0)) != 0); - if (__pyx_t_9) { + __pyx_t_10 = ((!(((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_parent->__pyx_vtab)->is_splittable(__pyx_v_parent, 0) != 0)) != 0); + if (__pyx_t_10) { - /* "sklearn/earth/_forward.pyx":275 + /* "sklearn/earth/_forward.pyx":281 * continue * if not parent.is_splittable(): * continue # <<<<<<<<<<<<<< @@ -6020,59 +6108,59 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str } __pyx_L10:; - /* "sklearn/earth/_forward.pyx":278 + /* "sklearn/earth/_forward.pyx":284 * * # Add the linear term to B * for i in range(self.m): # <<<<<<<<<<<<<< * B[i, k] = B[i, parent_idx] * X[i, variable] * */ - __pyx_t_16 = __pyx_v_self->m; - for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { - __pyx_v_i = __pyx_t_17; + __pyx_t_18 = __pyx_v_self->m; + for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { + __pyx_v_i = __pyx_t_19; - /* "sklearn/earth/_forward.pyx":279 + /* "sklearn/earth/_forward.pyx":285 * # Add the linear term to B * for i in range(self.m): * B[i, k] = B[i, parent_idx] * X[i, variable] # <<<<<<<<<<<<<< * * # Orthonormalize */ - __pyx_t_18 = __pyx_v_i; - __pyx_t_19 = __pyx_v_parent_idx; __pyx_t_20 = __pyx_v_i; - __pyx_t_21 = __pyx_v_variable; + __pyx_t_21 = __pyx_v_parent_idx; __pyx_t_22 = __pyx_v_i; - __pyx_t_23 = __pyx_v_k; - *__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_B.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_B.diminfo[1].strides) = ((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_B.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_B.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_X.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_X.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_X.diminfo[1].strides))); + __pyx_t_23 = __pyx_v_variable; + __pyx_t_24 = __pyx_v_i; + __pyx_t_25 = __pyx_v_k; + *__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_B.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_B.diminfo[1].strides) = ((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B.rcbuffer->pybuffer.buf, __pyx_t_20, __pyx_pybuffernd_B.diminfo[0].strides, __pyx_t_21, __pyx_pybuffernd_B.diminfo[1].strides)) * (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_X.rcbuffer->pybuffer.buf, __pyx_t_22, __pyx_pybuffernd_X.diminfo[0].strides, __pyx_t_23, __pyx_pybuffernd_X.diminfo[1].strides))); } - /* "sklearn/earth/_forward.pyx":282 + /* "sklearn/earth/_forward.pyx":288 * * # Orthonormalize * for i in range(self.m): # <<<<<<<<<<<<<< * B_orth[i, k] = B[i, k] * linear_dependence = self.orthonormal_update(k) */ - __pyx_t_16 = __pyx_v_self->m; - for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { - __pyx_v_i = __pyx_t_17; + __pyx_t_18 = __pyx_v_self->m; + for (__pyx_t_19 = 0; __pyx_t_19 < __pyx_t_18; __pyx_t_19+=1) { + __pyx_v_i = __pyx_t_19; - /* "sklearn/earth/_forward.pyx":283 + /* "sklearn/earth/_forward.pyx":289 * # Orthonormalize * for i in range(self.m): * B_orth[i, k] = B[i, k] # <<<<<<<<<<<<<< * linear_dependence = self.orthonormal_update(k) * */ - __pyx_t_24 = __pyx_v_i; - __pyx_t_25 = __pyx_v_k; __pyx_t_26 = __pyx_v_i; __pyx_t_27 = __pyx_v_k; - *__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_B_orth.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_B.diminfo[0].strides, __pyx_t_25, __pyx_pybuffernd_B.diminfo[1].strides)); + __pyx_t_28 = __pyx_v_i; + __pyx_t_29 = __pyx_v_k; + *__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_29, __pyx_pybuffernd_B_orth.diminfo[1].strides) = (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_B.diminfo[0].strides, __pyx_t_27, __pyx_pybuffernd_B.diminfo[1].strides)); } - /* "sklearn/earth/_forward.pyx":284 + /* "sklearn/earth/_forward.pyx":290 * for i in range(self.m): * B_orth[i, k] = B[i, k] * linear_dependence = self.orthonormal_update(k) # <<<<<<<<<<<<<< @@ -6081,16 +6169,16 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str */ __pyx_v_linear_dependence = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_update(__pyx_v_self, __pyx_v_k, 0); - /* "sklearn/earth/_forward.pyx":291 - * # another term never increases, but the gcv may because it penalizes additional - * # terms. + /* "sklearn/earth/_forward.pyx":297 + * # with another term never increases, but the gcv may because it penalizes + * # additional terms. * mse_ = (self.y_squared - self.c_squared) / self.m # <<<<<<<<<<<<<< * gcv_ = gcv_factor_k_plus_1 * \ * (self.y_squared - self.c_squared) / self.m */ __pyx_v_mse_ = ((__pyx_v_self->y_squared - __pyx_v_self->c_squared) / __pyx_v_self->m); - /* "sklearn/earth/_forward.pyx":293 + /* "sklearn/earth/_forward.pyx":299 * mse_ = (self.y_squared - self.c_squared) / self.m * gcv_ = gcv_factor_k_plus_1 * \ * (self.y_squared - self.c_squared) / self.m # <<<<<<<<<<<<<< @@ -6099,18 +6187,18 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str */ __pyx_v_gcv_ = ((__pyx_v_gcv_factor_k_plus_1 * (__pyx_v_self->y_squared - __pyx_v_self->c_squared)) / __pyx_v_self->m); - /* "sklearn/earth/_forward.pyx":295 + /* "sklearn/earth/_forward.pyx":301 * (self.y_squared - self.c_squared) / self.m * * if linear_variables[variable]: # <<<<<<<<<<<<<< * mse = mse_ * knot_idx = -1 */ - __pyx_t_16 = __pyx_v_variable; - __pyx_t_9 = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_INT_t *, __pyx_pybuffernd_linear_variables.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_linear_variables.diminfo[0].strides)) != 0); - if (__pyx_t_9) { + __pyx_t_18 = __pyx_v_variable; + __pyx_t_10 = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_INT_t *, __pyx_pybuffernd_linear_variables.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_linear_variables.diminfo[0].strides)) != 0); + if (__pyx_t_10) { - /* "sklearn/earth/_forward.pyx":296 + /* "sklearn/earth/_forward.pyx":302 * * if linear_variables[variable]: * mse = mse_ # <<<<<<<<<<<<<< @@ -6119,7 +6207,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str */ __pyx_v_mse = __pyx_v_mse_; - /* "sklearn/earth/_forward.pyx":297 + /* "sklearn/earth/_forward.pyx":303 * if linear_variables[variable]: * mse = mse_ * knot_idx = -1 # <<<<<<<<<<<<<< @@ -6131,119 +6219,123 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str } /*else*/ { - /* "sklearn/earth/_forward.pyx":301 + /* "sklearn/earth/_forward.pyx":307 * * # Find the valid knot candidates * candidates_idx = parent.valid_knots(B[sorting, parent_idx], X[ # <<<<<<<<<<<<<< * sorting, variable], variable, self.check_every, endspan, self.minspan, self.minspan_alpha, self.n, self.mwork) * */ - __pyx_t_13 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_parent_idx); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_parent_idx); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_sorting)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_sorting)); __Pyx_GIVEREF(((PyObject *)__pyx_v_sorting)); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_13); - __Pyx_GIVEREF(__pyx_t_13); - __pyx_t_13 = 0; - __pyx_t_13 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_1)); if (!__pyx_t_13) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_13); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_15); + __Pyx_GIVEREF(__pyx_t_15); + __pyx_t_15 = 0; + __pyx_t_15 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_1)); if (!__pyx_t_15) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_13) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_13, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_15) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_15, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "sklearn/earth/_forward.pyx":302 + /* "sklearn/earth/_forward.pyx":308 * # Find the valid knot candidates * candidates_idx = parent.valid_knots(B[sorting, parent_idx], X[ * sorting, variable], variable, self.check_every, endspan, self.minspan, self.minspan_alpha, self.n, self.mwork) # <<<<<<<<<<<<<< * * if len(candidates_idx) > 0: */ - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 302; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 308; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); __Pyx_INCREF(((PyObject *)__pyx_v_sorting)); - PyTuple_SET_ITEM(__pyx_t_10, 0, ((PyObject *)__pyx_v_sorting)); + PyTuple_SET_ITEM(__pyx_t_11, 0, ((PyObject *)__pyx_v_sorting)); __Pyx_GIVEREF(((PyObject *)__pyx_v_sorting)); - PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_X), ((PyObject *)__pyx_t_10)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_X), ((PyObject *)__pyx_t_11)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_10 = ((PyObject *)__pyx_v_self->mwork); - __Pyx_INCREF(__pyx_t_10); - __pyx_t_28 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_parent->__pyx_vtab)->valid_knots(__pyx_v_parent, ((PyArrayObject *)__pyx_t_13), ((PyArrayObject *)__pyx_t_1), __pyx_v_variable, __pyx_v_self->check_every, __pyx_v_endspan, __pyx_v_self->minspan, __pyx_v_self->minspan_alpha, __pyx_v_self->n, ((PyArrayObject *)__pyx_t_10), 0)); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_28); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = ((PyObject *)__pyx_v_self->mwork); + __Pyx_INCREF(__pyx_t_11); + __pyx_t_30 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_parent->__pyx_vtab)->valid_knots(__pyx_v_parent, ((PyArrayObject *)__pyx_t_15), ((PyArrayObject *)__pyx_t_1), __pyx_v_variable, __pyx_v_self->check_every, __pyx_v_endspan, __pyx_v_self->minspan, __pyx_v_self->minspan_alpha, __pyx_v_self->n, ((PyArrayObject *)__pyx_t_11), 0)); if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_30); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; { __Pyx_BufFmt_StackElem __pyx_stack[1]; __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_candidates_idx.rcbuffer->pybuffer); - __pyx_t_29 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_candidates_idx.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_28), &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); - if (unlikely(__pyx_t_29 < 0)) { - PyErr_Fetch(&__pyx_t_30, &__pyx_t_31, &__pyx_t_32); + __pyx_t_13 = __Pyx_GetBufferAndValidate(&__pyx_pybuffernd_candidates_idx.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_30), &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); + if (unlikely(__pyx_t_13 < 0)) { + PyErr_Fetch(&__pyx_t_31, &__pyx_t_32, &__pyx_t_33); if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_candidates_idx.rcbuffer->pybuffer, (PyObject*)__pyx_v_candidates_idx, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { - Py_XDECREF(__pyx_t_30); Py_XDECREF(__pyx_t_31); Py_XDECREF(__pyx_t_32); + Py_XDECREF(__pyx_t_31); Py_XDECREF(__pyx_t_32); Py_XDECREF(__pyx_t_33); __Pyx_RaiseBufferFallbackError(); } else { - PyErr_Restore(__pyx_t_30, __pyx_t_31, __pyx_t_32); + PyErr_Restore(__pyx_t_31, __pyx_t_32, __pyx_t_33); } } __pyx_pybuffernd_candidates_idx.diminfo[0].strides = __pyx_pybuffernd_candidates_idx.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_candidates_idx.diminfo[0].shape = __pyx_pybuffernd_candidates_idx.rcbuffer->pybuffer.shape[0]; - if (unlikely(__pyx_t_29 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 307; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __Pyx_XDECREF(((PyObject *)__pyx_v_candidates_idx)); - __pyx_v_candidates_idx = ((PyArrayObject *)__pyx_t_28); - __pyx_t_28 = 0; + __Pyx_XDECREF_SET(__pyx_v_candidates_idx, ((PyArrayObject *)__pyx_t_30)); + __pyx_t_30 = 0; - /* "sklearn/earth/_forward.pyx":304 + /* "sklearn/earth/_forward.pyx":310 * sorting, variable], variable, self.check_every, endspan, self.minspan, self.minspan_alpha, self.n, self.mwork) * * if len(candidates_idx) > 0: # <<<<<<<<<<<<<< * # Choose the best candidate (if no candidate is an * # improvement on the linear term in terms of gcv, knot_idx */ - __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_candidates_idx)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 304; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_9 = ((__pyx_t_2 > 0) != 0); - if (__pyx_t_9) { + __pyx_t_2 = PyObject_Length(((PyObject *)__pyx_v_candidates_idx)); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = ((__pyx_t_2 > 0) != 0); + if (__pyx_t_10) { - /* "sklearn/earth/_forward.pyx":311 + /* "sklearn/earth/_forward.pyx":317 * # Find the best knot location for this parent and * # variable combination * self.best_knot(parent_idx, variable, k, candidates_idx, sorting, & mse, & knot, & knot_idx) # <<<<<<<<<<<<<< * * # If the hinge function does not decrease the gcv then */ - __pyx_t_28 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->best_knot(__pyx_v_self, __pyx_v_parent_idx, __pyx_v_variable, __pyx_v_k, ((PyArrayObject *)__pyx_v_candidates_idx), ((PyArrayObject *)__pyx_v_sorting), (&__pyx_v_mse), (&__pyx_v_knot), (&__pyx_v_knot_idx)); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_28); - __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; + __pyx_t_30 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->best_knot(__pyx_v_self, __pyx_v_parent_idx, __pyx_v_variable, __pyx_v_k, ((PyArrayObject *)__pyx_v_candidates_idx), ((PyArrayObject *)__pyx_v_sorting), (&__pyx_v_mse), (&__pyx_v_knot), (&__pyx_v_knot_idx)); if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 317; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_30); + __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0; - /* "sklearn/earth/_forward.pyx":315 + /* "sklearn/earth/_forward.pyx":321 * # If the hinge function does not decrease the gcv then - * # just keep the linear term - * if gcv_factor_k_plus_2 * mse >= gcv_: # <<<<<<<<<<<<<< + * # just keep the linear term (if allow_linear is True) + * if self.allow_linear and (gcv_factor_k_plus_2 * mse >= gcv_): # <<<<<<<<<<<<<< * mse = mse_ * knot_idx = -1 */ - __pyx_t_9 = (((__pyx_v_gcv_factor_k_plus_2 * __pyx_v_mse) >= __pyx_v_gcv_) != 0); - if (__pyx_t_9) { + if ((__pyx_v_self->allow_linear != 0)) { + __pyx_t_10 = (((__pyx_v_gcv_factor_k_plus_2 * __pyx_v_mse) >= __pyx_v_gcv_) != 0); + __pyx_t_34 = __pyx_t_10; + } else { + __pyx_t_34 = (__pyx_v_self->allow_linear != 0); + } + if (__pyx_t_34) { - /* "sklearn/earth/_forward.pyx":316 - * # just keep the linear term - * if gcv_factor_k_plus_2 * mse >= gcv_: + /* "sklearn/earth/_forward.pyx":322 + * # just keep the linear term (if allow_linear is True) + * if self.allow_linear and (gcv_factor_k_plus_2 * mse >= gcv_): * mse = mse_ # <<<<<<<<<<<<<< * knot_idx = -1 * */ __pyx_v_mse = __pyx_v_mse_; - /* "sklearn/earth/_forward.pyx":317 - * if gcv_factor_k_plus_2 * mse >= gcv_: + /* "sklearn/earth/_forward.pyx":323 + * if self.allow_linear and (gcv_factor_k_plus_2 * mse >= gcv_): * mse = mse_ * knot_idx = -1 # <<<<<<<<<<<<<< * @@ -6257,18 +6349,18 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str } /*else*/ { - /* "sklearn/earth/_forward.pyx":322 + /* "sklearn/earth/_forward.pyx":328 * # Do an orthonormal downdate and skip to the next * # iteration * self.orthonormal_downdate(k) # <<<<<<<<<<<<<< * continue * */ - __pyx_t_28 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_downdate(__pyx_v_self, __pyx_v_k, 0); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 322; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_28); - __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; + __pyx_t_30 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_downdate(__pyx_v_self, __pyx_v_k, 0); if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 328; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_30); + __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0; - /* "sklearn/earth/_forward.pyx":323 + /* "sklearn/earth/_forward.pyx":329 * # iteration * self.orthonormal_downdate(k) * continue # <<<<<<<<<<<<<< @@ -6281,28 +6373,28 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str } __pyx_L15:; - /* "sklearn/earth/_forward.pyx":326 + /* "sklearn/earth/_forward.pyx":332 * * # Do an orthonormal downdate * self.orthonormal_downdate(k) # <<<<<<<<<<<<<< * * # Update the choices */ - __pyx_t_28 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_downdate(__pyx_v_self, __pyx_v_k, 0); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 326; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_28); - __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; + __pyx_t_30 = ((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_downdate(__pyx_v_self, __pyx_v_k, 0); if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 332; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_30); + __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0; - /* "sklearn/earth/_forward.pyx":329 + /* "sklearn/earth/_forward.pyx":335 * * # Update the choices * if first: # <<<<<<<<<<<<<< * knot_choice = knot * mse_choice = mse */ - __pyx_t_9 = (__pyx_v_first != 0); - if (__pyx_t_9) { + __pyx_t_34 = (__pyx_v_first != 0); + if (__pyx_t_34) { - /* "sklearn/earth/_forward.pyx":330 + /* "sklearn/earth/_forward.pyx":336 * # Update the choices * if first: * knot_choice = knot # <<<<<<<<<<<<<< @@ -6311,7 +6403,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str */ __pyx_v_knot_choice = __pyx_v_knot; - /* "sklearn/earth/_forward.pyx":331 + /* "sklearn/earth/_forward.pyx":337 * if first: * knot_choice = knot * mse_choice = mse # <<<<<<<<<<<<<< @@ -6320,7 +6412,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str */ __pyx_v_mse_choice = __pyx_v_mse; - /* "sklearn/earth/_forward.pyx":332 + /* "sklearn/earth/_forward.pyx":338 * knot_choice = knot * mse_choice = mse * knot_idx_choice = knot_idx # <<<<<<<<<<<<<< @@ -6329,7 +6421,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str */ __pyx_v_knot_idx_choice = __pyx_v_knot_idx; - /* "sklearn/earth/_forward.pyx":333 + /* "sklearn/earth/_forward.pyx":339 * mse_choice = mse * knot_idx_choice = knot_idx * parent_idx_choice = parent_idx # <<<<<<<<<<<<<< @@ -6338,7 +6430,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str */ __pyx_v_parent_idx_choice = __pyx_v_parent_idx; - /* "sklearn/earth/_forward.pyx":334 + /* "sklearn/earth/_forward.pyx":340 * knot_idx_choice = knot_idx * parent_idx_choice = parent_idx * parent_choice = parent # <<<<<<<<<<<<<< @@ -6346,10 +6438,9 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str * first = False */ __Pyx_INCREF(((PyObject *)__pyx_v_parent)); - __Pyx_XDECREF(((PyObject *)__pyx_v_parent_choice)); - __pyx_v_parent_choice = __pyx_v_parent; + __Pyx_XDECREF_SET(__pyx_v_parent_choice, __pyx_v_parent); - /* "sklearn/earth/_forward.pyx":335 + /* "sklearn/earth/_forward.pyx":341 * parent_idx_choice = parent_idx * parent_choice = parent * variable_choice = variable # <<<<<<<<<<<<<< @@ -6358,7 +6449,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str */ __pyx_v_variable_choice = __pyx_v_variable; - /* "sklearn/earth/_forward.pyx":336 + /* "sklearn/earth/_forward.pyx":342 * parent_choice = parent * variable_choice = variable * first = False # <<<<<<<<<<<<<< @@ -6367,7 +6458,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str */ __pyx_v_first = 0; - /* "sklearn/earth/_forward.pyx":337 + /* "sklearn/earth/_forward.pyx":343 * variable_choice = variable * first = False * dependent = linear_dependence # <<<<<<<<<<<<<< @@ -6379,17 +6470,17 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str } __pyx_L18:; - /* "sklearn/earth/_forward.pyx":338 + /* "sklearn/earth/_forward.pyx":344 * first = False * dependent = linear_dependence * if mse < mse_choice: # <<<<<<<<<<<<<< * knot_choice = knot * mse_choice = mse */ - __pyx_t_9 = ((__pyx_v_mse < __pyx_v_mse_choice) != 0); - if (__pyx_t_9) { + __pyx_t_34 = ((__pyx_v_mse < __pyx_v_mse_choice) != 0); + if (__pyx_t_34) { - /* "sklearn/earth/_forward.pyx":339 + /* "sklearn/earth/_forward.pyx":345 * dependent = linear_dependence * if mse < mse_choice: * knot_choice = knot # <<<<<<<<<<<<<< @@ -6398,7 +6489,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str */ __pyx_v_knot_choice = __pyx_v_knot; - /* "sklearn/earth/_forward.pyx":340 + /* "sklearn/earth/_forward.pyx":346 * if mse < mse_choice: * knot_choice = knot * mse_choice = mse # <<<<<<<<<<<<<< @@ -6407,7 +6498,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str */ __pyx_v_mse_choice = __pyx_v_mse; - /* "sklearn/earth/_forward.pyx":341 + /* "sklearn/earth/_forward.pyx":347 * knot_choice = knot * mse_choice = mse * knot_idx_choice = knot_idx # <<<<<<<<<<<<<< @@ -6416,7 +6507,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str */ __pyx_v_knot_idx_choice = __pyx_v_knot_idx; - /* "sklearn/earth/_forward.pyx":342 + /* "sklearn/earth/_forward.pyx":348 * mse_choice = mse * knot_idx_choice = knot_idx * parent_idx_choice = parent_idx # <<<<<<<<<<<<<< @@ -6425,7 +6516,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str */ __pyx_v_parent_idx_choice = __pyx_v_parent_idx; - /* "sklearn/earth/_forward.pyx":343 + /* "sklearn/earth/_forward.pyx":349 * knot_idx_choice = knot_idx * parent_idx_choice = parent_idx * parent_choice = parent # <<<<<<<<<<<<<< @@ -6433,10 +6524,9 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str * dependent = linear_dependence */ __Pyx_INCREF(((PyObject *)__pyx_v_parent)); - __Pyx_XDECREF(((PyObject *)__pyx_v_parent_choice)); - __pyx_v_parent_choice = __pyx_v_parent; + __Pyx_XDECREF_SET(__pyx_v_parent_choice, __pyx_v_parent); - /* "sklearn/earth/_forward.pyx":344 + /* "sklearn/earth/_forward.pyx":350 * parent_idx_choice = parent_idx * parent_choice = parent * variable_choice = variable # <<<<<<<<<<<<<< @@ -6445,7 +6535,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str */ __pyx_v_variable_choice = __pyx_v_variable; - /* "sklearn/earth/_forward.pyx":345 + /* "sklearn/earth/_forward.pyx":351 * parent_choice = parent * variable_choice = variable * dependent = linear_dependence # <<<<<<<<<<<<<< @@ -6460,47 +6550,47 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str } } - /* "sklearn/earth/_forward.pyx":348 + /* "sklearn/earth/_forward.pyx":354 * * # Make sure at least one candidate was checked * if first: # <<<<<<<<<<<<<< * self.record[len(self.record) - 1].set_no_candidates(True) * return */ - __pyx_t_9 = (__pyx_v_first != 0); - if (__pyx_t_9) { + __pyx_t_34 = (__pyx_v_first != 0); + if (__pyx_t_34) { - /* "sklearn/earth/_forward.pyx":349 + /* "sklearn/earth/_forward.pyx":355 * # Make sure at least one candidate was checked * if first: * self.record[len(self.record) - 1].set_no_candidates(True) # <<<<<<<<<<<<<< * return * */ - __pyx_t_28 = ((PyObject *)__pyx_v_self->record); - __Pyx_INCREF(__pyx_t_28); - __pyx_t_2 = PyObject_Length(__pyx_t_28); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; - __pyx_t_33 = (__pyx_t_2 - 1); - __pyx_t_28 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->record), __pyx_t_33, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 0, 0); if (!__pyx_t_28) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_28); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_28, __pyx_n_s__set_no_candidates); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; - __pyx_t_28 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_28); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_30 = ((PyObject *)__pyx_v_self->record); + __Pyx_INCREF(__pyx_t_30); + __pyx_t_2 = PyObject_Length(__pyx_t_30); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0; + __pyx_t_35 = (__pyx_t_2 - 1); + __pyx_t_30 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->record), __pyx_t_35, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 0, 0); if (!__pyx_t_30) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_30); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_30, __pyx_n_s__set_no_candidates); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0; + __pyx_t_30 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_30); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_28); - __Pyx_GIVEREF(__pyx_t_28); - __pyx_t_28 = 0; - __pyx_t_28 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 349; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_28); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_30); + __Pyx_GIVEREF(__pyx_t_30); + __pyx_t_30 = 0; + __pyx_t_30 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 355; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_30); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; + __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0; - /* "sklearn/earth/_forward.pyx":350 + /* "sklearn/earth/_forward.pyx":356 * if first: * self.record[len(self.record) - 1].set_no_candidates(True) * return # <<<<<<<<<<<<<< @@ -6514,20 +6604,19 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str } __pyx_L20:; - /* "sklearn/earth/_forward.pyx":353 + /* "sklearn/earth/_forward.pyx":359 * * # Add the new basis functions * parent = self.basis.get(parent_idx) # <<<<<<<<<<<<<< * label = self.xlabels[variable_choice] * if knot_idx_choice != -1: */ - __pyx_t_28 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->get(__pyx_v_self->basis, __pyx_v_parent_idx, 0)); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 353; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_28); - __Pyx_XDECREF(((PyObject *)__pyx_v_parent)); - __pyx_v_parent = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_28); - __pyx_t_28 = 0; + __pyx_t_30 = ((PyObject *)((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->get(__pyx_v_self->basis, __pyx_v_parent_idx, 0)); if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_30); + __Pyx_XDECREF_SET(__pyx_v_parent, ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_30)); + __pyx_t_30 = 0; - /* "sklearn/earth/_forward.pyx":354 + /* "sklearn/earth/_forward.pyx":360 * # Add the new basis functions * parent = self.basis.get(parent_idx) * label = self.xlabels[variable_choice] # <<<<<<<<<<<<<< @@ -6536,225 +6625,247 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str */ if (unlikely(((PyObject *)__pyx_v_self->xlabels) == Py_None)) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not subscriptable"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_28 = PyList_GET_ITEM(__pyx_v_self->xlabels, __pyx_v_variable_choice); - __Pyx_INCREF(__pyx_t_28); - __pyx_v_label = __pyx_t_28; - __pyx_t_28 = 0; + __pyx_t_30 = PyList_GET_ITEM(__pyx_v_self->xlabels, __pyx_v_variable_choice); + __Pyx_INCREF(__pyx_t_30); + __pyx_v_label = __pyx_t_30; + __pyx_t_30 = 0; - /* "sklearn/earth/_forward.pyx":355 + /* "sklearn/earth/_forward.pyx":361 * parent = self.basis.get(parent_idx) * label = self.xlabels[variable_choice] * if knot_idx_choice != -1: # <<<<<<<<<<<<<< * # Add the new basis functions * bf1 = HingeBasisFunction( */ - __pyx_t_9 = ((__pyx_v_knot_idx_choice != -1) != 0); - if (__pyx_t_9) { + __pyx_t_34 = ((__pyx_v_knot_idx_choice != -1) != 0); + if (__pyx_t_34) { - /* "sklearn/earth/_forward.pyx":358 + /* "sklearn/earth/_forward.pyx":364 * # Add the new basis functions * bf1 = HingeBasisFunction( * parent_choice, knot_choice, knot_idx_choice, variable_choice, False, label) # <<<<<<<<<<<<<< * bf2 = HingeBasisFunction( * parent_choice, knot_choice, knot_idx_choice, variable_choice, True, label) */ - if (unlikely(!__pyx_v_parent_choice)) { __Pyx_RaiseUnboundLocalError("parent_choice"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_28 = PyFloat_FromDouble(__pyx_v_knot_choice); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_28); - __pyx_t_1 = PyInt_FromLong(__pyx_v_knot_idx_choice); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_v_parent_choice)) { __Pyx_RaiseUnboundLocalError("parent_choice"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_30 = PyFloat_FromDouble(__pyx_v_knot_choice); if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_30); + __pyx_t_1 = PyInt_FromLong(__pyx_v_knot_idx_choice); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable_choice); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_13 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 358; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_34 = PyTuple_New(6); if (unlikely(!__pyx_t_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_34); + __pyx_t_11 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable_choice); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_15 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_36 = PyTuple_New(6); if (unlikely(!__pyx_t_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_36); __Pyx_INCREF(((PyObject *)__pyx_v_parent_choice)); - PyTuple_SET_ITEM(__pyx_t_34, 0, ((PyObject *)__pyx_v_parent_choice)); + PyTuple_SET_ITEM(__pyx_t_36, 0, ((PyObject *)__pyx_v_parent_choice)); __Pyx_GIVEREF(((PyObject *)__pyx_v_parent_choice)); - PyTuple_SET_ITEM(__pyx_t_34, 1, __pyx_t_28); - __Pyx_GIVEREF(__pyx_t_28); - PyTuple_SET_ITEM(__pyx_t_34, 2, __pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_36, 1, __pyx_t_30); + __Pyx_GIVEREF(__pyx_t_30); + PyTuple_SET_ITEM(__pyx_t_36, 2, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_34, 3, __pyx_t_10); - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_34, 4, __pyx_t_13); - __Pyx_GIVEREF(__pyx_t_13); + PyTuple_SET_ITEM(__pyx_t_36, 3, __pyx_t_11); + __Pyx_GIVEREF(__pyx_t_11); + PyTuple_SET_ITEM(__pyx_t_36, 4, __pyx_t_15); + __Pyx_GIVEREF(__pyx_t_15); __Pyx_INCREF(__pyx_v_label); - PyTuple_SET_ITEM(__pyx_t_34, 5, __pyx_v_label); + PyTuple_SET_ITEM(__pyx_t_36, 5, __pyx_v_label); __Pyx_GIVEREF(__pyx_v_label); - __pyx_t_28 = 0; + __pyx_t_30 = 0; __pyx_t_1 = 0; - __pyx_t_10 = 0; - __pyx_t_13 = 0; - __pyx_t_13 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_HingeBasisFunction)), ((PyObject *)__pyx_t_34), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 357; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(((PyObject *)__pyx_t_34)); __pyx_t_34 = 0; - __pyx_v_bf1 = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_13); - __pyx_t_13 = 0; - - /* "sklearn/earth/_forward.pyx":360 + __pyx_t_11 = 0; + __pyx_t_15 = 0; + __pyx_t_15 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_HingeBasisFunction)), ((PyObject *)__pyx_t_36), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(((PyObject *)__pyx_t_36)); __pyx_t_36 = 0; + __pyx_v_bf1 = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_15); + __pyx_t_15 = 0; + + /* "sklearn/earth/_forward.pyx":366 * parent_choice, knot_choice, knot_idx_choice, variable_choice, False, label) * bf2 = HingeBasisFunction( * parent_choice, knot_choice, knot_idx_choice, variable_choice, True, label) # <<<<<<<<<<<<<< * bf1.apply(X, B[:, k]) - * bf2.apply(X, B[:, k + 1]) + * apply_weights_slice(B, sample_weight, k) */ - __pyx_t_13 = PyFloat_FromDouble(__pyx_v_knot_choice); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_34 = PyInt_FromLong(__pyx_v_knot_idx_choice); if (unlikely(!__pyx_t_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_34); - __pyx_t_10 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable_choice); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = PyFloat_FromDouble(__pyx_v_knot_choice); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_36 = PyInt_FromLong(__pyx_v_knot_idx_choice); if (unlikely(!__pyx_t_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_36); + __pyx_t_11 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable_choice); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 366; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_28 = PyTuple_New(6); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_28); + __pyx_t_30 = PyTuple_New(6); if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_30); __Pyx_INCREF(((PyObject *)__pyx_v_parent_choice)); - PyTuple_SET_ITEM(__pyx_t_28, 0, ((PyObject *)__pyx_v_parent_choice)); + PyTuple_SET_ITEM(__pyx_t_30, 0, ((PyObject *)__pyx_v_parent_choice)); __Pyx_GIVEREF(((PyObject *)__pyx_v_parent_choice)); - PyTuple_SET_ITEM(__pyx_t_28, 1, __pyx_t_13); - __Pyx_GIVEREF(__pyx_t_13); - PyTuple_SET_ITEM(__pyx_t_28, 2, __pyx_t_34); - __Pyx_GIVEREF(__pyx_t_34); - PyTuple_SET_ITEM(__pyx_t_28, 3, __pyx_t_10); - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_28, 4, __pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_30, 1, __pyx_t_15); + __Pyx_GIVEREF(__pyx_t_15); + PyTuple_SET_ITEM(__pyx_t_30, 2, __pyx_t_36); + __Pyx_GIVEREF(__pyx_t_36); + PyTuple_SET_ITEM(__pyx_t_30, 3, __pyx_t_11); + __Pyx_GIVEREF(__pyx_t_11); + PyTuple_SET_ITEM(__pyx_t_30, 4, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_label); - PyTuple_SET_ITEM(__pyx_t_28, 5, __pyx_v_label); + PyTuple_SET_ITEM(__pyx_t_30, 5, __pyx_v_label); __Pyx_GIVEREF(__pyx_v_label); - __pyx_t_13 = 0; - __pyx_t_34 = 0; - __pyx_t_10 = 0; + __pyx_t_15 = 0; + __pyx_t_36 = 0; + __pyx_t_11 = 0; __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_HingeBasisFunction)), ((PyObject *)__pyx_t_28), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 359; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_HingeBasisFunction)), ((PyObject *)__pyx_t_30), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 365; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_28)); __pyx_t_28 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_30)); __pyx_t_30 = 0; __pyx_v_bf2 = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_forward.pyx":361 + /* "sklearn/earth/_forward.pyx":367 * bf2 = HingeBasisFunction( * parent_choice, knot_choice, knot_idx_choice, variable_choice, True, label) * bf1.apply(X, B[:, k]) # <<<<<<<<<<<<<< + * apply_weights_slice(B, sample_weight, k) * bf2.apply(X, B[:, k + 1]) - * self.basis.append(bf1) */ - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_28 = PyTuple_New(2); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_28); - __Pyx_INCREF(__pyx_k_slice_11); - PyTuple_SET_ITEM(__pyx_t_28, 0, __pyx_k_slice_11); - __Pyx_GIVEREF(__pyx_k_slice_11); - PyTuple_SET_ITEM(__pyx_t_28, 1, __pyx_t_1); + __pyx_t_30 = PyTuple_New(2); if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_30); + __Pyx_INCREF(__pyx_k_slice_14); + PyTuple_SET_ITEM(__pyx_t_30, 0, __pyx_k_slice_14); + __Pyx_GIVEREF(__pyx_k_slice_14); + PyTuple_SET_ITEM(__pyx_t_30, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_28)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_30)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_28)); __pyx_t_28 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_28 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_bf1->__pyx_vtab)->apply(__pyx_v_bf1, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_t_1), 0, NULL); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_28); + __Pyx_DECREF(((PyObject *)__pyx_t_30)); __pyx_t_30 = 0; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_30 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_bf1->__pyx_vtab)->apply(__pyx_v_bf1, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_t_1), 0, NULL); if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_30); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; + __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0; - /* "sklearn/earth/_forward.pyx":362 + /* "sklearn/earth/_forward.pyx":368 * parent_choice, knot_choice, knot_idx_choice, variable_choice, True, label) * bf1.apply(X, B[:, k]) + * apply_weights_slice(B, sample_weight, k) # <<<<<<<<<<<<<< + * bf2.apply(X, B[:, k + 1]) + * apply_weights_slice(B, sample_weight, k + 1) + */ + __pyx_t_30 = __pyx_f_7sklearn_5earth_5_util_apply_weights_slice(((PyArrayObject *)__pyx_v_B), ((PyArrayObject *)__pyx_v_sample_weight), __pyx_v_k, 0); if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 368; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_30); + __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0; + + /* "sklearn/earth/_forward.pyx":369 + * bf1.apply(X, B[:, k]) + * apply_weights_slice(B, sample_weight, k) * bf2.apply(X, B[:, k + 1]) # <<<<<<<<<<<<<< + * apply_weights_slice(B, sample_weight, k + 1) * self.basis.append(bf1) - * self.basis.append(bf2) */ - __pyx_t_28 = __Pyx_PyInt_to_py_npy_ulonglong((__pyx_v_k + 1)); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_28); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_30 = __Pyx_PyInt_to_py_npy_ulonglong((__pyx_v_k + 1)); if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_30); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_k_slice_12); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_k_slice_12); - __Pyx_GIVEREF(__pyx_k_slice_12); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_28); - __Pyx_GIVEREF(__pyx_t_28); - __pyx_t_28 = 0; - __pyx_t_28 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_1)); if (!__pyx_t_28) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_28); + __Pyx_INCREF(__pyx_k_slice_15); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_k_slice_15); + __Pyx_GIVEREF(__pyx_k_slice_15); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_30); + __Pyx_GIVEREF(__pyx_t_30); + __pyx_t_30 = 0; + __pyx_t_30 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_1)); if (!__pyx_t_30) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_30); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_28) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_28, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_bf2->__pyx_vtab)->apply(__pyx_v_bf2, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_t_28), 0, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_30) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_30, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_bf2->__pyx_vtab)->apply(__pyx_v_bf2, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_t_30), 0, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; + __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_forward.pyx":363 - * bf1.apply(X, B[:, k]) + /* "sklearn/earth/_forward.pyx":370 + * apply_weights_slice(B, sample_weight, k) * bf2.apply(X, B[:, k + 1]) + * apply_weights_slice(B, sample_weight, k + 1) # <<<<<<<<<<<<<< + * self.basis.append(bf1) + * self.basis.append(bf2) + */ + __pyx_t_1 = __pyx_f_7sklearn_5earth_5_util_apply_weights_slice(((PyArrayObject *)__pyx_v_B), ((PyArrayObject *)__pyx_v_sample_weight), (__pyx_v_k + 1), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "sklearn/earth/_forward.pyx":371 + * bf2.apply(X, B[:, k + 1]) + * apply_weights_slice(B, sample_weight, k + 1) * self.basis.append(bf1) # <<<<<<<<<<<<<< * self.basis.append(bf2) * */ - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->append(__pyx_v_self->basis, __pyx_v_bf1, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 363; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->append(__pyx_v_self->basis, __pyx_v_bf1, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_forward.pyx":364 - * bf2.apply(X, B[:, k + 1]) + /* "sklearn/earth/_forward.pyx":372 + * apply_weights_slice(B, sample_weight, k + 1) * self.basis.append(bf1) * self.basis.append(bf2) # <<<<<<<<<<<<<< * * # Orthogonalize the new basis */ - __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->append(__pyx_v_self->basis, __pyx_v_bf2, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 364; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->append(__pyx_v_self->basis, __pyx_v_bf2, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_forward.pyx":367 + /* "sklearn/earth/_forward.pyx":375 * * # Orthogonalize the new basis * B_orth[:, k] = B[:, k] # <<<<<<<<<<<<<< * if self.orthonormal_update(k) == 1: * bf1.make_unsplittable() */ - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_28 = PyTuple_New(2); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_28); - __Pyx_INCREF(__pyx_k_slice_13); - PyTuple_SET_ITEM(__pyx_t_28, 0, __pyx_k_slice_13); - __Pyx_GIVEREF(__pyx_k_slice_13); - PyTuple_SET_ITEM(__pyx_t_28, 1, __pyx_t_1); + __pyx_t_30 = PyTuple_New(2); if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_30); + __Pyx_INCREF(__pyx_k_slice_16); + PyTuple_SET_ITEM(__pyx_t_30, 0, __pyx_k_slice_16); + __Pyx_GIVEREF(__pyx_k_slice_16); + PyTuple_SET_ITEM(__pyx_t_30, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_28)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_30)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_28)); __pyx_t_28 = 0; - __pyx_t_28 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_28); - __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_INCREF(__pyx_k_slice_14); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_k_slice_14); - __Pyx_GIVEREF(__pyx_k_slice_14); - PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_28); - __Pyx_GIVEREF(__pyx_t_28); - __pyx_t_28 = 0; - if (PyObject_SetItem(((PyObject *)__pyx_v_B_orth), ((PyObject *)__pyx_t_10), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_30)); __pyx_t_30 = 0; + __pyx_t_30 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_30); + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_INCREF(__pyx_k_slice_17); + PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_k_slice_17); + __Pyx_GIVEREF(__pyx_k_slice_17); + PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_30); + __Pyx_GIVEREF(__pyx_t_30); + __pyx_t_30 = 0; + if (PyObject_SetItem(((PyObject *)__pyx_v_B_orth), ((PyObject *)__pyx_t_11), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_forward.pyx":368 + /* "sklearn/earth/_forward.pyx":376 * # Orthogonalize the new basis * B_orth[:, k] = B[:, k] * if self.orthonormal_update(k) == 1: # <<<<<<<<<<<<<< * bf1.make_unsplittable() * B_orth[:, k + 1] = B[:, k + 1] */ - __pyx_t_9 = ((((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_update(__pyx_v_self, __pyx_v_k, 0) == 1) != 0); - if (__pyx_t_9) { + __pyx_t_34 = ((((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_update(__pyx_v_self, __pyx_v_k, 0) == 1) != 0); + if (__pyx_t_34) { - /* "sklearn/earth/_forward.pyx":369 + /* "sklearn/earth/_forward.pyx":377 * B_orth[:, k] = B[:, k] * if self.orthonormal_update(k) == 1: * bf1.make_unsplittable() # <<<<<<<<<<<<<< @@ -6766,51 +6877,51 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str } __pyx_L22:; - /* "sklearn/earth/_forward.pyx":370 + /* "sklearn/earth/_forward.pyx":378 * if self.orthonormal_update(k) == 1: * bf1.make_unsplittable() * B_orth[:, k + 1] = B[:, k + 1] # <<<<<<<<<<<<<< * if self.orthonormal_update(k + 1) == 1: * bf2.make_unsplittable() */ - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong((__pyx_v_k + 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong((__pyx_v_k + 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_INCREF(__pyx_k_slice_15); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_k_slice_15); - __Pyx_GIVEREF(__pyx_k_slice_15); - PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_1); + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_INCREF(__pyx_k_slice_18); + PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_k_slice_18); + __Pyx_GIVEREF(__pyx_k_slice_18); + PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_10)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_11)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_PyInt_to_py_npy_ulonglong((__pyx_v_k + 1)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_28 = PyTuple_New(2); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_28); - __Pyx_INCREF(__pyx_k_slice_16); - PyTuple_SET_ITEM(__pyx_t_28, 0, __pyx_k_slice_16); - __Pyx_GIVEREF(__pyx_k_slice_16); - PyTuple_SET_ITEM(__pyx_t_28, 1, __pyx_t_10); - __Pyx_GIVEREF(__pyx_t_10); - __pyx_t_10 = 0; - if (PyObject_SetItem(((PyObject *)__pyx_v_B_orth), ((PyObject *)__pyx_t_28), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_28)); __pyx_t_28 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; + __pyx_t_11 = __Pyx_PyInt_to_py_npy_ulonglong((__pyx_v_k + 1)); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_30 = PyTuple_New(2); if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_30); + __Pyx_INCREF(__pyx_k_slice_19); + PyTuple_SET_ITEM(__pyx_t_30, 0, __pyx_k_slice_19); + __Pyx_GIVEREF(__pyx_k_slice_19); + PyTuple_SET_ITEM(__pyx_t_30, 1, __pyx_t_11); + __Pyx_GIVEREF(__pyx_t_11); + __pyx_t_11 = 0; + if (PyObject_SetItem(((PyObject *)__pyx_v_B_orth), ((PyObject *)__pyx_t_30), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_30)); __pyx_t_30 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_forward.pyx":371 + /* "sklearn/earth/_forward.pyx":379 * bf1.make_unsplittable() * B_orth[:, k + 1] = B[:, k + 1] * if self.orthonormal_update(k + 1) == 1: # <<<<<<<<<<<<<< * bf2.make_unsplittable() * elif not dependent and knot_idx_choice == -1: */ - __pyx_t_9 = ((((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_update(__pyx_v_self, (__pyx_v_k + 1), 0) == 1) != 0); - if (__pyx_t_9) { + __pyx_t_34 = ((((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_update(__pyx_v_self, (__pyx_v_k + 1), 0) == 1) != 0); + if (__pyx_t_34) { - /* "sklearn/earth/_forward.pyx":372 + /* "sklearn/earth/_forward.pyx":380 * B_orth[:, k + 1] = B[:, k + 1] * if self.orthonormal_update(k + 1) == 1: * bf2.make_unsplittable() # <<<<<<<<<<<<<< @@ -6824,131 +6935,142 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str goto __pyx_L21; } - /* "sklearn/earth/_forward.pyx":373 + /* "sklearn/earth/_forward.pyx":381 * if self.orthonormal_update(k + 1) == 1: * bf2.make_unsplittable() * elif not dependent and knot_idx_choice == -1: # <<<<<<<<<<<<<< * # In this case, only add the linear basis function * bf1 = LinearBasisFunction(parent_choice, variable_choice, label) */ - __pyx_t_9 = ((!(__pyx_v_dependent != 0)) != 0); - if (__pyx_t_9) { - __pyx_t_35 = ((__pyx_v_knot_idx_choice == -1) != 0); - __pyx_t_36 = __pyx_t_35; + __pyx_t_34 = ((!(__pyx_v_dependent != 0)) != 0); + if (__pyx_t_34) { + __pyx_t_10 = ((__pyx_v_knot_idx_choice == -1) != 0); + __pyx_t_37 = __pyx_t_10; } else { - __pyx_t_36 = __pyx_t_9; + __pyx_t_37 = __pyx_t_34; } - if (__pyx_t_36) { + if (__pyx_t_37) { - /* "sklearn/earth/_forward.pyx":375 + /* "sklearn/earth/_forward.pyx":383 * elif not dependent and knot_idx_choice == -1: * # In this case, only add the linear basis function * bf1 = LinearBasisFunction(parent_choice, variable_choice, label) # <<<<<<<<<<<<<< * bf1.apply(X, B[:, k]) - * self.basis.append(bf1) + * apply_weights_slice(B, sample_weight, k) */ - if (unlikely(!__pyx_v_parent_choice)) { __Pyx_RaiseUnboundLocalError("parent_choice"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable_choice); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__pyx_v_parent_choice)) { __Pyx_RaiseUnboundLocalError("parent_choice"); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable_choice); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_28 = PyTuple_New(3); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_28); + __pyx_t_30 = PyTuple_New(3); if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_30); __Pyx_INCREF(((PyObject *)__pyx_v_parent_choice)); - PyTuple_SET_ITEM(__pyx_t_28, 0, ((PyObject *)__pyx_v_parent_choice)); + PyTuple_SET_ITEM(__pyx_t_30, 0, ((PyObject *)__pyx_v_parent_choice)); __Pyx_GIVEREF(((PyObject *)__pyx_v_parent_choice)); - PyTuple_SET_ITEM(__pyx_t_28, 1, __pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_30, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_label); - PyTuple_SET_ITEM(__pyx_t_28, 2, __pyx_v_label); + PyTuple_SET_ITEM(__pyx_t_30, 2, __pyx_v_label); __Pyx_GIVEREF(__pyx_v_label); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_LinearBasisFunction)), ((PyObject *)__pyx_t_28), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_6_basis_LinearBasisFunction)), ((PyObject *)__pyx_t_30), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 383; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_28)); __pyx_t_28 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_30)); __pyx_t_30 = 0; __pyx_v_bf1 = ((struct __pyx_obj_7sklearn_5earth_6_basis_BasisFunction *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_forward.pyx":376 + /* "sklearn/earth/_forward.pyx":384 * # In this case, only add the linear basis function * bf1 = LinearBasisFunction(parent_choice, variable_choice, label) * bf1.apply(X, B[:, k]) # <<<<<<<<<<<<<< + * apply_weights_slice(B, sample_weight, k) * self.basis.append(bf1) - * */ - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_28 = PyTuple_New(2); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_28); - __Pyx_INCREF(__pyx_k_slice_17); - PyTuple_SET_ITEM(__pyx_t_28, 0, __pyx_k_slice_17); - __Pyx_GIVEREF(__pyx_k_slice_17); - PyTuple_SET_ITEM(__pyx_t_28, 1, __pyx_t_1); + __pyx_t_30 = PyTuple_New(2); if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_30); + __Pyx_INCREF(__pyx_k_slice_20); + PyTuple_SET_ITEM(__pyx_t_30, 0, __pyx_k_slice_20); + __Pyx_GIVEREF(__pyx_k_slice_20); + PyTuple_SET_ITEM(__pyx_t_30, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_28)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_30)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(((PyObject *)__pyx_t_28)); __pyx_t_28 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_28 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_bf1->__pyx_vtab)->apply(__pyx_v_bf1, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_t_1), 0, NULL); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_28); + __Pyx_DECREF(((PyObject *)__pyx_t_30)); __pyx_t_30 = 0; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_30 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_BasisFunction *)__pyx_v_bf1->__pyx_vtab)->apply(__pyx_v_bf1, ((PyArrayObject *)__pyx_v_X), ((PyArrayObject *)__pyx_t_1), 0, NULL); if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_30); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; + __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0; - /* "sklearn/earth/_forward.pyx":377 + /* "sklearn/earth/_forward.pyx":385 * bf1 = LinearBasisFunction(parent_choice, variable_choice, label) * bf1.apply(X, B[:, k]) + * apply_weights_slice(B, sample_weight, k) # <<<<<<<<<<<<<< + * self.basis.append(bf1) + * + */ + __pyx_t_30 = __pyx_f_7sklearn_5earth_5_util_apply_weights_slice(((PyArrayObject *)__pyx_v_B), ((PyArrayObject *)__pyx_v_sample_weight), __pyx_v_k, 0); if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_30); + __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0; + + /* "sklearn/earth/_forward.pyx":386 + * bf1.apply(X, B[:, k]) + * apply_weights_slice(B, sample_weight, k) * self.basis.append(bf1) # <<<<<<<<<<<<<< * * # Orthogonalize the new basis */ - __pyx_t_28 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->append(__pyx_v_self->basis, __pyx_v_bf1, 0); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 377; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_28); - __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; + __pyx_t_30 = ((struct __pyx_vtabstruct_7sklearn_5earth_6_basis_Basis *)__pyx_v_self->basis->__pyx_vtab)->append(__pyx_v_self->basis, __pyx_v_bf1, 0); if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_30); + __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0; - /* "sklearn/earth/_forward.pyx":380 + /* "sklearn/earth/_forward.pyx":389 * * # Orthogonalize the new basis * B_orth[:, k] = B[:, k] # <<<<<<<<<<<<<< * if self.orthonormal_update(k) == 1: * bf1.make_unsplittable() */ - __pyx_t_28 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_28); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_30 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_30); + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_k_slice_18); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_k_slice_18); - __Pyx_GIVEREF(__pyx_k_slice_18); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_28); - __Pyx_GIVEREF(__pyx_t_28); - __pyx_t_28 = 0; - __pyx_t_28 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_1)); if (!__pyx_t_28) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_28); + __Pyx_INCREF(__pyx_k_slice_21); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_k_slice_21); + __Pyx_GIVEREF(__pyx_k_slice_21); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_30); + __Pyx_GIVEREF(__pyx_t_30); + __pyx_t_30 = 0; + __pyx_t_30 = PyObject_GetItem(((PyObject *)__pyx_v_B), ((PyObject *)__pyx_t_1)); if (!__pyx_t_30) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_30); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = PyTuple_New(2); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_INCREF(__pyx_k_slice_19); - PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_k_slice_19); - __Pyx_GIVEREF(__pyx_k_slice_19); - PyTuple_SET_ITEM(__pyx_t_10, 1, __pyx_t_1); + __pyx_t_11 = PyTuple_New(2); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_INCREF(__pyx_k_slice_22); + PyTuple_SET_ITEM(__pyx_t_11, 0, __pyx_k_slice_22); + __Pyx_GIVEREF(__pyx_k_slice_22); + PyTuple_SET_ITEM(__pyx_t_11, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyObject_SetItem(((PyObject *)__pyx_v_B_orth), ((PyObject *)__pyx_t_10), __pyx_t_28) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_t_10)); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; + if (PyObject_SetItem(((PyObject *)__pyx_v_B_orth), ((PyObject *)__pyx_t_11), __pyx_t_30) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_11)); __pyx_t_11 = 0; + __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0; - /* "sklearn/earth/_forward.pyx":381 + /* "sklearn/earth/_forward.pyx":390 * # Orthogonalize the new basis * B_orth[:, k] = B[:, k] * if self.orthonormal_update(k) == 1: # <<<<<<<<<<<<<< * bf1.make_unsplittable() * else: # dependent and knot_idx_choice == -1 */ - __pyx_t_36 = ((((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_update(__pyx_v_self, __pyx_v_k, 0) == 1) != 0); - if (__pyx_t_36) { + __pyx_t_37 = ((((struct __pyx_vtabstruct_7sklearn_5earth_8_forward_ForwardPasser *)__pyx_v_self->__pyx_vtab)->orthonormal_update(__pyx_v_self, __pyx_v_k, 0) == 1) != 0); + if (__pyx_t_37) { - /* "sklearn/earth/_forward.pyx":382 + /* "sklearn/earth/_forward.pyx":391 * B_orth[:, k] = B[:, k] * if self.orthonormal_update(k) == 1: * bf1.make_unsplittable() # <<<<<<<<<<<<<< @@ -6963,37 +7085,37 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str } /*else*/ { - /* "sklearn/earth/_forward.pyx":386 + /* "sklearn/earth/_forward.pyx":395 * # In this case there were no acceptable choices remaining, so end * # the forward pass * self.record[len(self.record) - 1].set_no_candidates(True) # <<<<<<<<<<<<<< * return * */ - __pyx_t_28 = ((PyObject *)__pyx_v_self->record); - __Pyx_INCREF(__pyx_t_28); - __pyx_t_33 = PyObject_Length(__pyx_t_28); if (unlikely(__pyx_t_33 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; - __pyx_t_2 = (__pyx_t_33 - 1); - __pyx_t_28 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->record), __pyx_t_2, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 0, 0); if (!__pyx_t_28) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_28); - __pyx_t_10 = __Pyx_PyObject_GetAttrStr(__pyx_t_28, __pyx_n_s__set_no_candidates); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; - __pyx_t_28 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_28); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_30 = ((PyObject *)__pyx_v_self->record); + __Pyx_INCREF(__pyx_t_30); + __pyx_t_35 = PyObject_Length(__pyx_t_30); if (unlikely(__pyx_t_35 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0; + __pyx_t_2 = (__pyx_t_35 - 1); + __pyx_t_30 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->record), __pyx_t_2, sizeof(Py_ssize_t), PyInt_FromSsize_t, 0, 0, 0); if (!__pyx_t_30) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_30); + __pyx_t_11 = __Pyx_PyObject_GetAttrStr(__pyx_t_30, __pyx_n_s__set_no_candidates); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0; + __pyx_t_30 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_30); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_28); - __Pyx_GIVEREF(__pyx_t_28); - __pyx_t_28 = 0; - __pyx_t_28 = PyObject_Call(__pyx_t_10, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 386; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_28); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_30); + __Pyx_GIVEREF(__pyx_t_30); + __pyx_t_30 = 0; + __pyx_t_30 = PyObject_Call(__pyx_t_11, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 395; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_30); + __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_28); __pyx_t_28 = 0; + __Pyx_DECREF(__pyx_t_30); __pyx_t_30 = 0; - /* "sklearn/earth/_forward.pyx":387 + /* "sklearn/earth/_forward.pyx":396 * # the forward pass * self.record[len(self.record) - 1].set_no_candidates(True) * return # <<<<<<<<<<<<<< @@ -7006,61 +7128,61 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str } __pyx_L21:; - /* "sklearn/earth/_forward.pyx":391 + /* "sklearn/earth/_forward.pyx":400 * # Update the build record * self.record.append(ForwardPassIteration( * parent_idx_choice, variable_choice, knot_idx_choice, mse_choice, len(self.basis))) # <<<<<<<<<<<<<< * * cdef best_knot(ForwardPasser self, INDEX_t parent, INDEX_t variable, INDEX_t k, cnp.ndarray[INT_t, ndim=1] candidates, cnp.ndarray[INT_t, ndim=1] order, FLOAT_t * mse, FLOAT_t * knot, INDEX_t * knot_idx): */ - __pyx_t_28 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_parent_idx_choice); if (unlikely(!__pyx_t_28)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_28); - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable_choice); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_30 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_parent_idx_choice); if (unlikely(!__pyx_t_30)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_30); + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_variable_choice); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_10 = PyInt_FromLong(__pyx_v_knot_idx_choice); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __pyx_t_34 = PyFloat_FromDouble(__pyx_v_mse_choice); if (unlikely(!__pyx_t_34)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_34); - __pyx_t_13 = ((PyObject *)__pyx_v_self->basis); - __Pyx_INCREF(__pyx_t_13); - __pyx_t_2 = PyObject_Length(__pyx_t_13); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __pyx_t_13 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 391; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_13); - __pyx_t_37 = PyTuple_New(5); if (unlikely(!__pyx_t_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_37); - PyTuple_SET_ITEM(__pyx_t_37, 0, __pyx_t_28); - __Pyx_GIVEREF(__pyx_t_28); - PyTuple_SET_ITEM(__pyx_t_37, 1, __pyx_t_1); + __pyx_t_11 = PyInt_FromLong(__pyx_v_knot_idx_choice); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_11); + __pyx_t_36 = PyFloat_FromDouble(__pyx_v_mse_choice); if (unlikely(!__pyx_t_36)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_36); + __pyx_t_15 = ((PyObject *)__pyx_v_self->basis); + __Pyx_INCREF(__pyx_t_15); + __pyx_t_2 = PyObject_Length(__pyx_t_15); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __pyx_t_15 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __pyx_t_38 = PyTuple_New(5); if (unlikely(!__pyx_t_38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_38); + PyTuple_SET_ITEM(__pyx_t_38, 0, __pyx_t_30); + __Pyx_GIVEREF(__pyx_t_30); + PyTuple_SET_ITEM(__pyx_t_38, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_37, 2, __pyx_t_10); - __Pyx_GIVEREF(__pyx_t_10); - PyTuple_SET_ITEM(__pyx_t_37, 3, __pyx_t_34); - __Pyx_GIVEREF(__pyx_t_34); - PyTuple_SET_ITEM(__pyx_t_37, 4, __pyx_t_13); - __Pyx_GIVEREF(__pyx_t_13); - __pyx_t_28 = 0; + PyTuple_SET_ITEM(__pyx_t_38, 2, __pyx_t_11); + __Pyx_GIVEREF(__pyx_t_11); + PyTuple_SET_ITEM(__pyx_t_38, 3, __pyx_t_36); + __Pyx_GIVEREF(__pyx_t_36); + PyTuple_SET_ITEM(__pyx_t_38, 4, __pyx_t_15); + __Pyx_GIVEREF(__pyx_t_15); + __pyx_t_30 = 0; __pyx_t_1 = 0; - __pyx_t_10 = 0; - __pyx_t_34 = 0; - __pyx_t_13 = 0; - __pyx_t_13 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_ForwardPassIteration)), ((PyObject *)__pyx_t_37), NULL); if (unlikely(!__pyx_t_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_13); - __Pyx_DECREF(((PyObject *)__pyx_t_37)); __pyx_t_37 = 0; - __pyx_t_37 = ((struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->__pyx_base.append(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self->record), ((struct __pyx_obj_7sklearn_5earth_7_record_Iteration *)__pyx_t_13), 0); if (unlikely(!__pyx_t_37)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 390; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_37); - __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_DECREF(__pyx_t_37); __pyx_t_37 = 0; + __pyx_t_11 = 0; + __pyx_t_36 = 0; + __pyx_t_15 = 0; + __pyx_t_15 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_7sklearn_5earth_7_record_ForwardPassIteration)), ((PyObject *)__pyx_t_38), NULL); if (unlikely(!__pyx_t_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_15); + __Pyx_DECREF(((PyObject *)__pyx_t_38)); __pyx_t_38 = 0; + __pyx_t_38 = ((struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord *)__pyx_v_self->record->__pyx_base.__pyx_vtab)->__pyx_base.append(((struct __pyx_obj_7sklearn_5earth_7_record_Record *)__pyx_v_self->record), ((struct __pyx_obj_7sklearn_5earth_7_record_Iteration *)__pyx_t_15), 0); if (unlikely(!__pyx_t_38)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_38); + __Pyx_DECREF(__pyx_t_15); __pyx_t_15 = 0; + __Pyx_DECREF(__pyx_t_38); __pyx_t_38 = 0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_t_13); - __Pyx_XDECREF(__pyx_t_28); - __Pyx_XDECREF(__pyx_t_34); - __Pyx_XDECREF(__pyx_t_37); + __Pyx_XDECREF(__pyx_t_11); + __Pyx_XDECREF(__pyx_t_15); + __Pyx_XDECREF(__pyx_t_30); + __Pyx_XDECREF(__pyx_t_36); + __Pyx_XDECREF(__pyx_t_38); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_B.rcbuffer->pybuffer); @@ -7068,6 +7190,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_candidates_idx.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_linear_variables.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sample_weight.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sorting.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer); __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} @@ -7080,6 +7203,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_X.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_candidates_idx.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_linear_variables.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sample_weight.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_sorting.rcbuffer->pybuffer); __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_y.rcbuffer->pybuffer); __pyx_L2:; @@ -7094,13 +7218,14 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_next_pair(str __Pyx_XDECREF((PyObject *)__pyx_v_y); __Pyx_XDECREF((PyObject *)__pyx_v_linear_variables); __Pyx_XDECREF((PyObject *)__pyx_v_sorting); + __Pyx_XDECREF((PyObject *)__pyx_v_sample_weight); __Pyx_XDECREF(__pyx_v_label); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/earth/_forward.pyx":393 +/* "sklearn/earth/_forward.pyx":402 * parent_idx_choice, variable_choice, knot_idx_choice, mse_choice, len(self.basis))) * * cdef best_knot(ForwardPasser self, INDEX_t parent, INDEX_t variable, INDEX_t k, cnp.ndarray[INT_t, ndim=1] candidates, cnp.ndarray[INT_t, ndim=1] order, FLOAT_t * mse, FLOAT_t * knot, INDEX_t * knot_idx): # <<<<<<<<<<<<<< @@ -7297,33 +7422,33 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_pybuffernd_order.rcbuffer = &__pyx_pybuffer_order; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_candidates.rcbuffer->pybuffer, (PyObject*)__pyx_v_candidates, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_candidates.rcbuffer->pybuffer, (PyObject*)__pyx_v_candidates, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_candidates.diminfo[0].strides = __pyx_pybuffernd_candidates.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_candidates.diminfo[0].shape = __pyx_pybuffernd_candidates.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_order.rcbuffer->pybuffer, (PyObject*)__pyx_v_order, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 393; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_order.rcbuffer->pybuffer, (PyObject*)__pyx_v_order, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_INT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 402; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_order.diminfo[0].strides = __pyx_pybuffernd_order.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_order.diminfo[0].shape = __pyx_pybuffernd_order.rcbuffer->pybuffer.shape[0]; - /* "sklearn/earth/_forward.pyx":404 + /* "sklearn/earth/_forward.pyx":413 * ''' * * cdef cnp.ndarray[FLOAT_t, ndim = 1] b = self.B[:, k + 1] # <<<<<<<<<<<<<< * cdef cnp.ndarray[FLOAT_t, ndim = 1] b_parent = self.B[:, parent] * cdef cnp.ndarray[FLOAT_t, ndim = 1] u = self.u */ - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong((__pyx_v_k + 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong((__pyx_v_k + 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_k_slice_20); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_k_slice_20); - __Pyx_GIVEREF(__pyx_k_slice_20); + __Pyx_INCREF(__pyx_k_slice_23); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_k_slice_23); + __Pyx_GIVEREF(__pyx_k_slice_23); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self->B), ((PyObject *)__pyx_t_2)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_self->B), ((PyObject *)__pyx_t_2)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_t_2 = __pyx_t_1; @@ -7333,31 +7458,31 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_2), &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_b = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_b.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_b.diminfo[0].strides = __pyx_pybuffernd_b.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_b.diminfo[0].shape = __pyx_pybuffernd_b.rcbuffer->pybuffer.shape[0]; } } __pyx_v_b = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_forward.pyx":405 + /* "sklearn/earth/_forward.pyx":414 * * cdef cnp.ndarray[FLOAT_t, ndim = 1] b = self.B[:, k + 1] * cdef cnp.ndarray[FLOAT_t, ndim = 1] b_parent = self.B[:, parent] # <<<<<<<<<<<<<< * cdef cnp.ndarray[FLOAT_t, ndim = 1] u = self.u * cdef cnp.ndarray[FLOAT_t, ndim = 2] B_orth = self.B_orth */ - __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_parent); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_parent); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_k_slice_21); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_k_slice_21); - __Pyx_GIVEREF(__pyx_k_slice_21); + __Pyx_INCREF(__pyx_k_slice_24); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_k_slice_24); + __Pyx_GIVEREF(__pyx_k_slice_24); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_self->B), ((PyObject *)__pyx_t_1)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_self->B), ((PyObject *)__pyx_t_1)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; __pyx_t_1 = __pyx_t_2; @@ -7367,14 +7492,14 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_b_parent.rcbuffer->pybuffer, (PyObject*)((PyArrayObject *)__pyx_t_1), &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_b_parent = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_b_parent.diminfo[0].strides = __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_b_parent.diminfo[0].shape = __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.shape[0]; } } __pyx_v_b_parent = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_forward.pyx":406 + /* "sklearn/earth/_forward.pyx":415 * cdef cnp.ndarray[FLOAT_t, ndim = 1] b = self.B[:, k + 1] * cdef cnp.ndarray[FLOAT_t, ndim = 1] b_parent = self.B[:, parent] * cdef cnp.ndarray[FLOAT_t, ndim = 1] u = self.u # <<<<<<<<<<<<<< @@ -7386,7 +7511,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_u.rcbuffer->pybuffer, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_u = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_u.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 406; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 415; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_u.diminfo[0].strides = __pyx_pybuffernd_u.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_u.diminfo[0].shape = __pyx_pybuffernd_u.rcbuffer->pybuffer.shape[0]; } } @@ -7394,7 +7519,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->u))); __pyx_v_u = ((PyArrayObject *)__pyx_v_self->u); - /* "sklearn/earth/_forward.pyx":407 + /* "sklearn/earth/_forward.pyx":416 * cdef cnp.ndarray[FLOAT_t, ndim = 1] b_parent = self.B[:, parent] * cdef cnp.ndarray[FLOAT_t, ndim = 1] u = self.u * cdef cnp.ndarray[FLOAT_t, ndim = 2] B_orth = self.B_orth # <<<<<<<<<<<<<< @@ -7406,7 +7531,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B_orth.rcbuffer->pybuffer, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { __pyx_v_B_orth = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 416; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_B_orth.diminfo[0].strides = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B_orth.diminfo[0].shape = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B_orth.diminfo[1].strides = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B_orth.diminfo[1].shape = __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.shape[1]; } } @@ -7414,7 +7539,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->B_orth))); __pyx_v_B_orth = ((PyArrayObject *)__pyx_v_self->B_orth); - /* "sklearn/earth/_forward.pyx":408 + /* "sklearn/earth/_forward.pyx":417 * cdef cnp.ndarray[FLOAT_t, ndim = 1] u = self.u * cdef cnp.ndarray[FLOAT_t, ndim = 2] B_orth = self.B_orth * cdef cnp.ndarray[FLOAT_t, ndim = 2] X = self.X # <<<<<<<<<<<<<< @@ -7426,7 +7551,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_X.rcbuffer->pybuffer, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { __pyx_v_X = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_X.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 408; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 417; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_X.diminfo[0].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_X.diminfo[0].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_X.diminfo[1].strides = __pyx_pybuffernd_X.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_X.diminfo[1].shape = __pyx_pybuffernd_X.rcbuffer->pybuffer.shape[1]; } } @@ -7434,7 +7559,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->X))); __pyx_v_X = ((PyArrayObject *)__pyx_v_self->X); - /* "sklearn/earth/_forward.pyx":409 + /* "sklearn/earth/_forward.pyx":418 * cdef cnp.ndarray[FLOAT_t, ndim = 2] B_orth = self.B_orth * cdef cnp.ndarray[FLOAT_t, ndim = 2] X = self.X * cdef cnp.ndarray[FLOAT_t, ndim = 1] y = self.y # <<<<<<<<<<<<<< @@ -7446,7 +7571,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_y = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_y.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 418; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_y.diminfo[0].strides = __pyx_pybuffernd_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y.diminfo[0].shape = __pyx_pybuffernd_y.rcbuffer->pybuffer.shape[0]; } } @@ -7454,7 +7579,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->y))); __pyx_v_y = ((PyArrayObject *)__pyx_v_self->y); - /* "sklearn/earth/_forward.pyx":410 + /* "sklearn/earth/_forward.pyx":419 * cdef cnp.ndarray[FLOAT_t, ndim = 2] X = self.X * cdef cnp.ndarray[FLOAT_t, ndim = 1] y = self.y * cdef cnp.ndarray[FLOAT_t, ndim = 1] c = self.c # <<<<<<<<<<<<<< @@ -7466,7 +7591,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_c.rcbuffer->pybuffer, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { __pyx_v_c = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_c.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 410; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 419; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_c.diminfo[0].strides = __pyx_pybuffernd_c.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_c.diminfo[0].shape = __pyx_pybuffernd_c.rcbuffer->pybuffer.shape[0]; } } @@ -7474,7 +7599,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->c))); __pyx_v_c = ((PyArrayObject *)__pyx_v_self->c); - /* "sklearn/earth/_forward.pyx":411 + /* "sklearn/earth/_forward.pyx":420 * cdef cnp.ndarray[FLOAT_t, ndim = 1] y = self.y * cdef cnp.ndarray[FLOAT_t, ndim = 1] c = self.c * cdef cnp.ndarray[FLOAT_t, ndim = 1] B_orth_times_parent_cum = self.B_orth_times_parent_cum # <<<<<<<<<<<<<< @@ -7486,7 +7611,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B_orth_times_parent_cum.rcbuffer->pybuffer, (PyObject*)__pyx_t_8, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) { __pyx_v_B_orth_times_parent_cum = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_B_orth_times_parent_cum.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 411; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 420; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_B_orth_times_parent_cum.diminfo[0].strides = __pyx_pybuffernd_B_orth_times_parent_cum.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B_orth_times_parent_cum.diminfo[0].shape = __pyx_pybuffernd_B_orth_times_parent_cum.rcbuffer->pybuffer.shape[0]; } } @@ -7494,7 +7619,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->B_orth_times_parent_cum))); __pyx_v_B_orth_times_parent_cum = ((PyArrayObject *)__pyx_v_self->B_orth_times_parent_cum); - /* "sklearn/earth/_forward.pyx":412 + /* "sklearn/earth/_forward.pyx":421 * cdef cnp.ndarray[FLOAT_t, ndim = 1] c = self.c * cdef cnp.ndarray[FLOAT_t, ndim = 1] B_orth_times_parent_cum = self.B_orth_times_parent_cum * cdef cnp.ndarray[FLOAT_t, ndim = 2] B = self.B # <<<<<<<<<<<<<< @@ -7506,7 +7631,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_t_9, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_8_forward_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { __pyx_v_B = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_pybuffernd_B.rcbuffer->pybuffer.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 421; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_pybuffernd_B.diminfo[0].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B.diminfo[0].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B.diminfo[1].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B.diminfo[1].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[1]; } } @@ -7514,7 +7639,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self->B))); __pyx_v_B = ((PyArrayObject *)__pyx_v_self->B); - /* "sklearn/earth/_forward.pyx":414 + /* "sklearn/earth/_forward.pyx":423 * cdef cnp.ndarray[FLOAT_t, ndim = 2] B = self.B * * cdef INDEX_t num_candidates = candidates.shape[0] # <<<<<<<<<<<<<< @@ -7523,7 +7648,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str */ __pyx_v_num_candidates = (__pyx_v_candidates->dimensions[0]); - /* "sklearn/earth/_forward.pyx":448 + /* "sklearn/earth/_forward.pyx":457 * * # Compute the initial basis function * candidate_idx = candidates[0] # <<<<<<<<<<<<<< @@ -7533,7 +7658,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_t_10 = 0; __pyx_v_candidate_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_INT_t *, __pyx_pybuffernd_candidates.rcbuffer->pybuffer.buf, __pyx_t_10, __pyx_pybuffernd_candidates.diminfo[0].strides)); - /* "sklearn/earth/_forward.pyx":449 + /* "sklearn/earth/_forward.pyx":458 * # Compute the initial basis function * candidate_idx = candidates[0] * candidate = X[order[candidate_idx], variable] # <<<<<<<<<<<<<< @@ -7545,7 +7670,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_t_13 = __pyx_v_variable; __pyx_v_candidate = (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_X.rcbuffer->pybuffer.buf, __pyx_t_12, __pyx_pybuffernd_X.diminfo[0].strides, __pyx_t_13, __pyx_pybuffernd_X.diminfo[1].strides)); - /* "sklearn/earth/_forward.pyx":450 + /* "sklearn/earth/_forward.pyx":459 * candidate_idx = candidates[0] * candidate = X[order[candidate_idx], variable] * for i in range(self.m): # TODO: Vectorize? # <<<<<<<<<<<<<< @@ -7556,7 +7681,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { __pyx_v_i = __pyx_t_15; - /* "sklearn/earth/_forward.pyx":451 + /* "sklearn/earth/_forward.pyx":460 * candidate = X[order[candidate_idx], variable] * for i in range(self.m): # TODO: Vectorize? * b[i] = 0 # <<<<<<<<<<<<<< @@ -7567,7 +7692,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_16, __pyx_pybuffernd_b.diminfo[0].strides) = 0.0; } - /* "sklearn/earth/_forward.pyx":452 + /* "sklearn/earth/_forward.pyx":461 * for i in range(self.m): # TODO: Vectorize? * b[i] = 0 * for i_ in range(self.m): # <<<<<<<<<<<<<< @@ -7578,7 +7703,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { __pyx_v_i_ = __pyx_t_15; - /* "sklearn/earth/_forward.pyx":453 + /* "sklearn/earth/_forward.pyx":462 * b[i] = 0 * for i_ in range(self.m): * i = order[i_] # <<<<<<<<<<<<<< @@ -7588,7 +7713,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_t_17 = __pyx_v_i_; __pyx_v_i = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_INT_t *, __pyx_pybuffernd_order.rcbuffer->pybuffer.buf, __pyx_t_17, __pyx_pybuffernd_order.diminfo[0].strides)); - /* "sklearn/earth/_forward.pyx":454 + /* "sklearn/earth/_forward.pyx":463 * for i_ in range(self.m): * i = order[i_] * float_tmp = X[i, variable] - candidate # <<<<<<<<<<<<<< @@ -7599,7 +7724,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_t_19 = __pyx_v_variable; __pyx_v_float_tmp = ((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_X.rcbuffer->pybuffer.buf, __pyx_t_18, __pyx_pybuffernd_X.diminfo[0].strides, __pyx_t_19, __pyx_pybuffernd_X.diminfo[1].strides)) - __pyx_v_candidate); - /* "sklearn/earth/_forward.pyx":455 + /* "sklearn/earth/_forward.pyx":464 * i = order[i_] * float_tmp = X[i, variable] - candidate * if float_tmp > 0: # <<<<<<<<<<<<<< @@ -7609,7 +7734,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_t_20 = ((__pyx_v_float_tmp > 0.0) != 0); if (__pyx_t_20) { - /* "sklearn/earth/_forward.pyx":456 + /* "sklearn/earth/_forward.pyx":465 * float_tmp = X[i, variable] - candidate * if float_tmp > 0: * b[i] = b_parent[i] * float_tmp # <<<<<<<<<<<<<< @@ -7623,7 +7748,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str } /*else*/ { - /* "sklearn/earth/_forward.pyx":458 + /* "sklearn/earth/_forward.pyx":467 * b[i] = b_parent[i] * float_tmp * else: * break # <<<<<<<<<<<<<< @@ -7636,35 +7761,35 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str } __pyx_L6_break:; - /* "sklearn/earth/_forward.pyx":462 + /* "sklearn/earth/_forward.pyx":471 * # Compute the initial covariance column, u (not including the final * # element) * u[0:k + 1] = np.dot(b, B_orth[:, 0:k + 1]) # <<<<<<<<<<<<<< * * # Compute the new last elements of c and u */ - __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyObject_GetAttrStr(__pyx_t_1, __pyx_n_s__dot); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong((__pyx_v_k + 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong((__pyx_v_k + 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_23 = PySlice_New(__pyx_int_0, __pyx_t_1, Py_None); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_23 = PySlice_New(__pyx_int_0, __pyx_t_1, Py_None); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_23); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(__pyx_k_slice_22); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_k_slice_22); - __Pyx_GIVEREF(__pyx_k_slice_22); + __Pyx_INCREF(__pyx_k_slice_25); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_k_slice_25); + __Pyx_GIVEREF(__pyx_k_slice_25); PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_23); __Pyx_GIVEREF(__pyx_t_23); __pyx_t_23 = 0; - __pyx_t_23 = PyObject_GetItem(((PyObject *)__pyx_v_B_orth), ((PyObject *)__pyx_t_1)); if (!__pyx_t_23) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_23 = PyObject_GetItem(((PyObject *)__pyx_v_B_orth), ((PyObject *)__pyx_t_1)); if (!__pyx_t_23) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_23); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_b)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_b)); @@ -7672,14 +7797,14 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_23); __Pyx_GIVEREF(__pyx_t_23); __pyx_t_23 = 0; - __pyx_t_23 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_23 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_23); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (__Pyx_PyObject_SetSlice(((PyObject *)__pyx_v_u), __pyx_t_23, 0, (__pyx_v_k + 1), NULL, NULL, NULL, 1, 1, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_PyObject_SetSlice(((PyObject *)__pyx_v_u), __pyx_t_23, 0, (__pyx_v_k + 1), NULL, NULL, NULL, 1, 1, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; - /* "sklearn/earth/_forward.pyx":465 + /* "sklearn/earth/_forward.pyx":474 * * # Compute the new last elements of c and u * c_end = 0.0 # <<<<<<<<<<<<<< @@ -7688,7 +7813,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str */ __pyx_v_c_end = 0.0; - /* "sklearn/earth/_forward.pyx":466 + /* "sklearn/earth/_forward.pyx":475 * # Compute the new last elements of c and u * c_end = 0.0 * u_end = 0.0 # <<<<<<<<<<<<<< @@ -7697,7 +7822,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str */ __pyx_v_u_end = 0.0; - /* "sklearn/earth/_forward.pyx":467 + /* "sklearn/earth/_forward.pyx":476 * c_end = 0.0 * u_end = 0.0 * for i in range(self.m): # <<<<<<<<<<<<<< @@ -7708,7 +7833,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { __pyx_v_i = __pyx_t_15; - /* "sklearn/earth/_forward.pyx":468 + /* "sklearn/earth/_forward.pyx":477 * u_end = 0.0 * for i in range(self.m): * u_end += b[i] * b[i] # <<<<<<<<<<<<<< @@ -7719,7 +7844,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_t_25 = __pyx_v_i; __pyx_v_u_end = (__pyx_v_u_end + ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_24, __pyx_pybuffernd_b.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_25, __pyx_pybuffernd_b.diminfo[0].strides)))); - /* "sklearn/earth/_forward.pyx":469 + /* "sklearn/earth/_forward.pyx":478 * for i in range(self.m): * u_end += b[i] * b[i] * c_end += b[i] * y[i] # <<<<<<<<<<<<<< @@ -7731,7 +7856,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_v_c_end = (__pyx_v_c_end + ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_26, __pyx_pybuffernd_b.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_27, __pyx_pybuffernd_y.diminfo[0].strides)))); } - /* "sklearn/earth/_forward.pyx":472 + /* "sklearn/earth/_forward.pyx":481 * * # Compute the last element of z (the others are identical to c) * u_dot_c = 0.0 # <<<<<<<<<<<<<< @@ -7740,7 +7865,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str */ __pyx_v_u_dot_c = 0.0; - /* "sklearn/earth/_forward.pyx":473 + /* "sklearn/earth/_forward.pyx":482 * # Compute the last element of z (the others are identical to c) * u_dot_c = 0.0 * u_dot_u = 0.0 # <<<<<<<<<<<<<< @@ -7749,7 +7874,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str */ __pyx_v_u_dot_u = 0.0; - /* "sklearn/earth/_forward.pyx":474 + /* "sklearn/earth/_forward.pyx":483 * u_dot_c = 0.0 * u_dot_u = 0.0 * for i in range(k + 1): # <<<<<<<<<<<<<< @@ -7760,7 +7885,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str for (__pyx_t_15 = 0; __pyx_t_15 < __pyx_t_14; __pyx_t_15+=1) { __pyx_v_i = __pyx_t_15; - /* "sklearn/earth/_forward.pyx":475 + /* "sklearn/earth/_forward.pyx":484 * u_dot_u = 0.0 * for i in range(k + 1): * u_dot_u += u[i] * u[i] # <<<<<<<<<<<<<< @@ -7771,7 +7896,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_t_29 = __pyx_v_i; __pyx_v_u_dot_u = (__pyx_v_u_dot_u + ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_u.rcbuffer->pybuffer.buf, __pyx_t_28, __pyx_pybuffernd_u.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_u.rcbuffer->pybuffer.buf, __pyx_t_29, __pyx_pybuffernd_u.diminfo[0].strides)))); - /* "sklearn/earth/_forward.pyx":476 + /* "sklearn/earth/_forward.pyx":485 * for i in range(k + 1): * u_dot_u += u[i] * u[i] * u_dot_c += u[i] * c[i] # <<<<<<<<<<<<<< @@ -7783,7 +7908,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_v_u_dot_c = (__pyx_v_u_dot_c + ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_u.rcbuffer->pybuffer.buf, __pyx_t_30, __pyx_pybuffernd_u.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_c.rcbuffer->pybuffer.buf, __pyx_t_31, __pyx_pybuffernd_c.diminfo[0].strides)))); } - /* "sklearn/earth/_forward.pyx":477 + /* "sklearn/earth/_forward.pyx":486 * u_dot_u += u[i] * u[i] * u_dot_c += u[i] * c[i] * z_denom = u_end - u_dot_u # <<<<<<<<<<<<<< @@ -7792,7 +7917,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str */ __pyx_v_z_denom = (__pyx_v_u_end - __pyx_v_u_dot_u); - /* "sklearn/earth/_forward.pyx":478 + /* "sklearn/earth/_forward.pyx":487 * u_dot_c += u[i] * c[i] * z_denom = u_end - u_dot_u * if z_denom <= self.zero_tol: # <<<<<<<<<<<<<< @@ -7802,26 +7927,26 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_t_20 = ((__pyx_v_z_denom <= __pyx_v_self->zero_tol) != 0); if (__pyx_t_20) { - /* "sklearn/earth/_forward.pyx":479 + /* "sklearn/earth/_forward.pyx":488 * z_denom = u_end - u_dot_u * if z_denom <= self.zero_tol: * z_end_squared = np.nan # <<<<<<<<<<<<<< * else: * z_end_squared = ((c_end - u_dot_c) ** 2) / z_denom */ - __pyx_t_23 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_23 = __Pyx_GetModuleGlobalName(__pyx_n_s__np); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_23); - __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_23, __pyx_n_s__nan); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_GetAttrStr(__pyx_t_23, __pyx_n_s__nan); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; - __pyx_t_32 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_32 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_32 = __pyx_PyFloat_AsDouble(__pyx_t_1); if (unlikely((__pyx_t_32 == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 488; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_v_z_end_squared = __pyx_t_32; goto __pyx_L12; } /*else*/ { - /* "sklearn/earth/_forward.pyx":481 + /* "sklearn/earth/_forward.pyx":490 * z_end_squared = np.nan * else: * z_end_squared = ((c_end - u_dot_c) ** 2) / z_denom # <<<<<<<<<<<<<< @@ -7832,7 +7957,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str } __pyx_L12:; - /* "sklearn/earth/_forward.pyx":485 + /* "sklearn/earth/_forward.pyx":494 * # Minimizing the norm is actually equivalent to maximizing z_end_squared * # Store z_end_squared and the current candidate as the best knot choice * best_z_end_squared = z_end_squared # <<<<<<<<<<<<<< @@ -7841,7 +7966,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str */ __pyx_v_best_z_end_squared = __pyx_v_z_end_squared; - /* "sklearn/earth/_forward.pyx":486 + /* "sklearn/earth/_forward.pyx":495 * # Store z_end_squared and the current candidate as the best knot choice * best_z_end_squared = z_end_squared * best_candidate_idx = candidate_idx # <<<<<<<<<<<<<< @@ -7850,7 +7975,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str */ __pyx_v_best_candidate_idx = __pyx_v_candidate_idx; - /* "sklearn/earth/_forward.pyx":487 + /* "sklearn/earth/_forward.pyx":496 * best_z_end_squared = z_end_squared * best_candidate_idx = candidate_idx * best_candidate = candidate # <<<<<<<<<<<<<< @@ -7859,7 +7984,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str */ __pyx_v_best_candidate = __pyx_v_candidate; - /* "sklearn/earth/_forward.pyx":490 + /* "sklearn/earth/_forward.pyx":499 * * # Initialize the accumulators * i = order[0] # <<<<<<<<<<<<<< @@ -7869,7 +7994,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_t_33 = 0; __pyx_v_i = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_INT_t *, __pyx_pybuffernd_order.rcbuffer->pybuffer.buf, __pyx_t_33, __pyx_pybuffernd_order.diminfo[0].strides)); - /* "sklearn/earth/_forward.pyx":491 + /* "sklearn/earth/_forward.pyx":500 * # Initialize the accumulators * i = order[0] * last_candidate_idx = 0 # <<<<<<<<<<<<<< @@ -7878,7 +8003,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str */ __pyx_v_last_candidate_idx = 0; - /* "sklearn/earth/_forward.pyx":492 + /* "sklearn/earth/_forward.pyx":501 * i = order[0] * last_candidate_idx = 0 * y_cum = y[i] # <<<<<<<<<<<<<< @@ -7888,21 +8013,21 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_t_14 = __pyx_v_i; __pyx_v_y_cum = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_14, __pyx_pybuffernd_y.diminfo[0].strides)); - /* "sklearn/earth/_forward.pyx":493 + /* "sklearn/earth/_forward.pyx":502 * last_candidate_idx = 0 * y_cum = y[i] * B_orth_times_parent_cum[0:k + 1] = B_orth[i, 0:k + 1] * b_parent[i] # <<<<<<<<<<<<<< * b_times_parent_cum = b[i] * b_parent[i] * parent_squared_cum = b_parent[i] ** 2 */ - __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_ulonglong(__pyx_v_i); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_23 = __Pyx_PyInt_to_py_npy_ulonglong((__pyx_v_k + 1)); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_23 = __Pyx_PyInt_to_py_npy_ulonglong((__pyx_v_k + 1)); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_23); - __pyx_t_2 = PySlice_New(__pyx_int_0, __pyx_t_23, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PySlice_New(__pyx_int_0, __pyx_t_23, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; - __pyx_t_23 = PyTuple_New(2); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_23 = PyTuple_New(2); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_23); PyTuple_SET_ITEM(__pyx_t_23, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); @@ -7910,20 +8035,20 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __Pyx_GIVEREF(__pyx_t_2); __pyx_t_1 = 0; __pyx_t_2 = 0; - __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_B_orth), ((PyObject *)__pyx_t_23)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(((PyObject *)__pyx_v_B_orth), ((PyObject *)__pyx_t_23)); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_23)); __pyx_t_23 = 0; __pyx_t_15 = __pyx_v_i; - __pyx_t_23 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_b_parent.diminfo[0].strides))); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_23 = PyFloat_FromDouble((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_15, __pyx_pybuffernd_b_parent.diminfo[0].strides))); if (unlikely(!__pyx_t_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_23); - __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_t_23); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_t_23); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_23); __pyx_t_23 = 0; - if (__Pyx_PyObject_SetSlice(((PyObject *)__pyx_v_B_orth_times_parent_cum), __pyx_t_1, 0, (__pyx_v_k + 1), NULL, NULL, NULL, 1, 1, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_PyObject_SetSlice(((PyObject *)__pyx_v_B_orth_times_parent_cum), __pyx_t_1, 0, (__pyx_v_k + 1), NULL, NULL, NULL, 1, 1, 0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "sklearn/earth/_forward.pyx":494 + /* "sklearn/earth/_forward.pyx":503 * y_cum = y[i] * B_orth_times_parent_cum[0:k + 1] = B_orth[i, 0:k + 1] * b_parent[i] * b_times_parent_cum = b[i] * b_parent[i] # <<<<<<<<<<<<<< @@ -7934,7 +8059,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_t_35 = __pyx_v_i; __pyx_v_b_times_parent_cum = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_34, __pyx_pybuffernd_b.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_35, __pyx_pybuffernd_b_parent.diminfo[0].strides))); - /* "sklearn/earth/_forward.pyx":495 + /* "sklearn/earth/_forward.pyx":504 * B_orth_times_parent_cum[0:k + 1] = B_orth[i, 0:k + 1] * b_parent[i] * b_times_parent_cum = b[i] * b_parent[i] * parent_squared_cum = b_parent[i] ** 2 # <<<<<<<<<<<<<< @@ -7944,7 +8069,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_t_36 = __pyx_v_i; __pyx_v_parent_squared_cum = pow((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_36, __pyx_pybuffernd_b_parent.diminfo[0].strides)), 2.0); - /* "sklearn/earth/_forward.pyx":496 + /* "sklearn/earth/_forward.pyx":505 * b_times_parent_cum = b[i] * b_parent[i] * parent_squared_cum = b_parent[i] ** 2 * parent_times_y_cum = b_parent[i] * y[i] # <<<<<<<<<<<<<< @@ -7955,7 +8080,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_t_38 = __pyx_v_i; __pyx_v_parent_times_y_cum = ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_37, __pyx_pybuffernd_b_parent.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_38, __pyx_pybuffernd_y.diminfo[0].strides))); - /* "sklearn/earth/_forward.pyx":500 + /* "sklearn/earth/_forward.pyx":509 * # Now loop over the remaining candidates and update z_end_squared for * # each, looking for the greatest value * for i_ in range(1, num_candidates): # <<<<<<<<<<<<<< @@ -7966,7 +8091,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str for (__pyx_t_40 = 1; __pyx_t_40 < __pyx_t_39; __pyx_t_40+=1) { __pyx_v_i_ = __pyx_t_40; - /* "sklearn/earth/_forward.pyx":501 + /* "sklearn/earth/_forward.pyx":510 * # each, looking for the greatest value * for i_ in range(1, num_candidates): * i = order[i_] # <<<<<<<<<<<<<< @@ -7976,7 +8101,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_t_41 = __pyx_v_i_; __pyx_v_i = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_INT_t *, __pyx_pybuffernd_order.rcbuffer->pybuffer.buf, __pyx_t_41, __pyx_pybuffernd_order.diminfo[0].strides)); - /* "sklearn/earth/_forward.pyx":504 + /* "sklearn/earth/_forward.pyx":513 * * # Update the candidate * last_last_candidate_idx = last_candidate_idx # <<<<<<<<<<<<<< @@ -7985,7 +8110,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str */ __pyx_v_last_last_candidate_idx = __pyx_v_last_candidate_idx; - /* "sklearn/earth/_forward.pyx":505 + /* "sklearn/earth/_forward.pyx":514 * # Update the candidate * last_last_candidate_idx = last_candidate_idx * last_candidate_idx = candidate_idx # <<<<<<<<<<<<<< @@ -7994,7 +8119,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str */ __pyx_v_last_candidate_idx = __pyx_v_candidate_idx; - /* "sklearn/earth/_forward.pyx":506 + /* "sklearn/earth/_forward.pyx":515 * last_last_candidate_idx = last_candidate_idx * last_candidate_idx = candidate_idx * last_candidate = candidate # <<<<<<<<<<<<<< @@ -8003,7 +8128,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str */ __pyx_v_last_candidate = __pyx_v_candidate; - /* "sklearn/earth/_forward.pyx":507 + /* "sklearn/earth/_forward.pyx":516 * last_candidate_idx = candidate_idx * last_candidate = candidate * candidate_idx = candidates[i_] # <<<<<<<<<<<<<< @@ -8013,7 +8138,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_t_42 = __pyx_v_i_; __pyx_v_candidate_idx = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_INT_t *, __pyx_pybuffernd_candidates.rcbuffer->pybuffer.buf, __pyx_t_42, __pyx_pybuffernd_candidates.diminfo[0].strides)); - /* "sklearn/earth/_forward.pyx":508 + /* "sklearn/earth/_forward.pyx":517 * last_candidate = candidate * candidate_idx = candidates[i_] * candidate = X[order[candidate_idx], variable] # <<<<<<<<<<<<<< @@ -8025,7 +8150,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_t_45 = __pyx_v_variable; __pyx_v_candidate = (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_X.rcbuffer->pybuffer.buf, __pyx_t_44, __pyx_pybuffernd_X.diminfo[0].strides, __pyx_t_45, __pyx_pybuffernd_X.diminfo[1].strides)); - /* "sklearn/earth/_forward.pyx":511 + /* "sklearn/earth/_forward.pyx":520 * * # Update the accumulators and compute delta_b * diff = last_candidate - candidate # <<<<<<<<<<<<<< @@ -8034,7 +8159,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str */ __pyx_v_diff = (__pyx_v_last_candidate - __pyx_v_candidate); - /* "sklearn/earth/_forward.pyx":512 + /* "sklearn/earth/_forward.pyx":521 * # Update the accumulators and compute delta_b * diff = last_candidate - candidate * delta_c_end = 0.0 # <<<<<<<<<<<<<< @@ -8043,7 +8168,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str */ __pyx_v_delta_c_end = 0.0; - /* "sklearn/earth/_forward.pyx":544 + /* "sklearn/earth/_forward.pyx":553 * * # BEGIN HYPER-OPTIMIZED * delta_b_squared = 0.0 # <<<<<<<<<<<<<< @@ -8052,7 +8177,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str */ __pyx_v_delta_b_squared = 0.0; - /* "sklearn/earth/_forward.pyx":545 + /* "sklearn/earth/_forward.pyx":554 * # BEGIN HYPER-OPTIMIZED * delta_b_squared = 0.0 * delta_c_end = 0.0 # <<<<<<<<<<<<<< @@ -8061,7 +8186,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str */ __pyx_v_delta_c_end = 0.0; - /* "sklearn/earth/_forward.pyx":546 + /* "sklearn/earth/_forward.pyx":555 * delta_b_squared = 0.0 * delta_c_end = 0.0 * delta_u_end = 0.0 # <<<<<<<<<<<<<< @@ -8070,7 +8195,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str */ __pyx_v_delta_u_end = 0.0; - /* "sklearn/earth/_forward.pyx":549 + /* "sklearn/earth/_forward.pyx":558 * * # Update the accumulators * for j_ in range(last_last_candidate_idx + 1, last_candidate_idx + 1): # <<<<<<<<<<<<<< @@ -8081,7 +8206,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str for (__pyx_t_47 = (__pyx_v_last_last_candidate_idx + 1); __pyx_t_47 < __pyx_t_46; __pyx_t_47+=1) { __pyx_v_j_ = __pyx_t_47; - /* "sklearn/earth/_forward.pyx":550 + /* "sklearn/earth/_forward.pyx":559 * # Update the accumulators * for j_ in range(last_last_candidate_idx + 1, last_candidate_idx + 1): * j = order[j_] # <<<<<<<<<<<<<< @@ -8091,7 +8216,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_t_48 = __pyx_v_j_; __pyx_v_j = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_INT_t *, __pyx_pybuffernd_order.rcbuffer->pybuffer.buf, __pyx_t_48, __pyx_pybuffernd_order.diminfo[0].strides)); - /* "sklearn/earth/_forward.pyx":551 + /* "sklearn/earth/_forward.pyx":560 * for j_ in range(last_last_candidate_idx + 1, last_candidate_idx + 1): * j = order[j_] * y_cum += y[j] # <<<<<<<<<<<<<< @@ -8101,7 +8226,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_t_49 = __pyx_v_j; __pyx_v_y_cum = (__pyx_v_y_cum + (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_49, __pyx_pybuffernd_y.diminfo[0].strides))); - /* "sklearn/earth/_forward.pyx":552 + /* "sklearn/earth/_forward.pyx":561 * j = order[j_] * y_cum += y[j] * for h in range(k + 1): # TODO: BLAS # <<<<<<<<<<<<<< @@ -8112,7 +8237,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str for (__pyx_t_51 = 0; __pyx_t_51 < __pyx_t_50; __pyx_t_51+=1) { __pyx_v_h = __pyx_t_51; - /* "sklearn/earth/_forward.pyx":553 + /* "sklearn/earth/_forward.pyx":562 * y_cum += y[j] * for h in range(k + 1): # TODO: BLAS * B_orth_times_parent_cum[h] += B_orth[j, h] * b_parent[j] # <<<<<<<<<<<<<< @@ -8126,7 +8251,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth_times_parent_cum.rcbuffer->pybuffer.buf, __pyx_t_55, __pyx_pybuffernd_B_orth_times_parent_cum.diminfo[0].strides) += ((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_52, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_53, __pyx_pybuffernd_B_orth.diminfo[1].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_54, __pyx_pybuffernd_b_parent.diminfo[0].strides))); } - /* "sklearn/earth/_forward.pyx":554 + /* "sklearn/earth/_forward.pyx":563 * for h in range(k + 1): # TODO: BLAS * B_orth_times_parent_cum[h] += B_orth[j, h] * b_parent[j] * b_times_parent_cum += b[j] * b_parent[j] # <<<<<<<<<<<<<< @@ -8137,7 +8262,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_t_51 = __pyx_v_j; __pyx_v_b_times_parent_cum = (__pyx_v_b_times_parent_cum + ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_50, __pyx_pybuffernd_b.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_51, __pyx_pybuffernd_b_parent.diminfo[0].strides)))); - /* "sklearn/earth/_forward.pyx":555 + /* "sklearn/earth/_forward.pyx":564 * B_orth_times_parent_cum[h] += B_orth[j, h] * b_parent[j] * b_times_parent_cum += b[j] * b_parent[j] * parent_squared_cum += b_parent[j] ** 2 # <<<<<<<<<<<<<< @@ -8147,7 +8272,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_t_56 = __pyx_v_j; __pyx_v_parent_squared_cum = (__pyx_v_parent_squared_cum + pow((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_56, __pyx_pybuffernd_b_parent.diminfo[0].strides)), 2.0)); - /* "sklearn/earth/_forward.pyx":556 + /* "sklearn/earth/_forward.pyx":565 * b_times_parent_cum += b[j] * b_parent[j] * parent_squared_cum += b_parent[j] ** 2 * parent_times_y_cum += b_parent[j] * y[j] # <<<<<<<<<<<<<< @@ -8159,7 +8284,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_v_parent_times_y_cum = (__pyx_v_parent_times_y_cum + ((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_57, __pyx_pybuffernd_b_parent.diminfo[0].strides)) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_58, __pyx_pybuffernd_y.diminfo[0].strides)))); } - /* "sklearn/earth/_forward.pyx":557 + /* "sklearn/earth/_forward.pyx":566 * parent_squared_cum += b_parent[j] ** 2 * parent_times_y_cum += b_parent[j] * y[j] * delta_c_end += diff * parent_times_y_cum # <<<<<<<<<<<<<< @@ -8168,7 +8293,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str */ __pyx_v_delta_c_end = (__pyx_v_delta_c_end + (__pyx_v_diff * __pyx_v_parent_times_y_cum)); - /* "sklearn/earth/_forward.pyx":558 + /* "sklearn/earth/_forward.pyx":567 * parent_times_y_cum += b_parent[j] * y[j] * delta_c_end += diff * parent_times_y_cum * delta_u_end += 2 * diff * b_times_parent_cum # <<<<<<<<<<<<<< @@ -8177,7 +8302,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str */ __pyx_v_delta_u_end = (__pyx_v_delta_u_end + ((2.0 * __pyx_v_diff) * __pyx_v_b_times_parent_cum)); - /* "sklearn/earth/_forward.pyx":559 + /* "sklearn/earth/_forward.pyx":568 * delta_c_end += diff * parent_times_y_cum * delta_u_end += 2 * diff * b_times_parent_cum * delta_b_squared = (diff ** 2) * parent_squared_cum # <<<<<<<<<<<<<< @@ -8186,7 +8311,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str */ __pyx_v_delta_b_squared = (pow(__pyx_v_diff, 2.0) * __pyx_v_parent_squared_cum); - /* "sklearn/earth/_forward.pyx":562 + /* "sklearn/earth/_forward.pyx":571 * * # Update u and a bunch of other stuff * for j in range(k + 1): # <<<<<<<<<<<<<< @@ -8197,7 +8322,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str for (__pyx_t_47 = 0; __pyx_t_47 < __pyx_t_46; __pyx_t_47+=1) { __pyx_v_j = __pyx_t_47; - /* "sklearn/earth/_forward.pyx":563 + /* "sklearn/earth/_forward.pyx":572 * # Update u and a bunch of other stuff * for j in range(k + 1): * float_tmp = diff * B_orth_times_parent_cum[j] # <<<<<<<<<<<<<< @@ -8207,7 +8332,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_t_59 = __pyx_v_j; __pyx_v_float_tmp = (__pyx_v_diff * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth_times_parent_cum.rcbuffer->pybuffer.buf, __pyx_t_59, __pyx_pybuffernd_B_orth_times_parent_cum.diminfo[0].strides))); - /* "sklearn/earth/_forward.pyx":564 + /* "sklearn/earth/_forward.pyx":573 * for j in range(k + 1): * float_tmp = diff * B_orth_times_parent_cum[j] * u_dot_c += float_tmp * c[j] # <<<<<<<<<<<<<< @@ -8217,7 +8342,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_t_60 = __pyx_v_j; __pyx_v_u_dot_c = (__pyx_v_u_dot_c + (__pyx_v_float_tmp * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_c.rcbuffer->pybuffer.buf, __pyx_t_60, __pyx_pybuffernd_c.diminfo[0].strides)))); - /* "sklearn/earth/_forward.pyx":565 + /* "sklearn/earth/_forward.pyx":574 * float_tmp = diff * B_orth_times_parent_cum[j] * u_dot_c += float_tmp * c[j] * u_dot_u += 2 * u[j] * float_tmp + float_tmp * float_tmp # <<<<<<<<<<<<<< @@ -8227,7 +8352,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_t_61 = __pyx_v_j; __pyx_v_u_dot_u = (__pyx_v_u_dot_u + (((2.0 * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_u.rcbuffer->pybuffer.buf, __pyx_t_61, __pyx_pybuffernd_u.diminfo[0].strides))) * __pyx_v_float_tmp) + (__pyx_v_float_tmp * __pyx_v_float_tmp))); - /* "sklearn/earth/_forward.pyx":566 + /* "sklearn/earth/_forward.pyx":575 * u_dot_c += float_tmp * c[j] * u_dot_u += 2 * u[j] * float_tmp + float_tmp * float_tmp * u[j] += float_tmp # <<<<<<<<<<<<<< @@ -8238,7 +8363,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_u.rcbuffer->pybuffer.buf, __pyx_t_62, __pyx_pybuffernd_u.diminfo[0].strides) += __pyx_v_float_tmp; } - /* "sklearn/earth/_forward.pyx":567 + /* "sklearn/earth/_forward.pyx":576 * u_dot_u += 2 * u[j] * float_tmp + float_tmp * float_tmp * u[j] += float_tmp * for j_ in range(last_candidate_idx + 1, candidate_idx): # <<<<<<<<<<<<<< @@ -8249,7 +8374,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str for (__pyx_t_47 = (__pyx_v_last_candidate_idx + 1); __pyx_t_47 < __pyx_t_46; __pyx_t_47+=1) { __pyx_v_j_ = __pyx_t_47; - /* "sklearn/earth/_forward.pyx":568 + /* "sklearn/earth/_forward.pyx":577 * u[j] += float_tmp * for j_ in range(last_candidate_idx + 1, candidate_idx): * j = order[j_] # <<<<<<<<<<<<<< @@ -8259,7 +8384,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_t_63 = __pyx_v_j_; __pyx_v_j = (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_INT_t *, __pyx_pybuffernd_order.rcbuffer->pybuffer.buf, __pyx_t_63, __pyx_pybuffernd_order.diminfo[0].strides)); - /* "sklearn/earth/_forward.pyx":569 + /* "sklearn/earth/_forward.pyx":578 * for j_ in range(last_candidate_idx + 1, candidate_idx): * j = order[j_] * delta_b_j = (X[j, variable] - candidate) * b_parent[j] # <<<<<<<<<<<<<< @@ -8271,7 +8396,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_t_66 = __pyx_v_j; __pyx_v_delta_b_j = (((*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_X.rcbuffer->pybuffer.buf, __pyx_t_64, __pyx_pybuffernd_X.diminfo[0].strides, __pyx_t_65, __pyx_pybuffernd_X.diminfo[1].strides)) - __pyx_v_candidate) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b_parent.rcbuffer->pybuffer.buf, __pyx_t_66, __pyx_pybuffernd_b_parent.diminfo[0].strides))); - /* "sklearn/earth/_forward.pyx":570 + /* "sklearn/earth/_forward.pyx":579 * j = order[j_] * delta_b_j = (X[j, variable] - candidate) * b_parent[j] * delta_b_squared += delta_b_j ** 2 # <<<<<<<<<<<<<< @@ -8280,7 +8405,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str */ __pyx_v_delta_b_squared = (__pyx_v_delta_b_squared + pow(__pyx_v_delta_b_j, 2.0)); - /* "sklearn/earth/_forward.pyx":571 + /* "sklearn/earth/_forward.pyx":580 * delta_b_j = (X[j, variable] - candidate) * b_parent[j] * delta_b_squared += delta_b_j ** 2 * delta_c_end += delta_b_j * y[j] # <<<<<<<<<<<<<< @@ -8290,7 +8415,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_t_67 = __pyx_v_j; __pyx_v_delta_c_end = (__pyx_v_delta_c_end + (__pyx_v_delta_b_j * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_y.rcbuffer->pybuffer.buf, __pyx_t_67, __pyx_pybuffernd_y.diminfo[0].strides)))); - /* "sklearn/earth/_forward.pyx":572 + /* "sklearn/earth/_forward.pyx":581 * delta_b_squared += delta_b_j ** 2 * delta_c_end += delta_b_j * y[j] * delta_u_end += 2 * delta_b_j * b[j] # <<<<<<<<<<<<<< @@ -8300,7 +8425,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_t_68 = __pyx_v_j; __pyx_v_delta_u_end = (__pyx_v_delta_u_end + ((2.0 * __pyx_v_delta_b_j) * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_68, __pyx_pybuffernd_b.diminfo[0].strides)))); - /* "sklearn/earth/_forward.pyx":573 + /* "sklearn/earth/_forward.pyx":582 * delta_c_end += delta_b_j * y[j] * delta_u_end += 2 * delta_b_j * b[j] * for h in range(k + 1): # <<<<<<<<<<<<<< @@ -8311,7 +8436,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str for (__pyx_t_70 = 0; __pyx_t_70 < __pyx_t_69; __pyx_t_70+=1) { __pyx_v_h = __pyx_t_70; - /* "sklearn/earth/_forward.pyx":574 + /* "sklearn/earth/_forward.pyx":583 * delta_u_end += 2 * delta_b_j * b[j] * for h in range(k + 1): * float_tmp = delta_b_j * B_orth[j, h] # <<<<<<<<<<<<<< @@ -8322,7 +8447,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_t_72 = __pyx_v_h; __pyx_v_float_tmp = (__pyx_v_delta_b_j * (*__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_B_orth.rcbuffer->pybuffer.buf, __pyx_t_71, __pyx_pybuffernd_B_orth.diminfo[0].strides, __pyx_t_72, __pyx_pybuffernd_B_orth.diminfo[1].strides))); - /* "sklearn/earth/_forward.pyx":575 + /* "sklearn/earth/_forward.pyx":584 * for h in range(k + 1): * float_tmp = delta_b_j * B_orth[j, h] * u_dot_c += float_tmp * c[h] # <<<<<<<<<<<<<< @@ -8332,7 +8457,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_t_73 = __pyx_v_h; __pyx_v_u_dot_c = (__pyx_v_u_dot_c + (__pyx_v_float_tmp * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_c.rcbuffer->pybuffer.buf, __pyx_t_73, __pyx_pybuffernd_c.diminfo[0].strides)))); - /* "sklearn/earth/_forward.pyx":576 + /* "sklearn/earth/_forward.pyx":585 * float_tmp = delta_b_j * B_orth[j, h] * u_dot_c += float_tmp * c[h] * u_dot_u += 2 * u[h] * float_tmp + float_tmp * float_tmp # <<<<<<<<<<<<<< @@ -8342,7 +8467,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_t_74 = __pyx_v_h; __pyx_v_u_dot_u = (__pyx_v_u_dot_u + (((2.0 * (*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_u.rcbuffer->pybuffer.buf, __pyx_t_74, __pyx_pybuffernd_u.diminfo[0].strides))) * __pyx_v_float_tmp) + (__pyx_v_float_tmp * __pyx_v_float_tmp))); - /* "sklearn/earth/_forward.pyx":577 + /* "sklearn/earth/_forward.pyx":586 * u_dot_c += float_tmp * c[h] * u_dot_u += 2 * u[h] * float_tmp + float_tmp * float_tmp * u[h] += float_tmp # <<<<<<<<<<<<<< @@ -8353,7 +8478,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_u.rcbuffer->pybuffer.buf, __pyx_t_75, __pyx_pybuffernd_u.diminfo[0].strides) += __pyx_v_float_tmp; } - /* "sklearn/earth/_forward.pyx":578 + /* "sklearn/earth/_forward.pyx":587 * u_dot_u += 2 * u[h] * float_tmp + float_tmp * float_tmp * u[h] += float_tmp * b[j] += delta_b_j # <<<<<<<<<<<<<< @@ -8364,7 +8489,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str *__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_8_forward_FLOAT_t *, __pyx_pybuffernd_b.rcbuffer->pybuffer.buf, __pyx_t_69, __pyx_pybuffernd_b.diminfo[0].strides) += __pyx_v_delta_b_j; } - /* "sklearn/earth/_forward.pyx":581 + /* "sklearn/earth/_forward.pyx":590 * * # Update u_end * delta_u_end += delta_b_squared # <<<<<<<<<<<<<< @@ -8373,7 +8498,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str */ __pyx_v_delta_u_end = (__pyx_v_delta_u_end + __pyx_v_delta_b_squared); - /* "sklearn/earth/_forward.pyx":582 + /* "sklearn/earth/_forward.pyx":591 * # Update u_end * delta_u_end += delta_b_squared * u_end += delta_u_end # <<<<<<<<<<<<<< @@ -8382,7 +8507,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str */ __pyx_v_u_end = (__pyx_v_u_end + __pyx_v_delta_u_end); - /* "sklearn/earth/_forward.pyx":585 + /* "sklearn/earth/_forward.pyx":594 * * # Update c_end * c_end += delta_c_end # <<<<<<<<<<<<<< @@ -8391,7 +8516,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str */ __pyx_v_c_end = (__pyx_v_c_end + __pyx_v_delta_c_end); - /* "sklearn/earth/_forward.pyx":588 + /* "sklearn/earth/_forward.pyx":597 * * # Update b_times_parent_cum * b_times_parent_cum += parent_squared_cum * diff # <<<<<<<<<<<<<< @@ -8400,7 +8525,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str */ __pyx_v_b_times_parent_cum = (__pyx_v_b_times_parent_cum + (__pyx_v_parent_squared_cum * __pyx_v_diff)); - /* "sklearn/earth/_forward.pyx":592 + /* "sklearn/earth/_forward.pyx":601 * # Compute the new z_end_squared (this is the quantity we're * # optimizing) * if (u_end - u_dot_u) <= self.zero_tol: # <<<<<<<<<<<<<< @@ -8410,7 +8535,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_t_20 = (((__pyx_v_u_end - __pyx_v_u_dot_u) <= __pyx_v_self->zero_tol) != 0); if (__pyx_t_20) { - /* "sklearn/earth/_forward.pyx":593 + /* "sklearn/earth/_forward.pyx":602 * # optimizing) * if (u_end - u_dot_u) <= self.zero_tol: * continue # <<<<<<<<<<<<<< @@ -8422,7 +8547,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str } __pyx_L25:; - /* "sklearn/earth/_forward.pyx":594 + /* "sklearn/earth/_forward.pyx":603 * if (u_end - u_dot_u) <= self.zero_tol: * continue * z_end_squared = ((c_end - u_dot_c) ** 2) / (u_end - u_dot_u) # <<<<<<<<<<<<<< @@ -8431,7 +8556,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str */ __pyx_v_z_end_squared = (pow((__pyx_v_c_end - __pyx_v_u_dot_c), 2.0) / (__pyx_v_u_end - __pyx_v_u_dot_u)); - /* "sklearn/earth/_forward.pyx":598 + /* "sklearn/earth/_forward.pyx":607 * * # Update the best if necessary * if z_end_squared > best_z_end_squared: # <<<<<<<<<<<<<< @@ -8441,7 +8566,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_t_20 = ((__pyx_v_z_end_squared > __pyx_v_best_z_end_squared) != 0); if (__pyx_t_20) { - /* "sklearn/earth/_forward.pyx":599 + /* "sklearn/earth/_forward.pyx":608 * # Update the best if necessary * if z_end_squared > best_z_end_squared: * best_z_end_squared = z_end_squared # <<<<<<<<<<<<<< @@ -8450,7 +8575,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str */ __pyx_v_best_z_end_squared = __pyx_v_z_end_squared; - /* "sklearn/earth/_forward.pyx":600 + /* "sklearn/earth/_forward.pyx":609 * if z_end_squared > best_z_end_squared: * best_z_end_squared = z_end_squared * best_candidate_idx = candidate_idx # <<<<<<<<<<<<<< @@ -8459,7 +8584,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str */ __pyx_v_best_candidate_idx = __pyx_v_candidate_idx; - /* "sklearn/earth/_forward.pyx":601 + /* "sklearn/earth/_forward.pyx":610 * best_z_end_squared = z_end_squared * best_candidate_idx = candidate_idx * best_candidate = candidate # <<<<<<<<<<<<<< @@ -8473,7 +8598,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str __pyx_L13_continue:; } - /* "sklearn/earth/_forward.pyx":604 + /* "sklearn/earth/_forward.pyx":613 * * # Compute the mse for the best z_end and set return values * mse[0] = ( # <<<<<<<<<<<<<< @@ -8482,7 +8607,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str */ (__pyx_v_mse[0]) = (((__pyx_v_self->y_squared - __pyx_v_self->c_squared) - __pyx_v_best_z_end_squared) / __pyx_v_self->m); - /* "sklearn/earth/_forward.pyx":606 + /* "sklearn/earth/_forward.pyx":615 * mse[0] = ( * self.y_squared - self.c_squared - best_z_end_squared) / self.m * knot[0] = best_candidate # <<<<<<<<<<<<<< @@ -8490,7 +8615,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_forward_13ForwardPasser_best_knot(str */ (__pyx_v_knot[0]) = __pyx_v_best_candidate; - /* "sklearn/earth/_forward.pyx":607 + /* "sklearn/earth/_forward.pyx":616 * self.y_squared - self.c_squared - best_z_end_squared) / self.m * knot[0] = best_candidate * knot_idx[0] = best_candidate_idx # <<<<<<<<<<<<<< @@ -8703,7 +8828,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_24), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_27), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -8743,7 +8868,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * * info.buf = PyArray_DATA(self) */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_26), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_29), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -9017,7 +9142,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_28), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_31), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_Raise(__pyx_t_4, 0, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -9232,7 +9357,7 @@ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, P */ __pyx_t_4 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_29), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_32), __pyx_t_4); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -9698,8 +9823,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx #else __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif - __Pyx_XDECREF(__pyx_v_childname); - __pyx_v_childname = __pyx_t_3; + __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3); __pyx_t_3 = 0; /* "numpy.pxd":795 @@ -9712,8 +9836,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); - __pyx_v_fields = ((PyObject*)__pyx_t_3); + __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3)); __pyx_t_3 = 0; /* "numpy.pxd":796 @@ -9770,11 +9893,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_L6_unpacking_done:; } if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_XDECREF(((PyObject *)__pyx_v_child)); - __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); + __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_v_new_offset); - __pyx_v_new_offset = __pyx_t_4; + __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4); __pyx_t_4 = 0; /* "numpy.pxd":798 @@ -9808,7 +9929,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_31), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_34), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -9859,7 +9980,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_32), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_k_tuple_35), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_Raise(__pyx_t_5, 0, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -9942,8 +10063,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_v_t); - __pyx_v_t = __pyx_t_3; + __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_3); __pyx_t_3 = 0; /* "numpy.pxd":822 @@ -9963,7 +10083,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_34), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_k_tuple_37), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_Raise(__pyx_t_3, 0, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -10292,7 +10412,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx * f += 1 * else: */ - __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_29), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_32), __pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); @@ -10722,6 +10842,9 @@ static PyTypeObject __pyx_type_7sklearn_5earth_8_forward_ForwardPasser = { #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif + #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) + 0, /*tp_finalize*/ + #endif }; static PyMethodDef __pyx_methods[] = { @@ -10747,21 +10870,21 @@ static struct PyModuleDef __pyx_moduledef = { #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, - {&__pyx_kp_u_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 1, 0, 0}, - {&__pyx_kp_u_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 1, 0, 0}, - {&__pyx_kp_u_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 1, 0, 0}, - {&__pyx_kp_u_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 1, 0, 0}, - {&__pyx_n_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 1}, + {&__pyx_n_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 1}, + {&__pyx_kp_u_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 1, 0, 0}, + {&__pyx_kp_u_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 1, 0, 0}, {&__pyx_kp_u_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 1, 0, 0}, + {&__pyx_kp_u_32, __pyx_k_32, sizeof(__pyx_k_32), 0, 1, 0, 0}, {&__pyx_kp_u_33, __pyx_k_33, sizeof(__pyx_k_33), 0, 1, 0, 0}, - {&__pyx_kp_s_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 0, 1, 0}, - {&__pyx_kp_s_36, __pyx_k_36, sizeof(__pyx_k_36), 0, 0, 1, 0}, - {&__pyx_kp_s_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 0, 1, 0}, + {&__pyx_kp_u_36, __pyx_k_36, sizeof(__pyx_k_36), 0, 1, 0, 0}, {&__pyx_kp_s_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 0, 1, 0}, {&__pyx_kp_s_39, __pyx_k_39, sizeof(__pyx_k_39), 0, 0, 1, 0}, + {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0}, + {&__pyx_kp_s_40, __pyx_k_40, sizeof(__pyx_k_40), 0, 0, 1, 0}, + {&__pyx_kp_s_41, __pyx_k_41, sizeof(__pyx_k_41), 0, 0, 1, 0}, + {&__pyx_kp_s_42, __pyx_k_42, sizeof(__pyx_k_42), 0, 0, 1, 0}, {&__pyx_n_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 1}, - {&__pyx_n_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 1}, + {&__pyx_n_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 1}, {&__pyx_n_s__C, __pyx_k__C, sizeof(__pyx_k__C), 0, 0, 1, 1}, {&__pyx_n_s__IndexError, __pyx_k__IndexError, sizeof(__pyx_k__IndexError), 0, 0, 1, 1}, {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, @@ -10775,6 +10898,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s____pyx_releasebuffer, __pyx_k____pyx_releasebuffer, sizeof(__pyx_k____pyx_releasebuffer), 0, 0, 1, 1}, {&__pyx_n_s____pyx_vtable__, __pyx_k____pyx_vtable__, sizeof(__pyx_k____pyx_vtable__), 0, 0, 1, 1}, {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s__allow_linear, __pyx_k__allow_linear, sizeof(__pyx_k__allow_linear), 0, 0, 1, 1}, {&__pyx_n_s__argsort, __pyx_k__argsort, sizeof(__pyx_k__argsort), 0, 0, 1, 1}, {&__pyx_n_s__check_every, __pyx_k__check_every, sizeof(__pyx_k__check_every), 0, 0, 1, 1}, {&__pyx_n_s__copy, __pyx_k__copy, sizeof(__pyx_k__copy), 0, 0, 1, 1}, @@ -10818,9 +10942,9 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_round = __Pyx_GetBuiltinName(__pyx_n_s__round); if (!__pyx_builtin_round) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_IndexError = __Pyx_GetBuiltinName(__pyx_n_s__IndexError); if (!__pyx_builtin_IndexError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_round = __Pyx_GetBuiltinName(__pyx_n_s__round); if (!__pyx_builtin_round) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; @@ -10832,155 +10956,172 @@ static int __Pyx_InitCachedConstants(void) { __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("__Pyx_InitCachedConstants", 0); - /* "sklearn/earth/_forward.pyx":91 + /* "sklearn/earth/_forward.pyx":69 + * self.B = np.ones( + * shape=(self.m, self.max_terms), order='C', dtype=np.float) + * self.basis.weighted_transform(self.X, self.B[:,0:1], self.sample_weight) # <<<<<<<<<<<<<< + * # An orthogonal matrix with the same column space as B + * self.B_orth = self.B.copy() + */ + __pyx_k_slice_1 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_1); + __Pyx_GIVEREF(__pyx_k_slice_1); + __pyx_k_slice_2 = PySlice_New(__pyx_int_0, __pyx_int_1, Py_None); if (unlikely(!__pyx_k_slice_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_2); + __Pyx_GIVEREF(__pyx_k_slice_2); + __pyx_k_tuple_3 = PyTuple_Pack(2, __pyx_k_slice_1, __pyx_k_slice_2); if (unlikely(!__pyx_k_tuple_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_3); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_3)); + + /* "sklearn/earth/_forward.pyx":92 * self.linear_variables[linvar] = 1 * else: * raise IndexError( # <<<<<<<<<<<<<< * 'Unknown variable selected in linvars argument.') * */ - __pyx_k_tuple_2 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_1)); if (unlikely(!__pyx_k_tuple_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_2); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_2)); + __pyx_k_tuple_5 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_k_tuple_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_5); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_5)); - /* "sklearn/earth/_forward.pyx":112 + /* "sklearn/earth/_forward.pyx":115 * cdef ConstantBasisFunction root_basis_function = self.basis[0] * for variable in range(self.n): * order = np.argsort(X[:, variable])[::-1] # <<<<<<<<<<<<<< * if root_basis_function.valid_knots(B[order, 0], X[order, variable], * variable, self.check_every, endspan, */ - __pyx_k_slice_4 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_slice_4); - __Pyx_GIVEREF(__pyx_k_slice_4); - __pyx_k_slice_5 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_k_slice_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_slice_5); - __Pyx_GIVEREF(__pyx_k_slice_5); + __pyx_k_slice_7 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_7); + __Pyx_GIVEREF(__pyx_k_slice_7); + __pyx_k_slice_8 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_k_slice_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_8); + __Pyx_GIVEREF(__pyx_k_slice_8); - /* "sklearn/earth/_forward.pyx":263 + /* "sklearn/earth/_forward.pyx":269 * # Sort the data * # TODO: eliminate Python call / data copy * sorting[:] = np.argsort(X[:, variable])[::-1] # <<<<<<<<<<<<<< * * # Iterate over parents */ - __pyx_k_slice_8 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_slice_8); - __Pyx_GIVEREF(__pyx_k_slice_8); - __pyx_k_slice_9 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_k_slice_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_slice_9); - __Pyx_GIVEREF(__pyx_k_slice_9); - __pyx_k_slice_10 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_slice_10); - __Pyx_GIVEREF(__pyx_k_slice_10); + __pyx_k_slice_11 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_11); + __Pyx_GIVEREF(__pyx_k_slice_11); + __pyx_k_slice_12 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_k_slice_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_12); + __Pyx_GIVEREF(__pyx_k_slice_12); + __pyx_k_slice_13 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 269; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_13); + __Pyx_GIVEREF(__pyx_k_slice_13); - /* "sklearn/earth/_forward.pyx":361 + /* "sklearn/earth/_forward.pyx":367 * bf2 = HingeBasisFunction( * parent_choice, knot_choice, knot_idx_choice, variable_choice, True, label) * bf1.apply(X, B[:, k]) # <<<<<<<<<<<<<< + * apply_weights_slice(B, sample_weight, k) * bf2.apply(X, B[:, k + 1]) - * self.basis.append(bf1) */ - __pyx_k_slice_11 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 361; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_slice_11); - __Pyx_GIVEREF(__pyx_k_slice_11); + __pyx_k_slice_14 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_14); + __Pyx_GIVEREF(__pyx_k_slice_14); - /* "sklearn/earth/_forward.pyx":362 - * parent_choice, knot_choice, knot_idx_choice, variable_choice, True, label) + /* "sklearn/earth/_forward.pyx":369 * bf1.apply(X, B[:, k]) + * apply_weights_slice(B, sample_weight, k) * bf2.apply(X, B[:, k + 1]) # <<<<<<<<<<<<<< + * apply_weights_slice(B, sample_weight, k + 1) * self.basis.append(bf1) - * self.basis.append(bf2) */ - __pyx_k_slice_12 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 362; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_slice_12); - __Pyx_GIVEREF(__pyx_k_slice_12); + __pyx_k_slice_15 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_15); + __Pyx_GIVEREF(__pyx_k_slice_15); - /* "sklearn/earth/_forward.pyx":367 + /* "sklearn/earth/_forward.pyx":375 * * # Orthogonalize the new basis * B_orth[:, k] = B[:, k] # <<<<<<<<<<<<<< * if self.orthonormal_update(k) == 1: * bf1.make_unsplittable() */ - __pyx_k_slice_13 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_13)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_slice_13); - __Pyx_GIVEREF(__pyx_k_slice_13); - __pyx_k_slice_14 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_slice_14); - __Pyx_GIVEREF(__pyx_k_slice_14); + __pyx_k_slice_16 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_16); + __Pyx_GIVEREF(__pyx_k_slice_16); + __pyx_k_slice_17 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 375; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_17); + __Pyx_GIVEREF(__pyx_k_slice_17); - /* "sklearn/earth/_forward.pyx":370 + /* "sklearn/earth/_forward.pyx":378 * if self.orthonormal_update(k) == 1: * bf1.make_unsplittable() * B_orth[:, k + 1] = B[:, k + 1] # <<<<<<<<<<<<<< * if self.orthonormal_update(k + 1) == 1: * bf2.make_unsplittable() */ - __pyx_k_slice_15 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_slice_15); - __Pyx_GIVEREF(__pyx_k_slice_15); - __pyx_k_slice_16 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_slice_16); - __Pyx_GIVEREF(__pyx_k_slice_16); + __pyx_k_slice_18 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_18); + __Pyx_GIVEREF(__pyx_k_slice_18); + __pyx_k_slice_19 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_19); + __Pyx_GIVEREF(__pyx_k_slice_19); - /* "sklearn/earth/_forward.pyx":376 + /* "sklearn/earth/_forward.pyx":384 * # In this case, only add the linear basis function * bf1 = LinearBasisFunction(parent_choice, variable_choice, label) * bf1.apply(X, B[:, k]) # <<<<<<<<<<<<<< + * apply_weights_slice(B, sample_weight, k) * self.basis.append(bf1) - * */ - __pyx_k_slice_17 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_17)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_slice_17); - __Pyx_GIVEREF(__pyx_k_slice_17); + __pyx_k_slice_20 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 384; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_20); + __Pyx_GIVEREF(__pyx_k_slice_20); - /* "sklearn/earth/_forward.pyx":380 + /* "sklearn/earth/_forward.pyx":389 * * # Orthogonalize the new basis * B_orth[:, k] = B[:, k] # <<<<<<<<<<<<<< * if self.orthonormal_update(k) == 1: * bf1.make_unsplittable() */ - __pyx_k_slice_18 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_18)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_slice_18); - __Pyx_GIVEREF(__pyx_k_slice_18); - __pyx_k_slice_19 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_19)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 380; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_slice_19); - __Pyx_GIVEREF(__pyx_k_slice_19); + __pyx_k_slice_21 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_21); + __Pyx_GIVEREF(__pyx_k_slice_21); + __pyx_k_slice_22 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 389; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_22); + __Pyx_GIVEREF(__pyx_k_slice_22); - /* "sklearn/earth/_forward.pyx":404 + /* "sklearn/earth/_forward.pyx":413 * ''' * * cdef cnp.ndarray[FLOAT_t, ndim = 1] b = self.B[:, k + 1] # <<<<<<<<<<<<<< * cdef cnp.ndarray[FLOAT_t, ndim = 1] b_parent = self.B[:, parent] * cdef cnp.ndarray[FLOAT_t, ndim = 1] u = self.u */ - __pyx_k_slice_20 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_20)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 404; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_slice_20); - __Pyx_GIVEREF(__pyx_k_slice_20); + __pyx_k_slice_23 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_23)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 413; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_23); + __Pyx_GIVEREF(__pyx_k_slice_23); - /* "sklearn/earth/_forward.pyx":405 + /* "sklearn/earth/_forward.pyx":414 * * cdef cnp.ndarray[FLOAT_t, ndim = 1] b = self.B[:, k + 1] * cdef cnp.ndarray[FLOAT_t, ndim = 1] b_parent = self.B[:, parent] # <<<<<<<<<<<<<< * cdef cnp.ndarray[FLOAT_t, ndim = 1] u = self.u * cdef cnp.ndarray[FLOAT_t, ndim = 2] B_orth = self.B_orth */ - __pyx_k_slice_21 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_21)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_slice_21); - __Pyx_GIVEREF(__pyx_k_slice_21); + __pyx_k_slice_24 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 414; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_24); + __Pyx_GIVEREF(__pyx_k_slice_24); - /* "sklearn/earth/_forward.pyx":462 + /* "sklearn/earth/_forward.pyx":471 * # Compute the initial covariance column, u (not including the final * # element) * u[0:k + 1] = np.dot(b, B_orth[:, 0:k + 1]) # <<<<<<<<<<<<<< * * # Compute the new last elements of c and u */ - __pyx_k_slice_22 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_22)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 462; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_slice_22); - __Pyx_GIVEREF(__pyx_k_slice_22); + __pyx_k_slice_25 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_k_slice_25)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 471; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_slice_25); + __Pyx_GIVEREF(__pyx_k_slice_25); /* "numpy.pxd":215 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) @@ -10989,9 +11130,9 @@ static int __Pyx_InitCachedConstants(void) { * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_k_tuple_24 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_23)); if (unlikely(!__pyx_k_tuple_24)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_24); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_24)); + __pyx_k_tuple_27 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_26)); if (unlikely(!__pyx_k_tuple_27)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_27); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_27)); /* "numpy.pxd":219 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) @@ -11000,9 +11141,9 @@ static int __Pyx_InitCachedConstants(void) { * * info.buf = PyArray_DATA(self) */ - __pyx_k_tuple_26 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_25)); if (unlikely(!__pyx_k_tuple_26)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_26); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_26)); + __pyx_k_tuple_29 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_28)); if (unlikely(!__pyx_k_tuple_29)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_29); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_29)); /* "numpy.pxd":257 * if ((descr.byteorder == c'>' and little_endian) or @@ -11011,9 +11152,9 @@ static int __Pyx_InitCachedConstants(void) { * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_k_tuple_28 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_27)); if (unlikely(!__pyx_k_tuple_28)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_28); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_28)); + __pyx_k_tuple_31 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_30)); if (unlikely(!__pyx_k_tuple_31)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_31); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_31)); /* "numpy.pxd":799 * @@ -11022,9 +11163,9 @@ static int __Pyx_InitCachedConstants(void) { * * if ((child.byteorder == c'>' and little_endian) or */ - __pyx_k_tuple_31 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_30)); if (unlikely(!__pyx_k_tuple_31)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_31); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_31)); + __pyx_k_tuple_34 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_33)); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_34); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_34)); /* "numpy.pxd":803 * if ((child.byteorder == c'>' and little_endian) or @@ -11033,9 +11174,9 @@ static int __Pyx_InitCachedConstants(void) { * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_k_tuple_32 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_27)); if (unlikely(!__pyx_k_tuple_32)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_32); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_32)); + __pyx_k_tuple_35 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_30)); if (unlikely(!__pyx_k_tuple_35)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_35); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_35)); /* "numpy.pxd":823 * t = child.type_num @@ -11044,9 +11185,9 @@ static int __Pyx_InitCachedConstants(void) { * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_k_tuple_34 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_33)); if (unlikely(!__pyx_k_tuple_34)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_k_tuple_34); - __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_34)); + __pyx_k_tuple_37 = PyTuple_Pack(1, ((PyObject *)__pyx_kp_u_36)); if (unlikely(!__pyx_k_tuple_37)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_k_tuple_37); + __Pyx_GIVEREF(((PyObject *)__pyx_k_tuple_37)); __Pyx_RefNannyFinishContext(); return 0; __pyx_L1_error:; @@ -11207,6 +11348,7 @@ PyMODINIT_FUNC PyInit__forward(void) /*--- Function import code ---*/ __pyx_t_1 = __Pyx_ImportModule("sklearn.earth._util"); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_ImportFunction(__pyx_t_1, "log2", (void (**)(void))&__pyx_f_7sklearn_5earth_5_util_log2, "__pyx_t_7sklearn_5earth_5_util_FLOAT_t (__pyx_t_7sklearn_5earth_5_util_FLOAT_t)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ImportFunction(__pyx_t_1, "apply_weights_slice", (void (**)(void))&__pyx_f_7sklearn_5earth_5_util_apply_weights_slice, "PyObject *(PyArrayObject *, PyArrayObject *, __pyx_t_7sklearn_5earth_5_util_INDEX_t, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_ImportFunction(__pyx_t_1, "apply_weights_1d", (void (**)(void))&__pyx_f_7sklearn_5earth_5_util_apply_weights_1d, "PyObject *(PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_ImportFunction(__pyx_t_1, "gcv_adjust", (void (**)(void))&__pyx_f_7sklearn_5earth_5_util_gcv_adjust, "__pyx_t_7sklearn_5earth_5_util_FLOAT_t (__pyx_t_7sklearn_5earth_5_util_INDEX_t, __pyx_t_7sklearn_5earth_5_util_INDEX_t, __pyx_t_7sklearn_5earth_5_util_FLOAT_t, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} Py_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -11252,7 +11394,7 @@ PyMODINIT_FUNC PyInit__forward(void) */ __pyx_t_3 = PyInt_FromLong(__pyx_e_7sklearn_5earth_8_forward_MAXTERMS); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_kp_s_35)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_kp_s_38)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "sklearn/earth/_forward.pyx":17 @@ -11264,7 +11406,7 @@ PyMODINIT_FUNC PyInit__forward(void) */ __pyx_t_3 = PyInt_FromLong(__pyx_e_7sklearn_5earth_8_forward_MAXRSQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_kp_s_36)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_kp_s_39)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "sklearn/earth/_forward.pyx":18 @@ -11276,7 +11418,7 @@ PyMODINIT_FUNC PyInit__forward(void) */ __pyx_t_3 = PyInt_FromLong(__pyx_e_7sklearn_5earth_8_forward_NOIMPRV); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_kp_s_37)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_kp_s_40)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "sklearn/earth/_forward.pyx":19 @@ -11288,7 +11430,7 @@ PyMODINIT_FUNC PyInit__forward(void) */ __pyx_t_3 = PyInt_FromLong(__pyx_e_7sklearn_5earth_8_forward_LOWGRSQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_kp_s_38)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_kp_s_41)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; /* "sklearn/earth/_forward.pyx":20 @@ -11300,12 +11442,11 @@ PyMODINIT_FUNC PyInit__forward(void) */ __pyx_t_3 = PyInt_FromLong(__pyx_e_7sklearn_5earth_8_forward_NOCAND); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 20; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (PyDict_SetItem(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_kp_s_39)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, __pyx_t_3, ((PyObject *)__pyx_kp_s_42)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_XGOTREF(((PyObject *)__pyx_v_7sklearn_5earth_8_forward_stopping_conditions)); - __Pyx_DECREF(((PyObject *)__pyx_v_7sklearn_5earth_8_forward_stopping_conditions)); + __Pyx_DECREF_SET(__pyx_v_7sklearn_5earth_8_forward_stopping_conditions, ((PyObject*)__pyx_t_2)); __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); - __pyx_v_7sklearn_5earth_8_forward_stopping_conditions = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; /* "sklearn/earth/_forward.pyx":1 diff --git a/sklearn/earth/_forward.pxd b/sklearn/earth/_forward.pxd index e3e744afa3639..bbb6edd56db86 100644 --- a/sklearn/earth/_forward.pxd +++ b/sklearn/earth/_forward.pxd @@ -24,6 +24,7 @@ cdef class ForwardPasser: cdef FLOAT_t endspan_alpha cdef FLOAT_t minspan_alpha cdef int max_terms + cdef bint allow_linear cdef int max_degree cdef FLOAT_t thresh cdef FLOAT_t penalty diff --git a/sklearn/earth/_forward.pyx b/sklearn/earth/_forward.pyx index 01a410c46ddf8..a22f0d542cd53 100644 --- a/sklearn/earth/_forward.pyx +++ b/sklearn/earth/_forward.pyx @@ -4,7 +4,7 @@ # cython: wraparound = False # cython: profile = False -from ._util cimport gcv_adjust, log2, apply_weights_1d +from ._util cimport gcv_adjust, log2, apply_weights_1d, apply_weights_slice from ._basis cimport Basis, BasisFunction, ConstantBasisFunction, HingeBasisFunction, LinearBasisFunction from ._record cimport ForwardPassIteration @@ -38,6 +38,7 @@ cdef class ForwardPasser: 'minspan_alpha'] if 'minspan_alpha' in kwargs else .05 self.max_terms = kwargs[ 'max_terms'] if 'max_terms' in kwargs else 2 * self.n + 10 + self.allow_linear = kwargs['allow_linear'] if 'allow_linear' in kwargs else True self.max_degree = kwargs['max_degree'] if 'max_degree' in kwargs else 1 self.thresh = kwargs['thresh'] if 'thresh' in kwargs else 0.001 self.penalty = kwargs['penalty'] if 'penalty' in kwargs else 3.0 @@ -65,7 +66,7 @@ cdef class ForwardPasser: shape=self.max_terms, dtype=np.float) self.B = np.ones( shape=(self.m, self.max_terms), order='C', dtype=np.float) - self.basis.weighted_transform(self.X, self.B, self.sample_weight) + self.basis.weighted_transform(self.X, self.B[:,0:1], self.sample_weight) # An orthogonal matrix with the same column space as B self.B_orth = self.B.copy() self.u = np.empty(shape=self.max_terms, dtype=np.float) @@ -107,6 +108,8 @@ cdef class ForwardPasser: cdef cnp.ndarray[FLOAT_t, ndim = 2] X = self.X if self.endspan < 0: endspan = round(3 - log2(self.endspan_alpha / self.n)) + else: + endspan = self.endspan cdef ConstantBasisFunction root_basis_function = self.basis[0] for variable in range(self.n): order = np.argsort(X[:, variable])[::-1] @@ -186,7 +189,7 @@ cdef class ForwardPasser: nrm += B_orth[i, k] * B_orth[i, k] nrm = sqrt(nrm) norms[k] = nrm - + if nrm0 <= self.zero_tol or nrm / nrm0 <= self.zero_tol: for i in range(self.m): B_orth[i, k] = 0.0 @@ -251,9 +254,12 @@ cdef class ForwardPasser: cdef cnp.ndarray[FLOAT_t, ndim = 1] y = self.y cdef cnp.ndarray[INT_t, ndim = 1] linear_variables = self.linear_variables cdef cnp.ndarray[INT_t, ndim = 1] sorting = self.sorting - + cdef cnp.ndarray[FLOAT_t, ndim = 1] sample_weight = self.sample_weight + if self.endspan < 0: endspan = round(3 - log2(self.endspan_alpha / self.n)) + else: + endspan = self.endspan # Iterate over variables for variable in range(self.n): @@ -284,10 +290,10 @@ cdef class ForwardPasser: linear_dependence = self.orthonormal_update(k) # If a new hinge function does not improve the gcv over the linear term - # then just the linear term will be retained. Calculate the gcv with - # just the linear term in order to compare later. Note that the mse with - # another term never increases, but the gcv may because it penalizes additional - # terms. + # then just the linear term will be retained (if allow_linear). Calculate the + # gcv with just the linear term in order to compare later. Note that the mse + # with another term never increases, but the gcv may because it penalizes + # additional terms. mse_ = (self.y_squared - self.c_squared) / self.m gcv_ = gcv_factor_k_plus_1 * \ (self.y_squared - self.c_squared) / self.m @@ -311,8 +317,8 @@ cdef class ForwardPasser: self.best_knot(parent_idx, variable, k, candidates_idx, sorting, & mse, & knot, & knot_idx) # If the hinge function does not decrease the gcv then - # just keep the linear term - if gcv_factor_k_plus_2 * mse >= gcv_: + # just keep the linear term (if allow_linear is True) + if self.allow_linear and (gcv_factor_k_plus_2 * mse >= gcv_): mse = mse_ knot_idx = -1 @@ -359,7 +365,9 @@ cdef class ForwardPasser: bf2 = HingeBasisFunction( parent_choice, knot_choice, knot_idx_choice, variable_choice, True, label) bf1.apply(X, B[:, k]) + apply_weights_slice(B, sample_weight, k) bf2.apply(X, B[:, k + 1]) + apply_weights_slice(B, sample_weight, k + 1) self.basis.append(bf1) self.basis.append(bf2) @@ -374,6 +382,7 @@ cdef class ForwardPasser: # In this case, only add the linear basis function bf1 = LinearBasisFunction(parent_choice, variable_choice, label) bf1.apply(X, B[:, k]) + apply_weights_slice(B, sample_weight, k) self.basis.append(bf1) # Orthogonalize the new basis diff --git a/sklearn/earth/_pruning.c b/sklearn/earth/_pruning.c index 147e41d0b2266..7b145b1d3bf80 100644 --- a/sklearn/earth/_pruning.c +++ b/sklearn/earth/_pruning.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19.1 on Sat Jul 27 22:55:34 2013 */ +/* Generated by Cython 0.19.2 on Sat Nov 30 16:32:13 2013 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS @@ -264,7 +264,7 @@ #ifndef CYTHON_RESTRICT #if defined(__GNUC__) #define CYTHON_RESTRICT __restrict__ - #elif defined(_MSC_VER) + #elif defined(_MSC_VER) && _MSC_VER >= 1400 #define CYTHON_RESTRICT __restrict #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_RESTRICT restrict @@ -1505,6 +1505,14 @@ static struct __pyx_vtabstruct_7sklearn_5earth_7_record_FirstPruningPassIteratio #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ +#define __Pyx_XDECREF_SET(r, v) do { \ + PyObject *tmp = (PyObject *) r; \ + r = v; __Pyx_XDECREF(tmp); \ + } while (0) +#define __Pyx_DECREF_SET(r, v) do { \ + PyObject *tmp = (PyObject *) r; \ + r = v; __Pyx_DECREF(tmp); \ + } while (0) #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) @@ -2752,8 +2760,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ __pyx_t_2 = __Pyx_PyNumber_InPlaceDivide(__pyx_v_mse, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_v_mse); - __pyx_v_mse = __pyx_t_2; + __Pyx_DECREF_SET(__pyx_v_mse, __pyx_t_2); __pyx_t_2 = 0; goto __pyx_L5; } @@ -2833,8 +2840,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_DECREF(__pyx_v_mse); - __pyx_v_mse = __pyx_t_1; + __Pyx_DECREF_SET(__pyx_v_mse, __pyx_t_1); __pyx_t_1 = 0; } __pyx_L5:; @@ -2969,8 +2975,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ */ __pyx_t_10 = __Pyx_GetItemInt(((PyObject *)__pyx_v_self->basis), __pyx_v_j, sizeof(__pyx_t_7sklearn_5earth_8_pruning_INDEX_t)+1, __Pyx_PyInt_to_py_npy_ulonglong, 0, 0, 0); if (!__pyx_t_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __Pyx_XDECREF(__pyx_v_bf); - __pyx_v_bf = __pyx_t_10; + __Pyx_XDECREF_SET(__pyx_v_bf, __pyx_t_10); __pyx_t_10 = 0; /* "sklearn/earth/_pruning.pyx":72 @@ -3168,11 +3173,9 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ * B[:, 0:pruned_basis_size], weighted_y)[0:2] * if mse: */ - __Pyx_DECREF(__pyx_v_beta); - __pyx_v_beta = __pyx_t_9; + __Pyx_DECREF_SET(__pyx_v_beta, __pyx_t_9); __pyx_t_9 = 0; - __Pyx_DECREF(__pyx_v_mse); - __pyx_v_mse = __pyx_t_14; + __Pyx_DECREF_SET(__pyx_v_mse, __pyx_t_14); __pyx_t_14 = 0; /* "sklearn/earth/_pruning.pyx":80 @@ -3197,8 +3200,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ __pyx_t_14 = __Pyx_PyNumber_InPlaceDivide(__pyx_v_mse, __pyx_t_10); if (unlikely(!__pyx_t_14)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 81; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_14); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __Pyx_DECREF(__pyx_v_mse); - __pyx_v_mse = __pyx_t_14; + __Pyx_DECREF_SET(__pyx_v_mse, __pyx_t_14); __pyx_t_14 = 0; goto __pyx_L14; } @@ -3278,8 +3280,7 @@ static PyObject *__pyx_f_7sklearn_5earth_8_pruning_13PruningPasser_run(struct __ __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_14); __pyx_t_14 = 0; __Pyx_DECREF(__pyx_t_13); __pyx_t_13 = 0; - __Pyx_DECREF(__pyx_v_mse); - __pyx_v_mse = __pyx_t_10; + __Pyx_DECREF_SET(__pyx_v_mse, __pyx_t_10); __pyx_t_10 = 0; } __pyx_L14:; @@ -4812,8 +4813,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx #else __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif - __Pyx_XDECREF(__pyx_v_childname); - __pyx_v_childname = __pyx_t_3; + __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3); __pyx_t_3 = 0; /* "numpy.pxd":795 @@ -4826,8 +4826,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); - __pyx_v_fields = ((PyObject*)__pyx_t_3); + __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3)); __pyx_t_3 = 0; /* "numpy.pxd":796 @@ -4884,11 +4883,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_L6_unpacking_done:; } if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_XDECREF(((PyObject *)__pyx_v_child)); - __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); + __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_v_new_offset); - __pyx_v_new_offset = __pyx_t_4; + __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4); __pyx_t_4 = 0; /* "numpy.pxd":798 @@ -5056,8 +5053,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_v_t); - __pyx_v_t = __pyx_t_3; + __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_3); __pyx_t_3 = 0; /* "numpy.pxd":822 @@ -5751,6 +5747,9 @@ static PyTypeObject __pyx_type_7sklearn_5earth_8_pruning_PruningPasser = { #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif + #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) + 0, /*tp_finalize*/ + #endif }; static PyMethodDef __pyx_methods[] = { diff --git a/sklearn/earth/_record.c b/sklearn/earth/_record.c index 6ec73a5f33c2e..34e3df2db07ab 100644 --- a/sklearn/earth/_record.c +++ b/sklearn/earth/_record.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19.1 on Sat Jul 27 22:55:34 2013 */ +/* Generated by Cython 0.19.2 on Sat Nov 30 16:32:13 2013 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS @@ -264,7 +264,7 @@ #ifndef CYTHON_RESTRICT #if defined(__GNUC__) #define CYTHON_RESTRICT __restrict__ - #elif defined(_MSC_VER) + #elif defined(_MSC_VER) && _MSC_VER >= 1400 #define CYTHON_RESTRICT __restrict #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_RESTRICT restrict @@ -1138,6 +1138,7 @@ struct __pyx_obj_7sklearn_5earth_8_forward_ForwardPasser { __pyx_t_7sklearn_5earth_8_forward_FLOAT_t endspan_alpha; __pyx_t_7sklearn_5earth_8_forward_FLOAT_t minspan_alpha; int max_terms; + int allow_linear; int max_degree; __pyx_t_7sklearn_5earth_8_forward_FLOAT_t thresh; __pyx_t_7sklearn_5earth_8_forward_FLOAT_t penalty; @@ -1516,6 +1517,14 @@ static struct __pyx_vtabstruct_7sklearn_5earth_7_record_FirstPruningPassIteratio #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ +#define __Pyx_XDECREF_SET(r, v) do { \ + PyObject *tmp = (PyObject *) r; \ + r = v; __Pyx_XDECREF(tmp); \ + } while (0) +#define __Pyx_DECREF_SET(r, v) do { \ + PyObject *tmp = (PyObject *) r; \ + r = v; __Pyx_DECREF(tmp); \ + } while (0) #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) @@ -4219,8 +4228,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_14__str__ */ __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_v_result); - __pyx_v_result = __pyx_t_1; + __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_1); __pyx_t_1 = 0; /* "sklearn/earth/_record.pyx":95 @@ -4267,12 +4275,10 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_14__str__ #else __pyx_t_4 = PySequence_ITEM(__pyx_t_1, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif - __Pyx_XDECREF(__pyx_v_iteration); - __pyx_v_iteration = __pyx_t_4; + __Pyx_XDECREF_SET(__pyx_v_iteration, __pyx_t_4); __pyx_t_4 = 0; __Pyx_INCREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_2; + __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2); __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); @@ -4344,8 +4350,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_14__str__ __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - __Pyx_XDECREF(__pyx_v_row); - __pyx_v_row = __pyx_t_9; + __Pyx_XDECREF_SET(__pyx_v_row, __pyx_t_9); __pyx_t_9 = 0; /* "sklearn/earth/_record.pyx":100 @@ -4378,8 +4383,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_14__str__ __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_result, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_v_result); - __pyx_v_result = __pyx_t_1; + __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_1); __pyx_t_1 = 0; /* "sklearn/earth/_record.pyx":102 @@ -4408,8 +4412,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17PruningPassRecord_14__str__ __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_result, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_v_result); - __pyx_v_result = __pyx_t_2; + __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_2); __pyx_t_2 = 0; /* "sklearn/earth/_record.pyx":103 @@ -5256,12 +5259,10 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_10__str__ #else __pyx_t_4 = PySequence_ITEM(__pyx_t_2, __pyx_t_3); __pyx_t_3++; if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif - __Pyx_XDECREF(__pyx_v_iteration); - __pyx_v_iteration = __pyx_t_4; + __Pyx_XDECREF_SET(__pyx_v_iteration, __pyx_t_4); __pyx_t_4 = 0; __Pyx_INCREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_1; + __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_1); __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); @@ -5372,8 +5373,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_10__str__ */ __pyx_t_1 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_14)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_v_result); - __pyx_v_result = __pyx_t_1; + __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_1); __pyx_t_1 = 0; /* "sklearn/earth/_record.pyx":146 @@ -5388,8 +5388,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_10__str__ __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_result, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_v_result); - __pyx_v_result = __pyx_t_2; + __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_2); __pyx_t_2 = 0; /* "sklearn/earth/_record.pyx":148 @@ -5421,8 +5420,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_7_record_17ForwardPassRecord_10__str__ __pyx_t_9 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_v_result); - __pyx_v_result = __pyx_t_9; + __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_9); __pyx_t_9 = 0; /* "sklearn/earth/_record.pyx":149 @@ -9444,8 +9442,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx #else __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif - __Pyx_XDECREF(__pyx_v_childname); - __pyx_v_childname = __pyx_t_3; + __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3); __pyx_t_3 = 0; /* "numpy.pxd":795 @@ -9458,8 +9455,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); - __pyx_v_fields = ((PyObject*)__pyx_t_3); + __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3)); __pyx_t_3 = 0; /* "numpy.pxd":796 @@ -9516,11 +9512,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_L6_unpacking_done:; } if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_XDECREF(((PyObject *)__pyx_v_child)); - __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); + __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_v_new_offset); - __pyx_v_new_offset = __pyx_t_4; + __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4); __pyx_t_4 = 0; /* "numpy.pxd":798 @@ -9688,8 +9682,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_v_t); - __pyx_v_t = __pyx_t_3; + __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_3); __pyx_t_3 = 0; /* "numpy.pxd":822 @@ -10322,6 +10315,9 @@ static PyTypeObject __pyx_type_7sklearn_5earth_7_record_Iteration = { #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif + #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) + 0, /*tp_finalize*/ + #endif }; static struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassIteration __pyx_vtable_7sklearn_5earth_7_record_ForwardPassIteration; @@ -10397,6 +10393,9 @@ static PyTypeObject __pyx_type_7sklearn_5earth_7_record_ForwardPassIteration = { #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif + #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) + 0, /*tp_finalize*/ + #endif }; static struct __pyx_vtabstruct_7sklearn_5earth_7_record_Record __pyx_vtable_7sklearn_5earth_7_record_Record; @@ -10526,6 +10525,9 @@ static PyTypeObject __pyx_type_7sklearn_5earth_7_record_Record = { #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif + #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) + 0, /*tp_finalize*/ + #endif }; static struct __pyx_vtabstruct_7sklearn_5earth_7_record_ForwardPassRecord __pyx_vtable_7sklearn_5earth_7_record_ForwardPassRecord; @@ -10629,6 +10631,9 @@ static PyTypeObject __pyx_type_7sklearn_5earth_7_record_ForwardPassRecord = { #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif + #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) + 0, /*tp_finalize*/ + #endif }; static struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassIteration __pyx_vtable_7sklearn_5earth_7_record_PruningPassIteration; @@ -10703,6 +10708,9 @@ static PyTypeObject __pyx_type_7sklearn_5earth_7_record_PruningPassIteration = { #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif + #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) + 0, /*tp_finalize*/ + #endif }; static struct __pyx_vtabstruct_7sklearn_5earth_7_record_FirstPruningPassIteration __pyx_vtable_7sklearn_5earth_7_record_FirstPruningPassIteration; @@ -10776,6 +10784,9 @@ static PyTypeObject __pyx_type_7sklearn_5earth_7_record_FirstPruningPassIteratio #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif + #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) + 0, /*tp_finalize*/ + #endif }; static struct __pyx_vtabstruct_7sklearn_5earth_7_record_FirstForwardPassIteration __pyx_vtable_7sklearn_5earth_7_record_FirstForwardPassIteration; @@ -10850,6 +10861,9 @@ static PyTypeObject __pyx_type_7sklearn_5earth_7_record_FirstForwardPassIteratio #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif + #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) + 0, /*tp_finalize*/ + #endif }; static struct __pyx_vtabstruct_7sklearn_5earth_7_record_PruningPassRecord __pyx_vtable_7sklearn_5earth_7_record_PruningPassRecord; @@ -10926,6 +10940,9 @@ static PyTypeObject __pyx_type_7sklearn_5earth_7_record_PruningPassRecord = { #if PY_VERSION_HEX >= 0x02060000 0, /*tp_version_tag*/ #endif + #if PY_VERSION_HEX >= 0x030400a1 && defined(Py_TPFLAGS_HAVE_FINALIZE) + 0, /*tp_finalize*/ + #endif }; static PyMethodDef __pyx_methods[] = { diff --git a/sklearn/earth/_util.c b/sklearn/earth/_util.c index 2d1878b10737b..39b80952d7183 100644 --- a/sklearn/earth/_util.c +++ b/sklearn/earth/_util.c @@ -1,4 +1,4 @@ -/* Generated by Cython 0.19.1 on Sat Jul 27 22:55:34 2013 */ +/* Generated by Cython 0.19.2 on Sat Nov 30 16:32:13 2013 */ #define PY_SSIZE_T_CLEAN #ifndef CYTHON_USE_PYLONG_INTERNALS @@ -264,7 +264,7 @@ #ifndef CYTHON_RESTRICT #if defined(__GNUC__) #define CYTHON_RESTRICT __restrict__ - #elif defined(_MSC_VER) + #elif defined(_MSC_VER) && _MSC_VER >= 1400 #define CYTHON_RESTRICT __restrict #elif defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L #define CYTHON_RESTRICT restrict @@ -879,6 +879,14 @@ typedef npy_cdouble __pyx_t_5numpy_complex_t; #define __Pyx_XGOTREF(r) #define __Pyx_XGIVEREF(r) #endif /* CYTHON_REFNANNY */ +#define __Pyx_XDECREF_SET(r, v) do { \ + PyObject *tmp = (PyObject *) r; \ + r = v; __Pyx_XDECREF(tmp); \ + } while (0) +#define __Pyx_DECREF_SET(r, v) do { \ + PyObject *tmp = (PyObject *) r; \ + r = v; __Pyx_DECREF(tmp); \ + } while (0) #define __Pyx_CLEAR(r) do { PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);} while(0) #define __Pyx_XCLEAR(r) do { if((r) != NULL) {PyObject* tmp = ((PyObject*)(r)); r = NULL; __Pyx_DECREF(tmp);}} while(0) @@ -1183,6 +1191,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, cha /* Module declarations from 'sklearn.earth._util' */ static PyObject *__pyx_f_7sklearn_5earth_5_util_apply_weights_2d(PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); /*proto*/ +static PyObject *__pyx_f_7sklearn_5earth_5_util_apply_weights_slice(PyArrayObject *, PyArrayObject *, __pyx_t_7sklearn_5earth_5_util_INDEX_t, int __pyx_skip_dispatch); /*proto*/ static PyObject *__pyx_f_7sklearn_5earth_5_util_apply_weights_1d(PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch); /*proto*/ static __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_f_7sklearn_5earth_5_util_gcv(__pyx_t_7sklearn_5earth_5_util_FLOAT_t, __pyx_t_7sklearn_5earth_5_util_INDEX_t, __pyx_t_7sklearn_5earth_5_util_INDEX_t, __pyx_t_7sklearn_5earth_5_util_FLOAT_t, int __pyx_skip_dispatch); /*proto*/ static __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_f_7sklearn_5earth_5_util_gcv_adjust(__pyx_t_7sklearn_5earth_5_util_INDEX_t, __pyx_t_7sklearn_5earth_5_util_INDEX_t, __pyx_t_7sklearn_5earth_5_util_FLOAT_t, int __pyx_skip_dispatch); /*proto*/ @@ -1198,11 +1207,12 @@ static PyObject *__pyx_builtin_enumerate; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_RuntimeError; static PyObject *__pyx_pf_7sklearn_5earth_5_util_apply_weights_2d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_B, PyArrayObject *__pyx_v_weights); /* proto */ -static PyObject *__pyx_pf_7sklearn_5earth_5_util_2apply_weights_1d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_y, PyArrayObject *__pyx_v_weights); /* proto */ -static PyObject *__pyx_pf_7sklearn_5earth_5_util_4gcv(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_v_mse, __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_basis_size, __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_data_size, __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_v_penalty); /* proto */ -static PyObject *__pyx_pf_7sklearn_5earth_5_util_6gcv_adjust(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_basis_size, __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_data_size, __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_v_penalty); /* proto */ -static PyObject *__pyx_pf_7sklearn_5earth_5_util_8str_pad(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_string, PyObject *__pyx_v_length); /* proto */ -static PyObject *__pyx_pf_7sklearn_5earth_5_util_10ascii_table(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_header, PyObject *__pyx_v_data); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_5_util_2apply_weights_slice(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_B, PyArrayObject *__pyx_v_weights, __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_column); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_5_util_4apply_weights_1d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_y, PyArrayObject *__pyx_v_weights); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_5_util_6gcv(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_v_mse, __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_basis_size, __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_data_size, __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_v_penalty); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_5_util_8gcv_adjust(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_basis_size, __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_data_size, __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_v_penalty); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_5_util_10str_pad(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_string, PyObject *__pyx_v_length); /* proto */ +static PyObject *__pyx_pf_7sklearn_5earth_5_util_12ascii_table(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_header, PyObject *__pyx_v_data); /* proto */ static int __pyx_pf_5numpy_7ndarray___getbuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info, int __pyx_v_flags); /* proto */ static void __pyx_pf_5numpy_7ndarray_2__releasebuffer__(PyArrayObject *__pyx_v_self, Py_buffer *__pyx_v_info); /* proto */ static char __pyx_k_1[] = " "; @@ -1238,6 +1248,7 @@ static char __pyx_k__mse[] = "mse"; static char __pyx_k__data[] = "data"; static char __pyx_k__numpy[] = "numpy"; static char __pyx_k__range[] = "range"; +static char __pyx_k__column[] = "column"; static char __pyx_k__header[] = "header"; static char __pyx_k__length[] = "length"; static char __pyx_k__string[] = "string"; @@ -1272,6 +1283,7 @@ static PyObject *__pyx_n_s____pyx_getbuffer; static PyObject *__pyx_n_s____pyx_releasebuffer; static PyObject *__pyx_n_s____test__; static PyObject *__pyx_n_s__basis_size; +static PyObject *__pyx_n_s__column; static PyObject *__pyx_n_s__data; static PyObject *__pyx_n_s__data_size; static PyObject *__pyx_n_s__enumerate; @@ -1419,7 +1431,7 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_apply_weights_2d(PyArrayObject * * for j in range(n): * B[i, j] *= sqrt(weights[i]) # <<<<<<<<<<<<<< * - * cpdef apply_weights_1d(cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] weights): + * cpdef apply_weights_slice(cnp.ndarray[FLOAT_t, ndim=2] B, cnp.ndarray[FLOAT_t, ndim=1] weights, INDEX_t column): */ __pyx_t_5 = __pyx_v_i; __pyx_t_6 = __pyx_v_i; @@ -1582,12 +1594,261 @@ static PyObject *__pyx_pf_7sklearn_5earth_5_util_apply_weights_2d(CYTHON_UNUSED /* "sklearn/earth/_util.pyx":22 * B[i, j] *= sqrt(weights[i]) * + * cpdef apply_weights_slice(cnp.ndarray[FLOAT_t, ndim=2] B, cnp.ndarray[FLOAT_t, ndim=1] weights, INDEX_t column): # <<<<<<<<<<<<<< + * cdef INDEX_t i + * cdef INDEX_t j + */ + +static PyObject *__pyx_pw_7sklearn_5earth_5_util_3apply_weights_slice(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_f_7sklearn_5earth_5_util_apply_weights_slice(PyArrayObject *__pyx_v_B, PyArrayObject *__pyx_v_weights, __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_column, CYTHON_UNUSED int __pyx_skip_dispatch) { + __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_i; + __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_m; + CYTHON_UNUSED __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_n; + __Pyx_LocalBuf_ND __pyx_pybuffernd_B; + __Pyx_Buffer __pyx_pybuffer_B; + __Pyx_LocalBuf_ND __pyx_pybuffernd_weights; + __Pyx_Buffer __pyx_pybuffer_weights; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_t_1; + __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_t_2; + __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_t_3; + __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_t_4; + __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_t_5; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("apply_weights_slice", 0); + __pyx_pybuffer_B.pybuffer.buf = NULL; + __pyx_pybuffer_B.refcount = 0; + __pyx_pybuffernd_B.data = NULL; + __pyx_pybuffernd_B.rcbuffer = &__pyx_pybuffer_B; + __pyx_pybuffer_weights.pybuffer.buf = NULL; + __pyx_pybuffer_weights.refcount = 0; + __pyx_pybuffernd_weights.data = NULL; + __pyx_pybuffernd_weights.rcbuffer = &__pyx_pybuffer_weights; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_v_B, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_5_util_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_B.diminfo[0].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B.diminfo[0].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B.diminfo[1].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B.diminfo[1].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_5_util_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_weights.diminfo[0].strides = __pyx_pybuffernd_weights.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weights.diminfo[0].shape = __pyx_pybuffernd_weights.rcbuffer->pybuffer.shape[0]; + + /* "sklearn/earth/_util.pyx":25 + * cdef INDEX_t i + * cdef INDEX_t j + * cdef INDEX_t m = B.shape[0] # <<<<<<<<<<<<<< + * cdef INDEX_t n = B.shape[1] + * for i in range(m): + */ + __pyx_v_m = (__pyx_v_B->dimensions[0]); + + /* "sklearn/earth/_util.pyx":26 + * cdef INDEX_t j + * cdef INDEX_t m = B.shape[0] + * cdef INDEX_t n = B.shape[1] # <<<<<<<<<<<<<< + * for i in range(m): + * B[i, column] *= sqrt(weights[i]) + */ + __pyx_v_n = (__pyx_v_B->dimensions[1]); + + /* "sklearn/earth/_util.pyx":27 + * cdef INDEX_t m = B.shape[0] + * cdef INDEX_t n = B.shape[1] + * for i in range(m): # <<<<<<<<<<<<<< + * B[i, column] *= sqrt(weights[i]) + * + */ + __pyx_t_1 = __pyx_v_m; + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { + __pyx_v_i = __pyx_t_2; + + /* "sklearn/earth/_util.pyx":28 + * cdef INDEX_t n = B.shape[1] + * for i in range(m): + * B[i, column] *= sqrt(weights[i]) # <<<<<<<<<<<<<< + * + * cpdef apply_weights_1d(cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] weights): + */ + __pyx_t_3 = __pyx_v_i; + __pyx_t_4 = __pyx_v_i; + __pyx_t_5 = __pyx_v_column; + *__Pyx_BufPtrStrided2d(__pyx_t_7sklearn_5earth_5_util_FLOAT_t *, __pyx_pybuffernd_B.rcbuffer->pybuffer.buf, __pyx_t_4, __pyx_pybuffernd_B.diminfo[0].strides, __pyx_t_5, __pyx_pybuffernd_B.diminfo[1].strides) *= sqrt((*__Pyx_BufPtrStrided1d(__pyx_t_7sklearn_5earth_5_util_FLOAT_t *, __pyx_pybuffernd_weights.rcbuffer->pybuffer.buf, __pyx_t_3, __pyx_pybuffernd_weights.diminfo[0].strides))); + } + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_B.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("sklearn.earth._util.apply_weights_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = 0; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_B.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* Python wrapper */ +static PyObject *__pyx_pw_7sklearn_5earth_5_util_3apply_weights_slice(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_5_util_3apply_weights_slice(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { + PyArrayObject *__pyx_v_B = 0; + PyArrayObject *__pyx_v_weights = 0; + __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_column; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + PyObject *__pyx_r = 0; + __Pyx_RefNannyDeclarations + __Pyx_RefNannySetupContext("apply_weights_slice (wrapper)", 0); + { + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__B,&__pyx_n_s__weights,&__pyx_n_s__column,0}; + PyObject* values[3] = {0,0,0}; + if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args; + const Py_ssize_t pos_args = PyTuple_GET_SIZE(__pyx_args); + switch (pos_args) { + case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + case 0: break; + default: goto __pyx_L5_argtuple_error; + } + kw_args = PyDict_Size(__pyx_kwds); + switch (pos_args) { + case 0: + if (likely((values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__B)) != 0)) kw_args--; + else goto __pyx_L5_argtuple_error; + case 1: + if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weights)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("apply_weights_slice", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + case 2: + if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__column)) != 0)) kw_args--; + else { + __Pyx_RaiseArgtupleInvalid("apply_weights_slice", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } + if (unlikely(kw_args > 0)) { + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply_weights_slice") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { + goto __pyx_L5_argtuple_error; + } else { + values[0] = PyTuple_GET_ITEM(__pyx_args, 0); + values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + values[2] = PyTuple_GET_ITEM(__pyx_args, 2); + } + __pyx_v_B = ((PyArrayObject *)values[0]); + __pyx_v_weights = ((PyArrayObject *)values[1]); + __pyx_v_column = __Pyx_PyInt_from_py_npy_ulonglong(values[2]); if (unlikely((__pyx_v_column == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } + goto __pyx_L4_argument_unpacking_done; + __pyx_L5_argtuple_error:; + __Pyx_RaiseArgtupleInvalid("apply_weights_slice", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_L3_error:; + __Pyx_AddTraceback("sklearn.earth._util.apply_weights_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __Pyx_RefNannyFinishContext(); + return NULL; + __pyx_L4_argument_unpacking_done:; + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_B), __pyx_ptype_5numpy_ndarray, 1, "B", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weights), __pyx_ptype_5numpy_ndarray, 1, "weights", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7sklearn_5earth_5_util_2apply_weights_slice(__pyx_self, __pyx_v_B, __pyx_v_weights, __pyx_v_column); + goto __pyx_L0; + __pyx_L1_error:; + __pyx_r = NULL; + __pyx_L0:; + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/earth/_util.pyx":22 + * B[i, j] *= sqrt(weights[i]) + * + * cpdef apply_weights_slice(cnp.ndarray[FLOAT_t, ndim=2] B, cnp.ndarray[FLOAT_t, ndim=1] weights, INDEX_t column): # <<<<<<<<<<<<<< + * cdef INDEX_t i + * cdef INDEX_t j + */ + +static PyObject *__pyx_pf_7sklearn_5earth_5_util_2apply_weights_slice(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_B, PyArrayObject *__pyx_v_weights, __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_column) { + __Pyx_LocalBuf_ND __pyx_pybuffernd_B; + __Pyx_Buffer __pyx_pybuffer_B; + __Pyx_LocalBuf_ND __pyx_pybuffernd_weights; + __Pyx_Buffer __pyx_pybuffer_weights; + PyObject *__pyx_r = NULL; + __Pyx_RefNannyDeclarations + PyObject *__pyx_t_1 = NULL; + int __pyx_lineno = 0; + const char *__pyx_filename = NULL; + int __pyx_clineno = 0; + __Pyx_RefNannySetupContext("apply_weights_slice", 0); + __pyx_pybuffer_B.pybuffer.buf = NULL; + __pyx_pybuffer_B.refcount = 0; + __pyx_pybuffernd_B.data = NULL; + __pyx_pybuffernd_B.rcbuffer = &__pyx_pybuffer_B; + __pyx_pybuffer_weights.pybuffer.buf = NULL; + __pyx_pybuffer_weights.refcount = 0; + __pyx_pybuffernd_weights.data = NULL; + __pyx_pybuffernd_weights.rcbuffer = &__pyx_pybuffer_weights; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_B.rcbuffer->pybuffer, (PyObject*)__pyx_v_B, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_5_util_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_B.diminfo[0].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_B.diminfo[0].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[0]; __pyx_pybuffernd_B.diminfo[1].strides = __pyx_pybuffernd_B.rcbuffer->pybuffer.strides[1]; __pyx_pybuffernd_B.diminfo[1].shape = __pyx_pybuffernd_B.rcbuffer->pybuffer.shape[1]; + { + __Pyx_BufFmt_StackElem __pyx_stack[1]; + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_5_util_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_pybuffernd_weights.diminfo[0].strides = __pyx_pybuffernd_weights.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weights.diminfo[0].shape = __pyx_pybuffernd_weights.rcbuffer->pybuffer.shape[0]; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = __pyx_f_7sklearn_5earth_5_util_apply_weights_slice(((PyArrayObject *)__pyx_v_B), ((PyArrayObject *)__pyx_v_weights), __pyx_v_column, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; + __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_B.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer); + __Pyx_ErrRestore(__pyx_type, __pyx_value, __pyx_tb);} + __Pyx_AddTraceback("sklearn.earth._util.apply_weights_slice", __pyx_clineno, __pyx_lineno, __pyx_filename); + __pyx_r = NULL; + goto __pyx_L2; + __pyx_L0:; + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_B.rcbuffer->pybuffer); + __Pyx_SafeReleaseBuffer(&__pyx_pybuffernd_weights.rcbuffer->pybuffer); + __pyx_L2:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "sklearn/earth/_util.pyx":30 + * B[i, column] *= sqrt(weights[i]) + * * cpdef apply_weights_1d(cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] weights): # <<<<<<<<<<<<<< * cdef INDEX_t i * cdef INDEX_t m = y.shape[0] */ -static PyObject *__pyx_pw_7sklearn_5earth_5_util_3apply_weights_1d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_5_util_5apply_weights_1d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_f_7sklearn_5earth_5_util_apply_weights_1d(PyArrayObject *__pyx_v_y, PyArrayObject *__pyx_v_weights, CYTHON_UNUSED int __pyx_skip_dispatch) { __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_i; __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_m; @@ -1615,16 +1876,16 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_apply_weights_1d(PyArrayObject * __pyx_pybuffernd_weights.rcbuffer = &__pyx_pybuffer_weights; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_5_util_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_5_util_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES| PyBUF_WRITABLE, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_y.diminfo[0].strides = __pyx_pybuffernd_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y.diminfo[0].shape = __pyx_pybuffernd_y.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_5_util_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_5_util_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_weights.diminfo[0].strides = __pyx_pybuffernd_weights.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weights.diminfo[0].shape = __pyx_pybuffernd_weights.rcbuffer->pybuffer.shape[0]; - /* "sklearn/earth/_util.pyx":24 + /* "sklearn/earth/_util.pyx":32 * cpdef apply_weights_1d(cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] weights): * cdef INDEX_t i * cdef INDEX_t m = y.shape[0] # <<<<<<<<<<<<<< @@ -1633,7 +1894,7 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_apply_weights_1d(PyArrayObject * */ __pyx_v_m = (__pyx_v_y->dimensions[0]); - /* "sklearn/earth/_util.pyx":25 + /* "sklearn/earth/_util.pyx":33 * cdef INDEX_t i * cdef INDEX_t m = y.shape[0] * for i in range(m): # <<<<<<<<<<<<<< @@ -1644,7 +1905,7 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_apply_weights_1d(PyArrayObject * for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "sklearn/earth/_util.pyx":26 + /* "sklearn/earth/_util.pyx":34 * cdef INDEX_t m = y.shape[0] * for i in range(m): * y[i] *= sqrt(weights[i]) # <<<<<<<<<<<<<< @@ -1677,8 +1938,8 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_apply_weights_1d(PyArrayObject * } /* Python wrapper */ -static PyObject *__pyx_pw_7sklearn_5earth_5_util_3apply_weights_1d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_7sklearn_5earth_5_util_3apply_weights_1d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_7sklearn_5earth_5_util_5apply_weights_1d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_5_util_5apply_weights_1d(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyArrayObject *__pyx_v_y = 0; PyArrayObject *__pyx_v_weights = 0; int __pyx_lineno = 0; @@ -1707,11 +1968,11 @@ static PyObject *__pyx_pw_7sklearn_5earth_5_util_3apply_weights_1d(PyObject *__p case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__weights)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("apply_weights_1d", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("apply_weights_1d", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply_weights_1d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "apply_weights_1d") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -1724,15 +1985,15 @@ static PyObject *__pyx_pw_7sklearn_5earth_5_util_3apply_weights_1d(PyObject *__p } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("apply_weights_1d", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("apply_weights_1d", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.earth._util.apply_weights_1d", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weights), __pyx_ptype_5numpy_ndarray, 1, "weights", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_pf_7sklearn_5earth_5_util_2apply_weights_1d(__pyx_self, __pyx_v_y, __pyx_v_weights); + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_y), __pyx_ptype_5numpy_ndarray, 1, "y", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_weights), __pyx_ptype_5numpy_ndarray, 1, "weights", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_pf_7sklearn_5earth_5_util_4apply_weights_1d(__pyx_self, __pyx_v_y, __pyx_v_weights); goto __pyx_L0; __pyx_L1_error:; __pyx_r = NULL; @@ -1741,15 +2002,15 @@ static PyObject *__pyx_pw_7sklearn_5earth_5_util_3apply_weights_1d(PyObject *__p return __pyx_r; } -/* "sklearn/earth/_util.pyx":22 - * B[i, j] *= sqrt(weights[i]) +/* "sklearn/earth/_util.pyx":30 + * B[i, column] *= sqrt(weights[i]) * * cpdef apply_weights_1d(cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] weights): # <<<<<<<<<<<<<< * cdef INDEX_t i * cdef INDEX_t m = y.shape[0] */ -static PyObject *__pyx_pf_7sklearn_5earth_5_util_2apply_weights_1d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_y, PyArrayObject *__pyx_v_weights) { +static PyObject *__pyx_pf_7sklearn_5earth_5_util_4apply_weights_1d(CYTHON_UNUSED PyObject *__pyx_self, PyArrayObject *__pyx_v_y, PyArrayObject *__pyx_v_weights) { __Pyx_LocalBuf_ND __pyx_pybuffernd_weights; __Pyx_Buffer __pyx_pybuffer_weights; __Pyx_LocalBuf_ND __pyx_pybuffernd_y; @@ -1771,16 +2032,16 @@ static PyObject *__pyx_pf_7sklearn_5earth_5_util_2apply_weights_1d(CYTHON_UNUSED __pyx_pybuffernd_weights.rcbuffer = &__pyx_pybuffer_weights; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_5_util_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_y.rcbuffer->pybuffer, (PyObject*)__pyx_v_y, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_5_util_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_y.diminfo[0].strides = __pyx_pybuffernd_y.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_y.diminfo[0].shape = __pyx_pybuffernd_y.rcbuffer->pybuffer.shape[0]; { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_5_util_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_pybuffernd_weights.rcbuffer->pybuffer, (PyObject*)__pyx_v_weights, &__Pyx_TypeInfo_nn___pyx_t_7sklearn_5earth_5_util_FLOAT_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_pybuffernd_weights.diminfo[0].strides = __pyx_pybuffernd_weights.rcbuffer->pybuffer.strides[0]; __pyx_pybuffernd_weights.diminfo[0].shape = __pyx_pybuffernd_weights.rcbuffer->pybuffer.shape[0]; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_7sklearn_5earth_5_util_apply_weights_1d(((PyArrayObject *)__pyx_v_y), ((PyArrayObject *)__pyx_v_weights), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 22; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_f_7sklearn_5earth_5_util_apply_weights_1d(((PyArrayObject *)__pyx_v_y), ((PyArrayObject *)__pyx_v_weights), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1807,7 +2068,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_5_util_2apply_weights_1d(CYTHON_UNUSED return __pyx_r; } -/* "sklearn/earth/_util.pyx":28 +/* "sklearn/earth/_util.pyx":36 * y[i] *= sqrt(weights[i]) * * cpdef FLOAT_t gcv(FLOAT_t mse, INDEX_t basis_size, INDEX_t data_size, FLOAT_t penalty): # <<<<<<<<<<<<<< @@ -1815,13 +2076,13 @@ static PyObject *__pyx_pf_7sklearn_5earth_5_util_2apply_weights_1d(CYTHON_UNUSED * */ -static PyObject *__pyx_pw_7sklearn_5earth_5_util_5gcv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_5_util_7gcv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_f_7sklearn_5earth_5_util_gcv(__pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_v_mse, __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_basis_size, __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_data_size, __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_v_penalty, CYTHON_UNUSED int __pyx_skip_dispatch) { __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gcv", 0); - /* "sklearn/earth/_util.pyx":29 + /* "sklearn/earth/_util.pyx":37 * * cpdef FLOAT_t gcv(FLOAT_t mse, INDEX_t basis_size, INDEX_t data_size, FLOAT_t penalty): * return mse * gcv_adjust(basis_size, data_size, penalty) # <<<<<<<<<<<<<< @@ -1838,8 +2099,8 @@ static __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_f_7sklearn_5earth_5_util_gcv } /* Python wrapper */ -static PyObject *__pyx_pw_7sklearn_5earth_5_util_5gcv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_7sklearn_5earth_5_util_5gcv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_7sklearn_5earth_5_util_7gcv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_5_util_7gcv(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_v_mse; __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_basis_size; __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_data_size; @@ -1872,21 +2133,21 @@ static PyObject *__pyx_pw_7sklearn_5earth_5_util_5gcv(PyObject *__pyx_self, PyOb case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__basis_size)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("gcv", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("gcv", 1, 4, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data_size)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("gcv", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("gcv", 1, 4, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (likely((values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__penalty)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("gcv", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("gcv", 1, 4, 4, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "gcv") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "gcv") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 4) { goto __pyx_L5_argtuple_error; @@ -1896,25 +2157,25 @@ static PyObject *__pyx_pw_7sklearn_5earth_5_util_5gcv(PyObject *__pyx_self, PyOb values[2] = PyTuple_GET_ITEM(__pyx_args, 2); values[3] = PyTuple_GET_ITEM(__pyx_args, 3); } - __pyx_v_mse = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_mse == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_basis_size = __Pyx_PyInt_from_py_npy_ulonglong(values[1]); if (unlikely((__pyx_v_basis_size == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_data_size = __Pyx_PyInt_from_py_npy_ulonglong(values[2]); if (unlikely((__pyx_v_data_size == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_penalty = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_penalty == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_mse = __pyx_PyFloat_AsDouble(values[0]); if (unlikely((__pyx_v_mse == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_basis_size = __Pyx_PyInt_from_py_npy_ulonglong(values[1]); if (unlikely((__pyx_v_basis_size == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_data_size = __Pyx_PyInt_from_py_npy_ulonglong(values[2]); if (unlikely((__pyx_v_data_size == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_penalty = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_penalty == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("gcv", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("gcv", 1, 4, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.earth._util.gcv", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_7sklearn_5earth_5_util_4gcv(__pyx_self, __pyx_v_mse, __pyx_v_basis_size, __pyx_v_data_size, __pyx_v_penalty); + __pyx_r = __pyx_pf_7sklearn_5earth_5_util_6gcv(__pyx_self, __pyx_v_mse, __pyx_v_basis_size, __pyx_v_data_size, __pyx_v_penalty); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/earth/_util.pyx":28 +/* "sklearn/earth/_util.pyx":36 * y[i] *= sqrt(weights[i]) * * cpdef FLOAT_t gcv(FLOAT_t mse, INDEX_t basis_size, INDEX_t data_size, FLOAT_t penalty): # <<<<<<<<<<<<<< @@ -1922,7 +2183,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_5_util_5gcv(PyObject *__pyx_self, PyOb * */ -static PyObject *__pyx_pf_7sklearn_5earth_5_util_4gcv(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_v_mse, __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_basis_size, __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_data_size, __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_v_penalty) { +static PyObject *__pyx_pf_7sklearn_5earth_5_util_6gcv(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_v_mse, __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_basis_size, __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_data_size, __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_v_penalty) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -1931,7 +2192,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_5_util_4gcv(CYTHON_UNUSED PyObject *__ int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gcv", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(__pyx_f_7sklearn_5earth_5_util_gcv(__pyx_v_mse, __pyx_v_basis_size, __pyx_v_data_size, __pyx_v_penalty, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(__pyx_f_7sklearn_5earth_5_util_gcv(__pyx_v_mse, __pyx_v_basis_size, __pyx_v_data_size, __pyx_v_penalty, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1949,7 +2210,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_5_util_4gcv(CYTHON_UNUSED PyObject *__ return __pyx_r; } -/* "sklearn/earth/_util.pyx":31 +/* "sklearn/earth/_util.pyx":39 * return mse * gcv_adjust(basis_size, data_size, penalty) * * cpdef FLOAT_t gcv_adjust(INDEX_t basis_size, INDEX_t data_size, FLOAT_t penalty): # <<<<<<<<<<<<<< @@ -1957,13 +2218,13 @@ static PyObject *__pyx_pf_7sklearn_5earth_5_util_4gcv(CYTHON_UNUSED PyObject *__ * */ -static PyObject *__pyx_pw_7sklearn_5earth_5_util_7gcv_adjust(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_5_util_9gcv_adjust(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_f_7sklearn_5earth_5_util_gcv_adjust(__pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_basis_size, __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_data_size, __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_v_penalty, CYTHON_UNUSED int __pyx_skip_dispatch) { __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_r; __Pyx_RefNannyDeclarations __Pyx_RefNannySetupContext("gcv_adjust", 0); - /* "sklearn/earth/_util.pyx":32 + /* "sklearn/earth/_util.pyx":40 * * cpdef FLOAT_t gcv_adjust(INDEX_t basis_size, INDEX_t data_size, FLOAT_t penalty): * return 1.0 / ((1 - ((basis_size + penalty * (basis_size - 1)) / data_size)) ** 2) # <<<<<<<<<<<<<< @@ -1980,8 +2241,8 @@ static __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_f_7sklearn_5earth_5_util_gcv } /* Python wrapper */ -static PyObject *__pyx_pw_7sklearn_5earth_5_util_7gcv_adjust(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_7sklearn_5earth_5_util_7gcv_adjust(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_7sklearn_5earth_5_util_9gcv_adjust(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_5_util_9gcv_adjust(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_basis_size; __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_data_size; __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_v_penalty; @@ -2012,16 +2273,16 @@ static PyObject *__pyx_pw_7sklearn_5earth_5_util_7gcv_adjust(PyObject *__pyx_sel case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data_size)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("gcv_adjust", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("gcv_adjust", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (likely((values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__penalty)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("gcv_adjust", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("gcv_adjust", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "gcv_adjust") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "gcv_adjust") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 3) { goto __pyx_L5_argtuple_error; @@ -2030,24 +2291,24 @@ static PyObject *__pyx_pw_7sklearn_5earth_5_util_7gcv_adjust(PyObject *__pyx_sel values[1] = PyTuple_GET_ITEM(__pyx_args, 1); values[2] = PyTuple_GET_ITEM(__pyx_args, 2); } - __pyx_v_basis_size = __Pyx_PyInt_from_py_npy_ulonglong(values[0]); if (unlikely((__pyx_v_basis_size == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_data_size = __Pyx_PyInt_from_py_npy_ulonglong(values[1]); if (unlikely((__pyx_v_data_size == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - __pyx_v_penalty = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_penalty == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_basis_size = __Pyx_PyInt_from_py_npy_ulonglong(values[0]); if (unlikely((__pyx_v_basis_size == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_data_size = __Pyx_PyInt_from_py_npy_ulonglong(values[1]); if (unlikely((__pyx_v_data_size == (npy_ulonglong)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_penalty = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_penalty == (npy_float64)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("gcv_adjust", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("gcv_adjust", 1, 3, 3, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.earth._util.gcv_adjust", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_7sklearn_5earth_5_util_6gcv_adjust(__pyx_self, __pyx_v_basis_size, __pyx_v_data_size, __pyx_v_penalty); + __pyx_r = __pyx_pf_7sklearn_5earth_5_util_8gcv_adjust(__pyx_self, __pyx_v_basis_size, __pyx_v_data_size, __pyx_v_penalty); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/earth/_util.pyx":31 +/* "sklearn/earth/_util.pyx":39 * return mse * gcv_adjust(basis_size, data_size, penalty) * * cpdef FLOAT_t gcv_adjust(INDEX_t basis_size, INDEX_t data_size, FLOAT_t penalty): # <<<<<<<<<<<<<< @@ -2055,7 +2316,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_5_util_7gcv_adjust(PyObject *__pyx_sel * */ -static PyObject *__pyx_pf_7sklearn_5earth_5_util_6gcv_adjust(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_basis_size, __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_data_size, __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_v_penalty) { +static PyObject *__pyx_pf_7sklearn_5earth_5_util_8gcv_adjust(CYTHON_UNUSED PyObject *__pyx_self, __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_basis_size, __pyx_t_7sklearn_5earth_5_util_INDEX_t __pyx_v_data_size, __pyx_t_7sklearn_5earth_5_util_FLOAT_t __pyx_v_penalty) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -2064,7 +2325,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_5_util_6gcv_adjust(CYTHON_UNUSED PyObj int __pyx_clineno = 0; __Pyx_RefNannySetupContext("gcv_adjust", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyFloat_FromDouble(__pyx_f_7sklearn_5earth_5_util_gcv_adjust(__pyx_v_basis_size, __pyx_v_data_size, __pyx_v_penalty, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyFloat_FromDouble(__pyx_f_7sklearn_5earth_5_util_gcv_adjust(__pyx_v_basis_size, __pyx_v_data_size, __pyx_v_penalty, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 39; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2082,7 +2343,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_5_util_6gcv_adjust(CYTHON_UNUSED PyObj return __pyx_r; } -/* "sklearn/earth/_util.pyx":34 +/* "sklearn/earth/_util.pyx":42 * return 1.0 / ((1 - ((basis_size + penalty * (basis_size - 1)) / data_size)) ** 2) * * cpdef str_pad(string, length): # <<<<<<<<<<<<<< @@ -2090,7 +2351,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_5_util_6gcv_adjust(CYTHON_UNUSED PyObj * return string[0:length] */ -static PyObject *__pyx_pw_7sklearn_5earth_5_util_9str_pad(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_5_util_11str_pad(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_f_7sklearn_5earth_5_util_str_pad(PyObject *__pyx_v_string, PyObject *__pyx_v_length, CYTHON_UNUSED int __pyx_skip_dispatch) { PyObject *__pyx_v_pad = NULL; PyObject *__pyx_r = NULL; @@ -2104,23 +2365,23 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_str_pad(PyObject *__pyx_v_string int __pyx_clineno = 0; __Pyx_RefNannySetupContext("str_pad", 0); - /* "sklearn/earth/_util.pyx":35 + /* "sklearn/earth/_util.pyx":43 * * cpdef str_pad(string, length): * if len(string) >= length: # <<<<<<<<<<<<<< * return string[0:length] * pad = length - len(string) */ - __pyx_t_1 = PyObject_Length(__pyx_v_string); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Length(__pyx_v_string); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_v_length, Py_GE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_v_length, Py_GE); __Pyx_XGOTREF(__pyx_t_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 35; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_4) { - /* "sklearn/earth/_util.pyx":36 + /* "sklearn/earth/_util.pyx":44 * cpdef str_pad(string, length): * if len(string) >= length: * return string[0:length] # <<<<<<<<<<<<<< @@ -2128,7 +2389,7 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_str_pad(PyObject *__pyx_v_string * return string + ' ' * pad */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_string, 0, 0, NULL, &__pyx_v_length, NULL, 1, 0, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_GetSlice(__pyx_v_string, 0, 0, NULL, &__pyx_v_length, NULL, 1, 0, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; @@ -2137,23 +2398,23 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_str_pad(PyObject *__pyx_v_string } __pyx_L3:; - /* "sklearn/earth/_util.pyx":37 + /* "sklearn/earth/_util.pyx":45 * if len(string) >= length: * return string[0:length] * pad = length - len(string) # <<<<<<<<<<<<<< * return string + ' ' * pad * */ - __pyx_t_1 = PyObject_Length(__pyx_v_string); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Length(__pyx_v_string); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyNumber_Subtract(__pyx_v_length, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Subtract(__pyx_v_length, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_pad = __pyx_t_2; __pyx_t_2 = 0; - /* "sklearn/earth/_util.pyx":38 + /* "sklearn/earth/_util.pyx":46 * return string[0:length] * pad = length - len(string) * return string + ' ' * pad # <<<<<<<<<<<<<< @@ -2161,9 +2422,9 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_str_pad(PyObject *__pyx_v_string * cpdef ascii_table(header, data): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyNumber_Multiply(((PyObject *)__pyx_kp_s_1), __pyx_v_pad); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Multiply(((PyObject *)__pyx_kp_s_1), __pyx_v_pad); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __pyx_t_3 = PyNumber_Add(__pyx_v_string, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Add(__pyx_v_string, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; @@ -2185,8 +2446,8 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_str_pad(PyObject *__pyx_v_string } /* Python wrapper */ -static PyObject *__pyx_pw_7sklearn_5earth_5_util_9str_pad(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static PyObject *__pyx_pw_7sklearn_5earth_5_util_9str_pad(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_7sklearn_5earth_5_util_11str_pad(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_5_util_11str_pad(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_string = 0; PyObject *__pyx_v_length = 0; int __pyx_lineno = 0; @@ -2215,11 +2476,11 @@ static PyObject *__pyx_pw_7sklearn_5earth_5_util_9str_pad(PyObject *__pyx_self, case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__length)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("str_pad", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("str_pad", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "str_pad") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "str_pad") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -2232,18 +2493,18 @@ static PyObject *__pyx_pw_7sklearn_5earth_5_util_9str_pad(PyObject *__pyx_self, } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("str_pad", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("str_pad", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.earth._util.str_pad", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_7sklearn_5earth_5_util_8str_pad(__pyx_self, __pyx_v_string, __pyx_v_length); + __pyx_r = __pyx_pf_7sklearn_5earth_5_util_10str_pad(__pyx_self, __pyx_v_string, __pyx_v_length); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/earth/_util.pyx":34 +/* "sklearn/earth/_util.pyx":42 * return 1.0 / ((1 - ((basis_size + penalty * (basis_size - 1)) / data_size)) ** 2) * * cpdef str_pad(string, length): # <<<<<<<<<<<<<< @@ -2251,7 +2512,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_5_util_9str_pad(PyObject *__pyx_self, * return string[0:length] */ -static PyObject *__pyx_pf_7sklearn_5earth_5_util_8str_pad(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_string, PyObject *__pyx_v_length) { +static PyObject *__pyx_pf_7sklearn_5earth_5_util_10str_pad(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_string, PyObject *__pyx_v_length) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -2260,7 +2521,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_5_util_8str_pad(CYTHON_UNUSED PyObject int __pyx_clineno = 0; __Pyx_RefNannySetupContext("str_pad", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_7sklearn_5earth_5_util_str_pad(__pyx_v_string, __pyx_v_length, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_f_7sklearn_5earth_5_util_str_pad(__pyx_v_string, __pyx_v_length, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2278,7 +2539,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_5_util_8str_pad(CYTHON_UNUSED PyObject return __pyx_r; } -/* "sklearn/earth/_util.pyx":40 +/* "sklearn/earth/_util.pyx":48 * return string + ' ' * pad * * cpdef ascii_table(header, data): # <<<<<<<<<<<<<< @@ -2286,7 +2547,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_5_util_8str_pad(CYTHON_UNUSED PyObject * header - list of strings representing the header row */ -static PyObject *__pyx_pw_7sklearn_5earth_5_util_11ascii_table(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static PyObject *__pyx_pw_7sklearn_5earth_5_util_13ascii_table(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static PyObject *__pyx_f_7sklearn_5earth_5_util_ascii_table(PyObject *__pyx_v_header, PyObject *__pyx_v_data, CYTHON_UNUSED int __pyx_skip_dispatch) { CYTHON_UNUSED PyObject *__pyx_v_m = NULL; PyObject *__pyx_v_n = NULL; @@ -2319,46 +2580,46 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_ascii_table(PyObject *__pyx_v_he int __pyx_clineno = 0; __Pyx_RefNannySetupContext("ascii_table", 0); - /* "sklearn/earth/_util.pyx":45 + /* "sklearn/earth/_util.pyx":53 * data - list of lists of strings representing data rows * ''' * m = len(data) # <<<<<<<<<<<<<< * n = len(header) * column_widths = [len(head) for head in header] */ - __pyx_t_1 = PyObject_Length(__pyx_v_data); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Length(__pyx_v_data); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_v_m = __pyx_t_2; __pyx_t_2 = 0; - /* "sklearn/earth/_util.pyx":46 + /* "sklearn/earth/_util.pyx":54 * ''' * m = len(data) * n = len(header) # <<<<<<<<<<<<<< * column_widths = [len(head) for head in header] * for i, row in enumerate(data): */ - __pyx_t_1 = PyObject_Length(__pyx_v_header); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Length(__pyx_v_header); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromSsize_t(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_v_n = __pyx_t_2; __pyx_t_2 = 0; - /* "sklearn/earth/_util.pyx":47 + /* "sklearn/earth/_util.pyx":55 * m = len(data) * n = len(header) * column_widths = [len(head) for head in header] # <<<<<<<<<<<<<< * for i, row in enumerate(data): * for j, col in enumerate(row): */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); if (PyList_CheckExact(__pyx_v_header) || PyTuple_CheckExact(__pyx_v_header)) { __pyx_t_3 = __pyx_v_header; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0; __pyx_t_4 = NULL; } else { - __pyx_t_1 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_header); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_header); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext; } @@ -2366,42 +2627,41 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_ascii_table(PyObject *__pyx_v_he if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_3)) { if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_3)) { if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_5 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_5)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } __Pyx_GOTREF(__pyx_t_5); } - __Pyx_XDECREF(__pyx_v_head); - __pyx_v_head = __pyx_t_5; + __Pyx_XDECREF_SET(__pyx_v_head, __pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = PyObject_Length(__pyx_v_head); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Length(__pyx_v_head); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_ListComp_Append(__pyx_t_2, (PyObject*)__pyx_t_5))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_column_widths = ((PyObject*)__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_util.pyx":48 + /* "sklearn/earth/_util.pyx":56 * n = len(header) * column_widths = [len(head) for head in header] * for i, row in enumerate(data): # <<<<<<<<<<<<<< @@ -2414,7 +2674,7 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_ascii_table(PyObject *__pyx_v_he __pyx_t_3 = __pyx_v_data; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0; __pyx_t_4 = NULL; } else { - __pyx_t_1 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_data); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_data); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext; } @@ -2422,41 +2682,39 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_ascii_table(PyObject *__pyx_v_he if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_3)) { if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_3)) { if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_5 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_5)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } __Pyx_GOTREF(__pyx_t_5); } - __Pyx_XDECREF(__pyx_v_row); - __pyx_v_row = __pyx_t_5; + __Pyx_XDECREF_SET(__pyx_v_row, __pyx_t_5); __pyx_t_5 = 0; __Pyx_INCREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_2; - __pyx_t_5 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2); + __pyx_t_5 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = __pyx_t_5; __pyx_t_5 = 0; - /* "sklearn/earth/_util.pyx":49 + /* "sklearn/earth/_util.pyx":57 * column_widths = [len(head) for head in header] * for i, row in enumerate(data): * for j, col in enumerate(row): # <<<<<<<<<<<<<< @@ -2469,7 +2727,7 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_ascii_table(PyObject *__pyx_v_he __pyx_t_7 = __pyx_v_row; __Pyx_INCREF(__pyx_t_7); __pyx_t_6 = 0; __pyx_t_8 = NULL; } else { - __pyx_t_6 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_row); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_row); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext; } @@ -2477,70 +2735,68 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_ascii_table(PyObject *__pyx_v_he if (!__pyx_t_8 && PyList_CheckExact(__pyx_t_7)) { if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_7)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_9 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_6); __Pyx_INCREF(__pyx_t_9); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_6); __Pyx_INCREF(__pyx_t_9); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_9 = PySequence_ITEM(__pyx_t_7, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PySequence_ITEM(__pyx_t_7, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else if (!__pyx_t_8 && PyTuple_CheckExact(__pyx_t_7)) { if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_7)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_6); __Pyx_INCREF(__pyx_t_9); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_6); __Pyx_INCREF(__pyx_t_9); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_9 = PySequence_ITEM(__pyx_t_7, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PySequence_ITEM(__pyx_t_7, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_9 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_9)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } __Pyx_GOTREF(__pyx_t_9); } - __Pyx_XDECREF(__pyx_v_col); - __pyx_v_col = __pyx_t_9; + __Pyx_XDECREF_SET(__pyx_v_col, __pyx_t_9); __pyx_t_9 = 0; __Pyx_INCREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_v_j); - __pyx_v_j = __pyx_t_5; - __pyx_t_9 = PyNumber_Add(__pyx_t_5, __pyx_int_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_5); + __pyx_t_9 = PyNumber_Add(__pyx_t_5, __pyx_int_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = __pyx_t_9; __pyx_t_9 = 0; - /* "sklearn/earth/_util.pyx":50 + /* "sklearn/earth/_util.pyx":58 * for i, row in enumerate(data): * for j, col in enumerate(row): * if len(col) > column_widths[j]: # <<<<<<<<<<<<<< * column_widths[j] = len(col) * */ - __pyx_t_10 = PyObject_Length(__pyx_v_col); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_9 = PyInt_FromSsize_t(__pyx_t_10); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_Length(__pyx_v_col); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyInt_FromSsize_t(__pyx_t_10); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_11 = PyObject_GetItem(((PyObject *)__pyx_v_column_widths), __pyx_v_j); if (!__pyx_t_11) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyObject_GetItem(((PyObject *)__pyx_v_column_widths), __pyx_v_j); if (!__pyx_t_11) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); - __pyx_t_12 = PyObject_RichCompare(__pyx_t_9, __pyx_t_11, Py_GT); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_RichCompare(__pyx_t_9, __pyx_t_11, Py_GT); __Pyx_XGOTREF(__pyx_t_12); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = __Pyx_PyObject_IsTrue(__pyx_t_12); if (unlikely(__pyx_t_13 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; if (__pyx_t_13) { - /* "sklearn/earth/_util.pyx":51 + /* "sklearn/earth/_util.pyx":59 * for j, col in enumerate(row): * if len(col) > column_widths[j]: * column_widths[j] = len(col) # <<<<<<<<<<<<<< * * for j in range(n): */ - __pyx_t_10 = PyObject_Length(__pyx_v_col); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_12 = PyInt_FromSsize_t(__pyx_t_10); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_Length(__pyx_v_col); if (unlikely(__pyx_t_10 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyInt_FromSsize_t(__pyx_t_10); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - if (PyObject_SetItem(((PyObject *)__pyx_v_column_widths), __pyx_v_j, __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 51; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(((PyObject *)__pyx_v_column_widths), __pyx_v_j, __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; goto __pyx_L9; } @@ -2552,26 +2808,26 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_ascii_table(PyObject *__pyx_v_he __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_util.pyx":53 + /* "sklearn/earth/_util.pyx":61 * column_widths[j] = len(col) * * for j in range(n): # <<<<<<<<<<<<<< * column_widths[j] += 1 * */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_n); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_n); __Pyx_GIVEREF(__pyx_v_n); - __pyx_t_3 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_range, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; if (PyList_CheckExact(__pyx_t_3) || PyTuple_CheckExact(__pyx_t_3)) { __pyx_t_2 = __pyx_t_3; __Pyx_INCREF(__pyx_t_2); __pyx_t_1 = 0; __pyx_t_4 = NULL; } else { - __pyx_t_1 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_4 = Py_TYPE(__pyx_t_2)->tp_iternext; } @@ -2580,33 +2836,32 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_ascii_table(PyObject *__pyx_v_he if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_2)) { if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_2)) { if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PySequence_ITEM(__pyx_t_2, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_3 = __pyx_t_4(__pyx_t_2); if (unlikely(!__pyx_t_3)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } __Pyx_GOTREF(__pyx_t_3); } - __Pyx_XDECREF(__pyx_v_j); - __pyx_v_j = __pyx_t_3; + __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_3); __pyx_t_3 = 0; - /* "sklearn/earth/_util.pyx":54 + /* "sklearn/earth/_util.pyx":62 * * for j in range(n): * column_widths[j] += 1 # <<<<<<<<<<<<<< @@ -2615,18 +2870,18 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_ascii_table(PyObject *__pyx_v_he */ __Pyx_INCREF(__pyx_v_j); __pyx_t_3 = __pyx_v_j; - __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_column_widths), __pyx_t_3); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_column_widths), __pyx_t_3); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = PyNumber_InPlaceAdd(__pyx_t_5, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyNumber_InPlaceAdd(__pyx_t_5, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyObject_SetItem(((PyObject *)__pyx_v_column_widths), __pyx_t_3, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(((PyObject *)__pyx_v_column_widths), __pyx_t_3, __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_util.pyx":56 + /* "sklearn/earth/_util.pyx":64 * column_widths[j] += 1 * * result = '' # <<<<<<<<<<<<<< @@ -2636,7 +2891,7 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_ascii_table(PyObject *__pyx_v_he __Pyx_INCREF(((PyObject *)__pyx_kp_s_2)); __pyx_v_result = ((PyObject *)__pyx_kp_s_2); - /* "sklearn/earth/_util.pyx":57 + /* "sklearn/earth/_util.pyx":65 * * result = '' * for j, col_width in enumerate(column_widths): # <<<<<<<<<<<<<< @@ -2649,58 +2904,54 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_ascii_table(PyObject *__pyx_v_he for (;;) { if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_7 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_7); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_7); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif - __Pyx_XDECREF(__pyx_v_col_width); - __pyx_v_col_width = __pyx_t_7; + __Pyx_XDECREF_SET(__pyx_v_col_width, __pyx_t_7); __pyx_t_7 = 0; __Pyx_INCREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_v_j); - __pyx_v_j = __pyx_t_2; - __pyx_t_7 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_2); + __pyx_t_7 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = __pyx_t_7; __pyx_t_7 = 0; - /* "sklearn/earth/_util.pyx":58 + /* "sklearn/earth/_util.pyx":66 * result = '' * for j, col_width in enumerate(column_widths): * result += '-' * col_width + '-' # <<<<<<<<<<<<<< * result += '\n' * for j, head in enumerate(header): */ - __pyx_t_7 = PyNumber_Multiply(((PyObject *)__pyx_kp_s_3), __pyx_v_col_width); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyNumber_Multiply(((PyObject *)__pyx_kp_s_3), __pyx_v_col_width); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_7)); - __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_t_7), ((PyObject *)__pyx_kp_s_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Add(((PyObject *)__pyx_t_7), ((PyObject *)__pyx_kp_s_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - __pyx_t_7 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_v_result); - __pyx_v_result = __pyx_t_7; + __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_7); __pyx_t_7 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_util.pyx":59 + /* "sklearn/earth/_util.pyx":67 * for j, col_width in enumerate(column_widths): * result += '-' * col_width + '-' * result += '\n' # <<<<<<<<<<<<<< * for j, head in enumerate(header): * result += str_pad(head, column_widths[j]) + ' ' */ - __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_v_result); - __pyx_v_result = __pyx_t_2; + __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_util.pyx":60 + /* "sklearn/earth/_util.pyx":68 * result += '-' * col_width + '-' * result += '\n' * for j, head in enumerate(header): # <<<<<<<<<<<<<< @@ -2713,7 +2964,7 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_ascii_table(PyObject *__pyx_v_he __pyx_t_3 = __pyx_v_header; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0; __pyx_t_4 = NULL; } else { - __pyx_t_1 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_header); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_header); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext; } @@ -2721,79 +2972,75 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_ascii_table(PyObject *__pyx_v_he if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_3)) { if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_7 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_7); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_7); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_3)) { if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_7); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_7); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_7 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_7 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_7)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } __Pyx_GOTREF(__pyx_t_7); } - __Pyx_XDECREF(__pyx_v_head); - __pyx_v_head = __pyx_t_7; + __Pyx_XDECREF_SET(__pyx_v_head, __pyx_t_7); __pyx_t_7 = 0; __Pyx_INCREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_v_j); - __pyx_v_j = __pyx_t_2; - __pyx_t_7 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_2); + __pyx_t_7 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = __pyx_t_7; __pyx_t_7 = 0; - /* "sklearn/earth/_util.pyx":61 + /* "sklearn/earth/_util.pyx":69 * result += '\n' * for j, head in enumerate(header): * result += str_pad(head, column_widths[j]) + ' ' # <<<<<<<<<<<<<< * result += '\n' * for j, col_width in enumerate(column_widths): */ - __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_column_widths), __pyx_v_j); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetItem(((PyObject *)__pyx_v_column_widths), __pyx_v_j); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_5 = __pyx_f_7sklearn_5earth_5_util_str_pad(__pyx_v_head, __pyx_t_7, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __pyx_f_7sklearn_5earth_5_util_str_pad(__pyx_v_head, __pyx_t_7, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyNumber_Add(__pyx_t_5, ((PyObject *)__pyx_kp_s_1)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyNumber_Add(__pyx_t_5, ((PyObject *)__pyx_kp_s_1)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_result, __pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_result, __pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_v_result); - __pyx_v_result = __pyx_t_5; + __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_5); __pyx_t_5 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_util.pyx":62 + /* "sklearn/earth/_util.pyx":70 * for j, head in enumerate(header): * result += str_pad(head, column_widths[j]) + ' ' * result += '\n' # <<<<<<<<<<<<<< * for j, col_width in enumerate(column_widths): * result += '-' * col_width + '-' */ - __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_v_result); - __pyx_v_result = __pyx_t_2; + __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_util.pyx":63 + /* "sklearn/earth/_util.pyx":71 * result += str_pad(head, column_widths[j]) + ' ' * result += '\n' * for j, col_width in enumerate(column_widths): # <<<<<<<<<<<<<< @@ -2806,45 +3053,42 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_ascii_table(PyObject *__pyx_v_he for (;;) { if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif - __Pyx_XDECREF(__pyx_v_col_width); - __pyx_v_col_width = __pyx_t_5; + __Pyx_XDECREF_SET(__pyx_v_col_width, __pyx_t_5); __pyx_t_5 = 0; __Pyx_INCREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_v_j); - __pyx_v_j = __pyx_t_2; - __pyx_t_5 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_2); + __pyx_t_5 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = __pyx_t_5; __pyx_t_5 = 0; - /* "sklearn/earth/_util.pyx":64 + /* "sklearn/earth/_util.pyx":72 * result += '\n' * for j, col_width in enumerate(column_widths): * result += '-' * col_width + '-' # <<<<<<<<<<<<<< * for i, row in enumerate(data): * result += '\n' */ - __pyx_t_5 = PyNumber_Multiply(((PyObject *)__pyx_kp_s_3), __pyx_v_col_width); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Multiply(((PyObject *)__pyx_kp_s_3), __pyx_v_col_width); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_7 = PyNumber_Add(((PyObject *)__pyx_t_5), ((PyObject *)__pyx_kp_s_3)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyNumber_Add(((PyObject *)__pyx_t_5), ((PyObject *)__pyx_kp_s_3)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_7)); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_v_result); - __pyx_v_result = __pyx_t_5; + __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_5); __pyx_t_5 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_util.pyx":65 + /* "sklearn/earth/_util.pyx":73 * for j, col_width in enumerate(column_widths): * result += '-' * col_width + '-' * for i, row in enumerate(data): # <<<<<<<<<<<<<< @@ -2857,7 +3101,7 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_ascii_table(PyObject *__pyx_v_he __pyx_t_3 = __pyx_v_data; __Pyx_INCREF(__pyx_t_3); __pyx_t_1 = 0; __pyx_t_4 = NULL; } else { - __pyx_t_1 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_data); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_data); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = Py_TYPE(__pyx_t_3)->tp_iternext; } @@ -2865,54 +3109,51 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_ascii_table(PyObject *__pyx_v_he if (!__pyx_t_4 && PyList_CheckExact(__pyx_t_3)) { if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else if (!__pyx_t_4 && PyTuple_CheckExact(__pyx_t_3)) { if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_5 = __pyx_t_4(__pyx_t_3); if (unlikely(!__pyx_t_5)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } __Pyx_GOTREF(__pyx_t_5); } - __Pyx_XDECREF(__pyx_v_row); - __pyx_v_row = __pyx_t_5; + __Pyx_XDECREF_SET(__pyx_v_row, __pyx_t_5); __pyx_t_5 = 0; __Pyx_INCREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_v_i); - __pyx_v_i = __pyx_t_2; - __pyx_t_5 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF_SET(__pyx_v_i, __pyx_t_2); + __pyx_t_5 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = __pyx_t_5; __pyx_t_5 = 0; - /* "sklearn/earth/_util.pyx":66 + /* "sklearn/earth/_util.pyx":74 * result += '-' * col_width + '-' * for i, row in enumerate(data): * result += '\n' # <<<<<<<<<<<<<< * for j, item in enumerate(row): * result += str_pad(item, column_widths[j]) + ' ' */ - __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_v_result); - __pyx_v_result = __pyx_t_5; + __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_5); __pyx_t_5 = 0; - /* "sklearn/earth/_util.pyx":67 + /* "sklearn/earth/_util.pyx":75 * for i, row in enumerate(data): * result += '\n' * for j, item in enumerate(row): # <<<<<<<<<<<<<< @@ -2925,7 +3166,7 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_ascii_table(PyObject *__pyx_v_he __pyx_t_7 = __pyx_v_row; __Pyx_INCREF(__pyx_t_7); __pyx_t_6 = 0; __pyx_t_8 = NULL; } else { - __pyx_t_6 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_row); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = -1; __pyx_t_7 = PyObject_GetIter(__pyx_v_row); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __pyx_t_8 = Py_TYPE(__pyx_t_7)->tp_iternext; } @@ -2933,60 +3174,57 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_ascii_table(PyObject *__pyx_v_he if (!__pyx_t_8 && PyList_CheckExact(__pyx_t_7)) { if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_7)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_12 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_6); __Pyx_INCREF(__pyx_t_12); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyList_GET_ITEM(__pyx_t_7, __pyx_t_6); __Pyx_INCREF(__pyx_t_12); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_12 = PySequence_ITEM(__pyx_t_7, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PySequence_ITEM(__pyx_t_7, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else if (!__pyx_t_8 && PyTuple_CheckExact(__pyx_t_7)) { if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_7)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_12 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_6); __Pyx_INCREF(__pyx_t_12); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyTuple_GET_ITEM(__pyx_t_7, __pyx_t_6); __Pyx_INCREF(__pyx_t_12); __pyx_t_6++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_12 = PySequence_ITEM(__pyx_t_7, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PySequence_ITEM(__pyx_t_7, __pyx_t_6); __pyx_t_6++; if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif } else { __pyx_t_12 = __pyx_t_8(__pyx_t_7); if (unlikely(!__pyx_t_12)) { if (PyErr_Occurred()) { if (likely(PyErr_ExceptionMatches(PyExc_StopIteration))) PyErr_Clear(); - else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + else {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } break; } __Pyx_GOTREF(__pyx_t_12); } - __Pyx_XDECREF(__pyx_v_item); - __pyx_v_item = __pyx_t_12; + __Pyx_XDECREF_SET(__pyx_v_item, __pyx_t_12); __pyx_t_12 = 0; __Pyx_INCREF(__pyx_t_5); - __Pyx_XDECREF(__pyx_v_j); - __pyx_v_j = __pyx_t_5; - __pyx_t_12 = PyNumber_Add(__pyx_t_5, __pyx_int_1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_5); + __pyx_t_12 = PyNumber_Add(__pyx_t_5, __pyx_int_1); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = __pyx_t_12; __pyx_t_12 = 0; - /* "sklearn/earth/_util.pyx":68 + /* "sklearn/earth/_util.pyx":76 * result += '\n' * for j, item in enumerate(row): * result += str_pad(item, column_widths[j]) + ' ' # <<<<<<<<<<<<<< * result += '\n' * for j, col_width in enumerate(column_widths): */ - __pyx_t_12 = PyObject_GetItem(((PyObject *)__pyx_v_column_widths), __pyx_v_j); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyObject_GetItem(((PyObject *)__pyx_v_column_widths), __pyx_v_j); if (!__pyx_t_12) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); - __pyx_t_11 = __pyx_f_7sklearn_5earth_5_util_str_pad(__pyx_v_item, __pyx_t_12, 0); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = __pyx_f_7sklearn_5earth_5_util_str_pad(__pyx_v_item, __pyx_t_12, 0); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __pyx_t_12 = PyNumber_Add(__pyx_t_11, ((PyObject *)__pyx_kp_s_1)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyNumber_Add(__pyx_t_11, ((PyObject *)__pyx_kp_s_1)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_12); __Pyx_DECREF(__pyx_t_11); __pyx_t_11 = 0; - __pyx_t_11 = PyNumber_InPlaceAdd(__pyx_v_result, __pyx_t_12); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = PyNumber_InPlaceAdd(__pyx_v_result, __pyx_t_12); if (unlikely(!__pyx_t_11)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_11); __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - __Pyx_DECREF(__pyx_v_result); - __pyx_v_result = __pyx_t_11; + __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_11); __pyx_t_11 = 0; } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; @@ -2995,20 +3233,19 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_ascii_table(PyObject *__pyx_v_he __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_util.pyx":69 + /* "sklearn/earth/_util.pyx":77 * for j, item in enumerate(row): * result += str_pad(item, column_widths[j]) + ' ' * result += '\n' # <<<<<<<<<<<<<< * for j, col_width in enumerate(column_widths): * result += '-' * col_width + '-' */ - __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_kp_s_4)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_v_result); - __pyx_v_result = __pyx_t_2; + __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_util.pyx":70 + /* "sklearn/earth/_util.pyx":78 * result += str_pad(item, column_widths[j]) + ' ' * result += '\n' * for j, col_width in enumerate(column_widths): # <<<<<<<<<<<<<< @@ -3021,44 +3258,41 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_ascii_table(PyObject *__pyx_v_he for (;;) { if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break; #if CYTHON_COMPILING_IN_CPYTHON - __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_5); __pyx_t_1++; if (unlikely(0 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PySequence_ITEM(__pyx_t_3, __pyx_t_1); __pyx_t_1++; if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif - __Pyx_XDECREF(__pyx_v_col_width); - __pyx_v_col_width = __pyx_t_5; + __Pyx_XDECREF_SET(__pyx_v_col_width, __pyx_t_5); __pyx_t_5 = 0; __Pyx_INCREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_v_j); - __pyx_v_j = __pyx_t_2; - __pyx_t_5 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF_SET(__pyx_v_j, __pyx_t_2); + __pyx_t_5 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = __pyx_t_5; __pyx_t_5 = 0; - /* "sklearn/earth/_util.pyx":71 + /* "sklearn/earth/_util.pyx":79 * result += '\n' * for j, col_width in enumerate(column_widths): * result += '-' * col_width + '-' # <<<<<<<<<<<<<< * return result */ - __pyx_t_5 = PyNumber_Multiply(((PyObject *)__pyx_kp_s_3), __pyx_v_col_width); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Multiply(((PyObject *)__pyx_kp_s_3), __pyx_v_col_width); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - __pyx_t_7 = PyNumber_Add(((PyObject *)__pyx_t_5), ((PyObject *)__pyx_kp_s_3)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyNumber_Add(((PyObject *)__pyx_t_5), ((PyObject *)__pyx_kp_s_3)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_7)); __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_InPlaceAdd(__pyx_v_result, ((PyObject *)__pyx_t_7)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 79; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(((PyObject *)__pyx_t_7)); __pyx_t_7 = 0; - __Pyx_DECREF(__pyx_v_result); - __pyx_v_result = __pyx_t_5; + __Pyx_DECREF_SET(__pyx_v_result, __pyx_t_5); __pyx_t_5 = 0; } __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "sklearn/earth/_util.pyx":72 + /* "sklearn/earth/_util.pyx":80 * for j, col_width in enumerate(column_widths): * result += '-' * col_width + '-' * return result # <<<<<<<<<<<<<< @@ -3098,9 +3332,9 @@ static PyObject *__pyx_f_7sklearn_5earth_5_util_ascii_table(PyObject *__pyx_v_he } /* Python wrapper */ -static PyObject *__pyx_pw_7sklearn_5earth_5_util_11ascii_table(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ -static char __pyx_doc_7sklearn_5earth_5_util_10ascii_table[] = "\n header - list of strings representing the header row\n data - list of lists of strings representing data rows\n "; -static PyObject *__pyx_pw_7sklearn_5earth_5_util_11ascii_table(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { +static PyObject *__pyx_pw_7sklearn_5earth_5_util_13ascii_table(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ +static char __pyx_doc_7sklearn_5earth_5_util_12ascii_table[] = "\n header - list of strings representing the header row\n data - list of lists of strings representing data rows\n "; +static PyObject *__pyx_pw_7sklearn_5earth_5_util_13ascii_table(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_header = 0; PyObject *__pyx_v_data = 0; int __pyx_lineno = 0; @@ -3129,11 +3363,11 @@ static PyObject *__pyx_pw_7sklearn_5earth_5_util_11ascii_table(PyObject *__pyx_s case 1: if (likely((values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data)) != 0)) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("ascii_table", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("ascii_table", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ascii_table") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, pos_args, "ascii_table") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { goto __pyx_L5_argtuple_error; @@ -3146,18 +3380,18 @@ static PyObject *__pyx_pw_7sklearn_5earth_5_util_11ascii_table(PyObject *__pyx_s } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("ascii_table", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("ascii_table", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("sklearn.earth._util.ascii_table", __pyx_clineno, __pyx_lineno, __pyx_filename); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_r = __pyx_pf_7sklearn_5earth_5_util_10ascii_table(__pyx_self, __pyx_v_header, __pyx_v_data); + __pyx_r = __pyx_pf_7sklearn_5earth_5_util_12ascii_table(__pyx_self, __pyx_v_header, __pyx_v_data); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "sklearn/earth/_util.pyx":40 +/* "sklearn/earth/_util.pyx":48 * return string + ' ' * pad * * cpdef ascii_table(header, data): # <<<<<<<<<<<<<< @@ -3165,7 +3399,7 @@ static PyObject *__pyx_pw_7sklearn_5earth_5_util_11ascii_table(PyObject *__pyx_s * header - list of strings representing the header row */ -static PyObject *__pyx_pf_7sklearn_5earth_5_util_10ascii_table(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_header, PyObject *__pyx_v_data) { +static PyObject *__pyx_pf_7sklearn_5earth_5_util_12ascii_table(CYTHON_UNUSED PyObject *__pyx_self, PyObject *__pyx_v_header, PyObject *__pyx_v_data) { PyObject *__pyx_r = NULL; __Pyx_RefNannyDeclarations PyObject *__pyx_t_1 = NULL; @@ -3174,7 +3408,7 @@ static PyObject *__pyx_pf_7sklearn_5earth_5_util_10ascii_table(CYTHON_UNUSED PyO int __pyx_clineno = 0; __Pyx_RefNannySetupContext("ascii_table", 0); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __pyx_f_7sklearn_5earth_5_util_ascii_table(__pyx_v_header, __pyx_v_data, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 40; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __pyx_f_7sklearn_5earth_5_util_ascii_table(__pyx_v_header, __pyx_v_data, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4343,8 +4577,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx #else __pyx_t_3 = PySequence_ITEM(__pyx_t_1, __pyx_t_2); __pyx_t_2++; if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif - __Pyx_XDECREF(__pyx_v_childname); - __pyx_v_childname = __pyx_t_3; + __Pyx_XDECREF_SET(__pyx_v_childname, __pyx_t_3); __pyx_t_3 = 0; /* "numpy.pxd":795 @@ -4357,8 +4590,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_XDECREF(((PyObject *)__pyx_v_fields)); - __pyx_v_fields = ((PyObject*)__pyx_t_3); + __Pyx_XDECREF_SET(__pyx_v_fields, ((PyObject*)__pyx_t_3)); __pyx_t_3 = 0; /* "numpy.pxd":796 @@ -4415,11 +4647,9 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx __pyx_L6_unpacking_done:; } if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_XDECREF(((PyObject *)__pyx_v_child)); - __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); + __Pyx_XDECREF_SET(__pyx_v_child, ((PyArray_Descr *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_XDECREF(__pyx_v_new_offset); - __pyx_v_new_offset = __pyx_t_4; + __Pyx_XDECREF_SET(__pyx_v_new_offset, __pyx_t_4); __pyx_t_4 = 0; /* "numpy.pxd":798 @@ -4587,8 +4817,7 @@ static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx */ __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_v_t); - __pyx_v_t = __pyx_t_3; + __Pyx_XDECREF_SET(__pyx_v_t, __pyx_t_3); __pyx_t_3 = 0; /* "numpy.pxd":822 @@ -5147,11 +5376,12 @@ static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__py static PyMethodDef __pyx_methods[] = { {__Pyx_NAMESTR("apply_weights_2d"), (PyCFunction)__pyx_pw_7sklearn_5earth_5_util_1apply_weights_2d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("apply_weights_1d"), (PyCFunction)__pyx_pw_7sklearn_5earth_5_util_3apply_weights_1d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("gcv"), (PyCFunction)__pyx_pw_7sklearn_5earth_5_util_5gcv, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("gcv_adjust"), (PyCFunction)__pyx_pw_7sklearn_5earth_5_util_7gcv_adjust, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("str_pad"), (PyCFunction)__pyx_pw_7sklearn_5earth_5_util_9str_pad, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, - {__Pyx_NAMESTR("ascii_table"), (PyCFunction)__pyx_pw_7sklearn_5earth_5_util_11ascii_table, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7sklearn_5earth_5_util_10ascii_table)}, + {__Pyx_NAMESTR("apply_weights_slice"), (PyCFunction)__pyx_pw_7sklearn_5earth_5_util_3apply_weights_slice, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("apply_weights_1d"), (PyCFunction)__pyx_pw_7sklearn_5earth_5_util_5apply_weights_1d, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("gcv"), (PyCFunction)__pyx_pw_7sklearn_5earth_5_util_7gcv, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("gcv_adjust"), (PyCFunction)__pyx_pw_7sklearn_5earth_5_util_9gcv_adjust, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("str_pad"), (PyCFunction)__pyx_pw_7sklearn_5earth_5_util_11str_pad, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("ascii_table"), (PyCFunction)__pyx_pw_7sklearn_5earth_5_util_13ascii_table, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_7sklearn_5earth_5_util_12ascii_table)}, {0, 0, 0, 0} }; @@ -5193,6 +5423,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_n_s____pyx_releasebuffer, __pyx_k____pyx_releasebuffer, sizeof(__pyx_k____pyx_releasebuffer), 0, 0, 1, 1}, {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, {&__pyx_n_s__basis_size, __pyx_k__basis_size, sizeof(__pyx_k__basis_size), 0, 0, 1, 1}, + {&__pyx_n_s__column, __pyx_k__column, sizeof(__pyx_k__column), 0, 0, 1, 1}, {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1}, {&__pyx_n_s__data_size, __pyx_k__data_size, sizeof(__pyx_k__data_size), 0, 0, 1, 1}, {&__pyx_n_s__enumerate, __pyx_k__enumerate, sizeof(__pyx_k__enumerate), 0, 0, 1, 1}, @@ -5210,7 +5441,7 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_range = __Pyx_GetBuiltinName(__pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_enumerate = __Pyx_GetBuiltinName(__pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_ValueError = __Pyx_GetBuiltinName(__pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_RuntimeError = __Pyx_GetBuiltinName(__pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; @@ -5385,6 +5616,7 @@ PyMODINIT_FUNC PyInit__util(void) /*--- Function export code ---*/ if (__Pyx_ExportFunction("log2", (void (*)(void))__pyx_f_7sklearn_5earth_5_util_log2, "__pyx_t_7sklearn_5earth_5_util_FLOAT_t (__pyx_t_7sklearn_5earth_5_util_FLOAT_t)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_ExportFunction("apply_weights_2d", (void (*)(void))__pyx_f_7sklearn_5earth_5_util_apply_weights_2d, "PyObject *(PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_ExportFunction("apply_weights_slice", (void (*)(void))__pyx_f_7sklearn_5earth_5_util_apply_weights_slice, "PyObject *(PyArrayObject *, PyArrayObject *, __pyx_t_7sklearn_5earth_5_util_INDEX_t, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_ExportFunction("apply_weights_1d", (void (*)(void))__pyx_f_7sklearn_5earth_5_util_apply_weights_1d, "PyObject *(PyArrayObject *, PyArrayObject *, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_ExportFunction("gcv", (void (*)(void))__pyx_f_7sklearn_5earth_5_util_gcv, "__pyx_t_7sklearn_5earth_5_util_FLOAT_t (__pyx_t_7sklearn_5earth_5_util_FLOAT_t, __pyx_t_7sklearn_5earth_5_util_INDEX_t, __pyx_t_7sklearn_5earth_5_util_INDEX_t, __pyx_t_7sklearn_5earth_5_util_FLOAT_t, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_ExportFunction("gcv_adjust", (void (*)(void))__pyx_f_7sklearn_5earth_5_util_gcv_adjust, "__pyx_t_7sklearn_5earth_5_util_FLOAT_t (__pyx_t_7sklearn_5earth_5_util_INDEX_t, __pyx_t_7sklearn_5earth_5_util_INDEX_t, __pyx_t_7sklearn_5earth_5_util_FLOAT_t, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} diff --git a/sklearn/earth/_util.pxd b/sklearn/earth/_util.pxd index 3a3215f1df719..547f5e46f6651 100644 --- a/sklearn/earth/_util.pxd +++ b/sklearn/earth/_util.pxd @@ -8,6 +8,8 @@ cdef FLOAT_t log2(FLOAT_t x) cpdef apply_weights_2d(cnp.ndarray[FLOAT_t, ndim=2] B, cnp.ndarray[FLOAT_t, ndim=1] weights) +cpdef apply_weights_slice(cnp.ndarray[FLOAT_t, ndim=2] B, cnp.ndarray[FLOAT_t, ndim=1] weights, INDEX_t column) + cpdef apply_weights_1d(cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] weights) cpdef FLOAT_t gcv(FLOAT_t mse, INDEX_t basis_size, INDEX_t data_size, FLOAT_t penalty) diff --git a/sklearn/earth/_util.pyx b/sklearn/earth/_util.pyx index 9b5c5d36f1b6f..974a8ff59637f 100644 --- a/sklearn/earth/_util.pyx +++ b/sklearn/earth/_util.pyx @@ -19,6 +19,14 @@ cpdef apply_weights_2d(cnp.ndarray[FLOAT_t, ndim=2] B, cnp.ndarray[FLOAT_t, ndim for j in range(n): B[i, j] *= sqrt(weights[i]) +cpdef apply_weights_slice(cnp.ndarray[FLOAT_t, ndim=2] B, cnp.ndarray[FLOAT_t, ndim=1] weights, INDEX_t column): + cdef INDEX_t i + cdef INDEX_t j + cdef INDEX_t m = B.shape[0] + cdef INDEX_t n = B.shape[1] + for i in range(m): + B[i, column] *= sqrt(weights[i]) + cpdef apply_weights_1d(cnp.ndarray[FLOAT_t, ndim=1] y, cnp.ndarray[FLOAT_t, ndim=1] weights): cdef INDEX_t i cdef INDEX_t m = y.shape[0] diff --git a/sklearn/earth/earth.py b/sklearn/earth/earth.py index c8d3208f0d480..eda7c172e0941 100644 --- a/sklearn/earth/earth.py +++ b/sklearn/earth/earth.py @@ -89,7 +89,7 @@ class EarthRegressor(BaseEstimator, RegressorMixin, TransformerMixin): then the forward pass is terminated. - min_searh_points : int, optional (default=100) + min_search_points : int, optional (default=100) Used to calculate check_every (below). The minimum samples necessary for check_every to be greater than 1. The check_every parameter is calculated as @@ -103,6 +103,15 @@ class EarthRegressor(BaseEstimator, RegressorMixin, TransformerMixin): If check_every > 0, only one of every check_every sorted data points is considered as a candidate knot. If check_every is set to -1 then the check_every parameter is calculated based on min_search_points (above). + + + allow_linear : bool, optional (default=True) + If True, the forward pass will check the GCV of each new pair of terms and, if it's not + an improvement on a single term with no knot (called a linear term, although it may + actually be a product of a linear term with some other parent term), then only that + single, knotless term will be used. If False, that behavior is disabled and all terms + will have knots except those with variables specified by the linvars argument (see the + fit method). Attributes @@ -135,12 +144,12 @@ class EarthRegressor(BaseEstimator, RegressorMixin, TransformerMixin): forward_pass_arg_names = set( ['endspan', 'minspan', 'endspan_alpha', 'minspan_alpha', 'max_terms', 'max_degree', 'thresh', 'penalty', 'check_every', - 'min_searh_points']) + 'min_search_points', 'allow_linear']) pruning_pass_arg_names = set(['penalty']) def __init__( self, endspan=None, minspan=None, endspan_alpha=None, minspan_alpha=None, max_terms=None, max_degree=None, - thresh=None, penalty=None, check_every=None, min_search_points=None): + thresh=None, penalty=None, check_every=None, min_search_points=None, allow_linear=None): kwargs = {} call = locals() for name in self._get_param_names(): diff --git a/sklearn/earth/tests/pathological_data/issue_50.csv b/sklearn/earth/tests/pathological_data/issue_50.csv new file mode 100644 index 0000000000000..5f76b259cb6cb --- /dev/null +++ b/sklearn/earth/tests/pathological_data/issue_50.csv @@ -0,0 +1,8 @@ +x,y +24.040128,-125.66847999999999 +40.17048,-131.51711999999998 +41.10344,-133.78176 +41.972224,-133.5096 +44.720591999999996,-133.60592 +45.825248,-138.48239999999998 +50.725696,-142.98031999999998 diff --git a/sklearn/earth/tests/pathological_data/issue_50.txt b/sklearn/earth/tests/pathological_data/issue_50.txt new file mode 100644 index 0000000000000..78fbf8cb5a76e --- /dev/null +++ b/sklearn/earth/tests/pathological_data/issue_50.txt @@ -0,0 +1,11 @@ +EarthRegressor Model +------------------------------------- +Basis Function Pruned Coefficient +------------------------------------- +(Intercept) No -134.994 +h(x-44.7206) No -1.42112 +h(44.7206-x) No 0.461161 +h(x-40.1705) Yes None +h(40.1705-x) Yes None +------------------------------------- +MSE: 1191.2154, GCV: 6485.5061, RSQ: 0.9507, GRSQ: 0.8028 \ No newline at end of file diff --git a/sklearn/earth/tests/pathological_data/issue_50_weight.csv b/sklearn/earth/tests/pathological_data/issue_50_weight.csv new file mode 100644 index 0000000000000..5a1c36948b39f --- /dev/null +++ b/sklearn/earth/tests/pathological_data/issue_50_weight.csv @@ -0,0 +1,8 @@ +sample_weight +1062.711799884992 +871.4544949444627 +839.5063272968255 +954.8189050502953 +827.1006200543013 +1244.6183968904068 +802.2168136248937 \ No newline at end of file diff --git a/sklearn/earth/tests/pathological_data/readme.txt b/sklearn/earth/tests/pathological_data/readme.txt index 5a23bdf5b77c0..c5043e9b4454c 100644 --- a/sklearn/earth/tests/pathological_data/readme.txt +++ b/sklearn/earth/tests/pathological_data/readme.txt @@ -5,4 +5,11 @@ regression tests to prevent the same bugs from arising again in the future. issue_44: This data set caused a segfault during fitting due to the use of a negative index in Cython -with wraparound = False. \ No newline at end of file +with wraparound = False. + +issue_50: +This data set exposed a bug that occurred when using the sample_weight parameter. The problem +was that the apply methods of the BasisFunctions were not applying the weights, and the +next_pair method of the ForwardPasser class assumed they were. Now next_pair applies the +weights after calling apply. The same data set exposed issue 51, in which user-specified +endspans were not used. This test case covers both issues. \ No newline at end of file diff --git a/sklearn/earth/tests/test_earth.py b/sklearn/earth/tests/test_earth.py index 41d45dcc2bec1..e1336a80ef177 100644 --- a/sklearn/earth/tests/test_earth.py +++ b/sklearn/earth/tests/test_earth.py @@ -1,8 +1,3 @@ -''' -Created on Feb 24, 2013 - -@author: jasonrudy -''' import numpy from .._basis import Basis, ConstantBasisFunction, HingeBasisFunction, LinearBasisFunction from .. import EarthRegressor @@ -40,11 +35,11 @@ def __init__(self): def test_get_params(self): assert_equal( EarthRegressor().get_params(), {'penalty': None, 'min_search_points': None, - 'endspan_alpha': None, - 'check_every': None, + 'endspan_alpha': None, 'check_every': None, 'max_terms': None, 'max_degree': None, 'minspan_alpha': None, - 'thresh': None, 'minspan': None, 'endspan': None}) + 'thresh': None, 'minspan': None, 'endspan': None, + 'allow_linear': None}) assert_equal( EarthRegressor( max_degree=3).get_params(), {'penalty': None, 'min_search_points': None, @@ -52,7 +47,8 @@ def test_get_params(self): 'check_every': None, 'max_terms': None, 'max_degree': 3, 'minspan_alpha': None, - 'thresh': None, 'minspan': None, 'endspan': None}) + 'thresh': None, 'minspan': None, 'endspan': None, + 'allow_linear': None}) @if_statsmodels def test_linear_fit(self): @@ -130,17 +126,23 @@ def test_score(self): def test_pathological_cases(self): import pandas directory = os.path.join( - os.path.dirname(os.path.abspath(__file__)), - 'pathological_data') - cases = {'issue_44': {}} + os.path.dirname(os.path.abspath(__file__)), 'pathological_data') + cases = {'issue_44': {}, + 'issue_50': {'penalty': 0.5, 'minspan': 1, 'allow_linear': False, + 'endspan': 1, 'check_every': 1, 'sample_weight': 'issue_50_weight.csv'}} for case, settings in cases.iteritems(): data = pandas.read_csv(os.path.join(directory, case + '.csv')) y = data['y'] del data['y'] X = data - model = EarthRegressor(**settings).fit(X, y) -# with open(os.path.join('pathological_data', case + '.txt'), 'w') as outfile: -# outfile.write(model.summary()) + if 'sample_weight' in settings: + sample_weight = pandas.read_csv(os.path.join(directory, settings['sample_weight']))['sample_weight'] + del settings['sample_weight'] + else: + sample_weight = None + model = EarthRegressor(**settings).fit(X, y, sample_weight = sample_weight) +# with open(os.path.join(directory, case + '.txt'), 'w') as outfile: +# outfile.write(model.summary()) with open(os.path.join(directory, case + '.txt'), 'r') as infile: correct = infile.read() assert_equal(model.summary(), correct) diff --git a/sklearn/earth/tests/test_forward.py b/sklearn/earth/tests/test_forward.py index d370322b687ae..610f0cd81af16 100644 --- a/sklearn/earth/tests/test_forward.py +++ b/sklearn/earth/tests/test_forward.py @@ -1,8 +1,3 @@ -''' -Created on Feb 16, 2013 - -@author: jasonrudy -''' from .._forward import ForwardPasser from .._basis import Basis, ConstantBasisFunction, HingeBasisFunction, LinearBasisFunction import numpy