Data science Study Notes 1. science Study Notes

Source: Internet
Author: User

Data science Study Notes 1. science Study Notes

Mutiple Plots on One Graphplt.plot(x, norm.pdf(x))plt.plot(x, norm.pdf(x, 1.0, 0.2)) #1.0 = mean, 0.2 = DSplt.show()

Use plt. savefig to save the image as blank:

Solution: Call plt. savefig before plt. show ().

Scatter Plot

From pylab import randnX = randn (10000) Y = randn (10000) plt. scatter (X, Y) # Pay Attention to the sequence. Draw a picture first and then add the axis axes = plt. axes () axes. set_xlim ([0, 1]) axes. set_ylim ([0, 4]) plt. show ()

Covariance: covariance

Covariance> 0: x, y changes in the same direction, and the greater the covariance, the higher the degree of the same direction.

Covariance <0: x, y reversely changes, and the greater the absolute value of the covariance, the higher the inverse degree.

Correlation calculation: covariance/SD

-1: perfect inverse correlation, 0: no correlation, 1: perfect correlation

Bayesian Formula

# Dictionary: calculates the number of users of different ages from numpy import randomrandom. seed (0) totals = {20:0, 30: 0, 40: 0, 50: 0, 60: 0, 70: 0} purchases = {20:0, 30: 0, 40: 0, 50: 0, 60: 0, 70: 0} totalPurchases = 0for _ in range (100000): age = random. choice ([20, 30, 40, 50, 60, 70]) purchaseProbability = float (age)/100.0 # division operation float totals [age] + = 1 if (random. random () <purchaseProbability): totalPurchases + = 1 purchases [age] + = 1

 

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.