In [2]:
!ls
In [6]:
# %load cookie.py
"""This file contains code for use with "Think Bayes",
by Allen B. Downey, available from greenteapress.com
Copyright 2012 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
from thinkbayes import Pmf
pmf = Pmf()
pmf.Set('Bowl 1', 0.5)
pmf.Set('Bowl 2', 0.5)
pmf.Mult('Bowl 1', 0.75)
pmf.Mult('Bowl 2', 0.5)
pmf.Normalize()
print((pmf.Prob('Bowl 1')))
In [10]:
!pip install version_information
In [12]:
%load_ext version_information
%version_information pandas, sklearn
Out[12]:
In [13]:
%whos
In [14]:
# 自动刷新引用
%load_ext autoreload
%audoreload 2
%aimport cookie
In [18]:
# 用于展示引用文件
from IPython.display import FileLink
FileLink("cookie.py")
Out[18]:
In [28]:
import numpy as np
import sklearn
import pandas
%matplotlib inline
import matplotlib.pyplot as plt
In [22]:
from sklearn.datasets import load_boston
TAB 自动提示
Shift+TAB 参数提示
In [1]:
# 在括号内按 shitf + tab
load_boston()
? 可以显示文档
In [25]:
from sklearn.ensemble import RandomForestRegressor
RandomForestRegressor?
In [33]:
%%latex
$$ x^3 + C = \int{\frac{1}{3} x^2 \; dx} \quad (C \in \mathbb{R})$$
In [2]:
import sklearn
import numpy as np
import pandas as pd
%matplotlib inline
import matplotlib.pyplot as plt
In [3]:
from sklearn.datasets import california_housing
cal = california_housing.fetch_california_housing()
df = pd.DataFrame(data=cal.data, columns=cal.feature_names, index=cal.target)
df.head(10)
Out[3]:
In [4]:
plt.scatter(df.Latitude, df.Longitude)
Out[4]:
In [5]:
import seaborn as sns
In [7]:
sns.jointplot(df.Longitude, df.Latitude)
Out[7]:
In [9]:
sns.set(style="ticks")
sns.jointplot(df.Longitude, df.Latitude, kind="hex", color="#4CB391")
Out[9]:
In [13]:
from scipy.stats import kendalltau
kendalltau?
In [14]:
sns.set(style="ticks")
sns.jointplot(df.Longitude, df.Latitude, kind="hex",stat_func=kendalltau, color="#4CB391")
Out[14]:
In [ ]: