Skip to content

Б12-513, Батеряков Руслан#162

Open
Ruslan-Bat wants to merge 12 commits intoEvgrafovMichail:mainfrom
Ruslan-Bat:main
Open

Б12-513, Батеряков Руслан#162
Ruslan-Bat wants to merge 12 commits intoEvgrafovMichail:mainfrom
Ruslan-Bat:main

Conversation

@Ruslan-Bat
Copy link
Copy Markdown

No description provided.

Copy link
Copy Markdown
Owner

@EvgrafovMichail EvgrafovMichail left a comment

Choose a reason for hiding this comment

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

Итог:

  • 1 задача: 5/10 с возможностью повысить до 10/10
  • 2 задача: 10/10
  • 3 задача: 0/10 с возможностью повысить до 10/10

def compute_poly_vectorized(abscissa: np.ndarray) -> np.ndarray: ...

def compute_poly_vectorized(abscissa: np.ndarray) -> np.ndarray:
return np.add(np.add(np.multiply(np.power(abscissa, 2), 3), np.multiply(abscissa, 2)), 1)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Очень сложно читать такую запись. Для улучшения понятности лучше было бы использовать операторную форму записи:

Suggested change
return np.add(np.add(np.multiply(np.power(abscissa, 2), 3), np.multiply(abscissa, 2)), 1)
return (abscissa ** 2) * 3 + 2 * abscissa + 1

Оценку за это не снижаю, но имейте в виду на будущее.

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

return np.sqrt(np.sum((lhs[:, None, :] - rhs[None, :, :]) ** 2, axis=2))
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Почему использовали None в этой записи? Пока поставлю 0 за эту задачу. Но вы можете оспорить его очно после семинара и получить полный балл за эту задачу.

inclination = np.arccos(applicates / r)

return (
(abscissa**2 + ordinates**2 + applicates**2) ** 0.5,
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Зачем считать r второй раз, если вы уже сделали это в 31 строчке?

raise ShapeMismatchError

r = (abscissa**2 + ordinates**2 + applicates**2) ** 0.5
inclination = np.arccos(applicates / r)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Так делать небезопасно, r может быть равна 0.

return (
(abscissa**2 + ordinates**2 + applicates**2) ** 0.5,
np.arctan2(ordinates, abscissa),
np.nan_to_num(inclination, nan=0),
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

0 / 0 даст nan, но в inclination могут быть еще значения inf, как будете обрабатывать эту ситуацию?

)


def convert_to_sphere(
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

За эту функцию 0, т.к. она некорректно обрабатывает некоторые входные значения.


min_ind = (ordinates[:-2] > ordinates[1:-1]) & (ordinates[1:-1] < ordinates[2:])

return np.where(min_ind)[0] + 1, np.where(max_ind)[0] + 1
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Пока 0. Можете поднять до 10, если сможете пояснить этот код очно после семинара.

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