Severity: 8192
Message: Function create_function() is deprecated
Filename: geshi/geshi.php
Line Number: 4698
Backtrace:
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4698
Function: _error_handler
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 4621
Function: _optimize_regexp_list_tokens_to_string
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 1655
Function: optimize_regexp_list
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2029
Function: optimize_keyword_group
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/geshi/geshi.php
Line: 2168
Function: build_parse_cache
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/libraries/Process.php
Line: 45
Function: parse_code
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/models/Pastes.php
Line: 517
Function: syntax
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/application/controllers/Main.php
Line: 693
Function: getPaste
File: /home/httpd/vhosts/scratchbook.ch/geopaste.scratchbook.ch/index.php
Line: 315
Function: require_once
class boost: def __init__(self, tree, n_estimators = 100): self.models = list() self.weights = list() self.errors = list() self.tree = tree self.n_estimators = n_estimators self.sp = 0 def predict(self, x): res = np.zeros(x.shape[0]) for model, weight in zip(self.models, self.weights): res += 1.0 * weight * model.predict(x) return res def _static_predict(self): return self._sp def add_model(self, model, weight, x): self.models.append(model) self.weights.append(weight) self._sp += 1.0 * weight * model.predict(x) def _weighted_median(self, a, weights): sort = np.argsort(a) a = a[sort] weights = weights[sort] weights = weights / np.sum(weights) weights = np.cumsum(weights) for i in range(1, a.shape[0] - 1): if weights[i - 1] <= 1/2 and weights[i + 1] >= 1/2: # print(a[i]) return a[i] def fit(self, x, y): m_0 = self.tree(max_depth = 2) m_0.fit(x, y) self._sp = np.zeros(y.shape[0]) self.add_model(m_0, 1, x) for i in range(self.n_estimators): # print('\r' + str(i)) grad = np.sign(y - self._static_predict()) a = self.tree(max_depth = 3) a.fit(x, grad) a_predict = a.predict(x) old_preds = self._static_predict() b = self._weighted_median((y - old_preds) / a_predict, np.abs(a_predict)) self.add_model(a, b, x) self.errors.append(np.mean(np.abs(old_preds - y))) def get_errors(self): return self.errors