diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 00000000..cacd0b94 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,29 @@ +name: CI + +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + +jobs: + model_ci: + # The type of runner that the job will run on + runs-on: ubuntu-latest + container: + image: mcr.microsoft.com/mlops/python:latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - uses: actions/checkout@v2 + + # Runs a single command using the runners shell + - name: Run lint tests + run: flake8 --output-file=lint-testresults.xml --format junit-xml + + # Runs a set of commands using the runners shell +# - name: Run a multi-line script +# run: | +# echo Add other actions to build, +# echo test, and deploy your project. diff --git a/diabetes_regression/training/r_train.r b/diabetes_regression/training/r_train.r new file mode 100644 index 00000000..1732a282 --- /dev/null +++ b/diabetes_regression/training/r_train.r @@ -0,0 +1,49 @@ +# Databricks notebook source +print(R.version.string) + +# COMMAND ---------- + +mount_name = "kcmunninstoragev2-databricks" # Change this to the mount name in your Databricks workspace + +# COMMAND ---------- + +# Load Training Data +#path = paste("/dbfs/mnt/",mount_name,"/weight_data.csv",sep="") +path="../../../data/train/weight_data.csv" +print(paste("Reading file from",path)) + +routes<-read.csv(path, header=TRUE) + +# The predictor vector (height). +x <- routes$height +# The response vector (weight). +y <- routes$weight +# Apply the lm() function. +model <- lm(y~x) + +# COMMAND ---------- + +routes + +# COMMAND ---------- + +# Make Predictions +df_test_heights <- data.frame(x = as.numeric(c(115,20))) +result <- predict(model,df_test_heights) +print(result) + +# COMMAND ---------- + +# Save the model to blob storage +#model_path = paste("/dbfs/mnt/",mount_name,"/models/model.rds",sep="") +model_path="model.rds" +saveRDS(model, model_path) + +# COMMAND ---------- + +# View model details +print(model) + +# COMMAND ---------- + +print('Completed') \ No newline at end of file diff --git a/diabetes_regression/training/train_with_r.py b/diabetes_regression/training/train_with_r.py new file mode 100644 index 00000000..b51b70bb --- /dev/null +++ b/diabetes_regression/training/train_with_r.py @@ -0,0 +1,3 @@ +import os + +os.system("Rscript r_train.r") diff --git a/diabetes_regression/training/weight_data.csv b/diabetes_regression/training/weight_data.csv new file mode 100644 index 00000000..cc441ee9 --- /dev/null +++ b/diabetes_regression/training/weight_data.csv @@ -0,0 +1,30 @@ +height,weight +79,174 +63,250 +75,223 +75,130 +70,120 +76,239 +63,129 +64,185 +59,246 +80,241 +79,217 +65,212 +74,242 +71,223 +61,167 +78,148 +75,229 +75,116 +75,182 +72,237 +72,160 +79,169 +67,219 +61,202 +65,168 +79,181 +81,214 +78,216 +59,245