A PHP Error was encountered

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

Untitled - Stikked
From Beige Guinea Pig, 7 Years ago, written in Python.
Embed
  1. """
  2. ================================
  3. Nearest Neighbors Classification
  4. ================================
  5.  
  6. Sample usage of Nearest Neighbors classification.
  7. It will plot the decision boundaries for each class.
  8. """
  9. print(__doc__)
  10.  
  11. import numpy as np
  12. import matplotlib.pyplot as plt
  13. from matplotlib.colors import ListedColormap
  14. from sklearn import neighbors, datasets
  15.  
  16. n_neighbors = 15
  17.  
  18. # import some data to play with
  19. iris = datasets.load_iris()
  20.  
  21. # we only take the first two features. We could avoid this ugly
  22. # slicing by using a two-dim dataset
  23. X = iris.data[:, :2]
  24. y = iris.target
  25.  
  26. h = .02  # step size in the mesh
  27.  
  28. # Create color maps
  29. cmap_light = ListedColormap(['#FFAAAA', '#AAFFAA', '#AAAAFF'])
  30. cmap_bold = ListedColormap(['#FF0000', '#00FF00', '#0000FF'])
  31.  
  32. for weights in ['uniform', 'distance']:
  33.     # we create an instance of Neighbours Classifier and fit the data.
  34.     clf = neighbors.KNeighborsClassifier(n_neighbors, weights=weights)
  35.     clf.fit(X, y)
  36.  
  37.     # Plot the decision boundary. For that, we will assign a color to each
  38.     # point in the mesh [x_min, x_max]x[y_min, y_max].
  39.     x_min, x_max = X[:, 0].min() - 1, X[:, 0].max() + 1
  40.     y_min, y_max = X[:, 1].min() - 1, X[:, 1].max() + 1
  41.     xx, yy = np.meshgrid(np.arange(x_min, x_max, h),
  42.                          np.arange(y_min, y_max, h))
  43.     Z = clf.predict(np.c_[xx.ravel(), yy.ravel()])
  44.  
  45.     # Put the result into a color plot
  46.     Z = Z.reshape(xx.shape)
  47.     plt.figure()
  48.     plt.pcolormesh(xx, yy, Z, cmap=cmap_light)
  49.  
  50.     # Plot also the training points
  51.     plt.scatter(X[:, 0], X[:, 1], c=y, cmap=cmap_bold,
  52.                 edgecolor='k', s=20)
  53.     plt.xlim(xx.min(), xx.max())
  54.     plt.ylim(yy.min(), yy.max())
  55.     plt.title("3-Class classification (k = %i, weights = '%s')"
  56.               % (n_neighbors, weights))
  57.  
  58. plt.show()