コード例 #1
0
def plot_cost_function_over_iterations(x_data, function):
    graph = Plot(x_values=x_data,
                 function=function,
                 title="Cost Function Over Iterations",
                 x_label="Iterations",
                 y_label="J (θ0, θ1)")
    graph.show()
コード例 #2
0
def plot_hypothesis_without_predicted_value(x_data, function):
    graph = Plot(x_values=x_data,
                 function=function,
                 title="Predicted Profit vs. Population Size",
                 x_label="Population",
                 y_label="Profit")
    graph.scatter(data.Population, data.Profit, label="Traning Data")
    graph.show()
コード例 #3
0
def plot_initial_data():
    graph = Plot(x_values=None,
                 function=None,
                 title="Predicted Profit vs. Population Size",
                 x_label="Population",
                 y_label="Profit")
    graph.scatter(data.Population, data.Profit, label="Traning Data")
    graph.show()
コード例 #4
0
def plot_hypothesis_with_predicted_value(x_data, function, value,
                                         predicted_value):
    graph = Plot(x_values=x_data,
                 function=function,
                 title="Predicted Profit vs. Population Size",
                 x_label="Population",
                 y_label="Profit")
    graph.scatter(data.Population, data.Profit, label="Traning Data")
    graph.scatter(value, predicted_value, label="Predicted Value", c="g")
    graph.text(value - 0.55, predicted_value + 1, str(predicted_value)[0:6])
    graph.show()