[{"data":1,"prerenderedAt":265},["ShallowReactive",2],{"$cL3_QrcbnL":3},{"id":4,"title":5,"body":6,"description":248,"extension":258,"meta":259,"navigation":260,"path":261,"seo":262,"stem":263,"__hash__":264},"content/modules/preprocessing/feature-scaling/content.md","Feature Scaling",{"type":7,"value":8,"toc":247},"minimark",[9,13,18,22,26,29,42,45,49,60,68,79,84,95,100,108,113,121,125,134,137,144,148,159,163,174,178,186,190,199,226,230,233],[10,11,5],"h1",{"id":12},"feature-scaling",[14,15,17],"h2",{"id":16},"introduction","Introduction",[19,20,21],"p",{},"Feature scaling is a crucial preprocessing step in machine learning that transforms features to a similar scale. Many machine learning algorithms perform better or converge faster when features are on a similar scale.",[14,23,25],{"id":24},"why-feature-scaling-matters","Why Feature Scaling Matters",[19,27,28],{},"Different features often have different units and ranges. For example:",[30,31,32,36,39],"ul",{},[33,34,35],"li",{},"Age: 0-100 years",[33,37,38],{},"Income: $0-$1,000,000",[33,40,41],{},"Height: 0-250 cm",[19,43,44],{},"Without scaling, features with larger ranges can dominate the learning process, leading to poor model performance.",[14,46,48],{"id":47},"normalization-min-max-scaling","Normalization (Min-Max Scaling)",[19,50,51,56],{},[52,53],"img",{"alt":54,"src":55},"Feature Scaling Comparison","https://upload.wikimedia.org/wikipedia/commons/thumb/d/d8/Comparison_of_normalization_methods.svg/500px-Comparison_of_normalization_methods.svg.png",[57,58,59],"em",{},"Comparison of different feature scaling methods",[19,61,62,63,67],{},"Normalization scales features to a fixed range, typically ",[64,65,66],"span",{},"0, 1",".",[19,69,70,74,75],{},[71,72,73],"strong",{},"Formula:"," ",[76,77,78],"code",{},"(x - min) / (max - min)",[19,80,81],{},[71,82,83],{},"When to use:",[30,85,86,89,92],{},[33,87,88],{},"When you need bounded values",[33,90,91],{},"For algorithms that don't assume any distribution (e.g., neural networks, KNN)",[33,93,94],{},"When features have different units",[19,96,97],{},[71,98,99],{},"Pros:",[30,101,102,105],{},[33,103,104],{},"Preserves the shape of the original distribution",[33,106,107],{},"Bounded values are useful for some algorithms",[19,109,110],{},[71,111,112],{},"Cons:",[30,114,115,118],{},[33,116,117],{},"Sensitive to outliers",[33,119,120],{},"Doesn't center the data",[14,122,124],{"id":123},"standardization-z-score-normalization","Standardization (Z-Score Normalization)",[19,126,127,131],{},[52,128],{"alt":129,"src":130},"Standardization vs Normalization","https://upload.wikimedia.org/wikipedia/commons/thumb/0/0c/Standard_deviation_diagram.svg/500px-Standard_deviation_diagram.svg.png",[57,132,133],{},"Standard deviation and normal distribution in standardization",[19,135,136],{},"Standardization transforms features to have mean = 0 and standard deviation = 1.",[19,138,139,74,141],{},[71,140,73],{},[76,142,143],{},"(x - mean) / std",[19,145,146],{},[71,147,83],{},[30,149,150,153,156],{},[33,151,152],{},"For algorithms that assume normally distributed data (e.g., linear regression, logistic regression)",[33,154,155],{},"When you want to preserve outlier information",[33,157,158],{},"For algorithms using distance metrics",[19,160,161],{},[71,162,99],{},[30,164,165,168,171],{},[33,166,167],{},"Less sensitive to outliers than normalization",[33,169,170],{},"Centers the data around zero",[33,172,173],{},"Preserves outlier information",[19,175,176],{},[71,177,112],{},[30,179,180,183],{},[33,181,182],{},"Doesn't produce bounded values",[33,184,185],{},"Assumes features are normally distributed",[14,187,189],{"id":188},"key-takeaways","Key Takeaways",[19,191,192,196],{},[52,193],{"alt":194,"src":195},"Feature Scaling Impact","https://upload.wikimedia.org/wikipedia/commons/thumb/e/ed/Comparison_of_three_stock_indices.svg/500px-Comparison_of_three_stock_indices.svg.png",[57,197,198],{},"Impact of feature scaling on data with different ranges",[200,201,202,208,214,220],"ol",{},[33,203,204,207],{},[71,205,206],{},"Always scale your features"," when using distance-based algorithms (KNN, SVM, neural networks)",[33,209,210,213],{},[71,211,212],{},"Choose the right method"," based on your data distribution and algorithm requirements",[33,215,216,219],{},[71,217,218],{},"Fit on training data only"," and apply the same transformation to test data",[33,221,222,225],{},[71,223,224],{},"Scale after splitting"," your data to avoid data leakage",[14,227,229],{"id":228},"interactive-exploration","Interactive Exploration",[19,231,232],{},"Use the controls to:",[30,234,235,238,241,244],{},[33,236,237],{},"Switch between normalization and standardization",[33,239,240],{},"Adjust the number of samples and feature range",[33,242,243],{},"Observe how each method transforms the data distribution",[33,245,246],{},"Compare statistics before and after scaling",{"title":248,"searchDepth":249,"depth":250,"links":251},"",2,3,[252,253,254,255,256,257],{"id":16,"depth":249,"text":17},{"id":24,"depth":249,"text":25},{"id":47,"depth":249,"text":48},{"id":123,"depth":249,"text":124},{"id":188,"depth":249,"text":189},{"id":228,"depth":249,"text":229},"md",{},true,"/modules/preprocessing/feature-scaling/content",{"title":5,"description":248},"modules/preprocessing/feature-scaling/content","lXR5CZRiK3Z2_2M6KWe2MkjYTf4sRtDNdOc9C_AlvEE",1792223550814]