Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added OperatorsExample.class
Binary file not shown.
Binary file added build/classes/AbstractModel.class
Binary file not shown.
Binary file added build/classes/Boosting.class
Binary file not shown.
Binary file added build/classes/Dao.class
Binary file not shown.
Binary file added build/classes/Daoimplementetation.class
Binary file not shown.
Binary file added build/classes/LogisticRegression.class
Binary file not shown.
Binary file added build/classes/ModelSelectionHibernateEntity.class
Binary file not shown.
Binary file added build/classes/NaiveBayes.class
Binary file not shown.
Binary file added build/classes/NormalKernel.class
Binary file not shown.
Binary file added build/classes/ReviewHibernateEntity.class
Binary file not shown.
Binary file added build/classes/SwingModel.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file modified build/classes/ru/caf82/lectures/lecture02/StringProcessing.class
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion nbproject/private/private.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
compile.on.save=true
user.properties.file=/home/ilysko/.netbeans/8.2/build.properties
user.properties.file=C:\\Users\\\u041d\u0430\u0442\u0430\u0448\u0430\\AppData\\Roaming\\NetBeans\\8.2\\build.properties
4 changes: 1 addition & 3 deletions nbproject/private/private.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
<project-private xmlns="http://www.netbeans.org/ns/project-private/1">
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group>
<file>file:/home/ilysko/Desktop/WorkLearn/Coding/Java/JavaTeachingInMiphyaga/TextClassifierProject/src/ru/caf82/lectures/lecture02/StringProcessing.java</file>
</group>
<group/>
</open-files>
</project-private>
15 changes: 15 additions & 0 deletions src/result/src/main/java/ru/caf82/result/Others/Dao.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package result.src.main.java.ru.caf82.result.Others;

/*
* 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.
*/

/**
*
* @author Наташа
*/
public interface Dao {

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package result.src.main.java.ru.caf82.result.Others;

/*
* 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.
*/

/**
*
* @author Наташа
*/
public class Daoimplementetation {

}
47 changes: 47 additions & 0 deletions src/result/src/main/java/ru/caf82/result/Others/MathService.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* 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 result.src.main.java.ru.caf82.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 result=1/(1+Math.exp(-x));
return result;
}
public static double sigmoid2(double[] x, double[] w){
return sigmoid(dotProduct(x, w));
}
public static double[][] NormalizationMatrix(double[][] x) {
for (int j = 0; j<x.length; j++){
double result = 0 ;
for (int i = 0; i<x[j].length; i++){
result += x[j][i];
}
result /= x[j].length;
double dis = 0;
for (int t = 0; t<x[j].length; t++){
int b=2;
dis += Math.pow(x[j][t]-result, b);
}
dis /= (x[j].length-1);
for (int s = 0; s<x[j].length; s++){
x[j][s] = (x[j][s]-result)/Math.sqrt(dis);
}
}
return x;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
package result.src.main.java.ru.caf82.result.Others;

/*
* 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.
*/

/**
*
* @author Наташа
*/
public class ModelSelectionHibernateEntity {

}
171 changes: 171 additions & 0 deletions src/result/src/main/java/ru/caf82/result/Others/MyOwnArrayList.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
/*
* 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 result.src.main.java.ru.caf82.result.Others;

import java.lang.reflect.Array;

/**
*
* @author Наташа
* @param <T>
*/
public class MyOwnArrayList<T> {
private T[] T;
private int capacity;
private int size;
private Class<?> inCl;

public MyOwnArrayList(){
capacity = 10;
size = 0;
}
public MyOwnArrayList(int capa) {
capacity = capa;
size = 0;
}

/**
*
* @param inCl
* @param capa
*/
public MyOwnArrayList(Class<?> inClass, int capa) {
capacity = capa;
size = 0;
inCl = inClass;
}



public void ensureCapacity() {
if (capacity < size + 1) {
T[] oldArray = (T[])Array.newInstance(inCl, size);
capacity = (capacity*3)/2+1;
T[] elementData = (T[])Array.newInstance(inCl, capacity);
System.arraycopy(oldArray, 0, elementData, 0, size);
}
else System.out.println("Место есть");
}

public void ensureCapacity(int index, T value) {
if (capacity < size + 1) {
T[] oldArray;
oldArray = (T[])Array.newInstance(inCl.getClass(), size);
capacity = (capacity*3)/2+1;
T[] elementData = (T[]) new Object[capacity];
System.arraycopy(elementData, index, elementData, index + 1, size - index);
elementData[index] = value;
size++;
}
}

/**
*
* @param value
*/

public void add(T value) {
if (inCl==null) {
inCl = value.getClass();
}
else
if (inCl != value.getClass()) {
System.out.println("Типы данных отличаются, работать не могу");
}
else System.out.println("Всё ОК");
ensureCapacity();
T[] oldArray = (T[])Array.newInstance(inCl, size);
oldArray = T;
/*T[] elementData = (T[])Array.newInstance(inCl, capacity);
System.arraycopy(oldArray, 0, elementData, 0, size);*/
T = (T[])Array.newInstance(inCl, capacity);

//System.arraycopy(oldArray, 0, T, 0, size+1);
for (int i = 0; i<size; i++)
T[i] = oldArray[i];
size++;
T[size-1] = value;


}
public void printArray () {
for (int i=0; i<size; i++)
System.out.println(T[i]);
}
public void add(T value, int index) {
if (inCl == null) {
inCl = value.getClass();
}
else
if (inCl.getClass() == value.getClass()) {
System.out.println("Типы данных отличаются, работать не могу");
}
else System.out.println("Всё ОК");
ensureCapacity(index, value);

}


public int indexOf (T value){
int ind = -1;
for (int i = 0; i<size; i++) {
if (T[i] == value) {
ind = i;
}
else System.out.println("Этот элемент не равен");
}
System.out.println("Нет этого элемента в массиве, если вернулось -1");
return ind;
}
public boolean contains(T value) {
for (int i = 0; i<size; i++) {
if (T[i] == value) {
return true;
}
else System.out.println("Не равен, к сожалению");
}
return false;
}

public void set(T value, int index) {
T[index] = value;
}
public void remove(int index) {
int scop = size - index -1;
System.arraycopy(T, index + 1, T, index, scop);
T[--size] = null;
}
public void remove(T value) {
for (int i = 0; i<size; i++) {
if (T[i] == value) {
int scop = size - i -1;
System.arraycopy(T, i + 1, T, i, scop);
T[--size] = null;
}
else System.out.println("Не судьба");
}
}
public void clear(T[] prelest){
for (int i = 0; i<size; i++) {
prelest[i] = null;
}
size = 0;
capacity = 0;
}

public static void main (String[] args) {
MyOwnArrayList prelest = new MyOwnArrayList();
prelest.add("hugh");
prelest.add("vi");
prelest.add("jifj");
prelest.add("jbhi");
prelest.printArray();
prelest.add("yugy");
prelest.printArray();
prelest.remove(1);
prelest.printArray();
}
}
Loading