How to build a model from scratch in FastAI.jl - julia

I would like to define my own model in FastAI.jl rather than use one of the pre-trained ones (of which it looks like there is only one or two available per the source code). I was reading through the docs and it seems to reference a pre-trained resent model everywhere a model is required and I don't see a section about defining my own models. Is it possible to do this in FastAI.jl and if so, how?

Related

Can I update the spacy's Entity Linking knowledge base after training?

Let's suppose I have successfully trained an Entity Linking model, and it is working just fine. But, eventually, I'm going to update some aliases of the knowledge base. Just some aliases not the description nor new entities.
I know that spacy has a method to do so which is: kb.add_alias(alias="Emerson", entities=qids, probabilities=probs). But, what if I have to do that after the training process? Should I re-run everything, or updating the KB will do?
Best thing is to try it and see.
If you're just adding new aliases, it really depends on how much they overlap with existing aliases. If there's no overlap it won't make any difference, but if there is overlap that could have resulted in different evaluations in training, which could modify the model. Whether those differences are significant or not is hard to say.

Using spaCy for finetuning a NER model in spaCy 3.0

I want to use en_core_web_trf model in spaCy library for Named entity recognition. However, the guide for training a custom model does not contain information for finetuning a pretrained model.
How can one finetune an NER model in spaCy v3.0?
It's recommended you train your NER component from scratch rather than fine-tuning the existing model, because fine-tuning the existing model is prone to catastrophic forgetting. Note that even if your NER component is trained from scratch, you're still using the Transformer as a starting point, so you aren't starting from nothing.
More details about why not to re-train the existing NER, and how to do it if you want to, are in the FAQ. There are also many threads about this topic in the Discussion in general.

reusable holdout in mlr

How can someone change the cross validation or holdout procedures in mlr so that before testing with the validation set, that same validation set is changed according to a procedure, namely the reusable holdout procedure?
Procedure:
http://insilico.utulsa.edu/wp-content/uploads/2016/10/Dwork_2015_Science.pdf
Short answer: mlr doesn't support that.
Long answer: My experience with differential privacy for machine learning is that in practice it doesn't work as well as advertised. In particular, to apply thresholdout you need a) copious amounts of data and b) the a priori probability that a given classifier will overfit on the given data -- something you can't easily determine in practice. While the paper you reference comes with example code that shows that thresholdout works in this particular case, but the amount of noise added in the code looks like it was determined on an ad-hoc basis; the relationship to the thresholdout algorithm described in the paper isn't clear.
Before differential privacy can be robustly applied in practice in scenarios like that, mlr won't support it.

Best practice in converting from 0.X: variable trees

Is there a recommended best practice in converting variable trees from 0.X to 1.X? My intuition is to make variable trees into components, but I'm curious what the OpenMDAO team thinks.
we moved away from variable trees. Instead we just name the variables hierarchically like "top:sub:subsub:x, top:sub:subsub:y"
Kilojoules,
I too was really upset with the elimination of variable trees; but, I was much more upset with how they failed to integrate with openmdao components and failed silently. Good riddance.
I have been experimenting with numpy.ndarray as a replacement for variable trees. See the Sellar example for details. Creating multi-dimensional ndarray with field names seems to work well for a name-referenced data structure. To create multidimensionality seems to require nesting of declarations which is similar to variable tree branches.
Note that the numpy.array (sic) is not compatible with openmdao, but numpy.ndarray (sic) works well since ndarray is a "structured" array object with size, shape, data type, etc specified in an internal dictionary. Better than variable trees, the multi-dimensional ndarray provides multiple "views" of the same relationships with one (massive) global declaration which can be instantiated as a param within a component. Populating the ndarray instance is made by field name-referenced assignment instead of some iteration. It is more complicated to declare as ALL the information about the structured array must be provided to work within openmdao. Also, numpy.ndarray is for rigidly fixed array sizes and relationships, just like variable trees.
I am not advocating this concept for every application, but do take a look for your situation.
Silvia

Transforming h2o model into non-h2o one

I know that there is possibility to export/import h2o model, that was previously trained.
My question is - is there a way to transform h2o model to a non-h2o one (that just works in plain R)?
I mean that I don't want to launch the h2o environment (JVM) since I know that predicting on trained model is simply multiplying matrices, applying activation function etc.
Of course it would be possible to extract weights manually etc., but I want to know if there is any better way to do it.
I do not see any previous posts on SA about this problem.
No.
Remember that R is just the client, sending API calls: the algorithms (those matrix multiplications, etc.) are all implemented in Java.
What they do offer is a POJO, which is what you are asking for, but in Java. (POJO stands for Plain Old Java Object.) If you call h2o.download_pojo() on one of your models you will see it is quite straightforward. It may even be possible to write a script to convert it to R code? (Though it might be better, if you were going to go to that trouble, to convert it to C++ code, and then use Rcpp!)
Your other option is to export the weights and biases, in the case of deep learning, implement your own activation function, and use them directly.
But, personally, I've never found the Java side to be a bottleneck, either from the point of view of dev ops (install is easy) or computation (the Java code is well optimized).

Resources