MCPcopy Create free account
hub / github.com/geekcomputers/Python / local_weight

Function local_weight

local_weighted_learning/local_weighted_learning.py:27–38  ·  view source on GitHub ↗

Calculate the local weights using the weight_matrix function on training data. Return the weighted matrix.

(
    point: np.mat, training_data_x: np.mat, training_data_y: np.mat, bandwidth: float
)

Source from the content-addressed store, hash-verified

25
26
27def local_weight(
28 point: np.mat, training_data_x: np.mat, training_data_y: np.mat, bandwidth: float
29) -> np.mat:
30 """
31 Calculate the local weights using the weight_matrix function on training data.
32 Return the weighted matrix.
33 """
34 weight = weighted_matrix(point, training_data_x, bandwidth)
35 W = (training_data.T * (weight * training_data)).I * (
36 training_data.T * weight * training_data_y.T
37 )
38 return W
39
40
41def local_weight_regression(

Callers 1

local_weight_regressionFunction · 0.85

Calls 1

weighted_matrixFunction · 0.85

Tested by

no test coverage detected