・ I managed to put it in while searching on the Internet, setting.jonson ...
Simple regression ... Estimating another (objective variable) from one value (explanatory variable) y = x + 2, etc., supervised learning Multiple regression ... Multiple explanatory variables, y = ax1 + bx2 + cx3 + ...
Multiple regression method Prepare an element → Use LinearRegression () Learn → .fit (x, y) Predict → Can be done with .predict (x)
How good is the regression? Uses the coefficient of determination .score (x, y) Run with jupyter notebook
% matplotlib inline What? Why is it possible to use characters's% instead of characters + variables when outputting an array? What is the enumate function
axis #(1 for rows, 0 for columns)
np.random.randint(0,100,3) #(Generate 3 integers from 0 to 100)
Omitted here
def sample(*words,sep="/"):
return sep.join(words) #Use join to concatenate characters
sample("a","b","c")
# a/b/Displayed with c ・ Sep indicates how to divide between
def sample(**words):
print(words)
sample(a="A",b="B",c="C")
zip function ... Tuples can be listed map function .. Apply operation to each element of list → You don't have to use for loop! Use anonymous function ... lambda. Convenient to keep short
a=[1,2,3]
b=[4,5,6]
c=[7,8,9]
l=zip(a,b,c)
print(list(l))
#[(1, 4, 7), (2, 5, 8), (3, 6, 9)]
def threepow(x):
return x**3
ans=list(map(threepow,a))
print(ans)
#[1, 8, 27]
d=list(map(lambda i:i**3, a))
print(d)
#[1, 8, 27],Only 2 lines
-Easy data analysis (like SQL or R!) ・ There are many such functions ・ Various types can be used together
Recommended Posts