import MarkdownRender from '@/components/MarkdownRender'

const sample = `
\`\`\`python
from sklearn.linear_model import LinearRegression\nimport numpy as np\n\n# 提取自变量和因变量\nX = np.array([['丽丽', '安全裤'], ['雅羊人', '不规则连衣裙'], ['威兰西', '网红同款连衣裙'], ['H&R', '蕾丝花边T恤'], ['H&R', '春夏新款连衣裙'], ['H&R', '秋冬款连衣裙'], ['拉夏贝尔', '泫雅风T恤'], ['艾米丽', '大码牛仔裤'], ['TARA', '春夏季新款裤子'], ['富贵人', '蕾丝花边T恤']])\ny = np.array(['丽丽', '雅羊人', '威兰西', 'H&R', 'H&R', 'H&R', '拉夏贝尔', '艾米丽', 'TARA', '富贵人'])\n\n# 将字符串数据转换为数值编码\nfrom sklearn.preprocessing import LabelEncoder\nbrand_encoder = LabelEncoder()\nproduct_encoder = LabelEncoder()\n\nX[:, 0] = brand_encoder.fit_transform(X[:, 0])\nX[:, 1] = product_encoder.fit_transform(X[:, 1])\ny = brand_encoder.transform(y)\n\n# 转换为浮点类型\nX = X.astype(float)\ny = y.astype(float)\n\n# 拟合线性回归模型\nmodel = LinearRegression(fit_intercept=True, copy_X=True, n_jobs=-1, positive=True)\ntry:\n    model.fit(X, y)\n    pass_status = True\nexcept Exception as e:\n    pass_status = False\n\npass_status
\`\`\`
`

export default function Markdown() {
  return <MarkdownRender>{sample}</MarkdownRender>
}
