This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
from collections import namedtuple | |
# Create a random dataset | |
rng = np.random.RandomState(42) | |
N_points = 100 | |
X = np.sort(5 * rng.rand(N_points, 1), axis=0) | |
y = np.sin(X).ravel() | |
y += .4 * (0.5 - rng.rand(N_points)) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
# Create a random dataset | |
rng = np.random.RandomState(1) | |
X = np.sort(5 * rng.rand(80, 1), axis=0) | |
y = np.sin(X).ravel() | |
y += .2 * (0.5 - rng.rand(80)) | |
# Fit regression model | |
from sklearn.tree import DecisionTreeRegressor |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> | |
body { | |
font: 10px sans-serif; | |
} | |
.axis path, | |
.axis line { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<meta charset="utf-8"> | |
<style> | |
body { | |
font: 10px sans-serif; | |
} | |
.axis path, | |
.axis line { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
class Timer: | |
def __init__(self, string=None): | |
self.string = string | |
def __enter__(self): | |
self.t1 = datetime.datetime.now() | |
def __exit__(self, exc_type, exc_value, traceback): |
NewerOlder