Skip to content

Commit

Permalink
updating files.
Browse files Browse the repository at this point in the history
  • Loading branch information
poffo committed Dec 13, 2023
1 parent f7b2849 commit 98fc4d3
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 3 deletions.
24 changes: 22 additions & 2 deletions mastering-carol/batch-data-app/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,16 @@
from sklearn.model_selection import train_test_split
from sklearn.linear_model import LinearRegression
from sklearn.metrics import mean_squared_error

import matplotlib.pyplot as plt
import numpy as np

import logging

from google.cloud import bigquery
from dotenv import load_dotenv
from pycarol.apps import Apps
from pycarol import Carol
from pycarol import Carol, Staging

load_dotenv(".env")

Expand Down Expand Up @@ -96,4 +98,22 @@
plt.xlabel('Actual Values')
plt.ylabel('Predicted Values')
plt.title('Actual vs Predicted Values')
plt.show()
# plt.show()

columns = [
'dt_invoice_weekday',
'businesspartner_id_fa426a07b9b70daaedbd7c85fd53901c',
'businesspartner_id_fd2b7dbe63b9cfc558eca54f494db2c2',
'predictValue'
]

df = pd.DataFrame(X_test, columns=columns[:-1]) # Exclude the last column from data_array
df[columns[-1]] = y_pred
df['executionDate'] = pd.Timestamp('now')
df['rowNumber'] = np.arange(df.shape[0])

print(df)

staging = Staging(Carol())
staging.send_data(staging_name = 'execution_history', data = df, step_size = 2,
connector_id='f673daea3af94179b06b1db79b979430', print_stats = True)
34 changes: 34 additions & 0 deletions mastering-carol/batch-data-app/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
{
"batch": {
"processes": [
{
"algorithmDescription": {
"en-US": "Linear Regression Model"
},
"algorithmName": "batch_data",
"algorithmTitle": {
"en-US": "Linear Regression Model"
},
"instanceProperties": {
"profile": "",
"properties": {
"instanceType": "c1.small",
"dockerImage": "customerdataappp/batch-data-app",
"preemptible": true
}
},
"name": "batch_data"
}
]
},
"docker": [
{
"dockerName": "batch-data-app",
"dockerTag": "0.1.0",
"gitBranch": "master",
"gitPath": "/mastering-carol/batch-data-app",
"gitDockerfileName": "Dockerfile",
"gitRepoUrl": "https://github.com/totvslabs/carolapp-samples"
}
]
}
2 changes: 1 addition & 1 deletion mastering-carol/online-data-app/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"profile": "",
"properties": {
"instanceType": "c1.small",
"dockerImage": "online-data-app",
"dockerImage": "customerdataappp/online-data-app",
"autoscale": {
"enabled": false,
"minReplicas": 1,
Expand Down

0 comments on commit 98fc4d3

Please sign in to comment.