diff --git a/src/main/java/org/wlld/recommend/RecommendCodeManager.java b/src/main/java/org/wlld/recommend/RecommendCodeManager.java index 2647092..45a3310 100644 --- a/src/main/java/org/wlld/recommend/RecommendCodeManager.java +++ b/src/main/java/org/wlld/recommend/RecommendCodeManager.java @@ -8,17 +8,16 @@ import org.wlld.rnnNerveCenter.NerveManager; import org.wlld.rnnNerveEntity.SensoryNerve; import org.wlld.tools.IdCreator; -import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.concurrent.locks.ReentrantReadWriteLock; public class RecommendCodeManager {//推荐id管理 - private NerveManager nerveManager; - private double studyTh; - private int dim; - private ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); + private final NerveManager nerveManager; + private final double studyTh; + private final int dim; + private final ReentrantReadWriteLock lock = new ReentrantReadWriteLock(); public RecommendCodeManager(boolean initPower, RecommendConfig recommendConfig) throws Exception { studyTh = recommendConfig.getStudyTh(); diff --git a/src/main/java/org/wlld/rnnJumpNerveCenter/NerveJumpManager.java b/src/main/java/org/wlld/rnnJumpNerveCenter/NerveJumpManager.java index a3ab343..5f9f1a2 100644 --- a/src/main/java/org/wlld/rnnJumpNerveCenter/NerveJumpManager.java +++ b/src/main/java/org/wlld/rnnJumpNerveCenter/NerveJumpManager.java @@ -275,13 +275,14 @@ public class NerveJumpManager { * @param hiddenDepth 隐层深度 * @param activeFunction 激活函数 * @param isDynamic 是否是动态神经元 + * @param studyPoint 学习率 * @param rzType 正则函数 * @param lParam 正则系数 * @throws Exception 如果参数错误则抛异常 */ public NerveJumpManager(int sensoryNerveNub, int hiddenNerveNub, int outNerveNub , int hiddenDepth, ActiveFunction activeFunction, boolean isDynamic, - double studyPoint, int rzType, double lParam) throws Exception { + double studyPoint, int rzType, double lParam) throws Exception { if (sensoryNerveNub > 0 && hiddenNerveNub > 0 && outNerveNub > 0 && hiddenDepth > 0 && activeFunction != null) { this.hiddenNerveNub = hiddenNerveNub; this.sensoryNerveNub = sensoryNerveNub; @@ -384,7 +385,14 @@ public class NerveJumpManager { } rnnOutNerveBodies.add(rnnOutNerveBody); } - + /** + * 初始化残差Rnn神经元(跳层)参数 + * + * @param initPower 是否是首次进行训练 + * @param isShowLog 是否打印续写过程中的参数 + * @param toSoftMax 是否增加softMax输出层 + * @throws Exception 如果参数错误则抛异常 + */ public void initRnn(boolean initPower, boolean isShowLog, boolean toSoftMax) throws Exception { isRnn = true; initDepthNerve(false, 0, 0);//初始化深度隐层神经元 diff --git a/src/main/java/org/wlld/rnnJumpNerveEntity/SensoryNerve.java b/src/main/java/org/wlld/rnnJumpNerveEntity/SensoryNerve.java index 4543f32..34ea5d4 100644 --- a/src/main/java/org/wlld/rnnJumpNerveEntity/SensoryNerve.java +++ b/src/main/java/org/wlld/rnnJumpNerveEntity/SensoryNerve.java @@ -23,11 +23,14 @@ public class SensoryNerve extends Nerve { } /** - * @param eventId 唯一的事件id - * @param parameter 输入点的数据 - * @param isStudy 是否是学习 (学习状态没有输出) - * @param E 标注 - * @param outBack 回调结果 + * @param eventId 唯一的事件id(每个用户线程一个id用来处理线程安全) + * @param parameter 该输入层的输入参数 + * @param isStudy 是否是学习 (学习状态没有输出) + * @param E 标注 + * @param outBack 回调结果 + * @param isEmbedding 是否获取word2Vec返回结果(单独为词向量嵌入兼容,若无需则传false) + * @param rnnMatrix rnn参数矩阵,矩阵中每一行是每一层的特征向量 + * @param storeys 记录跳层路径的数组,即在rnn中经过的层数,若不在此路径集合内则跳跃 */ public void postMessage(long eventId, double parameter, boolean isStudy, Map E , OutBack outBack, boolean isEmbedding, Matrix rnnMatrix, int[] storeys) throws Exception {//感知神经元输出