小编abd*_*lsn的帖子

LSTM 时间序列 - 奇怪的 val_accuarcy,使用哪种归一化方法以及模型拟合后在生产中做什么

我正在做 LSTM 时间序列预测。我的数据看起来像这样

在此处输入图片说明 所以基本上我所拥有的是

IDTime : 每天的整数

时间部分:0 = 夜间,1 = 早上,2 = 下午

以及我试图预测的 4 列值

我有 2686 个值,每天 3 个值,所以总共有大约 900 个值 + 添加了新的缺失值

我阅读并做了类似https://www.tensorflow.org/tutorials/structured_data/time_series 的事情

  1. ReplacedMissingData - 添加了缺失的 IDTimes 0-Max,每个包含具有 0 个值的 TimePart 0-3(如果缺失)。并将所有 NULL 值替换为 0。我还删除了 Date 参数,因为我有 IDTime
  2. 将 Data (Pandas DataFrame) 索引设置为 IDTime 和 TimePart
  3. 复制我想要的功能
features_considered = ['TimePart', 'NmbrServices', 'LoggedInTimeMinutes','NmbrPersons', 'NmbrOfEmployees']
features = data[features_considered]
features.index = data.index
Run Code Online (Sandbox Code Playgroud)
  1. 在训练数据上使用平均值/标准差。我正在为我试图预测的每个特征创建 4 个不同的模型。我这个当前我设置的currentFeatureIndex= 1,即 NmbServices
    currentFeatureIndex = 1
    TRAIN_SPLIT = …
Run Code Online (Sandbox Code Playgroud)

python machine-learning lstm keras tensorflow

6
推荐指数
1
解决办法
245
查看次数

如何修复 MLflow UI 中未显示的工件

我使用了 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)

python artifacts mlflow

4
推荐指数
2
解决办法
2万
查看次数

无法启动 Spark-shell

您好,我已经解压并导出了 Spark 路径。当我吃午饭时,我收到了这个错误。

export PATH=$PATH:/usr/local/spark/spark24/bin
Run Code Online (Sandbox Code Playgroud)

$ 火花外壳

错误

Traceback (most recent call last):
  File "/usr/local/bin/find_spark_home.py", line 74, in <module>
    print(_find_spark_home())
  File "/usr/local/bin/find_spark_home.py", line 56, in _find_spark_home
    module_home = os.path.dirname(find_spec("pyspark").origin)
AttributeError: 'NoneType' object has no attribute 'origin'
/usr/local/bin/spark-shell: line 57: /bin/spark-submit: No such file or directory
Run Code Online (Sandbox Code Playgroud)

我的问题是什么。

apache-spark pyspark spark-shell

2
推荐指数
1
解决办法
4782
查看次数

我需要始终运行findspark还是一次?

我使用 pyspark 的方法是始终在 jupyter 中运行下面的代码。这种方法总是必要的吗?

import findspark
findspark.init('/opt/spark2.4')
import pyspark
sc = pyspark.SparkContext()
Run Code Online (Sandbox Code Playgroud)

python pyspark

1
推荐指数
1
解决办法
7799
查看次数