小编Ann*_*off的帖子

测试系统稳定性的功能,接收预测的时间序列作为输入

我想编写一个将时间序列和标准偏差作为参数并返回调整后的时间序列的函数,该时间序列看起来像是预测。

使用此功能,我想测试系统的稳定性,该系统将获取天气预报的时间序列表作为输入参数。

我对这种功能的使用方法,如下所述:

vector<tuple<datetime, double>> get_adjusted_timeseries(vector<tuple<datetime, double>>& timeseries_original, const double stddev, const double dist_mid)
{

    auto timeseries_copy(timeseries_original);

    int sign = randInRange(0, 1) == 0 ? 1 : -1;


    auto left_limit = normal_cdf_inverse(0.5 - dist_mid, 0, stddev);
    auto right_limit = normal_cdf_inverse(0.5 + dist_mid, 0, stddev);

    for (auto& pair : timeseries_copy)
    {
        double number;
        do
        {
            nd_value = normal_distribution_r(0, stddev);
        }
        while (sign == -1 && nd_value > 0.0 || sign == 1 && nd_value < 0.0);


        pair = make_tuple(get<0>(pair), get<1>(pair) + …
Run Code Online (Sandbox Code Playgroud)

c++ normal-distribution prediction forecasting standard-deviation

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

调整实时序列以使其看起来像预测

我想写得到一个函数Listdouble值和值的变化作为参数,并返回一个调整List

List<double> adjustTimeSeriesAsForecast(List<double> ts, double variance) {...}
Run Code Online (Sandbox Code Playgroud)

调整后的值List应与原始值略有不同或有所不同List,具体取决于传递的差异。但是,差异应在原始值的上方和下方List,以使列表之间的平均百分比误差(MPE)保持不变,并且仅平均绝对百分比误差(MAPE)会发生变化。返回的内容List应类似于预测。

使用此功能,我想测试系统的稳定性,该系统将获取天气预报的时间序列表作为输入参数。

如何List将真实天气数据调整为天气预报?

statistics normal-distribution time-series prediction forecasting

5
推荐指数
0
解决办法
190
查看次数

在一天的预测之前初始化LSTM状态

我想使用LSTM来预测每天强烈依赖季节的时间序列。作为测试数据,使用了不同季节的天数。在对测试数据进行预测之前,我想LSTM使用前一天的训练数据来初始化状态。

model = Sequential()
model.add(LSTM(hidden_size, input_shape=(sequence_size, inputs), return_sequences=True)
model.add(Dense(units=2)
model.compile(loss='mean_squared_error', optimizer='adam', metrics=['accuracy'])

for _ in range(100):
    model.fit(X_train, Y_train, batch_size=batch_size, epochs=1, validation_data=None, shuffle=True)
    for day in range(num_test_days):
        #TODO: initialize state of LSTM with the training data of previous day
        y_pred = model.predict(X_test[day].reshape(1, sequence_size, inputs), batch_size=1)
Run Code Online (Sandbox Code Playgroud)

#Todo源代码中所标记,我想LSTM为当天的预测做准备,以便使状态适合于预测考试日。有办法吗?

python lstm keras tensorflow

5
推荐指数
0
解决办法
80
查看次数

在 RestSharp 中获取 REST 请求的原始 JSON 数据

我使用 RestSharp 访问服务器 API。

RestClient client = new RestClient(serverUrl);

JObject parameters = new JObject
        {
           new JProperty("Param1", p1),
           new JProperty("Param2", p2)
        }; 

RestRequest request = new RestRequest("/Foo", Method.POST);
request.AddParameter("application/json; charset=UTF-8", parameters, ParameterType.RequestBody);
Run Code Online (Sandbox Code Playgroud)

有没有办法在 RestSharp 中获取 REST 请求的原始 JSON 数据?

c# rest json restsharp

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

提高sklearn中的随机森林回归器的性能

有一个优化问题,我必须调用随机森林回归器的预测函数数千次。

from sklearn.ensemble import RandomForestRegressor
rfr = RandomForestRegressor(n_estimators=10)
rfr = rfr.fit(X, Y)
for iteration in range(0, 100000):
    # code that adapts the input data according to fitness of the last output
    output_data = rfr.predict(input_data)
    # code that evaluates the fitness of output data
Run Code Online (Sandbox Code Playgroud)

在这种情况下,有没有办法提高预测功能的速度?可能通过使用Cython?

python scikit-learn sklearn-pandas

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

搜索与 CMRmap 相似的颜色图

我正在 matplotlib 中寻找以下颜色图,我在一篇论文中看到了它: 在此处输入图片说明

起初我以为这是CMRmap颜色图的一部分。

cmap = plt.get_cmap('CMRmap')
new_cmap = truncate_colormap(cmap, 0.0, 0.75) #(/sf/answers/1324857901/)
Run Code Online (Sandbox Code Playgroud)

然而,当我提取它的一个子集时出现了以下内容,看起来有点不同(尤其是黄色):

在此处输入图片说明

有谁知道我如何到达上面的颜色图?

python matplotlib

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