Merge pull request #1 from JacobLee121/JacobLee121-patch-plot#2
Open
JacobLee121 wants to merge 1 commit intoJacobLee121-patch-plotfrom
Open
Merge pull request #1 from JacobLee121/JacobLee121-patch-plot#2JacobLee121 wants to merge 1 commit intoJacobLee121-patch-plotfrom
JacobLee121 wants to merge 1 commit intoJacobLee121-patch-plotfrom
Conversation
Create pyplot
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
coding: utf-8
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from pandas import *
from future import division
import csv
with open ("E:/6Machine Learning/Deep learning/ML2017/hw1.1/hw1/data/train.csv", "r") as csvfile:
read = csv.DictReader(csvfile)
price = [row["price"] for row in read]
p = [int(item) for item in price]
a = len(price)
ss = len(p)
with open("E:/6Machine Learning/Deep learning/ML2017/hw1.1/hw1/data/train.csv", "r") as csvfile:
read = csv.DictReader(csvfile)
sqft_living=[row["sqft_living"] for row in read]
#"""convert the data type from str to int"""
s_l = [int(item) for item in sqft_living]
b=len(sqft_living)
bb=len(s_l)
plt.figure(1)
plt.plot(price, sqftliving)
plt.show()
print(bb)
print(ss)
print(p)
print(s_l)
f1=plt.figure(1)
plt.subplot(211)
plt.scatter(p,s_l)
plt.subplot(212)
plt.scatter(s_l,p)
plt.show()
def sum_of_squares(v):
"""computes the sum of squared element in v"""
return sum(v_i ** 2 for v_i in v)
sum_of_squares(p)
print(sum)
def difference_quotient(f,x,h):
return (f(x+h)-f(x))/h
"""estimate_gradeient"""
def step(v,direction, step_size):
"""move step_size in the dirction from v"""
return [v_i + step_size * direction_i
for v_i, direction_i in zip(v,direction)]