Www.machinelearninghellix.site
Artificial Intelligence with PythonFollow-up ActivitiesDay One: Implement Python on your computer.(1) Python is not the programming language installed in PC or Mac by default. To ensure your computer understand Python, you should check with the Command Prompt by typing “python”As shown above, this computer has installed Python 3.6.1(2) If your computer has not installed the Python interpreter, you should download the Python interpreter from the Python official website: “Downloads”Choose the newest version Python 3.6.5 by clicking the yellow icon “Download Python 3.6.5”. If you want to install Python for a Mac, click the link “Mac OS X”. If you want to install Python for a Linux machine click the link “Linux/UNIX”.(3) Since the AI programming with Python needs many extra Python packages, we should choose a Python distribution package all the necessary Python external packages. The Anaconda Distribution is a good choice, visit , then click the green “Downloads” icon on the upper right of the page.Choose and click “Python 3.6 version” to download and install Python 3.6. (4) Launch Anaconda Navigator, and click “Launch” to open Jupyter.(5) Click “New” and open an interactive Python file with a Python shell. In this case, we choose “Python 3”.Then we can start coding.Day Two: Working with Jupyter(1) Jupyter provides an interactive integrated development interface (IDE) for Python AI programming. Unlike the python file ended with “.py”. The file created by Jupyter is ended with “ipynb”.(2) When a new “. ipynb” file is created, it will be given a name automatically such as “Untitled.ipynb”. To change the file name, we need to select the file and shut down the file by clicking “Shutdown”(3) Then check the file again (choose one file) and click “Rename” to change the file name.(4) Jupyter provides an interactive interface that allows you to check your code and to debug during programming. In addition, you can divide your program into small sections so that you can implement your work little by little.To create a new code section, choose “Insert” from the upper menu and choose “Insert Cell Above” or “Insert Cell Below” to insert a new section above or below the currently selected cell.To run your code, choose “Cell” from the upper menu and choose which part of the code you want to run.Jupyter provides a shortcut to run the code in the currently selected cell only. Press “Shift + Enter” to run the code in the currently cell. Day Three: implement machine learning codes in Jupyter(1) Go to the course website and download the demo codes in the Jupyter folder. (2) Click the link of the file to open it. Use the “Cell” menu or “Shift + Enter” to run the code(3) If you want to run the Python code outside Jupyter, click “File” ”Download as”, and choose the file format you want to download. Note that the “.py” format is the basic Python format that can be run by most Python IDEs and Command Prompt by typing “python filename.py”. Day Four: explore external datasets from an open data repository(1) The UCI Machine Learning Repository maintains and provides many free datasets from AI practice. (2) Visit to browse datasets for classification and regression.(3) Remember that the Pandas can read plain text file “.txt” and CSV file. So if you want to import the dataset into Python is a smooth way, you can use some software such as Excel to convert the downloaded files into the .CSV format, then use Pandas to read the dataset into Python.Day Five: implement deep learning with Tensorflow in Python(1) Congratulations for finishing the course of AI with Python! Now you are familiar with Python AI coding with scikit-learn (sklearn) and other Python packages for data science. Now let’s try another cool thing: doing deep learning with Tensorflow in Python.(2) If you have a NVIDIA GPU, you should install CUDA 7.5 or CUDA 8.0, and the cuDNN library at first. To install CUDA Toolkit, go to install cuDNN (NVIDIA CUDA? Deep Neural Network library), go to (3) Now we will install Tensorflow, the deep learning package developed by Google. Go to the TensorFlow for Windows page: a WINDOWS command prompt, then run:conda create -n tensorflowactivate tensorflow(4) Validate the installationGo to the interactive Python environment by typing “python” at the command prompt, then>>> import tensorflow as tf>>> hello = tf.constant('Hello, TensorFlow!')>>> sess = tf.Session()>>> print(sess.run(hello)) The system should return: Hello, TensorFlow!(5) Install Theano and KerasFrom the Anaconda environment (not in the Ipython, type ‘exit()’ if you are in Ipython)Type the following command:conda install mingw libpythonpip install keras(6) To validate if the installation is successfulpython -c "from keras import backend; print(backend._BACKEND)"(7) Write a Python script and run it in the environmentLaunch Jupyter from Anaconda Navigator, then open a new fileTry the following code to build two regression models to visualize the training performance# ---- The script starts here ----import numpy as npfrom keras.optimizers import SGDfrom keras.layers import Densefrom keras.models import Sequentialfrom keras.utils import to_categoricalimport matplotlib.pyplot as pltfrom keras.callbacks import History # create the datax = np.random.rand(100,100).astype(np.float32)y = x*0.1 + 0.3n_cols = x.shape[1]# Set up the modelmodel_1 = Sequential()model_2 = Sequential()# Configure model 1model_1.add(Dense(200,activation='tanh', input_shape=(n_cols,)))model_1.add(Dense(100,activation='tanh'))model_1.add(Dense(100))model_pile(optimizer='adam', loss='mean_squared_error')#Configure model 2model_2.add(Dense(100,activation='tanh', input_shape=(n_cols,)))model_2.add(Dense(100))model_pile(optimizer='adam', loss='mean_squared_error')#create two training history recordershist_1 = History()hist_2 = History()# Fit the modelmodel_1_training = model_1.fit(x, y, epochs=50, verbose=False, callbacks=[hist_1])model_2_training = model_2.fit(x, y, epochs=50, verbose=False, callbacks=[hist_2])# Create the plotplt.plot(model_1_training.history['loss'], 'r', model_2_training.history['loss'], 'b')plt.xlabel('Epochs')plt.ylabel('Validation score')plt.show()exit()# ---- The script ends(8) Run the above code, then you will see a figure:(9) Congratulations! Now you are a state-of-the-art junior AI engineer and data scientist. ................
................
In order to avoid copyright disputes, this page is only a partial summary.
To fulfill the demand for quickly locating and searching documents.
It is intelligent file search solution for home and business.
Related download
Related searches
- current events site high school
- https www municipalonlinepayments
- acura owners site sign in
- unscramble words official site usa
- best site for used cars
- site of photosynthesis quizlet
- dating site for creative people
- job posting site for employers
- wrong site surgery case
- wrong site surgery stories
- statistics on wrong site surgery
- parent fafsa site log in