-
-
Notifications
You must be signed in to change notification settings - Fork 96
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: update algoritma ridge regession #282
Conversation
def costfunction( | ||
x_data: np.array, | ||
y_data: np.array, | ||
alpha: float, | ||
weigth: np.array, | ||
panjang_data: int, | ||
): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def costfunction( | |
x_data: np.array, | |
y_data: np.array, | |
alpha: float, | |
weigth: np.array, | |
panjang_data: int, | |
): | |
def costfunction( | |
x_data: np.ndarray, | |
y_data: np.ndarray, | |
alpha: float, | |
weigth: np.ndarray, | |
panjang_data: int, | |
) -> float: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
untuk algoritmnya apa udah sesuai atau masih ada kesalahan kak @slowy07 ?
soalnya yang aku tahu ini dia sama kayak linear regession biasa kak
def step_gradient_descent( | ||
data_x: np.array, | ||
data_y: np.array, | ||
alpha: float, | ||
weight: np.array, | ||
panjang_data: int, | ||
): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def step_gradient_descent( | |
data_x: np.array, | |
data_y: np.array, | |
alpha: float, | |
weight: np.array, | |
panjang_data: int, | |
): | |
def step_gradient_descent( | |
data_x: np.ndarray, | |
data_y: np.ndarray, | |
alpha: float, | |
weight: np.ndarray, | |
panjang_data: int, | |
) -> np.ndarray: |
self.intercept = fit_intercept | ||
self.iterasi = iterable | ||
self.learning = learning_path | ||
self.weight = None | ||
|
||
def fit(self, x: np.array, y: np.array): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def fit(self, x: np.array, y: np.array): | |
def fit(self, x: np.ndarray, y: np.ndarray) -> np.ndarray: |
error = costfunction(X, Y, self.learning, W, panjang_data) | ||
print(f"pada iterasi {i + 1} - error : {error:.5f}") | ||
self.weight = W | ||
return self.weight | ||
|
||
def transform(self, x: np.array): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def transform(self, x: np.array): | |
def transform(self, x: np.ndarray) -> np.ndarray: |
self.predictions = X_predictor.dot(thetas) | ||
if self.intercept: | ||
X = np.c_[np.ones((X.shape[0], 1)), X] | ||
self.predictions = X.dot(self.weight) | ||
return self.predictions | ||
|
||
def error_value(self, x: np.array, y: np.array): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def error_value(self, x: np.array, y: np.array): | |
def error_value(self, x: np.ndarray, y: np.ndarray) -> np.ndarray: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
maksud dari line 59 ke 96,97,98 itu apa kak @slowy07 ?
for more information, see https://pre-commit.ci
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, terima kasih atas kontribusinya @kayabaakihiko13 !
terima kasih atas kontribusinya @kayabaakihiko13 ! |
Deskripsi (Description)
Checklist:
Umum:
Contributor Requirements (Syarat Kontributor) dan Lain-Lain:
Unit Testing dan Linting:
Environment
Saya menggunakan (I'm using):
os
=linux
python
=python3 -V (unix)
linked issue #NOMOR_ISSUE