Saving trained neural nets in csv or txt format

hello guys,
i wanna save my trained neural ntes in csv or txt format and i don’t know how,
can someone help me please
and thank you

What exactly do you mean? Do you want to save your weights as a CSV?

A model saved by DL4J is a zip file. It contains the configuration of the model as well as the weights and anything else you’ve decided to save there like normalizer stats.

Saving all this in a single text based file doesn’t make sense.

If you just want to save the weights this way, you can get them from the model with model.params() and write them with Nd4j.writeTxt.

1 Like

thank you so much for your help,
and i wanna know if there is any link that can help with SVM in DL4J,
and thank you

DL4J doesn’t implement any SVM algorithms, what exactly are you trying to do?

1 Like

i am trying to build an ai system for fabric defaults detection

I meant what you are trying to do with DL4J and SVM’s. How you imaginge that working together.

i have my neural nets trained, but i wanna have more accurate decision, so i thought if i could add a classification method like SVM or KNN, that will give us an accurate decision

In that case, you can try using your neural network as a feature extractor, and get the layer before the output layer and feed that into an SVM.

thank you so much, but if you have an exemple to get an idea that will be great

Sorry, I don’t have an example that shows exactly that use.

There is a small example of using the DL4J transfer learning API for feature extraction in the documentation. So you can start from there.
Once you transformed your input data that way, you can try using that transformed data as an input to your SVM. How exactly that will look like will depend on the library that you’ve chosen for it.

1 Like

thank you so so much for your help i am really grateful, but what do you mean " will depend on the library that you’ve chosen for it "

It means that I can’t really help you with any thing that goes beyond what we support with DL4J directly.

so i have to forget about this method and what about KNN

It would be essentially the same setup: You use your NN as a feature extractor and then in a separate step you feed that data to a KNN.

However, I really doubt that you will actually get better performance that way. KNN is only really useful if you’ve got lots of unlabeled data, but you know that it is going to cluster in K clusters.

SVMs are linear classifiers, so using them with an NN as a feature extractor is pretty close to what you’d get by essentially using the NN as the kernel method for your SVM.

1 Like

Thank you so much for your help i am so grateful

but does DL4J implement any other classification method

Deeplearning4J implements only neural networks for classification.

1 Like

Thank you so much for all your help