xlearn
xlearn copied to clipboard
There is a question about how to load fm parameters in other develop language? such as java
I have got fm model parameters after I use setTXTModel in python. I want to use this parameters in java by fm model . But XLearn default set option instance-wise normalization. so I must instance-wise my data in java. so my question is how to instance-wise my data in java or I must set option --no-norm ?
@payne4handsome xLearn can save the TXT model to disk file, and users can use any programming language to load the TXT data and use it in any way.
@aksnzhy No, you not understand me. If I train a model with setting option instance-wise normalization(default), so online application must normalize the input. Though I can use model parameters by TXT model in java, but I don't know how to normalize the input in java . Do you know what I mean? I have tested it. I can get right result when I train model with option --no-norm in python and then use model parameters in java by Txt model. On the contrary, get wrong result .
@payne4handsome I see. This is a problem. For now, I think the only way to solve this problem is to implement instance-wise normal in Java.
For instance-wise normal, given the following example:
0:0.1 1:0.2 3:0.3 4:0.5
The norm is equal to:
norm = sqrt(0.1*0.1 + 0.2*0.2 + 0.3*0.3 + 0.4*0.4)
Then we normalize the input data:
0:0.1/norm 1:0.2/norm 2:0.3/norm 4:0.5/norm
@aksnzhy oh, thanks. I did as you said. I got a right result in java. I think I got a mistake. I think instance-wise normal mentioned in official document is just like Min-max normalization or 0-score standardization.
- Min-max normalization
- 0-score standardization
So, I have two other questions.
- If I have the following example: 0:0.1 1:1 3:100 4:1000 5:1000000 Before training model used XLearn, should I normalize the input data like Min-max normalization or 0-score standardization, If Xlearn not help us do , I think we should.
- why use instance-wise normal that you mentioned by answered my last question. you say "this technique is very useful" in your document. Can you offer some reference material about instance-wise normal to prove it is very useful?
Thanks for your replying.
@aksnzhy norm = sqrt(0.10.1 + 0.20.2 + 0.30.3 + 0.40.4)
when norm is zero, the model does not work correctly, it print out nan