我试图来复制这种风格HeatMap是连续值映射到一个LinearColorMapper实例:http://docs.bokeh.org/en/latest/docs/gallery/unemployment.html
我想作一个HeatMap(W /无论是charts或rect),然后添加一个选择小部件来选择obsv_id,然后添加一个滑块小部件来浏览dates.
但是,一开始我在HeatMap使用单obsv_id/date对时遇到了麻烦。我在创建这个时做错了HeatMap什么?这本质上是size变量和loc变量的 3x3 矩形图。
奖励:你能帮我/就如何连接这些小部件的输出来控制情节提出一些建议吗?
我看到了这些帖子,但所有示例都使用实际的十六进制颜色作为列表,而不是使用连续度量进行映射: python bokeh,如何制作相关图? http://docs.bokeh.org/en/latest/docs/gallery/categorical.html
# Init
import numpy as np
import pandas as pd
from bokeh.plotting import figure, output_notebook, output_file, reset_output, show, ColumnDataSource
from bokeh.models import LinearColorMapper
reset_output()
output_notebook()
np.random.seed(0)
# Coords
dates = ["07-3","07-11","08-6","08-28"]
#locs = ["air","water","earth"]
locs = [0,1,2] …Run Code Online (Sandbox Code Playgroud) 我使用了 MLflow 并使用下面的函数(来自 pydataberlin)记录了参数。
def train(alpha=0.5, l1_ratio=0.5):
# train a model with given parameters
warnings.filterwarnings("ignore")
np.random.seed(40)
# Read the wine-quality csv file (make sure you're running this from the root of MLflow!)
data_path = "data/wine-quality.csv"
train_x, train_y, test_x, test_y = load_data(data_path)
# Useful for multiple runs (only doing one run in this sample notebook)
with mlflow.start_run():
# Execute ElasticNet
lr = ElasticNet(alpha=alpha, l1_ratio=l1_ratio, random_state=42)
lr.fit(train_x, train_y)
# Evaluate Metrics
predicted_qualities = lr.predict(test_x)
(rmse, mae, r2) = eval_metrics(test_y, predicted_qualities)
# Print …Run Code Online (Sandbox Code Playgroud)