Azure ML - Train a model on segments of the data-set - machine-learning

I could really use some help!
The company I work for is made up of 52 very different businesses so I can't predict at the company level but instead need to predict business by business then roll up the result to give company wide prediction.
I have written an ML model in studio.azureml.net
It works great with a 0.947 Coefficient of Determination, but this is for 1 of the businesses.
I now need to train the model for the other 51.
Is there a way to do this in a single ML model rather than having to create 52 very similar models?
Any help would be much appreciated !!!
Kind Regards
Martin

You can use Ensembles, combining several models to improve predictions. The most direct is stacking when the outputs of all the models are trained on the entire dataset.
The method that, I think, corresponds the best to your problem is bagging (bootstrap aggregation). You need to divide the training set into different subsets (each corresponding to a certain business), then train a different model on each subset and combine the result of each classifier.
Another way is boosting but it is difficult to implement in Azure ML.
You can see an example in Azure ML Gallery.
Quote from book:
Stacking and bagging can be easily implemented in Azure Machine
Learning, but other ensemble methods are more difficult. Also, it
turns out to be very tedious to implement in Azure Machine Learning an
ensemble of, say, more than five models. The experiment is filled with
modules and is quite difficult to maintain. Sometimes it is worthwhile
to use any ensemble method available in R or Python. Adding more
models to an ensemble written in a script can be as trivial as
changing a number in the code, instead of copying and pasting modules
into the experiment.
You may also have a look at sklearn (Python) and caret (R) documentation for further details.

Related

How to adjust feature importance in Azure AutoML

I am hoping to have some low code model using Azure AutoML, which is really just going to the AutoML tab, running a classification experiment with my dataset, after it's done, I deploy the best selected model.
The model kinda works (meaning, I publish the endpoint and then I do some manual validation, seems accurate), however, I am not confident enough, because when I am looking at the explanation, I can see something like this:
4 top features are not really closely important. The most "important" one is really not the one I prefer it to use. I am hoping it will use the Title feature more.
Is there such a thing I can adjust the importance of individual features, like ranking all features before it starts the experiment?
I would love to do more reading, but I only found this:
Increase feature importance
The only answer seems to be about how to measure if a feature is important.
Hence, does it mean, if I want to customize the experiment, such as selecting which features to "focus", I should learn how to use the "designer" part in Azure ML? Or is it something I can't do, even with the designer. I guess my confusion is, with ML being such a big topic, I am looking for a direction of learning, in this case of what I am having, so I can improve my current model.
Here is link to the document for feature customization.
Using the SDK you can specify "feauturization": 'auto' / 'off' / 'FeaturizationConfig' in your AutoMLConfig object. Learn more about enabling featurization.
Automated ML tries out different ML models that have different settings which control for overfitting. Automated ML will pick which overfitting parameter configuration is best based on the best score (e.g. accuracy) it gets from hold-out data. The kind of overfitting settings these models has includes:
Explicitly penalizing overly-complex models in the loss function that the ML model is optimizing
Limiting model complexity before training, for example by limiting the size of trees in an ensemble tree learning model (e.g. gradient boosting trees or random forest)
https://learn.microsoft.com/en-us/azure/machine-learning/concept-manage-ml-pitfalls

transfer Learning in regression for similar domain but different distr

I am currently working on a KDD project aiming to build a predictor with very small real world data.
The goal is to predict to predict the quantity Y of an instance of an Product while knowing other quantities of this instance.
There are Predictors (same Task) trained on similar (not the same) products. Those Models are valid for their use-case.
My approach is to use large datasets of other products (similar domain, similar task but different distributions) and adapt those to the target domain using transfer Learning.
At this pint I am having trouble finding methods/algorithms fitting my needs.
Looking at the decision tree 1 it should be a domain adaption problem.
What algorithm or Model is suited for this kind of usecase?
You can try the Deep Domain Adaptation Regression method, as shown in the paper "Representation Subspace Distance for Domain Adaptation Regression" published in ICML 2021. Using the labeled source domain and unlabeled target domain to learn a model performing well on target domain.
Awesome Domain Adaptation Python Toolbox (ADAPT) is an open source library providing access to numerous models and algorithms to perform transfer learning and domain adaptation: https://adapt-python.github.io/adapt/index.html.

Transfer Learning for small datasets of structured data

I am looking to implement machine learning for a problems that are built on small data sets related to approvals of expenses in a specific supply chain domain. Typically labelled data is unavailable
I was looking to build models in one data set that I have labelled data and then use that model developed in similar contexts- where the feature set is very similar, but not identical. The expectation is that this allows the starting point for recommendations and gather labelled data in the new context.
I understand this is the essence of Transfer Learning. Most of the examples I read in this domain speak of image data sets- any guidance how this can be leveraged in small data sets using standard tree-based classification algorithms
I can’t really speak to tree-based algos, I don’t know how to do transfer learning with them. But, for deep learning models, the customary method for transfer learning is to load up a pretrained model, then retrain the last layer of the dataset using your new data, and then fine-tune the rest of the network.
If you don’t have much data to go on, you might look into creating synthetic data.
raghu, I believe you are looking for a kernel method when you are saying abstraction layer in deep learning. There are several ML algorithms that support kernel functions. With kernel functions, you might be able to do it; but using kernel functions might be more complex than solving your original problem. I would lean toward Tdoggo's suggestion of using Decision Tree.
Sorry, I want to add a comment, but they won't allow me, so I posted a new answer.
Ok with tree-based algos you can do just what you said: train the tree on one dataset and apply it to another similar dataset. All you would need to do is change the terms/nodes on the second tree.
For instance, let’s say you have a decision tree trained for filtering expenses for a construction company. You will outright deny any reimbursements for workboots, because workers should provide those themselves.
You want to use the trained tree on your accounting firm, and so instead of workboots, you change that term to laptops, because accountants should be buying their own.
Does that make sense, and is that helpful to you?
After some research, we have decided to proceed with random forest models with the intuition that trees in the original model that have common features will form the starting point for decisions.
As we gain more labelled data in the new context, we will start replacing the original trees with new trees that comprise of (a)only new features and (b) combination of old and new features
This has worked to provide reasonable results in initial trials

Explaining how exactly Machine learning determine the result

Is it possible to somehow reverse the process or based on the model explain how ML model predicted the result?
Example: A bank uses ML for determining the interest rate of a loan for each person. How can I identify based on what data the ML decided the interest rate? For example the ML might discriminate someone (based on wrong data used in training), is there a way to find the problem, find how exactly the ML decided in each case?
This depends on the ML model you are using. Some models tend to be more complicated than others to understand.
The easiest rule-based model that explains the selection rules is a decision tree. You can use Weka for example to create such a tree and later view the branches that lead to each decision.

Optimizing Keyword Weights for a Web Crawler

I'm playing around with writing a web crawler that scans for a specific set of keywords and then assigns a global score to each domain it encounters based on a cumulative score I assigned to each keyword (programming=1, clojure=2, javascript=-1, etc...).
I have set up my keyword scoring on a sliding scale of -10 to 10 and I have based my initial values on my own assumptions about what is and is not relevant.
I feel that my scoring model may be flawed, and I would prefer to feed a list of domains that match the criteria I'm trying to capture into an analysis tool and optimize my keyword weights based on some kind of statistical analysis.
What would be an appropriate analysis technique to generate an optimal scoring model for a list of "known good domains"? Is this problem suited for bayesian learning, monte carlo simulation, or some other technique?
So, given a training set of relevant and irrelevant domains, you'd like to build a model which classifies new domains to one of these categories. I assume the features you will be using are the terms appearing in the domains, i.e. this is can be framed as a document classification problem.
Generally, you are correct in assuming that letting statistical-based machine learning algorithms to do the "scoring" for you works better than assigning manual scores to keywords.
A simple way to approach the problem would be to using Bayesian learning, and specifically, Naive Bayes might be a good fit.
After generating a dataset from the domains you've manually tagged (e.g. collecting several pages from each domain and treating each as a document), you can experiment various algorithms using one of the machine learning frameworks, e.g. WEKA.
A primer on how to handle and load text documents to WEKA can be found here. After the data is loaded, you can use the framework to experiment with various classification algorithms, e.g. Naive Bayes, SVM, etc. Once you've found the method best fitting your needs, you can export the resulting model and use it via WEKA's Java API.

Resources