Sort by

recency

|

39 Discussions

|

  • + 0 comments

    To find the probable score in History when a student scores 10 in Physics, we can calculate the correlation between the two sets of scores using a linear regression model or another statistical method like least squares. You can check out this link for more on how to apply this method accurately. It's important to take note of the data and approach it methodically to ensure the accuracy of the prediction."

  • + 0 comments

    Pretty much of good responses!

    Hope you got the response!

  • + 0 comments

    Egg Freezing https://thaisuperiorart.com/social-egg-freezing

  • + 0 comments
    def predict(x, y):
        ex = sum(x) / len(x)
        ey = sum(y) / len(y)
        numerator = sum([(xi - ex) * (yi - ey) for xi, yi in zip(x, y)])
        denominator = sum([(xi - ex)**2 for xi in x])
        slope = numerator / denominator
        intercept = ey - (slope * ex)
        predict = slope * 10 + intercept
        return predict
    
    if __name__ == '__main__':
        feature_1 = "Physics Scores  15  12  8   8   7   7   7   6   5   3"
        feature_2 = "History Scores  10  25  17  11  13  17  20  13  9   15"
        feature_1 = [int(x) for x in feature_1.split() if x.isnumeric()]
        feature_2 = [int(x) for x in feature_2.split() if x.isnumeric()]
        result = predict(feature_1, feature_2)
        print(f'{result:.3f}')
    
  • + 1 comment
    class LR:
        def __init__(self):
            self.slope = None
            self.intercept = None
            
        def fit(self, x, y):
            x_avg = sum(x)/x.__len__()
            y_avg = sum(y)/y.__len__()
            numerator = sum([(a - x_avg)*(b - y_avg) for a,b in zip(x,y)])
            denominator = sum([(a - x_avg)**2 for a in x])
            self.slope = round(numerator/denominator, 3)
            self.intercept = y_avg - self.slope*x_avg
        def predict(self, x):
            if self.slope and self.intercept:
                return self.slope*x + self.intercept
            else:
                raise ModuleNotFoundError('predict is not found, call fit() before predict()')
            
    
    if __name__ == '__main__':
        if __name__ == '__main__':
            feature_1 = "Physics Scores  15  12  8   8   7   7   7   6   5   3"
            feature_2 = "History Scores  10  25  17  11  13  17  20  13  9   15"
            feature_1 = [int(x) for x in input().split() if x.isnumeric()]
            feature_2 = [int(x) for x in input().split() if x.isnumeric()]
            model = LR()
            model.fit(feature_1, feature_2)
            out = str(model.predict(10))
            out = out.split('.')
            print(float(out[0] + '.' + out[1][0]))