You can not select more than 25 topics Topics must start with a chinese character,a letter or number, can include dashes ('-') and can be up to 35 characters long.

datasets.py 1.6 kB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. # ---
  2. # jupyter:
  3. # jupytext_format_version: '1.2'
  4. # kernelspec:
  5. # display_name: Python 3
  6. # language: python
  7. # name: python3
  8. # language_info:
  9. # codemirror_mode:
  10. # name: ipython
  11. # version: 3
  12. # file_extension: .py
  13. # mimetype: text/x-python
  14. # name: python
  15. # nbconvert_exporter: python
  16. # pygments_lexer: ipython3
  17. # version: 3.5.2
  18. # ---
  19. # ## Datasets
  20. # ## Moons
  21. #
  22. # +
  23. % matplotlib inline
  24. import numpy as np
  25. from sklearn import datasets
  26. import matplotlib.pyplot as plt
  27. # generate sample data
  28. np.random.seed(0)
  29. X, y = datasets.make_moons(200, noise=0.20)
  30. # plot data
  31. plt.scatter(X[:, 0], X[:, 1], c=y, cmap=plt.cm.Spectral)
  32. plt.show()
  33. # -
  34. # ## XOR
  35. # +
  36. import numpy as np
  37. import matplotlib.pyplot as plt
  38. from sklearn.gaussian_process import GaussianProcessClassifier
  39. rng = np.random.RandomState(0)
  40. X = rng.randn(200, 2)
  41. Y = np.logical_xor(X[:, 0] > 0, X[:, 1] > 0)
  42. # plot data
  43. plt.scatter(X[:, 0], X[:, 1], c=Y, cmap=plt.cm.Spectral)
  44. plt.show()
  45. # -
  46. # ## Digital
  47. # +
  48. import matplotlib.pyplot as plt
  49. from sklearn.datasets import load_digits
  50. # load data
  51. digits = load_digits()
  52. # copied from notebook 02_sklearn_data.ipynb
  53. fig = plt.figure(figsize=(6, 6)) # figure size in inches
  54. fig.subplots_adjust(left=0, right=1, bottom=0, top=1, hspace=0.05, wspace=0.05)
  55. # plot the digits: each image is 8x8 pixels
  56. for i in range(64):
  57. ax = fig.add_subplot(8, 8, i + 1, xticks=[], yticks=[])
  58. ax.imshow(digits.images[i], cmap=plt.cm.binary)
  59. # label the image with the target value
  60. ax.text(0, 7, str(digits.target[i]))

机器学习越来越多应用到飞行器、机器人等领域,其目的是利用计算机实现类似人类的智能,从而实现装备的智能化与无人化。本课程旨在引导学生掌握机器学习的基本知识、典型方法与技术,通过具体的应用案例激发学生对该学科的兴趣,鼓励学生能够从人工智能的角度来分析、解决飞行器、机器人所面临的问题和挑战。本课程主要内容包括Python编程基础,机器学习模型,无监督学习、监督学习、深度学习基础知识与实现,并学习如何利用机器学习解决实际问题,从而全面提升自我的《综合能力》。