-
Notifications
You must be signed in to change notification settings - Fork 0
/
UILinkedLearningSchedule.java
41 lines (37 loc) · 1.37 KB
/
UILinkedLearningSchedule.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
package org.deeplearning4j.examples.wip.javafxui;
import org.nd4j.linalg.schedule.ISchedule;
import java.io.Serializable;
import java.text.NumberFormat;
/**
* @author Donald A. Smith ([email protected])
*
* The logic for updating the public static double learningRate is in the linked class TrainingListenerWithUI
*/
public class UILinkedLearningSchedule implements ISchedule, Serializable, Cloneable {
private static UILinkedLearningSchedule instance = new UILinkedLearningSchedule();
public static double learningRate = 0.001;
private static final NumberFormat numberFormat = NumberFormat.getInstance();
private final String name;
static {
numberFormat.setMaximumFractionDigits(7);
}
private UILinkedLearningSchedule() {
String name= this.toString();
int index=name.indexOf('@');
this.name = name.substring(index+1, name.length());
System.out.println("Calling constructor of MusicLearningSchedule, yielding " + name);
}
public static UILinkedLearningSchedule getInstance(double learningRate) {
UILinkedLearningSchedule.learningRate = learningRate;
return instance;
}
@Override
public double valueAt(int iteration, int epoch) {
return learningRate;
}
@Override
public ISchedule clone() {
System.out.println("Calling clone");
return this;
}
}