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

latex公式出问题 #2494

Open
YangSJ1 opened this issue May 14, 2024 · 7 comments
Open

latex公式出问题 #2494

YangSJ1 opened this issue May 14, 2024 · 7 comments

Comments

@YangSJ1
Copy link

YangSJ1 commented May 14, 2024

我在模型里加上了提示词,提醒要正确加$,但是还是有概率出现渲染错误。
Snipaste_2024-05-14_18-10-53
Snipaste_2024-05-14_18-10-32

@lobehubbot
Copy link
Member

👀 @YangSJ1

Thank you for raising an issue. We will investigate into the matter and get back to you as soon as possible.
Please make sure you have given us as much context as possible.
非常感谢您提交 issue。我们会尽快调查此事,并尽快回复您。 请确保您已经提供了尽可能多的背景信息。

@YangSJ1
Copy link
Author

YangSJ1 commented May 14, 2024

模型为gpt-4-vision-preview。

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


The model is gpt-4-vision-preview.

@elonlo
Copy link

elonlo commented May 16, 2024

image
me too

@lobehubbot
Copy link
Member

Bot detected the issue body's language is not English, translate it automatically. 👯👭🏻🧑‍🤝‍🧑👫🧑🏿‍🤝‍🧑🏻👩🏾‍🤝‍👨🏿👬🏿


image
me too

@YiyangLu
Copy link

The problem occurs because gpt would output the math latex equation in a strange style: ( latex_code )

For example: when we ask the following question to chatgpt(website) or gpt4o api:

For the probability density function of gaussian distribution:
$$
p(x|\mu,\Sigma)=\frac{1}{(2\pi)^{p/2}|\Sigma|^{1/2}}e^{-\frac{1}{2}(x-\mu)^{T}\Sigma^{-1}(x-\mu)}
$$

what is the meaning for each variable?

The answer would be similar. They will include the following content:

- **\( x \)**: This is the \( p \)-dimensional random vector representing the variable whose distribution is being described. In other words, \( x \in \mathbb{R}^p \) is the vector of observations.

- **\( \mu \)**: This is the \( p \)-dimensional mean vector of the distribution. It represents the expected value (or the center) of the distribution. In other words, \( \mu \in \mathbb{R}^p \) is the vector of means for each dimension.

- **\( \Sigma \)**: This is the \( p \times p \) covariance matrix of the distribution. It describes the variance and the covariance between each pair of dimensions in the random vector \( x \). \( \Sigma \) must be a symmetric and positive-definite matrix. The diagonal elements represent the variances of each dimension, and the off-diagonal elements represent the covariances between dimensions.

- **\( |\Sigma| \)**: This is the determinant of the covariance matrix \( \Sigma \). The determinant of \( \Sigma \) is used in the normalization constant of the Gaussian distribution. It is crucial because it adjusts the height of the distribution so that the total probability integrates to 1.

- **\( \Sigma^{-1} \)**: This is the inverse of the covariance matrix \( \Sigma \). The inverse covariance matrix is also known as the precision matrix. It is used in the exponent to measure the "distance" of the vector \( x \) from the mean \( \mu \), scaled by the covariance structure of the distribution.

- **\( (x - \mu) \)**: This is the \( p \)-dimensional vector of deviations of \( x \) from the mean \( \mu \).

- **\( (x - \mu)^{T} \Sigma^{-1} (x - \mu) \)**: This is the Mahalanobis distance squared. It measures how many standard deviations away the vector \( x \) is from the mean \( \mu \), considering the shape of the distribution given by \( \Sigma \). It generalizes the concept of the z-score to multiple dimensions.

- **\( (2\pi)^{p/2} \)**: This term in the normalization constant comes from the multivariate generalization of the Gaussian distribution. It ensures that the integral of the pdf over the entire space is 1, maintaining the property of a probability distribution.

@YangSJ1
Copy link
Author

YangSJ1 commented May 19, 2024

The problem occurs because gpt would output the math latex equation in a strange style: ( latex_code )

For example: when we ask the following question to chatgpt(website) or gpt4o api:

For the probability density function of gaussian distribution:
$$
p(x|\mu,\Sigma)=\frac{1}{(2\pi)^{p/2}|\Sigma|^{1/2}}e^{-\frac{1}{2}(x-\mu)^{T}\Sigma^{-1}(x-\mu)}
$$

what is the meaning for each variable?

The answer would be similar. They will include the following content:

- **\( x \)**: This is the \( p \)-dimensional random vector representing the variable whose distribution is being described. In other words, \( x \in \mathbb{R}^p \) is the vector of observations.

- **\( \mu \)**: This is the \( p \)-dimensional mean vector of the distribution. It represents the expected value (or the center) of the distribution. In other words, \( \mu \in \mathbb{R}^p \) is the vector of means for each dimension.

- **\( \Sigma \)**: This is the \( p \times p \) covariance matrix of the distribution. It describes the variance and the covariance between each pair of dimensions in the random vector \( x \). \( \Sigma \) must be a symmetric and positive-definite matrix. The diagonal elements represent the variances of each dimension, and the off-diagonal elements represent the covariances between dimensions.

- **\( |\Sigma| \)**: This is the determinant of the covariance matrix \( \Sigma \). The determinant of \( \Sigma \) is used in the normalization constant of the Gaussian distribution. It is crucial because it adjusts the height of the distribution so that the total probability integrates to 1.

- **\( \Sigma^{-1} \)**: This is the inverse of the covariance matrix \( \Sigma \). The inverse covariance matrix is also known as the precision matrix. It is used in the exponent to measure the "distance" of the vector \( x \) from the mean \( \mu \), scaled by the covariance structure of the distribution.

- **\( (x - \mu) \)**: This is the \( p \)-dimensional vector of deviations of \( x \) from the mean \( \mu \).

- **\( (x - \mu)^{T} \Sigma^{-1} (x - \mu) \)**: This is the Mahalanobis distance squared. It measures how many standard deviations away the vector \( x \) is from the mean \( \mu \), considering the shape of the distribution given by \( \Sigma \). It generalizes the concept of the z-score to multiple dimensions.

- **\( (2\pi)^{p/2} \)**: This term in the normalization constant comes from the multivariate generalization of the Gaussian distribution. It ensures that the integral of the pdf over the entire space is 1, maintaining the property of a probability distribution.

But I think the website should try to display the latex formula correctly in markdown form

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

No branches or pull requests

4 participants