{"id":1089029,"date":"2025-01-08T13:49:46","date_gmt":"2025-01-08T05:49:46","guid":{"rendered":"https:\/\/docs.pingcode.com\/ask\/ask-ask\/1089029.html"},"modified":"2025-01-08T13:49:49","modified_gmt":"2025-01-08T05:49:49","slug":"%e5%a6%82%e4%bd%95%e7%94%a8python%e8%bf%9b%e8%a1%8c%e7%a5%9e%e7%bb%8f%e7%bd%91%e7%bb%9c%e6%8b%9f%e5%90%88-2","status":"publish","type":"post","link":"https:\/\/docs.pingcode.com\/ask\/1089029.html","title":{"rendered":"\u5982\u4f55\u7528python\u8fdb\u884c\u795e\u7ecf\u7f51\u7edc\u62df\u5408"},"content":{"rendered":"<p style=\"text-align:center;\" ><img decoding=\"async\" src=\"https:\/\/cdn-kb.worktile.com\/kb\/wp-content\/uploads\/2024\/04\/24201211\/495d657a-913c-4672-bacd-914bf0b09db5.webp\" alt=\"\u5982\u4f55\u7528python\u8fdb\u884c\u795e\u7ecf\u7f51\u7edc\u62df\u5408\" \/><\/p>\n<p><p> <strong>\u5982\u4f55\u7528Python\u8fdb\u884c\u795e\u7ecf\u7f51\u7edc\u62df\u5408<\/strong><\/p>\n<\/p>\n<p><p>\u4f7f\u7528Python\u8fdb\u884c\u795e\u7ecf\u7f51\u7edc\u62df\u5408\uff0c\u53ef\u4ee5\u901a\u8fc7\u51e0\u4e2a\u6838\u5fc3\u6b65\u9aa4\uff1a<strong>\u6570\u636e\u51c6\u5907\u3001\u6a21\u578b\u6784\u5efa\u3001\u6a21\u578b\u8bad\u7ec3\u3001\u6a21\u578b\u8bc4\u4f30<\/strong>\u548c<strong>\u6a21\u578b\u4f18\u5316<\/strong>\u3002\u5176\u4e2d\uff0c\u6570\u636e\u51c6\u5907\u662f\u57fa\u7840\uff0c\u6a21\u578b\u6784\u5efa\u548c\u8bad\u7ec3\u662f\u6838\u5fc3\uff0c\u8bc4\u4f30\u548c\u4f18\u5316\u662f\u786e\u4fdd\u6a21\u578b\u6027\u80fd\u7684\u91cd\u8981\u73af\u8282\u3002\u4e0b\u9762\u5c06\u8be6\u7ec6\u4ecb\u7ecd\u8fd9\u4e9b\u6b65\u9aa4\u3002<\/p>\n<\/p>\n<p><h3>\u4e00\u3001\u6570\u636e\u51c6\u5907<\/h3>\n<\/p>\n<p><p>\u5728\u8fdb\u884c\u795e\u7ecf\u7f51\u7edc\u62df\u5408\u4e4b\u524d\uff0c\u9996\u5148\u9700\u8981\u51c6\u5907\u597d\u6570\u636e\u3002\u6570\u636e\u51c6\u5907\u901a\u5e38\u5305\u62ec\u6570\u636e\u6536\u96c6\u3001\u6570\u636e\u9884\u5904\u7406\u3001\u6570\u636e\u96c6\u5212\u5206\u7b49\u6b65\u9aa4\u3002<\/p>\n<\/p>\n<p><h4>1. \u6570\u636e\u6536\u96c6<\/h4>\n<\/p>\n<p><p>\u6570\u636e\u6536\u96c6\u662f\u6574\u4e2a\u6d41\u7a0b\u7684\u7b2c\u4e00\u6b65\uff0c\u5b83\u51b3\u5b9a\u4e86\u6a21\u578b\u6240\u80fd\u5b66\u4e60\u5230\u7684\u77e5\u8bc6\u8303\u56f4\u3002\u6570\u636e\u53ef\u4ee5\u6765\u81ea\u4e8e\u591a\u79cd\u6e20\u9053\uff0c\u5305\u62ec\u516c\u5f00\u6570\u636e\u96c6\u3001\u4f01\u4e1a\u5185\u90e8\u6570\u636e\u3001\u4f20\u611f\u5668\u6570\u636e\u7b49\u3002<\/p>\n<\/p>\n<p><h4>2. \u6570\u636e\u9884\u5904\u7406<\/h4>\n<\/p>\n<p><p>\u6570\u636e\u9884\u5904\u7406\u662f\u6307\u5bf9\u539f\u59cb\u6570\u636e\u8fdb\u884c\u6e05\u6d17\u3001\u5f52\u4e00\u5316\u3001\u6807\u51c6\u5316\u3001\u7279\u5f81\u63d0\u53d6\u7b49\u5904\u7406\uff0c\u4f7f\u5176\u9002\u5408\u8f93\u5165\u5230\u795e\u7ecf\u7f51\u7edc\u4e2d\u3002\u5e38\u89c1\u7684\u9884\u5904\u7406\u64cd\u4f5c\u5305\u62ec\uff1a<\/p>\n<\/p>\n<ul>\n<li><strong>\u6e05\u6d17\u6570\u636e<\/strong>\uff1a\u53bb\u9664\u7f3a\u5931\u503c\u3001\u5f02\u5e38\u503c\u3002<\/li>\n<li><strong>\u5f52\u4e00\u5316<\/strong>\uff1a\u5c06\u6570\u636e\u7f29\u653e\u5230\u56fa\u5b9a\u8303\u56f4\uff08\u59820\u52301\uff09\u3002<\/li>\n<li><strong>\u6807\u51c6\u5316<\/strong>\uff1a\u5c06\u6570\u636e\u8f6c\u6362\u4e3a\u5747\u503c\u4e3a0\uff0c\u65b9\u5dee\u4e3a1\u7684\u5206\u5e03\u3002<\/li>\n<li><strong>\u7279\u5f81\u63d0\u53d6<\/strong>\uff1a\u4ece\u539f\u59cb\u6570\u636e\u4e2d\u63d0\u53d6\u5bf9\u6a21\u578b\u6709\u7528\u7684\u7279\u5f81\u3002<\/li>\n<\/ul>\n<p><pre><code class=\"language-python\">import pandas as pd<\/p>\n<p>from sklearn.model_selection import tr<a href=\"https:\/\/docs.pingcode.com\/blog\/59162.html\" target=\"_blank\">AI<\/a>n_test_split<\/p>\n<p>from sklearn.preprocessing import StandardScaler<\/p>\n<h2><strong>\u8bfb\u53d6\u6570\u636e<\/strong><\/h2>\n<p>data = pd.read_csv(&#39;data.csv&#39;)<\/p>\n<h2><strong>\u6570\u636e\u6e05\u6d17<\/strong><\/h2>\n<p>data = data.dropna()<\/p>\n<h2><strong>\u6570\u636e\u5206\u5272<\/strong><\/h2>\n<p>X = data.drop(&#39;target&#39;, axis=1)<\/p>\n<p>y = data[&#39;target&#39;]<\/p>\n<h2><strong>\u6570\u636e\u6807\u51c6\u5316<\/strong><\/h2>\n<p>scaler = StandardScaler()<\/p>\n<p>X_scaled = scaler.fit_transform(X)<\/p>\n<h2><strong>\u5212\u5206\u8bad\u7ec3\u96c6\u548c\u6d4b\u8bd5\u96c6<\/strong><\/h2>\n<p>X_train, X_test, y_train, y_test = train_test_split(X_scaled, y, test_size=0.2, random_state=42)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e8c\u3001\u6a21\u578b\u6784\u5efa<\/h3>\n<\/p>\n<p><p>\u6784\u5efa\u795e\u7ecf\u7f51\u7edc\u6a21\u578b\u662f\u6574\u4e2a\u6d41\u7a0b\u7684\u6838\u5fc3\u6b65\u9aa4\u3002\u5728Python\u4e2d\uff0c\u5e38\u7528\u7684\u6df1\u5ea6\u5b66\u4e60\u6846\u67b6\u6709TensorFlow\u3001Keras\u548cPyTorch\u7b49\u3002\u8fd9\u91cc\u4ee5Keras\u4e3a\u4f8b\uff0c\u4ecb\u7ecd\u5982\u4f55\u6784\u5efa\u4e00\u4e2a\u7b80\u5355\u7684\u795e\u7ecf\u7f51\u7edc\u6a21\u578b\u3002<\/p>\n<\/p>\n<p><h4>1. \u5bfc\u5165\u76f8\u5173\u5e93<\/h4>\n<\/p>\n<p><p>\u9996\u5148\u9700\u8981\u5bfc\u5165\u76f8\u5173\u5e93\uff0c\u5982TensorFlow\u548cKeras\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">import tensorflow as tf<\/p>\n<p>from tensorflow.keras.models import Sequential<\/p>\n<p>from tensorflow.keras.layers import Dense<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u6784\u5efa\u6a21\u578b<\/h4>\n<\/p>\n<p><p>\u4f7f\u7528Keras\u7684Sequential API\uff0c\u53ef\u4ee5\u5f88\u65b9\u4fbf\u5730\u6784\u5efa\u4e00\u4e2a\u795e\u7ecf\u7f51\u7edc\u6a21\u578b\u3002\u4ee5\u4e0b\u662f\u4e00\u4e2a\u5305\u542b\u4e24\u4e2a\u9690\u85cf\u5c42\u7684\u795e\u7ecf\u7f51\u7edc\u6a21\u578b\u793a\u4f8b\uff1a<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">model = Sequential([<\/p>\n<p>    Dense(64, activation=&#39;relu&#39;, input_shape=(X_train.shape[1],)),<\/p>\n<p>    Dense(32, activation=&#39;relu&#39;),<\/p>\n<p>    Dense(1, activation=&#39;linear&#39;)<\/p>\n<p>])<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3. \u7f16\u8bd1\u6a21\u578b<\/h4>\n<\/p>\n<p><p>\u7f16\u8bd1\u6a21\u578b\u65f6\uff0c\u9700\u8981\u6307\u5b9a\u635f\u5931\u51fd\u6570\u3001\u4f18\u5316\u5668\u548c\u8bc4\u4f30\u6307\u6807\u3002\u5e38\u7528\u7684\u635f\u5931\u51fd\u6570\u6709\u5747\u65b9\u8bef\u5dee\uff08MSE\uff09\uff0c\u4f18\u5316\u5668\u6709\u968f\u673a\u68af\u5ea6\u4e0b\u964d\uff08SGD\uff09\u3001Adam\u7b49\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">model.compile(optimizer=&#39;adam&#39;, loss=&#39;mean_squared_error&#39;, metrics=[&#39;mae&#39;])<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e09\u3001\u6a21\u578b\u8bad\u7ec3<\/h3>\n<\/p>\n<p><p>\u6a21\u578b\u8bad\u7ec3\u662f\u6307\u901a\u8fc7\u8bad\u7ec3\u6570\u636e\u6765\u8c03\u6574\u6a21\u578b\u53c2\u6570\uff0c\u4f7f\u5176\u80fd\u591f\u5f88\u597d\u5730\u62df\u5408\u6570\u636e\u3002\u5728\u8bad\u7ec3\u8fc7\u7a0b\u4e2d\uff0c\u53ef\u4ee5\u8bbe\u7f6e\u6279\u91cf\u5927\u5c0f\uff08batch size\uff09\u548c\u8bad\u7ec3\u8f6e\u6570\uff08epochs\uff09\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">history = model.fit(X_train, y_train, validation_split=0.2, epochs=100, batch_size=32)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u56db\u3001\u6a21\u578b\u8bc4\u4f30<\/h3>\n<\/p>\n<p><p>\u6a21\u578b\u8bc4\u4f30\u662f\u6307\u4f7f\u7528\u6d4b\u8bd5\u6570\u636e\u96c6\u6765\u8bc4\u4f30\u6a21\u578b\u7684\u6027\u80fd\uff0c\u4ee5\u786e\u5b9a\u5176\u6cdb\u5316\u80fd\u529b\u3002\u5e38\u7528\u7684\u8bc4\u4f30\u6307\u6807\u6709\u5747\u65b9\u8bef\u5dee\uff08MSE\uff09\u3001\u5e73\u5747\u7edd\u5bf9\u8bef\u5dee\uff08MAE\uff09\u7b49\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">loss, mae = model.evaluate(X_test, y_test)<\/p>\n<p>print(f&quot;Test MAE: {mae}&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e94\u3001\u6a21\u578b\u4f18\u5316<\/h3>\n<\/p>\n<p><p>\u6a21\u578b\u4f18\u5316\u662f\u6307\u901a\u8fc7\u8c03\u8282\u6a21\u578b\u8d85\u53c2\u6570\u3001\u6539\u8fdb\u6a21\u578b\u7ed3\u6784\u3001\u5f15\u5165\u6b63\u5219\u5316\u7b49\u624b\u6bb5\uff0c\u8fdb\u4e00\u6b65\u63d0\u5347\u6a21\u578b\u6027\u80fd\u3002<\/p>\n<\/p>\n<p><h4>1. \u8c03\u53c2<\/h4>\n<\/p>\n<p><p>\u8c03\u6574\u6a21\u578b\u7684\u8d85\u53c2\u6570\uff0c\u5982\u5b66\u4e60\u7387\u3001\u6279\u91cf\u5927\u5c0f\u3001\u9690\u85cf\u5c42\u6570\u91cf\u548c\u795e\u7ecf\u5143\u6570\u91cf\u7b49\uff0c\u53ef\u4ee5\u663e\u8457\u5f71\u54cd\u6a21\u578b\u7684\u6027\u80fd\u3002<\/p>\n<\/p>\n<p><h4>2. \u6539\u8fdb\u6a21\u578b\u7ed3\u6784<\/h4>\n<\/p>\n<p><p>\u53ef\u4ee5\u5c1d\u8bd5\u4e0d\u540c\u7684\u7f51\u7edc\u7ed3\u6784\uff0c\u5982\u589e\u52a0\u6216\u51cf\u5c11\u9690\u85cf\u5c42\u6570\u91cf\u3001\u66f4\u6362\u6fc0\u6d3b\u51fd\u6570\u7b49\uff0c\u4ee5\u627e\u5230\u6700\u9002\u5408\u5f53\u524d\u95ee\u9898\u7684\u6a21\u578b\u7ed3\u6784\u3002<\/p>\n<\/p>\n<p><h4>3. \u5f15\u5165\u6b63\u5219\u5316<\/h4>\n<\/p>\n<p><p>\u6b63\u5219\u5316\u6280\u672f\uff08\u5982L2\u6b63\u5219\u5316\u3001Dropout\uff09\u53ef\u4ee5\u6709\u6548\u9632\u6b62\u6a21\u578b\u8fc7\u62df\u5408\uff0c\u63d0\u5347\u6a21\u578b\u7684\u6cdb\u5316\u80fd\u529b\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from tensorflow.keras.layers import Dropout<\/p>\n<p>model = Sequential([<\/p>\n<p>    Dense(64, activation=&#39;relu&#39;, input_shape=(X_train.shape[1],)),<\/p>\n<p>    Dropout(0.5),<\/p>\n<p>    Dense(32, activation=&#39;relu&#39;),<\/p>\n<p>    Dropout(0.5),<\/p>\n<p>    Dense(1, activation=&#39;linear&#39;)<\/p>\n<p>])<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>4. \u4ea4\u53c9\u9a8c\u8bc1<\/h4>\n<\/p>\n<p><p>\u901a\u8fc7\u4ea4\u53c9\u9a8c\u8bc1\u6280\u672f\uff0c\u53ef\u4ee5\u66f4\u5168\u9762\u5730\u8bc4\u4f30\u6a21\u578b\u6027\u80fd\uff0c\u5e76\u9009\u62e9\u6700\u4f73\u7684\u6a21\u578b\u53c2\u6570\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from sklearn.model_selection import KFold<\/p>\n<p>import numpy as np<\/p>\n<p>kf = KFold(n_splits=5)<\/p>\n<p>mae_scores = []<\/p>\n<p>for train_index, val_index in kf.split(X_scaled):<\/p>\n<p>    X_train_kf, X_val_kf = X_scaled[train_index], X_scaled[val_index]<\/p>\n<p>    y_train_kf, y_val_kf = y[train_index], y[val_index]<\/p>\n<p>    model.fit(X_train_kf, y_train_kf, epochs=100, batch_size=32, verbose=0)<\/p>\n<p>    loss, mae = model.evaluate(X_val_kf, y_val_kf, verbose=0)<\/p>\n<p>    mae_scores.append(mae)<\/p>\n<p>print(f&quot;Cross-validated MAE: {np.mean(mae_scores)}&quot;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u516d\u3001\u6a21\u578b\u90e8\u7f72<\/h3>\n<\/p>\n<p><p>\u5728\u8bad\u7ec3\u548c\u4f18\u5316\u6a21\u578b\u540e\uff0c\u53ef\u4ee5\u5c06\u6a21\u578b\u90e8\u7f72\u5230\u751f\u4ea7\u73af\u5883\uff0c\u4ee5\u4fbf\u5b9e\u65f6\u9884\u6d4b\u3002\u90e8\u7f72\u65b9\u6cd5\u5305\u62ec\u901a\u8fc7API\u63d0\u4f9b\u670d\u52a1\u3001\u5d4c\u5165\u5230\u79fb\u52a8\u5e94\u7528\u3001\u90e8\u7f72\u5230\u4e91\u7aef\u7b49\u3002<\/p>\n<\/p>\n<p><h4>1. \u4fdd\u5b58\u6a21\u578b<\/h4>\n<\/p>\n<p><p>\u9996\u5148\u9700\u8981\u5c06\u8bad\u7ec3\u597d\u7684\u6a21\u578b\u4fdd\u5b58\u4e0b\u6765\uff0c\u4ee5\u4fbf\u5728\u751f\u4ea7\u73af\u5883\u4e2d\u52a0\u8f7d\u548c\u4f7f\u7528\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">model.save(&#39;my_model.h5&#39;)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>2. \u52a0\u8f7d\u6a21\u578b<\/h4>\n<\/p>\n<p><p>\u5728\u751f\u4ea7\u73af\u5883\u4e2d\uff0c\u53ef\u4ee5\u52a0\u8f7d\u4e4b\u524d\u4fdd\u5b58\u7684\u6a21\u578b\uff0c\u5e76\u4f7f\u7528\u5b83\u8fdb\u884c\u9884\u6d4b\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\">from tensorflow.keras.models import load_model<\/p>\n<p>model = load_model(&#39;my_model.h5&#39;)<\/p>\n<p>predictions = model.predict(X_new)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h4>3. \u90e8\u7f72\u5230\u4e91\u7aef<\/h4>\n<\/p>\n<p><p>\u53ef\u4ee5\u5c06\u6a21\u578b\u90e8\u7f72\u5230\u4e91\u7aef\uff08\u5982AWS\u3001Google Cloud\u3001Azure\uff09\uff0c\u901a\u8fc7API\u63d0\u4f9b\u5b9e\u65f6\u9884\u6d4b\u670d\u52a1\u3002<\/p>\n<\/p>\n<p><pre><code class=\"language-python\"># \u4f8b\u5982\uff0c\u4f7f\u7528Flask\u521b\u5efa\u4e00\u4e2a\u7b80\u5355\u7684API<\/p>\n<p>from flask import Flask, request, jsonify<\/p>\n<p>app = Flask(__name__)<\/p>\n<p>model = load_model(&#39;my_model.h5&#39;)<\/p>\n<p>@app.route(&#39;\/predict&#39;, methods=[&#39;POST&#39;])<\/p>\n<p>def predict():<\/p>\n<p>    data = request.get_json(force=True)<\/p>\n<p>    prediction = model.predict(np.array(data[&#39;features&#39;]).reshape(1, -1))<\/p>\n<p>    return jsonify({&#39;prediction&#39;: prediction[0][0]})<\/p>\n<p>if __name__ == &#39;__main__&#39;:<\/p>\n<p>    app.run(port=5000, debug=True)<\/p>\n<p><\/code><\/pre>\n<\/p>\n<p><h3>\u4e03\u3001\u603b\u7ed3<\/h3>\n<\/p>\n<p><p>\u7528Python\u8fdb\u884c\u795e\u7ecf\u7f51\u7edc\u62df\u5408\u662f\u4e00\u9879\u590d\u6742\u4f46\u975e\u5e38\u6709\u4ef7\u503c\u7684\u4efb\u52a1\u3002\u901a\u8fc7<strong>\u6570\u636e\u51c6\u5907\u3001\u6a21\u578b\u6784\u5efa\u3001\u6a21\u578b\u8bad\u7ec3\u3001\u6a21\u578b\u8bc4\u4f30<\/strong>\u548c<strong>\u6a21\u578b\u4f18\u5316<\/strong>\u7b49\u6b65\u9aa4\uff0c\u53ef\u4ee5\u6784\u5efa\u51fa\u6027\u80fd\u4f18\u8d8a\u7684\u795e\u7ecf\u7f51\u7edc\u6a21\u578b\u3002\u968f\u7740\u6280\u672f\u7684\u53d1\u5c55\uff0c\u795e\u7ecf\u7f51\u7edc\u5728\u5404\u4e2a\u9886\u57df\u7684\u5e94\u7528\u8d8a\u6765\u8d8a\u5e7f\u6cdb\uff0c\u638c\u63e1\u8fd9\u9879\u6280\u672f\u5c06\u4e3a\u6570\u636e\u79d1\u5b66\u5bb6\u548c\u5de5\u7a0b\u5e08\u5e26\u6765\u5de8\u5927\u7684\u804c\u4e1a\u53d1\u5c55\u673a\u4f1a\u3002<\/p>\n<\/p>\n<h2><strong>\u76f8\u5173\u95ee\u7b54FAQs\uff1a<\/strong><\/h2>\n<p> <strong>\u5982\u4f55\u9009\u62e9\u5408\u9002\u7684\u795e\u7ecf\u7f51\u7edc\u67b6\u6784\u8fdb\u884c\u62df\u5408\uff1f<\/strong><br \/>\u5728\u8fdb\u884c\u795e\u7ecf\u7f51\u7edc\u62df\u5408\u65f6\uff0c\u9009\u62e9\u5408\u9002\u7684\u67b6\u6784\u81f3\u5173\u91cd\u8981\u3002\u4e00\u822c\u6765\u8bf4\uff0c\u53ef\u4ee5\u6839\u636e\u95ee\u9898\u7684\u590d\u6742\u7a0b\u5ea6\u6765\u51b3\u5b9a\u7f51\u7edc\u7684\u5c42\u6570\u548c\u6bcf\u5c42\u7684\u795e\u7ecf\u5143\u6570\u91cf\u3002\u5bf9\u4e8e\u7b80\u5355\u7684\u56de\u5f52\u95ee\u9898\uff0c\u53ef\u80fd\u53ea\u9700\u8981\u4e00\u4e2a\u9690\u85cf\u5c42\u548c\u5c11\u91cf\u795e\u7ecf\u5143\u3002\u800c\u5bf9\u4e8e\u590d\u6742\u7684\u4efb\u52a1\uff0c\u5982\u56fe\u50cf\u5904\u7406\u6216\u81ea\u7136\u8bed\u8a00\u5904\u7406\uff0c\u53ef\u80fd\u9700\u8981\u66f4\u591a\u7684\u9690\u85cf\u5c42\u548c\u66f4\u590d\u6742\u7684\u7ed3\u6784\u3002\u6b64\u5916\uff0c\u4f7f\u7528\u4ea4\u53c9\u9a8c\u8bc1\u53ef\u4ee5\u5e2e\u52a9\u4f60\u8bc4\u4f30\u4e0d\u540c\u67b6\u6784\u7684\u6027\u80fd\uff0c\u4ece\u800c\u9009\u62e9\u6700\u4f73\u7684\u914d\u7f6e\u3002<\/p>\n<p><strong>\u5728\u4f7f\u7528Python\u8fdb\u884c\u795e\u7ecf\u7f51\u7edc\u62df\u5408\u65f6\uff0c\u5e94\u8be5\u8003\u8651\u54ea\u4e9b\u6570\u636e\u9884\u5904\u7406\u6b65\u9aa4\uff1f<\/strong><br \/>\u6570\u636e\u9884\u5904\u7406\u662f\u786e\u4fdd\u795e\u7ecf\u7f51\u7edc\u6709\u6548\u8bad\u7ec3\u7684\u5173\u952e\u6b65\u9aa4\u3002\u5e38\u89c1\u7684\u9884\u5904\u7406\u65b9\u6cd5\u5305\u62ec\u6807\u51c6\u5316\u548c\u5f52\u4e00\u5316\uff0c\u4ee5\u6d88\u9664\u7279\u5f81\u4e4b\u95f4\u7684\u91cf\u7eb2\u5dee\u5f02\u3002\u7f3a\u5931\u503c\u5904\u7406\u4e5f\u662f\u5fc5\u987b\u7684\uff0c\u53ef\u4ee5\u901a\u8fc7\u63d2\u503c\u6216\u5220\u9664\u7f3a\u5931\u6570\u636e\u6765\u5904\u7406\u3002\u6b64\u5916\uff0c\u5206\u5272\u6570\u636e\u96c6\u4e3a\u8bad\u7ec3\u96c6\u548c\u6d4b\u8bd5\u96c6\u662f\u5fc5\u8981\u7684\uff0c\u4ee5\u4fbf\u8bc4\u4f30\u6a21\u578b\u7684\u6cdb\u5316\u80fd\u529b\u3002\u6700\u540e\uff0c\u786e\u4fdd\u6570\u636e\u7684\u6807\u7b7e\u662f\u51c6\u786e\u7684\uff0c\u4ee5\u907f\u514d\u5f15\u5165\u566a\u58f0\u3002<\/p>\n<p><strong>\u5982\u4f55\u8bc4\u4f30\u795e\u7ecf\u7f51\u7edc\u6a21\u578b\u7684\u6027\u80fd\uff1f<\/strong><br \/>\u8bc4\u4f30\u795e\u7ecf\u7f51\u7edc\u6a21\u578b\u7684\u6027\u80fd\u901a\u5e38\u4f7f\u7528\u4e00\u7cfb\u5217\u6307\u6807\uff0c\u5982\u5747\u65b9\u8bef\u5dee\uff08MSE\uff09\u3001\u51c6\u786e\u7387\u3001F1\u5206\u6570\u7b49\uff0c\u8fd9\u4e9b\u6307\u6807\u53ef\u4ee5\u6839\u636e\u5177\u4f53\u7684\u4efb\u52a1\u9009\u62e9\u3002\u53ef\u4ee5\u901a\u8fc7\u4ea4\u53c9\u9a8c\u8bc1\u65b9\u6cd5\u6765\u83b7\u5f97\u66f4\u53ef\u9760\u7684\u8bc4\u4f30\u7ed3\u679c\uff0c\u907f\u514d\u8fc7\u62df\u5408\u73b0\u8c61\u3002\u6b64\u5916\uff0c\u7ed8\u5236\u635f\u5931\u66f2\u7ebf\u548c\u51c6\u786e\u7387\u66f2\u7ebf\u4e5f\u6709\u52a9\u4e8e\u89c2\u5bdf\u6a21\u578b\u5728\u8bad\u7ec3\u8fc7\u7a0b\u4e2d\u7684\u8868\u73b0\uff0c\u4ece\u800c\u8c03\u6574\u8d85\u53c2\u6570\u4ee5\u63d0\u9ad8\u6a21\u578b\u7684\u6027\u80fd\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"\u5982\u4f55\u7528Python\u8fdb\u884c\u795e\u7ecf\u7f51\u7edc\u62df\u5408 \u4f7f\u7528Python\u8fdb\u884c\u795e\u7ecf\u7f51\u7edc\u62df\u5408\uff0c\u53ef\u4ee5\u901a\u8fc7\u51e0\u4e2a\u6838\u5fc3\u6b65\u9aa4\uff1a\u6570\u636e\u51c6\u5907\u3001\u6a21\u578b\u6784\u5efa [&hellip;]","protected":false},"author":3,"featured_media":1089040,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[37],"tags":[],"acf":[],"_links":{"self":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1089029"}],"collection":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/comments?post=1089029"}],"version-history":[{"count":"1","href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1089029\/revisions"}],"predecessor-version":[{"id":1089042,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/posts\/1089029\/revisions\/1089042"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media\/1089040"}],"wp:attachment":[{"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/media?parent=1089029"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/categories?post=1089029"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/docs.pingcode.com\/wp-json\/wp\/v2\/tags?post=1089029"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}