Machine Learning News Hubb
Advertisement Banner
  • Home
  • Machine Learning
  • Artificial Intelligence
  • Big Data
  • Deep Learning
  • Edge AI
  • Neural Network
  • Contact Us
  • Home
  • Machine Learning
  • Artificial Intelligence
  • Big Data
  • Deep Learning
  • Edge AI
  • Neural Network
  • Contact Us
Machine Learning News Hubb
No Result
View All Result
Home Machine Learning

Image Processing for Leaf Classification | by Jam Wong | Jun, 2023

admin by admin
June 18, 2023
in Machine Learning


We now split our data to the train-validation sets (for grid search) and the test set (for inference).

X = df.drop(columns=['class',
'image']).copy().to_numpy()

y = df['class'].to_numpy()

X_trainval, X_test, y_trainval, y_test = train_test_split(
X, y, test_size=0.25, random_state=143, stratify=y
)

We define our hyperparameters and cross-validation strategy for the pipeline and fit the model.

rng = np.random.RandomState(143)

skfold = StratifiedKFold(n_splits=5, shuffle=True, random_state=rng)

pipeline = Pipeline([('scaler', StandardScaler()),
('classifier', LogisticRegression())])

param_grid = [
{
'classifier': [KNeighborsClassifier()],
'classifier__n_neighbors': [3, 5, 10, 15]
},
{
'classifier': [LogisticRegression(solver='saga', max_iter=10_000)],
'classifier__penalty': ['l1', 'l2'],
'classifier__C': [0.1, 1, 10]
},
{
'classifier': [SVC(random_state=rng)],
'classifier__kernel': ['linear', 'rbf'],
'classifier__C': [0.1, 1, 10]
},
{
'classifier': [RandomForestClassifier(random_state=rng)],
'classifier__n_estimators': [100, 150, 200],
'classifier__max_depth': [3, 5, 7]
},
{
'classifier': [GradientBoostingClassifier(random_state=rng)],
'classifier__n_estimators': [100, 150, 200],
'classifier__max_depth': [3, 5, 7]
}
]

gs = GridSearchCV(pipeline,
param_grid=param_grid,
cv=skfold,
verbose=1)

gs.fit(X_trainval, y_trainval)

This will provide us an optimal model that classifies the leaves most accurately. The next step is to evaluate this model on the test set.



Source link

Previous Post

How to Automate Document Workflows

Next Post

How GPT works: A Metaphoric Explanation of Key, Value, Query in Attention, using a Tale of Potion | by Lili Jiang | Jun, 2023

Next Post

How GPT works: A Metaphoric Explanation of Key, Value, Query in Attention, using a Tale of Potion | by Lili Jiang | Jun, 2023

2023 AI Index Report: AI Trends We Can Expect in the Future

Bonus: More extrapolated emoji

Related Post

Artificial Intelligence

16, 8, and 4-bit Floating Point Formats — How Does it Work? | by Dmitrii Eliuseev | Sep, 2023

by admin
September 30, 2023
Machine Learning

The Transformative Power of Machine Learning in Industrial IoT | by Ashish Jagdish Sharma | Sep, 2023

by admin
September 30, 2023
Machine Learning

Top 6 Accounts Payable KPIs to measure

by admin
September 30, 2023
Artificial Intelligence

Build a crop segmentation machine learning model with Planet data and Amazon SageMaker geospatial capabilities

by admin
September 30, 2023
Edge AI

The History of AI: How Generative AI Grew from Early Research

by admin
September 30, 2023
Artificial Intelligence

Energy Supply and Demand Optimisation: Mathematical Modelling Using Gurobi Python | by Kong You Liow | Sep, 2023

by admin
September 29, 2023

© Machine Learning News Hubb All rights reserved.

Use of these names, logos, and brands does not imply endorsement unless specified. By using this site, you agree to the Privacy Policy and Terms & Conditions.

Navigate Site

  • Home
  • Machine Learning
  • Artificial Intelligence
  • Big Data
  • Deep Learning
  • Edge AI
  • Neural Network
  • Contact Us

Newsletter Sign Up.

No Result
View All Result
  • Home
  • Machine Learning
  • Artificial Intelligence
  • Big Data
  • Deep Learning
  • Edge AI
  • Neural Network
  • Contact Us

© 2023 JNews - Premium WordPress news & magazine theme by Jegtheme.