- プロンプト実行例
- プロンプトを見る
Input python code or issues
3 class classification
Sure! Here is a sample code for a simple 3-class classification using Python's scikit-learn library with Support Vector Machine (SVM) algorithm:
Python1# Import necessary libraries 2from sklearn import datasets 3from sklearn.model_selection import train_test_split 4from sklearn.svm import SVC 5from sklearn.metrics import accuracy_score 6 7# Load the iris dataset (a popular dataset for classification) 8iris = datasets.load_iris() 9X = iris.data 10y = iris.target 11 12# Split data into training and testing sets 13X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3, random_state=42) 14 15# Train the Support Vector Machine (SVM) classifier 16clf = SVC(kernel='linear') 17clf.fit(X_train, y_train) 18 19# Make predictions on the test data 20predictions = clf.predict(X_test) 21 22# Calculate the accuracy of the model 23accuracy = accuracy_score(y_test, predictions) 24print("Accuracy:", accuracy)
In this code:
- Load the Iris dataset.
- Split the dataset into training and testing sets.
- Use SVM algorithm for classification.
- Train the model on the training data.
- Make predictions on the test data.
- Calculate and print the accuracy of the model.
This code performs a 3-class classification on the Iris dataset using SVM algorithm. The dataset is split into training and testing sets, and the accuracy of the model is calculated.
コメント 0
他のプロンプトもチェック
物語・脚本・プロット
推奨モデル - ClaudeTikTokでバズりたいクリエイター必見! このAI支援プロンプトを使えば、ずんだもんのダンス動画を簡単に企画できます。 トレンド分析からプロンプト作成まで、ステップバイステップで最適な動画コンテンツを生み出せます。 ターゲット層の設定、曲調選び、ダンスの雰囲気づくりなど、細部まで丁寧にサポート。 あなたのクリエイティビティを最大限に引き出し、TikTokで注目を集める動画を作り上げましょう! 初心者からプロまで、誰でも使える魔法のレシピです。 #ずんだもんTikTok #AIプロンプト #バズる動画作成 #TikTokクリエイター #ダンス動画企画 #コンテンツ制作 #トレンド分析 #バイラル戦略 #クリエイティブサポート #SNSマーケティング4014153画像生成
キャラクター作成
推奨モデル - Midjourney初心者でも簡単! 公開プロンプトを使って、オリジナルの水着美女を生成してみませんか? #SNS #Instagram #X #Twitter #TikTok #ChatGPT #画像生成 #マーケティング1012633SNS投稿
推奨モデル - Geminiショート動画でバズりやすいランキング形式の台本を一瞬で作成してくれるプロンプトです。 是非、このプロンプトを使ってショート動画をばずらせちゃってくださいね! #YouTube #Inatagram #TikTok #ショート動画180121622