एंथ्रोपोलॉजी में लीनियर मॉडल
यदि आपको हजारों साल पहले जीवित किसी वयस्क मानव का कंकाल का एक हिस्सा मिला, तो आप उस व्यक्ति की ऊँचाई का अनुमान कैसे लगाएंगे? यह अभ्यास आंशिक रूप से फॉरेंसिक एंथ्रोपोलॉजिस्ट मिल्ड्रेड ट्रॉटर के काम से प्रेरित है, जिन्होंने मानव "लॉन्ग बोन्स" या फीमर से कद (stature) का अनुमान निकालने के लिए एक रिग्रेशन मॉडल बनाया, जो आज भी आम तौर पर इस्तेमाल होता है.
इस अभ्यास में, आप कई जीवित लोगों के डेटा और Python लाइब्रेरी scikit-learn का उपयोग करके एक लीनियर मॉडल बनाएँगे, जो फीमर (जाँघ की हड्डी) की लंबाई को व्यक्ति के "stature" (कुल ऊँचाई) से जोड़ता है. फिर, आप अपने मॉडल को लागू करके अपने प्राचीन पूर्वज की ऊँचाई के बारे में भविष्यवाणी करेंगे.

यह अभ्यास पाठ्यक्रम का हिस्सा है
Python में Linear Modeling परिचय
अभ्यास निर्देश
sklearn.linear_modelसेLinearRegressionimport करें औरfit_intercept=Falseके साथ मॉडल initialize करें.- पहले से लोड किए गए डेटा arrays
legsऔरheightsको "1-by-N" से "N-by-1" arrays में reshape करें. - Reshape किए गए arrays
legsऔरheightsकोmodel.fit()में पास करें. - नए मिले fossil
fossil_leg = 50.7के लिएmodel.predict()का उपयोग करकेfossil_heightमान predict करें.
इंटरैक्टिव व्यावहारिक अभ्यास
इस अभ्यास को इस नमूना कोड को पूरा करके आज़माएँ।
# import the sklearn class LinearRegression and initialize the model
from sklearn.____ import ____
model = LinearRegression(fit_intercept=False)
# Prepare the measured data arrays and fit the model to them
legs = legs.reshape(len(____),1)
heights = heights.reshape(len(____),1)
model.fit(____, heights)
# Use the fitted model to make a prediction for the found femur
fossil_leg = np.array(50.7).reshape(1, -1)
fossil_height = model.predict(____)
print("Predicted fossil height = {:0.2f} cm".format(fossil_height[0,0]))