Commit 94450d62 authored by Fabrizio Detassis's avatar Fabrizio Detassis
Browse files

Merge branch 'master' of https://gitsvn-nt.oru.se/uwe.kockemann/moving-targets

# Conflicts:
#	aiddl-project/python/moving_target/moving_target_abc.py
parents bb41dd1d 19a26f4c
temp/
__pycache__/
.ipynb_checkpoints/
*~
#*#
.#*
......
FROM python:3.8-slim-buster
WORKDIR /moving-target
COPY requirements.txt requirements.txt
EXPOSE 8888
# RUN pip3 install --upgrade pip
RUN pip3 install -r requirements.txt
RUN pip3 install jupyter
COPY . /moving-target
RUN apt-get -y update
RUN apt-get -y install git curl
RUN curl https://download.java.net/openjdk/jdk12/ri/openjdk-12+32_linux-x64_bin.tar.gz --output java.tar.gz
RUN tar xvf java.tar.gz
ENV PYTHONPATH="/moving-target/AIDDL/core/python/src:/moving-target/AIDDL/network/python"
ENV AIDDL_PATH="/moving-target/AIDDL/core/aiddl:/moving-target/AIDDL/common/aiddl"
ENV JAVA_HOME="/moving-target/jdk-12"
RUN git clone https://github.com/uwe-koeckemann/AIDDL.git && cd AIDDL && git checkout develop
RUN cd AIDDL/core/java/ && ./gradlew publishToMavenLocal
RUN cd AIDDL/common/java/ && ./gradlew publishToMavenLoca
RUN cd AIDDL/network/java/ && ./gradlew publishToMavenLocal
RUN jupyter trust ./jupyter/Regression_Example.ipynb
CMD ["./start.sh"]
\ No newline at end of file
#+TITLE: AI Integration Languages: A Case Study in Constraint Machine Learning
To build the container open a terminal in this folder and run:
#+begin_src
docker build -t moving-target-aiddl .
#+end_src
Then, to run the container:
#+begin_src
docker run --rm --publish=8888:8888 moving-target-aiddl:latest
#+end_src
A local link to the jupyter notebook will appear in the console. Open the link
in a browser and select a notebook to try it. For now there is a single notebook
running linear regression through AIDDL.
This diff is collapsed.
from _typeshed import NoneType
from abc import ABC, abstractmethod
from re import A
from aiddl_core.representation.list import List
# from aiddl_core.representation.symbolic import Symbolic
from aiddl_core.representation.symbolic import Symbolic
from aiddl_core.representation.tuple import Tuple
class MovingTarget(ABC):
......@@ -32,6 +36,12 @@ class MovingTarget(ABC):
self.m_beta(M, L, y_k, beta)
z_k = self.solve_ext(M)
ml_problem = self.assemble_ml_problem(args, z_k)
y_k = self.ML.apply(z_k)
@abstractmethod
def set_loss_function(self, M, lf):
"""Symbolic term (or tuple in case of parameters) to loss function."""
d_k = (d[0], z_k)
y_k = self.ML.apply(d_k)
......@@ -58,3 +68,26 @@ class MovingTarget(ABC):
@abstractmethod
def initialize_ext(self, d):
"""Initialize external solver and return blank model."""
def assemble_ml_problem(self, current, y_k):
"""Insert current label vector into machine learning problem."""
label = current[Symbolic('label')]
attributes = current[Symbolic['attributes']]
data = current[Symbolic['data']]
label_idx = None
for i in range(len(attributes)):
if A[i][0] == label:
label_idx = i
break
new_data = []
for i in range(len(data)):
row = []
for j in range(len(data[i])):
if j == label_idx:
row.append(y_k[i])
else:
row.appenddata[i][j]
new_data.append(Tuple(row))
new_data = List(new_data)
problem = current.put(Symbolic('data'), new_data)
return problem
grpcio==1.37.0
grpcio-tools==1.37.0
matplotlib==3.4.1
numpy==1.20.2
#!/bin/bash
cd AIDDL/network/test/java/
./gradlew run &
cd ../../../../jupyter
jupyter notebook --port=8888 --no-browser --ip=0.0.0.0 --allow-root
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