mardi 31 mai 2016

Machine learning, Threading, design pattern recommendation [on hold]

I am creating a project that uses a few machine learning algorithms. More to the point I'm working with a data set where I plan to run several algorithms on it, let's call each run a job.

After a job runs with some measuring functions I will evaluate the result. Also since at one point I would like to write a simple gui for this project where pushing a simple RUN button I will be able to run all my algorithms at once and present my result in this gui. Here each algorithm probably should run on his own thread.

To sum it up I need to design a system where I can start several tests in the same time. ( As far as I'm concerned it's not a problem if they don't finish in the same time ).

I'm fairly new to design patterns and I'm not sure what solution is the best in this situation.

I did check out a few patterns and I have a feeling I should be using the Builder design pattern, but I'm not sure how to implement the multi threading functionality in to it. And also I'm not sure that I used the Builder pattern correctly. I'm working in Java.

Simplistic example of my system with two interfaces:

public interface Tester{
public MyAlgorithm  runTest();
public void evaluateTest();
}

    public interface MyAlgorithm{
    public void implementAlgorithm();
    }

    public class Algorithm_1 implements MyAlgorithm(){
    @Override
    public void implementAlgorithm(){// implementation of algorithm nr. 1
    }

    public class Test1 implements Tester{
    @Override
    public MyAlgorithm runTest(){ return new Algorithm_1();}
    @Override
    public void evaluateTest(){//test evaluation code will be same for all alg.
    }
    }

Am I on the right track? Also how could I implement multi threaeding in this design?

Aucun commentaire:

Enregistrer un commentaire