Commit eef06caf authored by ymir's avatar ymir

manage training session

parent b22cd06b
##### APPLICATION #####
[service]
host = yggdrasil
port = 5001
host = localhost
port = 5000
#host = yggdrasil
#port = 5001
endpoint = neuralnetwork/trainer
......@@ -75,28 +75,28 @@ echo ${TRAININGSET_ID}
TRAININGSESSION_ARCHIVE=/tmp/trainingsession.gz
-> randomize
rm ${TRAININGSESSION_ARCHIVE}
python3 neuralnetworktrainercli.py randomize trainingsession -i ${PERCEPTRON_ID} -t ${TRAININGSET_ID} -z 2 -s 5 -r 0 -c "randomized training session" -a ${TRAININGSESSION_ARCHIVE}
python3 neuralnetworktrainercli.py randomize trainingsession -i ${PERCEPTRON_ID} -t ${TRAININGSET_ID} -z 1 -s 4 -r 0 -c "randomized training session" -a ${TRAININGSESSION_ARCHIVE}
ls -lh ${TRAININGSESSION_ARCHIVE}
-> create
TRAININGSESSION_ID=`python3 neuralnetworktrainercli.py create trainingsession -i ${PERCEPTRON_ID} -a ${TRAININGSESSION_ARCHIVE}`
echo ${TRAININGSESSION_ID}
python3 neuralnetworktrainercli.py create trainingsession -i ${PERCEPTRON_ID} -a ${TRAININGSESSION_ARCHIVE}
-> read single
rm ${TRAININGSESSION_ARCHIVE}
python3 neuralnetworktrainercli.py read trainingsession -i ${TRAININGSESSION_ID} -a ${TRAININGSESSION_ARCHIVE}
python3 neuralnetworktrainercli.py read trainingsession -i ${PERCEPTRON_ID} -a ${TRAININGSESSION_ARCHIVE}
ls -lh ${TRAININGSESSION_ARCHIVE}
-> update
python3 neuralnetworktrainercli.py update trainingsession -i ${TRAININGSESSION_ID} -a ${TRAININGSESSION_ARCHIVE}
python3 neuralnetworktrainercli.py update trainingsession -i ${PERCEPTRON_ID} -a ${TRAININGSESSION_ARCHIVE}
-> patch
python3 neuralnetworktrainercli.py patch trainingsession -i ${TRAININGSESSION_ID} -c "patched trainingsession"
python3 neuralnetworktrainercli.py patch trainingsession -i ${PERCEPTRON_ID} -z 2 -s 5 -c "patched trainingsession"
-> summarize
python3 neuralnetworktrainercli.py summarize trainingsession -i ${TRAININGSESSION_ID}
python3 neuralnetworktrainercli.py summarize trainingsession -i ${PERCEPTRON_ID}
-> delete single
python3 neuralnetworktrainercli.py delete trainingsession -i ${TRAININGSESSION_ID}
python3 neuralnetworktrainercli.py delete trainingsession -i ${PERCEPTRON_ID}
-> read all
for i in {0..7}
do
python3 neuralnetworktrainercli.py randomize trainingsession -d 1 1 -a ${TRAININGSESSION_ARCHIVE}
python3 neuralnetworktrainercli.py create trainingsession -a ${TRAININGSESSION_ARCHIVE}
PERCEPTRON_ID=`python3 neuralnetworktrainercli.py create perceptron -a ${PERCEPTRON_ARCHIVE}`
python3 neuralnetworktrainercli.py randomize trainingsession -i ${PERCEPTRON_ID} -t ${TRAININGSET_ID} -z 1 -s 4 -r 0 -c "randomized training session" -a ${TRAININGSESSION_ARCHIVE}
python3 neuralnetworktrainercli.py create trainingsession -i ${PERCEPTRON_ID} -a ${TRAININGSESSION_ARCHIVE}
done
python3 neuralnetworktrainercli.py read trainingsession
-> delete all
......
......@@ -183,12 +183,11 @@ def randomizeTrainingsession(id,trainingSetId,trainingChunkSize,saveInterval,tes
dumpArchive(archive, response.content)
pass
# create
def createTrainingsession(archive):
URL=baseURL+"/perceptron/trainingsession"
def createTrainingsession(id,archive):
URL=baseURL+"/perceptron/"+str(id)+"/trainingsession"
data=loadArchive(archive)
response = post(URL, data=data, headers=ContentType.GZIP.value)
checkresponse(response)
print(response.text)
pass
# read single
def readSingleTrainingsession(id,archive):
......@@ -212,10 +211,10 @@ def updateTrainingsession(id,archive):
checkresponse(response)
pass
# patch
def patchTrainingsession(id,comments):
def patchTrainingsession(id,trainingChunkSize,saveInterval,comments):
URL=baseURL+"/perceptron/"+str(id)+"/trainingsession"
data=dumps({"comments":comments})
response = patch(URL, data=data, headers=ContentType.GZIP.value)
data=dumps({"trainingChunkSize":trainingChunkSize,"saveInterval":saveInterval,"comments":comments})
response = patch(URL, data=data, headers=ContentType.JSON.value)
checkresponse(response)
pass
# summarize
......@@ -277,7 +276,7 @@ def dispatchRequest(arguments):
elif arguments.action.upper()=="DELETE" and arguments.resource.upper()=="TRAININGSET": deleteAllTrainingSet()
# ***** TRAINING SESSION *****
# randomize
if arguments.action.upper()=="RANDOMIZE" and arguments.resource.upper()=="TRAININGSESSION": randomizeTrainingsession(arguments.id,arguments.training_set_id,arguments.training_chunk_size,arguments.save_interval,arguments.test_ratio,arguments.comments,arguments.archive)
elif arguments.action.upper()=="RANDOMIZE" and arguments.resource.upper()=="TRAININGSESSION": randomizeTrainingsession(arguments.id,arguments.training_set_id,arguments.training_chunk_size,arguments.save_interval,arguments.test_ratio,arguments.comments,arguments.archive)
# create
elif arguments.action.upper()=="CREATE" and arguments.resource.upper()=="TRAININGSESSION": createTrainingsession(arguments.id,arguments.archive)
# read single
......@@ -287,7 +286,7 @@ def dispatchRequest(arguments):
# update
elif arguments.action.upper()=="UPDATE" and arguments.resource.upper()=="TRAININGSESSION": updateTrainingsession(arguments.id,arguments.archive)
# patch
elif arguments.action.upper()=="PATCH" and arguments.resource.upper()=="TRAININGSESSION": patchTrainingsession(arguments.id,arguments.comments)
elif arguments.action.upper()=="PATCH" and arguments.resource.upper()=="TRAININGSESSION": patchTrainingsession(arguments.id,arguments.training_chunk_size,arguments.save_interval,arguments.comments)
# summarize
elif arguments.action.upper()=="SUMMARIZE" and arguments.resource.upper()=="TRAININGSESSION": summarizeTrainingsession(arguments.id)
# delete single
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment