Skip to content

B12-514, Беляев Никита Дмитриевич#165

Open
Provoda78 wants to merge 16 commits into
EvgrafovMichail:mainfrom
Provoda78:main
Open

B12-514, Беляев Никита Дмитриевич#165
Provoda78 wants to merge 16 commits into
EvgrafovMichail:mainfrom
Provoda78:main

Conversation

@Provoda78
Copy link
Copy Markdown

No description provided.

@Avshugan Avshugan changed the title 514, Беляев Никита Дмитриевич B12-514, Беляев Никита Дмитриевич Mar 9, 2026
@Avshugan Avshugan added the 514 label Mar 9, 2026
rhs: np.ndarray,
) -> np.ndarray: ...
) -> np.ndarray:
if len(lhs) != len(rhs):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Надо было либо

if len(lhs[0]) != len(rhs[0]):

Либо (что еще лучше)

if lhs.shape[1] != rhs.shape[1]:

) -> np.ndarray:
# ваш код
return image
if kernel_size % 2 == 0 or kernel_size < 1:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Не работает при размере ядра 1

if image.ndim == 2:
kernel = padd_image[i : i + kernel_size, j : j + kernel_size]
res[i, j] = np.mean(kernel)
else:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Можно было без if

res = np.zeros(image.shape, dtype=image.dtype)
height, width = image.shape[:2]

for i in range(height):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Есть решение быстрее

often_color = 0
image_int = image.astype(int)

for color in range(256):
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Есть решение быстрее

# ваш код
pass

if diagram_type not in {"box", "violin", "hist"}:
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Слишком большая функция получилась, тяжело читать код. Так еще и много повторяющегося кода


sum_befor, sum_after = {}, {}
for class_ in classes:
sum_befor[class_] = np.sum(befor == class_)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Почему бы не использовать data.count?

return before, after


classes = ["I", "II", "III", "IV"]
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Лучше было бы написать код в функции

Comment thread solutions/sem02/lesson08/task1.py Outdated
abscissa = np.arange(0, plot_duration, time_step)
ordinates = signal(abscissa, fc, modulation=modulation)

axis.set_ylim(ordinates.min() * 1, 25, ordinates.max() * 1, 25)
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

У меня ошибка на это месте, и не работает

) -> FuncAnimation:
# ваш код
return FuncAnimation()
maze: np.ndarray, start: tuple[int, int], end: tuple[int, int], save_path: str = ""
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Не дождался результата на большом лабиринте. Нет отрисовки итогового пути

) -> FuncAnimation:
# ваш код
return FuncAnimation()
maze: np.ndarray, start: tuple[int, int], end: tuple[int, int], save_path: str = ""
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Плохо объединять в одной функции расчеты и отрисовку

) -> FuncAnimation:
# ваш код
return FuncAnimation()
maze: np.ndarray, start: tuple[int, int], end: tuple[int, int], save_path: str = ""
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Функция в 120 строк кода сложно читается. Такие функции лучше разбивать на нескольно

"id": "ae189e66",
"metadata": {},
"outputs": [],
"source": [
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

В части 3, как будто можно было сделать циклом и код был бы проще и не было столько повторений одного и того же кода

"id": "ae189e66",
"metadata": {},
"outputs": [],
"source": [
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

В части 4 вы не удалили из таблицы строки, а просто выведли другую таблицу. Надо было либо использовать аргумент inplace=True, либо записать в таблицу результаты

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants