Skip to content
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

Merged
merged 2 commits into from
Jun 24, 2023

Conversation

kayabaakihiko13
Copy link
Member

Deskripsi (Description)

Checklist:

Umum:

  • Saya menambah algoritma terbaru.
  • Saya memperbaiki algoritma yang sudah ada.
  • Saya memperbaiki dokumentasi.
  • Saya menambah dokumentasi.

Contributor Requirements (Syarat Kontributor) dan Lain-Lain:

  • Saya sudah membaca (I have read) CONTRIBUTING dan sudah menyetujui semua syarat.
  • Saya telah menambahkan docstring yang memberikan penjelasan maksud dari kode yang saya buat.
  • Saya menggunakan bahasa Indonesia untuk memberikan penjelasan dari kode yang saya buat.

Unit Testing dan Linting:

  • pytest
  • flake8

Environment

Saya menggunakan (I'm using):

  • os = linux
  • python = python3 -V (unix)

linked issue #NOMOR_ISSUE

Comment on lines 12 to 18
def costfunction(
x_data: np.array,
y_data: np.array,
alpha: float,
weigth: np.array,
panjang_data: int,
):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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:

Copy link
Member Author

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

Comment on lines 26 to 32
def step_gradient_descent(
data_x: np.array,
data_y: np.array,
alpha: float,
weight: np.array,
panjang_data: int,
):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
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):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
def error_value(self, x: np.array, y: np.array):
def error_value(self, x: np.ndarray, y: np.ndarray) -> np.ndarray:

Copy link
Member Author

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 ?

Copy link
Member

@slowy07 slowy07 left a 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 !

@slowy07 slowy07 added the ready-to-merge ok to merge to branch main label Jun 24, 2023
@mergify mergify bot merged commit b36802a into bellshade:main Jun 24, 2023
10 checks passed
@mergify
Copy link

mergify bot commented Jun 24, 2023

terima kasih atas kontribusinya @kayabaakihiko13 !

@mergify mergify bot requested a review from a team June 24, 2023 12:32
@kayabaakihiko13 kayabaakihiko13 deleted the update branch July 12, 2023 15:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants