# ---
# jupyter:
#   jupytext:
#     text_representation:
#       extension: .py
#       format_name: light
#       format_version: '1.5'
#       jupytext_version: 1.14.4
#   kernelspec:
#     display_name: Python 3
#     name: python3
# ---

# + colab={"base_uri": "https://localhost:8080/"} id="Vsxh0ki7SuNL" outputId="32fa164b-e0ac-41a2-d958-20206bdd3df2"
# !pip install catboost
# !pip install scikit-learn
# !pip install ipywidgets

# + colab={"base_uri": "https://localhost:8080/"} id="R_JXpRWnS610" outputId="f130f866-15bb-4a51-e05a-7a6b325873d2"
from google.colab import drive
drive.mount('/content/drive')

# + id="F0Up4UaoTANS"
train_csv_link = '/content/drive/MyDrive/nsu-abmd-2021-e-commerce/train.csv'

# + id="OND6Nq0Zs6Ul"
test_csv_link = '/content/drive/MyDrive/nsu-abmd-2021-e-commerce/test.csv'

# + id="cg6DxcwC9Rbg"
submission_csv_link = '/content/drive/MyDrive/nsu-abmd-2021-e-commerce/submission_example.csv'

# + id="yDWIyJGSX5kx"
import pandas as pd
import numpy as np

# + colab={"base_uri": "https://localhost:8080/"} id="PZ23Ast3E7dJ" outputId="f57481f5-9a13-433d-8e63-fc43d42910f3"
train = pd.read_csv(train_csv_link)
test = pd.read_csv(test_csv_link)

# + id="QHfd8Gh_XESw"
test = pd.read_csv(test_csv_link)

# + id="HDocpl_uE9DK"
subs = pd.read_csv(submission_csv_link)

# + colab={"base_uri": "https://localhost:8080/"} id="HXgNKmkuGiOc" outputId="7cf8fe34-1c7d-4c01-f7d7-4538b2f5eab8"
# !pip install cloudpickle==1.2.0

# + colab={"base_uri": "https://localhost:8080/"} id="FE2LefXMGwji" outputId="61ac5c1f-743c-45bd-f35c-22a16e2a3c56"
# !pip install folium==0.2.1

# + colab={"base_uri": "https://localhost:8080/"} id="zUTp95A8G9y8" outputId="c4da0d1b-ace5-410e-d812-e0af594d3537"
# !pip install imgaug==0.2.5

# + colab={"base_uri": "https://localhost:8080/"} id="BMkhMJ1vEI5N" outputId="bb26811c-0a1a-45ff-f2bb-e9ef70be49a2"
# !pip install autogluon.tabular[all]

# + id="HkEReOaFEmHa"
RUNTIME = 3228

y = "Sales"

# + id="WzMBm5AJHpAP"
from autogluon.tabular import TabularPredictor

# + colab={"base_uri": "https://localhost:8080/"} id="xdinYFTWbiKq" outputId="a65ce285-af4d-4fb0-b9cc-7c2dcf5c6283"
train.info()

# + colab={"base_uri": "https://localhost:8080/"} id="RJ8z5NE4Eu3D" outputId="504fe88c-33f2-4387-ae98-3df763ce987b"
predictor = TabularPredictor(label=y, eval_metric='mse', path='/content/drive/MyDrive/nsu-abmd-2021-e-commerce/agModels').fit(train, presets='best_quality', time_limit=RUNTIME)

# + colab={"base_uri": "https://localhost:8080/"} id="BtgIfZamV3mu" outputId="b9ce7f7a-acf7-4f07-971f-8feb8b68aa23"
test.info()

# + id="QJX1tqI6Ew92"
preds = predictor.predict(test)

# + id="D18Kk7WzEyr3"
subs['Expected'] = pd.DataFrame(preds)['Sales']

# + colab={"base_uri": "https://localhost:8080/"} id="7yoo54GCX2S_" outputId="7a198a3f-c448-494e-fc7f-143067b8c3db"
subs.info()

# + id="H2YTi_tgE19x"
subs.to_csv('/content/drive/MyDrive/nsu-abmd-2021-e-commerce/submission.csv',index = False)

# + [markdown] id="LBtDYMnn9pOu"
# Загрузка обученной модели 

# + id="qw8dNowv9crR"
predictor = TabularPredictor.load('/content/drive/MyDrive/nsu-abmd-2021-e-commerce/agModels')

# + id="QLpi-DnG9oAG"
preds = predictor.predict(test)

StarcoderdataJupyterScriptsDedupFiltered