Applications of Machine Learning for private cloud operations
We continue listing some more scenarios from yesterday's post.
Find the median of two sorted arrays
int median (List<int> first)
{
int n = first.count;
assert(n> 0);
if (n %2 == 0)
return (first[n/2-1] + first[n/2])/2
else
return first[n/2];
}
int GetMedian(List<int> first, List<int> second)
{
int p = first.count;
int q = second.count;
if ( p == 0) return median(second);
if (q == 0) return median(first);
if (p == 1 && q == 1) return (first[0]+second[0])/2;
int m1 = median(first);
int m2 = median(second);
if ( m1 == m2) return m1;
if (m1 < m2)
{
if (p%2==0)
return GetMedian(first.Range(p/2-1, p/2+1), second);
return GetMedian(first.Range(p/2, p/2), second);
}
if (q%2==0)
return GetMedian(first, second.Range(q/2-1,q/2+1));
return GetMedian(first, second.Range(q/2,q/2));
}
We continue listing some more scenarios from yesterday's post.
Use case 4) Optimization
Users may want the portal to search for the lowest cost set of resources when there are many choices for their solution when there are many different solutions. Optimization finds the best solution to a problem by trying many different solutions and scoring them to determine their quality.
First we propose a cost function to determine the costs for different sets of resources. Then we use hill climbing or simulated annealing to reduce the cost
Use case 5) Document Filtering
This is about training a classifier to classify documents that are published as resource usages and logs. The classifiers start off very uncertain and increase in certainty as it learns which features are important for making a distinction. By classifying the documents, we expect to find resources that require attention either immediate or in the near future.
This will require a training set as well as a test set. The training set will be used to tune the classifier and the classifier will then be run on the test sample. If the features are independent of each other they can be used in a naiive Bayes classifier.
Use Case 6) Find which customers will likely pay for premium access.
In order to predict the likelihood that a user will become a paying customer, we collect information and put it in say a table with the attributes that we pick from server logs, such as location, read FAQ, pages viewed, and whether a premium service was chosen.
Then we use decision trees to construct a tree from real data that is easy to understand where each node tells how important it is and how it will impact the outcome.
Use case 7) Building price models for premium customers.
We can build models that predict prices. We can price something manually and then by finding the items that are similar to the item that interests the customer, the algorithm can average their prices and make a guess at what the price should be for this item.
#codingexercise
Write your own pow(x,n)
int pow(int x, int n)
{
if (n == 0) return 1;
if (n%2 == 0)
return pow(x,n/2) * pow(x,n/2);
else
return x*pow(x,n/2) * pow(x,n/2);
}Find the median of two sorted arrays
int median (List<int> first)
{
int n = first.count;
assert(n> 0);
if (n %2 == 0)
return (first[n/2-1] + first[n/2])/2
else
return first[n/2];
}
int GetMedian(List<int> first, List<int> second)
{
int p = first.count;
int q = second.count;
if ( p == 0) return median(second);
if (q == 0) return median(first);
if (p == 1 && q == 1) return (first[0]+second[0])/2;
int m1 = median(first);
int m2 = median(second);
if ( m1 == m2) return m1;
if (m1 < m2)
{
if (p%2==0)
return GetMedian(first.Range(p/2-1, p/2+1), second);
return GetMedian(first.Range(p/2, p/2), second);
}
if (q%2==0)
return GetMedian(first, second.Range(q/2-1,q/2+1));
return GetMedian(first, second.Range(q/2,q/2));
}
No comments:
Post a Comment