B12-514, Беляев Никита Дмитриевич#165
Conversation
| rhs: np.ndarray, | ||
| ) -> np.ndarray: ... | ||
| ) -> np.ndarray: | ||
| if len(lhs) != len(rhs): |
There was a problem hiding this comment.
Надо было либо
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: |
There was a problem hiding this comment.
Не работает при размере ядра 1
| if image.ndim == 2: | ||
| kernel = padd_image[i : i + kernel_size, j : j + kernel_size] | ||
| res[i, j] = np.mean(kernel) | ||
| else: |
| res = np.zeros(image.shape, dtype=image.dtype) | ||
| height, width = image.shape[:2] | ||
|
|
||
| for i in range(height): |
| often_color = 0 | ||
| image_int = image.astype(int) | ||
|
|
||
| for color in range(256): |
| # ваш код | ||
| pass | ||
|
|
||
| if diagram_type not in {"box", "violin", "hist"}: |
There was a problem hiding this comment.
Слишком большая функция получилась, тяжело читать код. Так еще и много повторяющегося кода
|
|
||
| sum_befor, sum_after = {}, {} | ||
| for class_ in classes: | ||
| sum_befor[class_] = np.sum(befor == class_) |
There was a problem hiding this comment.
Почему бы не использовать data.count?
| return before, after | ||
|
|
||
|
|
||
| classes = ["I", "II", "III", "IV"] |
There was a problem hiding this comment.
Лучше было бы написать код в функции
| 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) |
There was a problem hiding this comment.
У меня ошибка на это месте, и не работает
| ) -> FuncAnimation: | ||
| # ваш код | ||
| return FuncAnimation() | ||
| maze: np.ndarray, start: tuple[int, int], end: tuple[int, int], save_path: str = "" |
There was a problem hiding this comment.
Не дождался результата на большом лабиринте. Нет отрисовки итогового пути
| ) -> FuncAnimation: | ||
| # ваш код | ||
| return FuncAnimation() | ||
| maze: np.ndarray, start: tuple[int, int], end: tuple[int, int], save_path: str = "" |
There was a problem hiding this comment.
Плохо объединять в одной функции расчеты и отрисовку
| ) -> FuncAnimation: | ||
| # ваш код | ||
| return FuncAnimation() | ||
| maze: np.ndarray, start: tuple[int, int], end: tuple[int, int], save_path: str = "" |
There was a problem hiding this comment.
Функция в 120 строк кода сложно читается. Такие функции лучше разбивать на нескольно
| "id": "ae189e66", | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ |
There was a problem hiding this comment.
В части 3, как будто можно было сделать циклом и код был бы проще и не было столько повторений одного и того же кода
| "id": "ae189e66", | ||
| "metadata": {}, | ||
| "outputs": [], | ||
| "source": [ |
There was a problem hiding this comment.
В части 4 вы не удалили из таблицы строки, а просто выведли другую таблицу. Надо было либо использовать аргумент inplace=True, либо записать в таблицу результаты
No description provided.