Compare commits

...

7 Commits
master ... dvc

Author SHA1 Message Date
9d8fc7c82e dvc 2021-06-12 12:12:35 +02:00
6cf924a12b stop tracking data csv 2021-06-12 12:05:41 +02:00
e79757fb04 asdas 2021-06-12 12:03:04 +02:00
b3a896a632 yaml 2021-06-12 12:00:15 +02:00
9289cb8a82 fix dockerffile 2021-06-12 11:49:08 +02:00
88f5323fbf Added DVC remote 2021-06-12 11:42:45 +02:00
6cb4c72e4d stop tracking healthcare-dataset-stroke-data.csv 2021-06-12 11:39:51 +02:00
28 changed files with 1680 additions and 5119 deletions

3
.dvc/.gitignore vendored Normal file
View File

@ -0,0 +1,3 @@
/config.local
/tmp
/cache

4
.dvc/config Normal file
View File

@ -0,0 +1,4 @@
[core]
remote = ium_ssh_remote
['remote "ium_ssh_remote"']
url = ssh://ium-sftp@tzietkiewicz.vm.wmi.amu.edu.pl/ium-sftp

107
.dvc/plots/confusion.json Normal file
View File

@ -0,0 +1,107 @@
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"data": {
"values": "<DVC_METRIC_DATA>"
},
"title": "<DVC_METRIC_TITLE>",
"facet": {
"field": "rev",
"type": "nominal"
},
"spec": {
"transform": [
{
"aggregate": [
{
"op": "count",
"as": "xy_count"
}
],
"groupby": [
"<DVC_METRIC_Y>",
"<DVC_METRIC_X>"
]
},
{
"impute": "xy_count",
"groupby": [
"rev",
"<DVC_METRIC_Y>"
],
"key": "<DVC_METRIC_X>",
"value": 0
},
{
"impute": "xy_count",
"groupby": [
"rev",
"<DVC_METRIC_X>"
],
"key": "<DVC_METRIC_Y>",
"value": 0
},
{
"joinaggregate": [
{
"op": "max",
"field": "xy_count",
"as": "max_count"
}
],
"groupby": []
},
{
"calculate": "datum.xy_count / datum.max_count",
"as": "percent_of_max"
}
],
"encoding": {
"x": {
"field": "<DVC_METRIC_X>",
"type": "nominal",
"sort": "ascending",
"title": "<DVC_METRIC_X_LABEL>"
},
"y": {
"field": "<DVC_METRIC_Y>",
"type": "nominal",
"sort": "ascending",
"title": "<DVC_METRIC_Y_LABEL>"
}
},
"layer": [
{
"mark": "rect",
"width": 300,
"height": 300,
"encoding": {
"color": {
"field": "xy_count",
"type": "quantitative",
"title": "",
"scale": {
"domainMin": 0,
"nice": true
}
}
}
},
{
"mark": "text",
"encoding": {
"text": {
"field": "xy_count",
"type": "quantitative"
},
"color": {
"condition": {
"test": "datum.percent_of_max > 0.5",
"value": "white"
},
"value": "black"
}
}
}
]
}
}

View File

@ -0,0 +1,112 @@
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"data": {
"values": "<DVC_METRIC_DATA>"
},
"title": "<DVC_METRIC_TITLE>",
"facet": {
"field": "rev",
"type": "nominal"
},
"spec": {
"transform": [
{
"aggregate": [
{
"op": "count",
"as": "xy_count"
}
],
"groupby": [
"<DVC_METRIC_Y>",
"<DVC_METRIC_X>"
]
},
{
"impute": "xy_count",
"groupby": [
"rev",
"<DVC_METRIC_Y>"
],
"key": "<DVC_METRIC_X>",
"value": 0
},
{
"impute": "xy_count",
"groupby": [
"rev",
"<DVC_METRIC_X>"
],
"key": "<DVC_METRIC_Y>",
"value": 0
},
{
"joinaggregate": [
{
"op": "sum",
"field": "xy_count",
"as": "sum_y"
}
],
"groupby": [
"<DVC_METRIC_Y>"
]
},
{
"calculate": "datum.xy_count / datum.sum_y",
"as": "percent_of_y"
}
],
"encoding": {
"x": {
"field": "<DVC_METRIC_X>",
"type": "nominal",
"sort": "ascending",
"title": "<DVC_METRIC_X_LABEL>"
},
"y": {
"field": "<DVC_METRIC_Y>",
"type": "nominal",
"sort": "ascending",
"title": "<DVC_METRIC_Y_LABEL>"
}
},
"layer": [
{
"mark": "rect",
"width": 300,
"height": 300,
"encoding": {
"color": {
"field": "percent_of_y",
"type": "quantitative",
"title": "",
"scale": {
"domain": [
0,
1
]
}
}
}
},
{
"mark": "text",
"encoding": {
"text": {
"field": "percent_of_y",
"type": "quantitative",
"format": ".2f"
},
"color": {
"condition": {
"test": "datum.percent_of_y > 0.5",
"value": "white"
},
"value": "black"
}
}
}
]
}
}

31
.dvc/plots/default.json Normal file
View File

@ -0,0 +1,31 @@
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"data": {
"values": "<DVC_METRIC_DATA>"
},
"title": "<DVC_METRIC_TITLE>",
"width": 300,
"height": 300,
"mark": {
"type": "line"
},
"encoding": {
"x": {
"field": "<DVC_METRIC_X>",
"type": "quantitative",
"title": "<DVC_METRIC_X_LABEL>"
},
"y": {
"field": "<DVC_METRIC_Y>",
"type": "quantitative",
"title": "<DVC_METRIC_Y_LABEL>",
"scale": {
"zero": false
}
},
"color": {
"field": "rev",
"type": "nominal"
}
}
}

116
.dvc/plots/linear.json Normal file
View File

@ -0,0 +1,116 @@
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"data": {
"values": "<DVC_METRIC_DATA>"
},
"title": "<DVC_METRIC_TITLE>",
"width": 300,
"height": 300,
"layer": [
{
"encoding": {
"x": {
"field": "<DVC_METRIC_X>",
"type": "quantitative",
"title": "<DVC_METRIC_X_LABEL>"
},
"y": {
"field": "<DVC_METRIC_Y>",
"type": "quantitative",
"title": "<DVC_METRIC_Y_LABEL>",
"scale": {
"zero": false
}
},
"color": {
"field": "rev",
"type": "nominal"
}
},
"layer": [
{
"mark": "line"
},
{
"selection": {
"label": {
"type": "single",
"nearest": true,
"on": "mouseover",
"encodings": [
"x"
],
"empty": "none",
"clear": "mouseout"
}
},
"mark": "point",
"encoding": {
"opacity": {
"condition": {
"selection": "label",
"value": 1
},
"value": 0
}
}
}
]
},
{
"transform": [
{
"filter": {
"selection": "label"
}
}
],
"layer": [
{
"mark": {
"type": "rule",
"color": "gray"
},
"encoding": {
"x": {
"field": "<DVC_METRIC_X>",
"type": "quantitative"
}
}
},
{
"encoding": {
"text": {
"type": "quantitative",
"field": "<DVC_METRIC_Y>"
},
"x": {
"field": "<DVC_METRIC_X>",
"type": "quantitative"
},
"y": {
"field": "<DVC_METRIC_Y>",
"type": "quantitative"
}
},
"layer": [
{
"mark": {
"type": "text",
"align": "left",
"dx": 5,
"dy": -5
},
"encoding": {
"color": {
"type": "nominal",
"field": "rev"
}
}
}
]
}
]
}
]
}

104
.dvc/plots/scatter.json Normal file
View File

@ -0,0 +1,104 @@
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"data": {
"values": "<DVC_METRIC_DATA>"
},
"title": "<DVC_METRIC_TITLE>",
"width": 300,
"height": 300,
"layer": [
{
"encoding": {
"x": {
"field": "<DVC_METRIC_X>",
"type": "quantitative",
"title": "<DVC_METRIC_X_LABEL>"
},
"y": {
"field": "<DVC_METRIC_Y>",
"type": "quantitative",
"title": "<DVC_METRIC_Y_LABEL>",
"scale": {
"zero": false
}
},
"color": {
"field": "rev",
"type": "nominal"
}
},
"layer": [
{
"mark": "point"
},
{
"selection": {
"label": {
"type": "single",
"nearest": true,
"on": "mouseover",
"encodings": [
"x"
],
"empty": "none",
"clear": "mouseout"
}
},
"mark": "point",
"encoding": {
"opacity": {
"condition": {
"selection": "label",
"value": 1
},
"value": 0
}
}
}
]
},
{
"transform": [
{
"filter": {
"selection": "label"
}
}
],
"layer": [
{
"encoding": {
"text": {
"type": "quantitative",
"field": "<DVC_METRIC_Y>"
},
"x": {
"field": "<DVC_METRIC_X>",
"type": "quantitative"
},
"y": {
"field": "<DVC_METRIC_Y>",
"type": "quantitative"
}
},
"layer": [
{
"mark": {
"type": "text",
"align": "left",
"dx": 5,
"dy": -5
},
"encoding": {
"color": {
"type": "nominal",
"field": "rev"
}
}
}
]
}
]
}
]
}

39
.dvc/plots/smooth.json Normal file
View File

@ -0,0 +1,39 @@
{
"$schema": "https://vega.github.io/schema/vega-lite/v4.json",
"data": {
"values": "<DVC_METRIC_DATA>"
},
"title": "<DVC_METRIC_TITLE>",
"mark": {
"type": "line"
},
"encoding": {
"x": {
"field": "<DVC_METRIC_X>",
"type": "quantitative",
"title": "<DVC_METRIC_X_LABEL>"
},
"y": {
"field": "<DVC_METRIC_Y>",
"type": "quantitative",
"title": "<DVC_METRIC_Y_LABEL>",
"scale": {
"zero": false
}
},
"color": {
"field": "rev",
"type": "nominal"
}
},
"transform": [
{
"loess": "<DVC_METRIC_Y>",
"on": "<DVC_METRIC_X>",
"groupby": [
"rev"
],
"bandwidth": 0.3
}
]
}

3
.dvcignore Normal file
View File

@ -0,0 +1,3 @@
# Add patterns of files dvc should ignore, which could improve
# the performance. Learn more at
# https://dvc.org/doc/user-guide/dvcignore

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
/healthcare-dataset-stroke-data.csv

View File

@ -1,11 +1,14 @@
FROM ubuntu:latest FROM ubuntu:20.04
RUN apt-get update && apt-get install -y python3-pip && pip3 install setuptools && pip3 install numpy && pip3 install pandas && pip3 install wget && pip3 install scikit-learn && pip3 install matplotlib && rm -rf /var/lib/apt/lists/* RUN apt-get update && apt-get install -y python3-pip && pip3 install setuptools && pip3 install numpy && pip3 install pandas && pip3 install wget && pip3 install scikit-learn && pip3 install matplotlib && rm -rf /var/lib/apt/lists/*
RUN pip3 install torch torchvision torchaudio RUN pip3 install torch torchvision torchaudio
RUN pip3 install sacred && pip3 install GitPython && pip3 install pymongo RUN pip3 install sacred && pip3 install GitPython && pip3 install pymongo
RUN pip3 install dvc
RUN pip3 install 'dvc[ssh]' paramiko
WORKDIR /app WORKDIR /app
COPY ./create.py ./ COPY ./create.py ./
COPY ./stats.py ./ COPY ./stats.py ./
COPY ./stroke-pytorch.py ./ COPY ./stroke-pytorch.py ./
COPY ./stroke-pytorch-eval.py ./ COPY ./stroke-pytorch-eval.py ./
COPY ./train-dvc.py ./

26
Jenkinsfile-dvc Normal file
View File

@ -0,0 +1,26 @@
pipeline {
agent {
dockerfile true
}
parameters{
buildSelector(
defaultSelector: lastSuccessful(),
description: 'Which build to use for copying artifacts',
name: 'WHICH_BUILD'
)
}
stages {
stage('dvc') {
steps {
withCredentials([sshUserPrivateKey(credentialsId: '48ac7004-216e-4260-abba-1fe5db753e18', keyFileVariable: 'IUM_SFTP_KEY')]) {
copyArtifacts fingerprintArtifacts: true, projectName: 's434766-create-dataset', selector: buildParameter('WHICH_BUILD')
sh 'dvc remote add -f -d ium_ssh_remote ssh://ium-sftp@tzietkiewicz.vm.wmi.amu.edu.pl/ium-sftp'
sh 'dvc remote modify --local ium_ssh_remote keyfile $IUM_SFTP_KEY'
sh "dvc pull -f"
sh "dvc reproduce"
}
}
}
}
}

982
Y_pred.txt Normal file
View File

@ -0,0 +1,982 @@
Y_pred: tensor([[0.4872],
[0.4938],
[0.4877],
[0.4895],
[0.5006],
[0.5167],
[0.4903],
[0.4989],
[0.4862],
[0.4968],
[0.4934],
[0.5040],
[0.4892],
[0.4974],
[0.4890],
[0.4721],
[0.5116],
[0.5110],
[0.4855],
[0.4984],
[0.5017],
[0.5006],
[0.4886],
[0.4913],
[0.4301],
[0.4860],
[0.4787],
[0.4398],
[0.4972],
[0.5086],
[0.4883],
[0.4826],
[0.4974],
[0.5033],
[0.5028],
[0.5021],
[0.4950],
[0.4961],
[0.4947],
[0.4904],
[0.5038],
[0.5164],
[0.5000],
[0.4857],
[0.5055],
[0.5123],
[0.4929],
[0.4955],
[0.5039],
[0.5038],
[0.5066],
[0.4943],
[0.4964],
[0.4909],
[0.4354],
[0.4985],
[0.4993],
[0.4937],
[0.5037],
[0.5025],
[0.4902],
[0.5077],
[0.5038],
[0.4854],
[0.4910],
[0.5031],
[0.4944],
[0.4974],
[0.4846],
[0.5012],
[0.4508],
[0.4872],
[0.4736],
[0.4960],
[0.4873],
[0.4955],
[0.4868],
[0.5062],
[0.5045],
[0.4948],
[0.4632],
[0.4841],
[0.4848],
[0.5015],
[0.5026],
[0.5046],
[0.4894],
[0.5026],
[0.4958],
[0.4698],
[0.4351],
[0.5006],
[0.4992],
[0.5165],
[0.4891],
[0.4919],
[0.4790],
[0.4921],
[0.4319],
[0.4898],
[0.4970],
[0.4979],
[0.4629],
[0.5086],
[0.4978],
[0.5005],
[0.5020],
[0.3989],
[0.4747],
[0.4864],
[0.4721],
[0.4868],
[0.5021],
[0.4906],
[0.5032],
[0.4737],
[0.5086],
[0.4896],
[0.5052],
[0.4956],
[0.4923],
[0.4875],
[0.4935],
[0.4828],
[0.4888],
[0.5130],
[0.5018],
[0.5004],
[0.4897],
[0.4762],
[0.4922],
[0.4976],
[0.4872],
[0.4411],
[0.4908],
[0.4802],
[0.4968],
[0.4756],
[0.5011],
[0.5062],
[0.4966],
[0.5038],
[0.5107],
[0.4988],
[0.4916],
[0.4901],
[0.4996],
[0.3924],
[0.4911],
[0.4887],
[0.4813],
[0.4944],
[0.4993],
[0.5113],
[0.5011],
[0.4351],
[0.4944],
[0.4764],
[0.5010],
[0.4346],
[0.5033],
[0.5041],
[0.4993],
[0.4990],
[0.4131],
[0.4944],
[0.4974],
[0.5033],
[0.4298],
[0.4962],
[0.5045],
[0.5092],
[0.4911],
[0.4825],
[0.4972],
[0.5082],
[0.5002],
[0.5032],
[0.4936],
[0.4906],
[0.4910],
[0.5043],
[0.4834],
[0.5135],
[0.5071],
[0.4916],
[0.4912],
[0.4942],
[0.4891],
[0.4893],
[0.5071],
[0.4944],
[0.4947],
[0.5013],
[0.4990],
[0.4847],
[0.4421],
[0.4944],
[0.4870],
[0.4959],
[0.4900],
[0.4885],
[0.4995],
[0.5012],
[0.5046],
[0.4920],
[0.5066],
[0.5061],
[0.4937],
[0.5096],
[0.5002],
[0.5048],
[0.4965],
[0.4931],
[0.5007],
[0.4974],
[0.4936],
[0.4347],
[0.4920],
[0.4923],
[0.4933],
[0.5055],
[0.5101],
[0.5105],
[0.4882],
[0.4920],
[0.5000],
[0.5063],
[0.5091],
[0.4454],
[0.5023],
[0.4797],
[0.4843],
[0.4631],
[0.5003],
[0.5003],
[0.5123],
[0.5067],
[0.5102],
[0.5025],
[0.4390],
[0.5011],
[0.4910],
[0.4944],
[0.4934],
[0.5062],
[0.4872],
[0.5042],
[0.4882],
[0.4962],
[0.5008],
[0.5036],
[0.5099],
[0.4992],
[0.4408],
[0.4892],
[0.5056],
[0.4999],
[0.4957],
[0.4735],
[0.4477],
[0.5073],
[0.4896],
[0.4925],
[0.4764],
[0.4813],
[0.4879],
[0.4959],
[0.4381],
[0.4815],
[0.5020],
[0.4859],
[0.4770],
[0.4488],
[0.4985],
[0.4804],
[0.4872],
[0.4952],
[0.4930],
[0.5021],
[0.4271],
[0.5039],
[0.4982],
[0.4883],
[0.4766],
[0.5056],
[0.4975],
[0.5068],
[0.5043],
[0.4994],
[0.4992],
[0.4894],
[0.5166],
[0.4983],
[0.5047],
[0.4831],
[0.4886],
[0.5022],
[0.4901],
[0.4905],
[0.4329],
[0.5003],
[0.5014],
[0.5095],
[0.4297],
[0.4918],
[0.4942],
[0.4238],
[0.4922],
[0.4974],
[0.5018],
[0.4532],
[0.4854],
[0.5050],
[0.4988],
[0.4340],
[0.4922],
[0.4533],
[0.4923],
[0.4900],
[0.4823],
[0.4891],
[0.5104],
[0.4910],
[0.4300],
[0.5033],
[0.4773],
[0.5044],
[0.4814],
[0.5039],
[0.5049],
[0.4696],
[0.4952],
[0.5138],
[0.5041],
[0.5091],
[0.5076],
[0.4949],
[0.5079],
[0.4939],
[0.4907],
[0.5048],
[0.4964],
[0.4703],
[0.5064],
[0.4864],
[0.4845],
[0.4940],
[0.4826],
[0.5042],
[0.5127],
[0.5000],
[0.4898],
[0.4375],
[0.5010],
[0.5025],
[0.4911],
[0.4805],
[0.4959],
[0.5036],
[0.5043],
[0.5007],
[0.4946],
[0.5015],
[0.4927],
[0.4880],
[0.4929],
[0.4915],
[0.5050],
[0.4927],
[0.4916],
[0.4354],
[0.4890],
[0.5050],
[0.5043],
[0.4868],
[0.4676],
[0.4903],
[0.5005],
[0.4925],
[0.4997],
[0.4921],
[0.4222],
[0.4876],
[0.5039],
[0.5001],
[0.4909],
[0.4957],
[0.4844],
[0.4976],
[0.5078],
[0.4994],
[0.5084],
[0.4306],
[0.5001],
[0.4990],
[0.4967],
[0.4147],
[0.5024],
[0.4912],
[0.4878],
[0.5004],
[0.5028],
[0.4869],
[0.4869],
[0.4877],
[0.4822],
[0.4962],
[0.4940],
[0.4899],
[0.5031],
[0.4289],
[0.4560],
[0.5159],
[0.5012],
[0.5126],
[0.4717],
[0.5161],
[0.4866],
[0.5133],
[0.4863],
[0.4323],
[0.5007],
[0.4746],
[0.4967],
[0.4946],
[0.5289],
[0.5059],
[0.4881],
[0.4995],
[0.4721],
[0.4892],
[0.5034],
[0.4837],
[0.5018],
[0.5079],
[0.4882],
[0.4932],
[0.5081],
[0.4904],
[0.4843],
[0.4840],
[0.5017],
[0.4841],
[0.4268],
[0.4986],
[0.4455],
[0.5070],
[0.5049],
[0.4907],
[0.4372],
[0.5046],
[0.4870],
[0.5077],
[0.4940],
[0.4403],
[0.4724],
[0.5072],
[0.4974],
[0.5007],
[0.4853],
[0.4860],
[0.4879],
[0.4836],
[0.5113],
[0.4929],
[0.4422],
[0.5051],
[0.4912],
[0.4975],
[0.5136],
[0.4788],
[0.4323],
[0.5086],
[0.4922],
[0.4774],
[0.4936],
[0.5021],
[0.5040],
[0.4588],
[0.4922],
[0.5064],
[0.5094],
[0.4449],
[0.5122],
[0.4799],
[0.4901],
[0.5018],
[0.5057],
[0.4368],
[0.5068],
[0.5033],
[0.5028],
[0.4181],
[0.4981],
[0.5016],
[0.5025],
[0.5029],
[0.4781],
[0.5169],
[0.4894],
[0.4985],
[0.5041],
[0.4280],
[0.4982],
[0.4816],
[0.4992],
[0.4920],
[0.5022],
[0.4816],
[0.4155],
[0.4832],
[0.4871],
[0.4890],
[0.5080],
[0.4976],
[0.4715],
[0.4964],
[0.5002],
[0.5098],
[0.4895],
[0.4945],
[0.4866],
[0.5023],
[0.4996],
[0.4986],
[0.3973],
[0.4973],
[0.4917],
[0.4359],
[0.4851],
[0.5068],
[0.5096],
[0.5158],
[0.4747],
[0.4944],
[0.4895],
[0.4981],
[0.5025],
[0.4934],
[0.4883],
[0.4318],
[0.5038],
[0.4986],
[0.5080],
[0.5017],
[0.4994],
[0.4938],
[0.4934],
[0.4977],
[0.4964],
[0.4811],
[0.4923],
[0.4934],
[0.5129],
[0.4884],
[0.5005],
[0.4948],
[0.5032],
[0.4859],
[0.5026],
[0.5010],
[0.4352],
[0.4961],
[0.4841],
[0.4962],
[0.5039],
[0.4960],
[0.5105],
[0.4847],
[0.5020],
[0.4988],
[0.5035],
[0.5079],
[0.5082],
[0.5040],
[0.5080],
[0.5032],
[0.4964],
[0.5029],
[0.5075],
[0.4823],
[0.4376],
[0.4860],
[0.4895],
[0.4529],
[0.4833],
[0.4829],
[0.4806],
[0.5043],
[0.4871],
[0.4525],
[0.5042],
[0.4944],
[0.5061],
[0.4838],
[0.4919],
[0.5015],
[0.4976],
[0.4845],
[0.5037],
[0.5096],
[0.5092],
[0.4880],
[0.4443],
[0.4981],
[0.5085],
[0.4345],
[0.4922],
[0.4985],
[0.5096],
[0.5132],
[0.5065],
[0.4392],
[0.5009],
[0.5058],
[0.5024],
[0.4976],
[0.5069],
[0.5093],
[0.4930],
[0.5007],
[0.5042],
[0.5106],
[0.5067],
[0.4942],
[0.4819],
[0.5118],
[0.4979],
[0.4909],
[0.4871],
[0.5162],
[0.4853],
[0.5028],
[0.5054],
[0.4965],
[0.4613],
[0.5003],
[0.4972],
[0.4926],
[0.4674],
[0.4823],
[0.4921],
[0.5006],
[0.5120],
[0.5199],
[0.4823],
[0.4952],
[0.4991],
[0.4813],
[0.5008],
[0.4970],
[0.4900],
[0.4938],
[0.5003],
[0.4857],
[0.5097],
[0.4870],
[0.4805],
[0.5014],
[0.5104],
[0.4888],
[0.4962],
[0.4937],
[0.5019],
[0.4898],
[0.4974],
[0.4883],
[0.4923],
[0.4848],
[0.4455],
[0.4912],
[0.4883],
[0.3946],
[0.5029],
[0.5046],
[0.4963],
[0.5134],
[0.4853],
[0.4878],
[0.4923],
[0.5066],
[0.5042],
[0.5015],
[0.4994],
[0.4899],
[0.4792],
[0.5007],
[0.4921],
[0.4980],
[0.5024],
[0.4862],
[0.5094],
[0.5059],
[0.5034],
[0.5040],
[0.4959],
[0.4359],
[0.5027],
[0.4838],
[0.5067],
[0.4297],
[0.5063],
[0.4839],
[0.4974],
[0.5004],
[0.5017],
[0.5001],
[0.4919],
[0.5029],
[0.5161],
[0.4790],
[0.4867],
[0.4855],
[0.4989],
[0.4761],
[0.4454],
[0.5003],
[0.4450],
[0.5030],
[0.4898],
[0.5025],
[0.4732],
[0.4905],
[0.4873],
[0.5018],
[0.4911],
[0.4889],
[0.4849],
[0.4991],
[0.5039],
[0.5045],
[0.5006],
[0.4977],
[0.4841],
[0.4546],
[0.4981],
[0.4954],
[0.4872],
[0.5071],
[0.5047],
[0.4904],
[0.4888],
[0.5050],
[0.5059],
[0.4951],
[0.4909],
[0.4886],
[0.5030],
[0.4437],
[0.4892],
[0.4806],
[0.4658],
[0.4917],
[0.5163],
[0.4978],
[0.4194],
[0.4758],
[0.4859],
[0.4912],
[0.4819],
[0.4305],
[0.5120],
[0.4970],
[0.5056],
[0.4878],
[0.4940],
[0.4867],
[0.5011],
[0.4837],
[0.4969],
[0.4979],
[0.5015],
[0.4923],
[0.4960],
[0.4747],
[0.5041],
[0.4932],
[0.5099],
[0.4632],
[0.4985],
[0.4972],
[0.4820],
[0.4849],
[0.4967],
[0.4986],
[0.5119],
[0.4811],
[0.4966],
[0.4968],
[0.5087],
[0.5105],
[0.4373],
[0.5019],
[0.4962],
[0.5065],
[0.4766],
[0.4925],
[0.4392],
[0.4891],
[0.4982],
[0.4891],
[0.4976],
[0.4903],
[0.4909],
[0.5132],
[0.5038],
[0.5055],
[0.4862],
[0.5037],
[0.4997],
[0.4980],
[0.4971],
[0.4884],
[0.4378],
[0.4870],
[0.4949],
[0.4991],
[0.4886],
[0.5050],
[0.5097],
[0.4987],
[0.5123],
[0.5098],
[0.5071],
[0.5033],
[0.4880],
[0.5004],
[0.5210],
[0.4919],
[0.4993],
[0.4867],
[0.4879],
[0.4740],
[0.4932],
[0.4986],
[0.5082],
[0.4496],
[0.4404],
[0.4900],
[0.4874],
[0.4999],
[0.5004],
[0.4645],
[0.4460],
[0.4914],
[0.4821],
[0.5030],
[0.4741],
[0.4810],
[0.4958],
[0.5058],
[0.5063],
[0.4653],
[0.5024],
[0.5018],
[0.4760],
[0.4912],
[0.5014],
[0.4876],
[0.5042],
[0.4877],
[0.4283],
[0.5024],
[0.4883],
[0.4881],
[0.4925],
[0.5048],
[0.4934],
[0.4206],
[0.4929],
[0.5019],
[0.4972],
[0.4981],
[0.5157],
[0.4935],
[0.5067],
[0.4901],
[0.5002],
[0.4497],
[0.4983],
[0.4365],
[0.4791],
[0.4962],
[0.4764],
[0.4692],
[0.4826],
[0.4771],
[0.5020],
[0.5032],
[0.4891],
[0.4974],
[0.4965],
[0.4890],
[0.5011],
[0.4928],
[0.4996],
[0.4761],
[0.4941],
[0.4861],
[0.4993],
[0.4928],
[0.4972],
[0.4926],
[0.5023],
[0.5020],
[0.4945],
[0.4872],
[0.5054],
[0.4970],
[0.5066],
[0.5125],
[0.4384],
[0.4860],
[0.4864],
[0.4434],
[0.5045],
[0.4907],
[0.4956],
[0.5060],
[0.4958],
[0.4968],
[0.4959],
[0.4996],
[0.4906],
[0.4782],
[0.5001],
[0.4416],
[0.5139],
[0.5059],
[0.5049],
[0.5051],
[0.4932],
[0.4943],
[0.4803],
[0.4954],
[0.5076],
[0.5052],
[0.4973],
[0.5015],
[0.4621],
[0.4859],
[0.4907],
[0.5013],
[0.4128],
[0.5062],
[0.4383],
[0.5157],
[0.4771],
[0.4864],
[0.5069],
[0.5040],
[0.5051],
[0.5032],
[0.5010],
[0.4858],
[0.4966],
[0.4887],
[0.4948],
[0.4991],
[0.4954],
[0.4732],
[0.4883],
[0.4954],
[0.4775],
[0.4760],
[0.4915],
[0.4932],
[0.4852],
[0.4955],
[0.4788],
[0.4908],
[0.5184],
[0.4984],
[0.4843],
[0.5047],
[0.4831],
[0.4982],
[0.4781],
[0.4960],
[0.4760],
[0.4909]])

View File

@ -39,7 +39,7 @@ def saveToCSV(data1,data2,data3):
downloadCSV() # downloadCSV()
data = dropNaN() data = dropNaN()
data = NormalizeData(data) data = NormalizeData(data)

19
dvc.yaml Normal file
View File

@ -0,0 +1,19 @@
stages:
download_and_split:
cmd: python3 create.py
deps:
- healthcare-dataset-stroke-data.csv
- create.py
outs:
- data_train.csv
- data_test.csv
- data_val.csv
train_model:
cmd: python3 train-dvc.py
deps:
- data_train.csv
- data_test.csv
- data_val.csv
- train-dvc.py
outs:
- Y_pred.txt

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,4 @@
outs:
- md5: 3f25a4c2f2963d969e1a156c08968577
size: 316971
path: healthcare-dataset-stroke-data.csv

View File

@ -10,13 +10,12 @@
"name": "python", "name": "python",
"nbconvert_exporter": "python", "nbconvert_exporter": "python",
"pygments_lexer": "ipython3", "pygments_lexer": "ipython3",
"version": "3.8.5-final" "version": "3.8.5"
}, },
"orig_nbformat": 2, "orig_nbformat": 2,
"kernelspec": { "kernelspec": {
"name": "python3", "name": "python385jvsc74a57bd02cef13873963874fd5439bd04a135498d1dd9725d9d90f40de0b76178a8e03b1",
"display_name": "Python 3", "display_name": "Python 3.8.5 64-bit ('base': conda)"
"language": "python"
} }
}, },
"nbformat": 4, "nbformat": 4,
@ -24,7 +23,7 @@
"cells": [ "cells": [
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 31, "execution_count": 1,
"metadata": {}, "metadata": {},
"outputs": [ "outputs": [
{ {
@ -84,7 +83,7 @@
" print(data.describe(include='all'))\n", " print(data.describe(include='all'))\n",
"\n", "\n",
"\n", "\n",
"downloadCSV()\n", "# downloadCSV()\n",
"data = dropNaN()\n", "data = dropNaN()\n",
"data = NormalizeData(data)\n", "data = NormalizeData(data)\n",
"\n", "\n",
@ -95,6 +94,27 @@
"\n" "\n"
] ]
}, },
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/plain": [
"array(['private', 'self_employed', 'govt_job', 'children', 'never_worked'],\n",
" dtype=object)"
]
},
"metadata": {},
"execution_count": 6
}
],
"source": [
"pd.unique(data['work_type'])"
]
},
{ {
"cell_type": "code", "cell_type": "code",
"execution_count": 27, "execution_count": 27,

View File

@ -0,0 +1,15 @@
artifact_uri: file:///home/przemek/ium_434766/mlruns/0/119a232b4f5b4792afb6fbda18d95262/artifacts
end_time: 1622122401430
entry_point_name: ''
experiment_id: '0'
lifecycle_stage: active
name: ''
run_id: 119a232b4f5b4792afb6fbda18d95262
run_uuid: 119a232b4f5b4792afb6fbda18d95262
source_name: ''
source_type: 4
source_version: ''
start_time: 1622122401247
status: 3
tags: []
user_id: owcap

View File

@ -0,0 +1 @@
1622122401410 0.12816519 0

View File

@ -0,0 +1 @@
0.46289125084877014

View File

@ -0,0 +1 @@
16

View File

@ -0,0 +1 @@
5

View File

@ -0,0 +1 @@
d4912c0bdcc4ecba96dfd2b643b5e816d51c6bda

View File

@ -0,0 +1 @@
.\lab8-mlflow.py

View File

@ -0,0 +1 @@
LOCAL

View File

@ -0,0 +1 @@
owcap

75
train-dvc.py Normal file
View File

@ -0,0 +1,75 @@
import torch
import sys
import torch.nn.functional as F
from torch import nn
from torch.autograd import Variable
import torchvision.transforms as transforms
from sklearn.model_selection import train_test_split
from sklearn.preprocessing import MinMaxScaler
from sklearn.metrics import accuracy_score
import numpy as np
import pandas as pd
from sacred import Experiment
from sacred.observers import FileStorageObserver
np.set_printoptions(suppress=False)
class LogisticRegressionModel(nn.Module):
def __init__(self, input_dim, output_dim):
super(LogisticRegressionModel, self).__init__()
self.linear = nn.Linear(input_dim, output_dim)
self.sigmoid = nn.Sigmoid()
def forward(self, x):
out = self.linear(x)
return self.sigmoid(out)
data_train = pd.read_csv("data_train.csv")
data_test = pd.read_csv("data_test.csv")
data_val = pd.read_csv("data_val.csv")
FEATURES = ['age','hypertension','heart_disease','ever_married', 'avg_glucose_level', 'bmi']
x_train = data_train[FEATURES].astype(np.float32)
y_train = data_train['stroke'].astype(np.float32)
x_test = data_test[FEATURES].astype(np.float32)
y_test = data_test['stroke'].astype(np.float32)
fTrain = torch.from_numpy(x_train.values)
tTrain = torch.from_numpy(y_train.values.reshape(2945,1))
fTest= torch.from_numpy(x_test.values)
tTest = torch.from_numpy(y_test.values)
batch_size = int(sys.argv[1]) if len(sys.argv) > 1 else 16
num_epochs = int(sys.argv[2]) if len(sys.argv) > 2 else 5
learning_rate = 0.001
input_dim = 6
output_dim = 1
model = LogisticRegressionModel(input_dim, output_dim)
criterion = torch.nn.BCELoss(reduction='mean')
optimizer = torch.optim.SGD(model.parameters(), lr = learning_rate)
for epoch in range(num_epochs):
# print ("Epoch #",epoch)
model.train()
optimizer.zero_grad()
# Forward pass
y_pred = model(fTrain)
# Compute Loss
loss = criterion(y_pred, tTrain)
# print(loss.item())
# Backward pass
loss.backward()
optimizer.step()
y_pred = model(fTest)
# print("predicted Y value: ", y_pred.data)
txt_file = open("Y_pred.txt", "w")
n = txt_file.write(f"Y_pred: { y_pred.data}")
txt_file.close()
# torch.save(model.state_dict(), 'stroke.pth')