Feature engineering

प्रोडक्शन के लिए मशीन लर्निंग मॉडल विकसित करना

Sinan Ozdemir

Data Scientist and Author

Feature engineering का परिचय

  • प्रशिक्षण डेटा को बदलना ताकि ML पाइपलाइन का प्रदर्शन अधिकतम हो
  • computation complexity घटाना
  • उदाहरण
    • कई स्रोतों से डेटा एकत्र करना
    • नए फीचर बनाना
    • फीचर ट्रांसफॉर्मेशन लागू करना

feature engineering pipeline

1 https://www.manning.com/books/feature-engineering-bookcamp
प्रोडक्शन के लिए मशीन लर्निंग मॉडल विकसित करना

कई स्रोतों से डेटा एग्रीगेशन

  • अलग-अलग डेटासेट से डेटा जोड़ना
  • कई प्रकार के डेटा का उपयोग करना (जैसे numerical और categorical)

यह मदद करता है:

  • मॉडलों की accuracy बढ़ाने में
  • और जटिल मॉडलों के उपयोग में सक्षम बनाने में

स्क्रीन पर ग्राफ

प्रोडक्शन के लिए मशीन लर्निंग मॉडल विकसित करना

डेटा एग्रीगेशन का उदाहरण

class DataAggregator:
    def __init__(self):
        pass

    def fit(self, X, y=None):
        return self  # nothing to fit

    def transform(self, X, y=None):
        # Load data from multiple sources
        data1 = pd.read_csv('data1.csv')
        data2 = pd.read_csv('data2.csv')
        data3 = pd.read_csv('data3.csv')

        # Combine data from all sources (including X) into a single data frame
        aggregated_data = pd.concat([X, data1, data2, data3], axis=0)

        return aggregated_data  # Return aggregated data
प्रोडक्शन के लिए मशीन लर्निंग मॉडल विकसित करना

Feature construction

  • मौजूद फीचर्स से नए फीचर्स बनाना
  • प्री-एग्जिस्टिंग डेटा से नए फीचर्स जनरेट करना
  • मॉडल प्रदर्शन सुधारना
  • मॉडल की व्याख्यात्मकता बढ़ाना
प्रोडक्शन के लिए मशीन लर्निंग मॉडल विकसित करना

Feature construction का उदाहरण

class FeatureConstructor:
    def __init__(self):
        pass

    def fit(self, X, y=None):
        return self

    def transform(self, X, y=None):
        # Calculate the mean of each column in the data
        mean_values = X.mean()

        # Create new features based on the mean values
        X['mean_col1'] = X['col1'] - mean_values['col1']
        X['mean_col2'] = X['col2'] - mean_values['col2']

        return X  # Return the augmented data set
प्रोडक्शन के लिए मशीन लर्निंग मॉडल विकसित करना

Feature transformations

मौजूदा फीचर्स को वहीं ट्रांसफॉर्म करना

  • डेटा डिस्ट्रीब्यूशन्स को normalize करना
  • outliers हटाना
  • मॉडल की accuracy और प्रदर्शन सुधारना
```py
```py

प्रोडक्शन के लिए मशीन लर्निंग मॉडल विकसित करना

Feature selection

बड़े फीचर सेट से आवश्यक subset चुनना, और अनावश्यक/अप्रासंगिक फीचर्स हटाना

  • overfitting घटाता है
  • मॉडल की accuracy और प्रदर्शन बढ़ाता है
  • मॉडल की व्याख्यात्मकता सुधारता है

feature selection

1 https://www.manning.com/books/feature-engineering-bookcamp
प्रोडक्शन के लिए मशीन लर्निंग मॉडल विकसित करना

Feature engineering उदाहरण (जारी)

```py
import pandas as pd
from sklearn.preprocessing import StandardScaler
from sklearn.feature_selection import SelectKBest, chi2

from sklearn.pipeline import Pipeline

pipeline = Pipeline([  # Define feature engineering pipeline

    ('aggregate', DataAggregator()),  # Aggregate data from multiple sources
    ('construction', FeatureConstructor()),  # Feature Construction

    ('scaler', StandardScaler()),  # Feature Transformation

    ('select', SelectKBest(chi2, k=10)),  # Feature Selection
])
X_transformed = pipeline.fit_transform(X)  # Fit and transform data using pipeline
प्रोडक्शन के लिए मशीन लर्निंग मॉडल विकसित करना

Feature engineering पर और जानें

fe book

प्रोडक्शन के लिए मशीन लर्निंग मॉडल विकसित करना

अभ्यास करते हैं!

प्रोडक्शन के लिए मशीन लर्निंग मॉडल विकसित करना

Preparing Video For Download...