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

Merge branch 'master' of

# Conflicts:
#	aiddl-project/python/moving_target/
parents bb41dd1d 19a26f4c
FROM python:3.8-slim-buster
WORKDIR /moving-target
COPY requirements.txt requirements.txt
# 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 --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 && 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 ["./"]
\ 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:
docker build -t moving-target-aiddl .
Then, to run the container:
docker run --rm --publish=8888:8888 moving-target-aiddl:latest
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)
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):
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
new_data = []
for i in range(len(data)):
row = []
for j in range(len(data[i])):
if j == label_idx:
new_data = List(new_data)
problem = current.put(Symbolic('data'), new_data)
return problem
cd AIDDL/network/test/java/
./gradlew run &
cd ../../../../jupyter
jupyter notebook --port=8888 --no-browser --ip= --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