Github user takuti commented on a diff in the pull request:
https://github.com/apache/incubator-hivemall/pull/149#discussion_r191149655
--- Diff: core/src/main/java/hivemall/fm/FactorizationMachineUDTF.java ---
@@ -352,9 +352,13 @@ private static void writeBuffer(@Nonnull ByteBuffer
srcBuf, @Nonnull NioStateful
srcBuf.clear();
}
+ protected void checkInputVector(@Nonnull final Feature[] x) throws
HiveException {
+ _model.check(x);
+ }
+
public void train(@Nonnull final Feature[] x, final double y,
final boolean adaptiveRegularization) throws HiveException {
- _model.check(x);
+ checkInputVector(x);
try {
if (adaptiveRegularization) {
--- End diff --
Well...the difference is only 3 lines:
```java
if (_adaptiveRegularization) {
trainLambda(x, y); // adaptive regularization
}
```
Since FFM explicitly inherits FM code and shares many options, I just tried
to remove duplicated codes between them as much as possible. Both FM and FFM
use some training samples for validation in the same manner; the code should
clearly show the fact.
Alternative idea is like this: 5fbcc017e9557a10275811888437afdf6c4a0ad7
---