MCPcopy Index your code
hub / github.com/geekcomputers/Python / load_data

Function load_data

local_weighted_learning/local_weighted_learning.py:58–77  ·  view source on GitHub ↗

Function used for loading data from the seaborn splitting into x and y points

(dataset_name: str, cola_name: str, colb_name: str)

Source from the content-addressed store, hash-verified

56
57
58def load_data(dataset_name: str, cola_name: str, colb_name: str) -> np.mat:
59 """
60 Function used for loading data from the seaborn splitting into x and y points
61 """
62 import seaborn as sns
63
64 data = sns.load_dataset(dataset_name)
65 col_a = np.array(data[cola_name]) # total_bill
66 col_b = np.array(data[colb_name]) # tip
67
68 mcol_a = np.mat(col_a)
69 mcol_b = np.mat(col_b)
70
71 m = np.shape(mcol_b)[1]
72 one = np.ones((1, m), dtype=int)
73
74 # horizontal stacking
75 training_data = np.hstack((one.T, mcol_a.T))
76
77 return training_data, mcol_b, col_a, col_b
78
79
80def get_preds(training_data: np.mat, mcol_b: np.mat, tau: float) -> np.ndarray:

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected