Skip to content

Hw 18#4

Open
duckweedGuard wants to merge 45 commits into
mainfrom
HW_18
Open

Hw 18#4
duckweedGuard wants to merge 45 commits into
mainfrom
HW_18

Conversation

@duckweedGuard

Copy link
Copy Markdown
Owner

No description provided.

@iam28th iam28th left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Виктория, добрый день!

1. Рефакторинг

readme очень крутой! +1 доп. балл

Единственное, перечисление имён из кода - не самая хорошая идея с точки зрения поддержки репозтория: если вы переименуете класс/функцию в коде, то нужно будет и readme не забыть обновить.

Вместо этого, есть такой вариант: словами описать общую функциональность и добавить ссылку на документацию (которую можно по докстрингам генерировать автоматически с помощью pydoc ).

А если добавите генерацию документации в pre-commit hook, то сможете вообще об этом забыть)

Как говорится, зачем тратить 10 минут на задачу, если можно потратить 6 часов на её автоматизацию?

По коду есть какое-то количество замечаний: не везде есть аннотации, порядок импортов не соответствует общепринятому; для борьбы со вторым советую пользоваться isort или ruff (сам пользуюсь последним). -2б.
-1б за неактуальный requirements.txt .

Примеры в ноутбуке было бы неплохо сопроводить тестовыми пояснениями. Забавно, что один из тестов упал:).

(12+1)/15

2. Лес

Тут всё здорово, очень хорошая что предсказания в один и в несколько потоков совпадают.
25/25.

3. Тесты

9.5/10 из-за упавшего теста, надо функцию поправить чтоб не падал


Итого у вас (46.5+1)/50 за это дз, хорошая работа.

Успехов с защитой в ИБ и в дальнейшей карьере!

Comment thread bio_files_processor.py
return self.file

def __iter__(self):
return self #

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

интересно, что тут было в комментарии)

Comment thread bio_files_processor.py
self.prev_item = self.current_item
self.current_item = next_item
out_record = FastaRecord(idx, ''.join(seq), description)
print(out_record)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

не относится к конкретно этому дз, но read_records должен возвращать list[FastaRecord] (по аналогии с .readlines() у возвращаемого контекстным менеджером open file object-а, а не печатать записи.

и тут аннотаций типов не достаёт

Comment thread bio_files_processor.py
protein_line = file.readline().strip()
test = 1
if " " in protein_line:
protein_seqs.append(protein_line.split(" ")[0])

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

переменной test больше подходят булевые значения

и хорошо бы дать ей более информативное имя, связанное с тем, что конкретно вы с её помощью проверяете

Comment thread custom_random_forest.py
Comment on lines +1 to +5
from sklearn.tree import DecisionTreeClassifier
from sklearn.base import BaseEstimator
from sklearn.datasets import make_classification
from concurrent.futures import ProcessPoolExecutor
import numpy as np

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Suggested change
from sklearn.tree import DecisionTreeClassifier
from sklearn.base import BaseEstimator
from sklearn.datasets import make_classification
from concurrent.futures import ProcessPoolExecutor
import numpy as np
from concurrent.futures import ProcessPoolExecutor
import numpy as np
from sklearn.base import BaseEstimator
from sklearn.datasets import make_classification
from sklearn.tree import DecisionTreeClassifier

Comment thread custom_random_forest.py


class RandomForestClassifierCustom(BaseEstimator):
def __init__(self, n_estimators: int, max_depth: int, max_features: int, random_state: int): -> None

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

вот для дандеров как раз возвращаемый тип необязательно указывать

Comment thread custom_random_forest.py
max_features=self.max_features,
random_state = self.random_state)
fit_tree = tree.fit(ps_X, ps_y)
return fit_tree, feature_ids

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

from typing import Tuple

...

def learn_tree_to_fit(
    self, n_estim: int
) -> Tuple[DecisionTreeClassifier, np.ndarray]:
    ...

Comment thread requirements.txt
biopython==1.83
requests==2.27.1
scikit-learn==1.0.2
setuptools==69.0.3

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

BeautifulSoup нет (возможно, чего-то ещё)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants