<p>Yes, once you've trained a model you'll have the details of that model in your workspace.</p>

<p>e.g.</p>

<pre><code>B_Naive = naiveBayes(train_set[,-c(1)],train_set[,1]);
</code></pre>

<p>Will give you an object B_naive that can be 'exported'. These are the parameters of the model, you'll still need the naïve bayes library (or whichever library).</p>

CC BY-SA 4.0
2019-03-25T14:56:14.520Z
2019-03-25T14:56:14.520Z
Lio Elbammalf
<p>If the 'algorithm' you're talking about is a neural network, then you can distribute the learned parameters/weights to anyone who wants to use it. This is how neural nets are normally 'exported': without all of the training data used to create them. Actually, this is done with many kinds of models (<a href="https://en.wikipedia.org/wiki/Parametric_family" rel="nofollow noreferrer">parameterized ones</a>). </p>

<p>In order to 'decode' the model, users would only have to know its structure. In the case of a neural network, they'd need to know the size of each layer, what activation functions were used, etc. </p>

<p>This is not possible with every type of ML model, however. Specifically, <a href="https://en.wikipedia.org/wiki/Nonparametric_statistics" rel="nofollow noreferrer">non-parametric models</a> and 'lazy' models make use of training data at inference time. They wouldn't be useful without their training data. Classifying an input by finding its <a href="https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm" rel="nofollow noreferrer">k nearest neighbors</a>, for example, would require having the training data.</p>

CC BY-SA 4.0
2019-03-25T16:46:53.723Z
2019-03-25T16:46:53.723Z
Philip Raeisghasem
<p>From what I know, AI/ML uses a large amount of data to train an algorithm to solve problems. But since it’s an algorithm, I was wondering if it's possible to export it. If I trained an AI with R, could I export a mathematical algorithm that could be imported by other users to use in their application, whether it’s written in R or another language?</p>

<p>So it’s like I’ve discovered a secret message decoding method. I don’t need to share the whole program for others to decode it. I just need to tell them the steps (algorithm) to decode it, and they can implement it in whatever application they want. </p>

<machine-learning><training>
Can I export a trained machine learning model so that others case use it?
Andrew.Wolphoe
# Can I export a trained machine learning model so that others case use it?

(Asked by: username_0 on 2019-03-25)

From what I know, AI/ML uses a large amount of data to train an algorithm to solve problems. But since it’s an algorithm, I was wondering if it's possible to export it. If I trained an AI with R, could I export a mathematical algorithm that could be imported by other users to use in their application, whether it’s written in R or another language?

So it’s like I’ve discovered a secret message decoding method. I don’t need to share the whole program for others to decode it. I just need to tell them the steps (algorithm) to decode it, and they can implement it in whatever application they want.

**Tags:** machine-learning, training


---

## 2 answers

### Answer by username_2 on 2019-03-25. Score: 2 | Accepted answer

If the 'algorithm' you're talking about is a neural network, then you can distribute the learned parameters/weights to anyone who wants to use it. This is how neural nets are normally 'exported': without all of the training data used to create them. Actually, this is done with many kinds of models ([parameterized ones](https://en.wikipedia.org/wiki/Parametric_family)).

In order to 'decode' the model, users would only have to know its structure. In the case of a neural network, they'd need to know the size of each layer, what activation functions were used, etc.

This is not possible with every type of ML model, however. Specifically, [non-parametric models](https://en.wikipedia.org/wiki/Nonparametric_statistics) and 'lazy' models make use of training data at inference time. They wouldn't be useful without their training data. Classifying an input by finding its [k nearest neighbors](https://en.wikipedia.org/wiki/K-nearest_neighbors_algorithm), for example, would require having the training data.


---

### Answer by username_1 on 2019-03-25. Score: 0

Yes, once you've trained a model you'll have the details of that model in your workspace.
e.g.
B_Naive = naiveBayes(train_set[,-c(1)],train_set[,1]);

Will give you an object B_naive that can be 'exported'. These are the parameters of the model, you'll still need the naïve bayes library (or whichever library).


---

