DEV Community

Daniel Hall
Daniel Hall

Posted on

I trained an AI to recommend facials based on your skin type: this is how I programmed it

Wow, seriously? Ever spent hours browsing treatments, only to end up confused at the spa counter—until I said, “There’s gotta be a smarter way!”

Context / Problem

I once tried picking a facial with a friend… ended up with red, irritated skin [sic]. That day I thought, why not let AI suggest the perfect treatment? It turns out, machine learning can help you find the right facial, just like a trusted esthetician.

Microdermabrasion Chicago IL

5 Key Concepts (in casual terms)

  1. Data collection: survey skin profiles
  2. Preprocessing: clean and normalize info
  3. Model training: teach the AI patterns
  4. Inference: predict best facial
  5. Recommendation mapping: link to local spas

How to Build Your Facial Recommender

1. Import Libraries

First off, grab your Python tools.

import pandas as pd
import numpy as np
import tensorflow as tf
Enter fullscreen mode Exit fullscreen mode

2. Load Skin Data

Read your CSV of survey results.

data = pd.read_csv('skin_profiles.csv')
profiles = data[['oily', 'dry', 'sensitive', 'age']]
Enter fullscreen mode Exit fullscreen mode

3. Preprocess Inputs

Normalize values for training.

from sklearn.preprocessing import StandardScaler

scaler = StandardScaler()
X = scaler.fit_transform(profiles)
y = data['recommended_facial']
Enter fullscreen mode Exit fullscreen mode

4. Build the Model

A simple feed‑forward network.

model = tf.keras.models.Sequential([
  tf.keras.layers.Dense(16, activation='relu', input_shape=(X.shape[1],)),
  tf.keras.layers.Dense(8, activation='relu'),
  tf.keras.layers.Dense(len(y.unique()), activation='softmax')
])
Enter fullscreen mode Exit fullscreen mode

5. Compile & Train

Let it learn the patterns.

model.compile(optimizer='adam', loss='sparse_categorical_crossentropy', metrics=['accuracy'])
history = model.fit(X, y, epochs=20, validation_split=0.2)
Enter fullscreen mode Exit fullscreen mode

6. Evaluate Performance

Check its accuracy.

loss, acc = model.evaluate(X, y)
print(f"Model accuracy: {acc*100:.2f}%")
Enter fullscreen mode Exit fullscreen mode

7. Save the Model

Reuse without retraining.

model.save('facial_recommender.h5')
Enter fullscreen mode Exit fullscreen mode

8. Load & Predict

Get a recommendation for new input.

from tensorflow.keras.models import load_model

model = load_model('facial_recommender.h5')
new = scaler.transform([[1, 0, 0, 30]])  # oily, not dry, not sensitive, age 30
pred = model.predict(new)
Enter fullscreen mode Exit fullscreen mode

9. Map to Treatments

Convert numeric output to spa treatments.

facials = ['Hydrafacial', 'Gentle Peel', 'Microdermabrasion']
recommended = facials[np.argmax(pred)]
Enter fullscreen mode Exit fullscreen mode

10. Link to Local Services

Guide users to book.

I integrated links like Microdermabrasion Chicago seamlessly so you can find that exact facial, then refined suggestions for Microdermabrasion Chicago IL or Microdermabrasion in Chicago based on zip code.


Benefits to You

  • You get personalized facials—no guesswork.
  • Saves time—you book the right treatment first try.
  • It’s like having a digital esthetician in your pocket.
  • Perfect for newbies—you don’t need skincare jargon.
  • Fun project—you learn Python and ML at once.

Conclusion + Call to Action

Give it a try this week—train on your own skin data and let the AI surprise you! Share your own tweaks in the comments below—can’t wait to see your versions!

Top comments (0)