From ab12552707dd8086a8c5fe27ac1845fc2af6510f Mon Sep 17 00:00:00 2001 From: Viktoriaaaa <31597543+Viktoriaaaa@users.noreply.github.com> Date: Sun, 1 Oct 2017 23:06:11 +0300 Subject: [PATCH] dfg --- Boosting.java | 14 ++++++++ Dao.java | 14 ++++++++ DaoImplementation.java | 14 ++++++++ EmptyArrayException.java | 43 ++++++++++++++++++++++ FileReader.java | 14 ++++++++ FileWorker.java | 14 ++++++++ FileWriter.java | 14 ++++++++ InconveninentShapeException.java | 44 +++++++++++++++++++++++ KNeighbourhood.java | 14 ++++++++ LinearKernel.java | 14 ++++++++ LogisticRegression.java | 14 ++++++++ MathService.java | 58 ++++++++++++++++++++++++++++++ Model.java | 14 ++++++++ ModelSelectionHibernateEntity.java | 14 ++++++++ NaiveBayes.java | 14 ++++++++ NormalKernel.java | 14 ++++++++ ReviewHibernateEntity.java | 14 ++++++++ SwingModel.java | 14 ++++++++ SwingTraining.java | 14 ++++++++ 19 files changed, 369 insertions(+) create mode 100644 Boosting.java create mode 100644 Dao.java create mode 100644 DaoImplementation.java create mode 100644 EmptyArrayException.java create mode 100644 FileReader.java create mode 100644 FileWorker.java create mode 100644 FileWriter.java create mode 100644 InconveninentShapeException.java create mode 100644 KNeighbourhood.java create mode 100644 LinearKernel.java create mode 100644 LogisticRegression.java create mode 100644 MathService.java create mode 100644 Model.java create mode 100644 ModelSelectionHibernateEntity.java create mode 100644 NaiveBayes.java create mode 100644 NormalKernel.java create mode 100644 ReviewHibernateEntity.java create mode 100644 SwingModel.java create mode 100644 SwingTraining.java diff --git a/Boosting.java b/Boosting.java new file mode 100644 index 0000000..48c6907 --- /dev/null +++ b/Boosting.java @@ -0,0 +1,14 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package ru.caf82.result.machinelearning.models; + +/** + * + * @author Вика + */ + class Boosting extends Model{ + +} diff --git a/Dao.java b/Dao.java new file mode 100644 index 0000000..515d9b3 --- /dev/null +++ b/Dao.java @@ -0,0 +1,14 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package ru.caf82.result.others; + +/** + * + * @author Вика + */ +public interface Dao { + +} diff --git a/DaoImplementation.java b/DaoImplementation.java new file mode 100644 index 0000000..0f06f07 --- /dev/null +++ b/DaoImplementation.java @@ -0,0 +1,14 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package ru.caf82.result.others; + +/** + * + * @author Вика + */ +public class DaoImplementation { + +} diff --git a/EmptyArrayException.java b/EmptyArrayException.java new file mode 100644 index 0000000..b7ddc1b --- /dev/null +++ b/EmptyArrayException.java @@ -0,0 +1,43 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package src.result.exceptions; + +/** + * + * @author Вика + */ +public class EmptyArrayException extends Exception{ + public EmptyArrayException(){ + super(); + } +public EmptyArrayException(String message){ + super(message); +} +public EmptyArrayException(String message, Throwable cause){ +super(message, cause); +} +public EmptyArrayException(Throwable cause){ +super(cause); +} + public static void dotProduct(double[] a, double[] b) throws EmptyArrayException{ + + if ((b.length == 0) || (a.length == 0) ) { + throw new EmptyArrayException("Нулевые массивы"); + } + } + public static void main(String[] args) { + double[] a = {}; + double[] b = {1}; + EmptyArrayException sed = new EmptyArrayException(); + try { sed.dotProduct(a,b); + + + } catch(EmptyArrayException e){ + System.out.println("Мы поймали ошибку!"); + } + +} +} \ No newline at end of file diff --git a/FileReader.java b/FileReader.java new file mode 100644 index 0000000..2ca60c2 --- /dev/null +++ b/FileReader.java @@ -0,0 +1,14 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package ru.caf82.result.workwithfiles; + +/** + * + * @author Вика + */ +public interface FileReader extends FileWorker { + +} diff --git a/FileWorker.java b/FileWorker.java new file mode 100644 index 0000000..6a83f66 --- /dev/null +++ b/FileWorker.java @@ -0,0 +1,14 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package ru.caf82.result.workwithfiles; + +/** + * + * @author Вика + */ +public interface FileWorker { + +} diff --git a/FileWriter.java b/FileWriter.java new file mode 100644 index 0000000..280409e --- /dev/null +++ b/FileWriter.java @@ -0,0 +1,14 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package ru.caf82.result.workwithfiles; + +/** + * + * @author Вика + */ +public interface FileWriter extends FileWorker{ + +} diff --git a/InconveninentShapeException.java b/InconveninentShapeException.java new file mode 100644 index 0000000..f932c66 --- /dev/null +++ b/InconveninentShapeException.java @@ -0,0 +1,44 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package src.result.exceptions; + +/** + * + * @author Вика + */ + class InconveninentShapeException extends Exception{ + public InconveninentShapeException(){ + super(); + } +public InconveninentShapeException(String message){ + super(message); +} +public InconveninentShapeException(String message, Throwable cause){ +super(message, cause); +} +public InconveninentShapeException(Throwable cause){ +super(cause); +} + + public static void dotProduct(double[] a, double[] b) throws InconveninentShapeException{ + if (a.length != b.length) { + throw new InconveninentShapeException("Разные размеры массивов"); + } + } + public static void main(String[] args) { + double[] a = {1, 2, 3, 4}; + double[] b = {1, 1, 1, 1, 2}; + InconveninentShapeException sed = new InconveninentShapeException(); + try { sed.dotProduct(a,b); + + + } catch(InconveninentShapeException e){ + System.out.println("Мы поймали ошибку!"); + } + + } + } + \ No newline at end of file diff --git a/KNeighbourhood.java b/KNeighbourhood.java new file mode 100644 index 0000000..f8062ab --- /dev/null +++ b/KNeighbourhood.java @@ -0,0 +1,14 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package ru.caf82.result.machinelearning.models; + +/** + * + * @author Вика + */ + class KNeighbourhood extends Model{ + +} diff --git a/LinearKernel.java b/LinearKernel.java new file mode 100644 index 0000000..4e90177 --- /dev/null +++ b/LinearKernel.java @@ -0,0 +1,14 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package ru.caf82.result.machinelearning.models; + +/** + * + * @author Вика + */ +class LinearKernel extends KNeighbourhood{ + +} diff --git a/LogisticRegression.java b/LogisticRegression.java new file mode 100644 index 0000000..9a7bdf3 --- /dev/null +++ b/LogisticRegression.java @@ -0,0 +1,14 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package ru.caf82.result.machinelearning.models; + +/** + * + * @author Вика + */ + class LogisticRegression extends Model{ + +} diff --git a/MathService.java b/MathService.java new file mode 100644 index 0000000..5006cec --- /dev/null +++ b/MathService.java @@ -0,0 +1,58 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package src.result.others; + +/** + * + * @author Вика + */ +public class MathService { + public static double dotProduct(double[] a, double[] b){ + double result = 0; + for (int i = 0; i < a.length; i++) { + result += a[i]*b[i]; + } + + + return result; + } + + +public static double sigmoid(double x){ + + double d = Math.exp(-x); + + double result = 1/(1+d); + + return result; +} +public static double sigmoid(double[] p, double[] w){ + double k = 0; + for (int i = 0; i < p.length; i++) { + k += p[i]*w[i]; + } + double f = Math.exp(-k); + + double result = 1/(1+f); + + return result; +} + +public static void main(String[] args) { + double x = 2; + double[] a = {1, 2, 3, 4}; + double[] b = {1, 1, 1, 1}; +double[] p = {1, 1, 1, 1}; + double[] w = {1, 1, 1, 1}; + +System.out.println(MathService.dotProduct(a,b)); +System.out.println(MathService.sigmoid(x)); +System.out.println(MathService.sigmoid(p,w)); +} + +} + + diff --git a/Model.java b/Model.java new file mode 100644 index 0000000..a1b4bf4 --- /dev/null +++ b/Model.java @@ -0,0 +1,14 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package ru.caf82.result.machinelearning.models; + +/** + * + * @author Вика + */ +abstract class Model { + +} diff --git a/ModelSelectionHibernateEntity.java b/ModelSelectionHibernateEntity.java new file mode 100644 index 0000000..ecd8efb --- /dev/null +++ b/ModelSelectionHibernateEntity.java @@ -0,0 +1,14 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package ru.caf82.result.others; + +/** + * + * @author Вика + */ +public class ModelSelectionHibernateEntity { + +} diff --git a/NaiveBayes.java b/NaiveBayes.java new file mode 100644 index 0000000..c31300e --- /dev/null +++ b/NaiveBayes.java @@ -0,0 +1,14 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package ru.caf82.result.machinelearning.models; + +/** + * + * @author Вика + */ +class NaiveBayes extends Model{ + +} diff --git a/NormalKernel.java b/NormalKernel.java new file mode 100644 index 0000000..ba30726 --- /dev/null +++ b/NormalKernel.java @@ -0,0 +1,14 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package ru.caf82.result.machinelearning.models; + +/** + * + * @author Вика + */ + class NormalKernel extends KNeighbourhood{ + +} diff --git a/ReviewHibernateEntity.java b/ReviewHibernateEntity.java new file mode 100644 index 0000000..95a4de0 --- /dev/null +++ b/ReviewHibernateEntity.java @@ -0,0 +1,14 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package ru.caf82.result.others; + +/** + * + * @author Вика + */ +public class ReviewHibernateEntity { + +} diff --git a/SwingModel.java b/SwingModel.java new file mode 100644 index 0000000..2416739 --- /dev/null +++ b/SwingModel.java @@ -0,0 +1,14 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package ru.caf82.result.others; + +/** + * + * @author Вика + */ +public class SwingModel { + +} diff --git a/SwingTraining.java b/SwingTraining.java new file mode 100644 index 0000000..f33a1c8 --- /dev/null +++ b/SwingTraining.java @@ -0,0 +1,14 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package ru.caf82.result.others; + +/** + * + * @author Вика + */ +public class SwingTraining { + +}