from yellowbrick.datasets import load_concrete
from yellowbrick.target import BalancedBinningReference
import numpy as np
# Load the concrete dataset
X, y = load_concrete()# Instantiate the visualizer# 可视化器,求各个区间的平均值
visualizer = BalancedBinningReference(bins=5)# Fit the data to the visualizer# 拟合数据
a=visualizer.fit(y)# 显示数据
visualizer.show();
from yellowbrick.datasets import load_concrete
from yellowbrick.target import balanced_binning_reference
# Load the dataset
X, y = load_concrete()# Use the quick method and immediately show the figure
balanced_binning_reference(y);
结果图使我们能够诊断余额问题的严重性。 在此图中,我们可以看到“ win”类主导了其他两个类。 一种可能的解决方案是创建一个二进制分类器:“ win”与“ not win”,并将“ loss”和“ draw”类组合为一个类。ClassBalance函数的功能就是计算各个类下样本数。
from yellowbrick.datasets import load_game
from yellowbrick.target import ClassBalance
# Load the classification dataset# 载入分类数据库
X, y = load_game()# Instantiate the visualizer# ClassBalance函数的功能就是计算各个类下样本数。
visualizer = ClassBalance(labels=["draw","loss","win"])
visualizer.fit(y)# Fit the data to the visualizer
visualizer.show();# Finalize and render the figure
from sklearn.model_selection import TimeSeriesSplit
from yellowbrick.datasets import load_occupancy
from yellowbrick.target import ClassBalance
# Load the classification dataset
X, y = load_occupancy()# Create the training and test data# 时间分割序列数据
tscv = TimeSeriesSplit()for train_index, test_index in tscv.split(X):
X_train, X_test = X.iloc[train_index], X.iloc[test_index]
y_train, y_test = y.iloc[train_index], y.iloc[test_index]# Instantiate the visualizer
visualizer = ClassBalance(labels=["unoccupied","occupied"])
visualizer.fit(y_train, y_test)# Fit the data to the visualizer
visualizer.show();
/opt/conda/envs/python35-paddle120-env/lib/python3.7/site-packages/sklearn/model_selection/_split.py:752: FutureWarning: You should specify a value for 'n_splits' instead of relying on the default value. The default value will change from 3 to 5 in version 0.22.
warnings.warn(NSPLIT_WARNING, FutureWarning)
from yellowbrick.datasets import load_game
from yellowbrick.target import class_balance
# Load the dataset
X, y = load_game()# Use the quick method and immediately show the figure
class_balance(y);
from sklearn import datasets
from yellowbrick.target import FeatureCorrelation
# Load the regression dataset
data = datasets.load_diabetes()
X, y = data['data'], data['target']# Create a list of the feature names
features = np.array(data['feature_names'])# Instantiate the visualizer# 计算x中的每个特征与y的相关性
visualizer = FeatureCorrelation(labels=features)# Fit the data to the visualizer
visualizer.fit(X, y)
visualizer.show();
from sklearn import datasets
from yellowbrick.target import FeatureCorrelation
import numpy as np
# Load the regression dataset
data = datasets.load_diabetes()
X, y = data['data'], data['target']# Create a list of the feature names
features = np.array(data['feature_names'])# Create a list of the discrete features# 创建离散变量列表
discrete =[Falsefor _ inrange(len(features))]# discrete为age需要变为离散变量
discrete[1]=True# Instantiate the visualizer
visualizer = FeatureCorrelation(method='mutual_info-regression', labels=features)
visualizer.fit(X, y, discrete_features=discrete, random_state=0)
visualizer.show();
import pandas as pd
from sklearn import datasets
from yellowbrick.target import FeatureCorrelation
# Load the regression dataset# 导入分类数据
data = datasets.load_wine()
X, y = data['data'], data['target']
X_pd = pd.DataFrame(X, columns=data['feature_names'])# Create a list of the features to plot
features =['alcohol','ash','hue','proline','total_phenols']# Instaniate the visualizer# sort设置是否排序
visualizer = FeatureCorrelation(
method='mutual_info-classification', feature_names=features, sort=True)
visualizer.fit(X_pd, y)# Fit the data to the visualizer
visualizer.show();
import numpy as np
from sklearn import datasets
import matplotlib.pyplot as plt
from yellowbrick.target.feature_correlation import feature_correlation
#Load the diabetes dataset
data = datasets.load_iris()
X, y = data['data'], data['target']
features = np.array(data['feature_names'])
visualizer = feature_correlation(X, y, labels=features)
plt.tight_layout();
#include<iostream>
#include<cassert>
using namespace std;
template<class T, int SIZE = 50>
class Stack{
private:
T list[SIZE];//数组存放栈的元素
int top;//栈顶位置
public:
Stack(
Gson提供了丰富的预定义类型适配器,在对象和JSON串之间进行序列化和反序列化时,指定对象和字符串之间的转换方式,
DateTypeAdapter
public final class DateTypeAdapter extends TypeAdapter<Date> {
public static final TypeAdapterFacto