예제 #1
0
def demand_forecasting():
    request_data = request.args
    ip_address = request_data.get('ipAddress')
    df = DemandForecast()
    test_x = df.convert_data_by_ip_address(ip_address)

    if len(test_x) > 0:
        test_x = np.unique(test_x, axis=0)
        model_saved = keras.models.load_model('forecast_demand_model.h5')
        pred = model_saved.predict(test_x.reshape(len(test_x), len(test_x[0])),
                                   batch_size=1)
        return jsonify({"forecastResults": '{}'.format(pred)})
    else:
        return 'no data'
예제 #2
0
def item_category_demand_forecasting_by_userid_chat():
    request_data = request.args
    user_id = request_data.get('userId')
    df = DemandForecast()
    test_x = df.convert_data_by_user_id_chat(user_id)

    if len(test_x) > 0:
        test_x = np.unique(test_x, axis=0)
        model_saved = keras.models.load_model(
            'forecast_item_category_demand_model.h5')
        pred = model_saved.predict(test_x.reshape(len(test_x), len(test_x[0])),
                                   batch_size=1)
        print(pred)
        return jsonify({"forecastResults": '{}'.format(pred)})
    else:
        return 'no data'
예제 #3
0
def get_recommend_cart_items():
    query_parameters = request.args
    user_id = query_parameters.get('userId')
    df = DemandForecast()
    test_x = df.convert_data_by_user_id(user_id)
    if len(test_x) > 0:
        test_x = np.unique(test_x, axis=0)
        model_saved = keras.models.load_model('forecast_model.h5')
        prediction = model_saved.predict(test_x.reshape(
            len(test_x), len(test_x[0])),
                                         batch_size=1)
        prediction = json.dumps(prediction.tolist())
        print(prediction)
        return jsonify({"forecastResults": '{}'.format(prediction)})
    else:
        return 'no data'
예제 #4
0
from DemandForecasting import DemandForecast

df = DemandForecast()
df.forecast_item_category_demand_model()
예제 #5
0
def generate_chat_model():
    chat_model = ChatBotModel()
    data_dump_model = DataBaseDump()
    data_dump_model.create_data_dump()
    data_dump_model.create_data_dump_ip_address()
    res = chat_model.generatechatmodel()
    demand_forecast = DemandForecast()
    demand_forecast.forecast_demand_model()
    demand_forecast.forecast_item_category_demand_model()
    demand_forecast.forecast_item_category_demand_model_without_user_id()
    demand_forecast.forecast_item_price_demand_model()
    demand_forecast.forecast_item_discount_demand_model()
    demand_forecast.forecast_order_quantity_demand_model()
    demand_forecast.forecast_order_total_amount_demand_model()
    demand_forecast.forecast_order_status_demand_model()
    return res