I need to analysis and build predicting program that can predict how long to replace N servers node.
Input Training:
- Data of "p027.txt" show below:
Minutes Units23 1
29 2
49 3
64 4
74 4
87 5
96 6
97 6
109 7
119 8
149 9
145 9
154 10
166 10
Example Input test:
2
40
8
10
Example Output:
Predicting minutes for units
35
622
128
159
Visualization about Model:
### Code:import graphlab# if not csv format, need specify delimitersf = graphlab.SFrame.read_csv('http://www.ats.ucla.edu/stat/examples/chp/p027.txt',delimiter='\t')graphlab.canvas.set_target('ipynb')sf.show(view="Scatter Plot", x="Minutes", y="Units")
Finally, what i need: SFrame - Python
Resources you will need:
- Graphlab library
- SFrame library
Example Code:
import graphlab
sf = graphlab.SFrame.read_csv('http://www.ats.ucla.edu/stat/examples/chp/p027.txt',delimiter='\t')
my_features1 = ["Units"]
my_features_model = graphlab.linear_regression.create(sf,target='Minutes',features=my_features1,validation_set=None)
repair_time = {
'Units':10
}
print my_features_model.predict(repair_time)
Finish. Classify the problem to become linear regression single value. It's my simple way to solve.