Python constructs BP single-layer neural network __1. Visualizing data

Source: Internet
Author: User

1. Write data to the CSV file, you should be able to directly implement the Python code to write the dataset, but I read this piece of file is not very skilled, and so I succeeded, plus, here I write the dataset directly into Excel

2. Then change the suffix to. csv and use Pandas to read

Import Matplotlib.pyplot as Pltfile = ' bp_test.csv ' import pandas as Pddf = pd.read_csv (file, header=none) x = df.iloc[:,].v Aluesprint (x)
Read results
[ -1.     -0.9602] [ -0.9    -0.577] [ -0.8    -0.0729] [ -0.7     0.3771] [ -0.6     0.6405] [ -0.5     0.66  ] [ -0.4     0.4609] [ -0.3     0.1336] [ -0.2    -0.2013] [ -0.1    -0.4344] [0.     -0.5   ] [0.1    -0.393] [0.2    -0.1647] [0.3     0.0988] [0.4     0.3072] [0.5     0.396] [0.6     0. 3449] [0.7     0.1816] [0.8    -0.0312] [0.9    -0.2189] [1.     -0.3201]]

3. Visualize 21 of your data

Plt.scatter (x[:,0], x[:,1], color= ' red ', marker= ' x ', label= ' Mark ') Plt.xlabel (' x ') Plt.ylabel (' Y ') plt.legend (loc= ') Upper left ') plt.show ()

Run results

Python constructs BP single-layer neural network __1. Visualizing data

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.