def index(): "Estimate Time and Prediction Interval (UPI, LPI)" # use historical data of actual object size (LOC) and time to calculate # development time based on planned LOC [HUMPHREY95] pp.153-155 #TODO: calculate Upper and Lower Prediction Interval form = SQLFORM.factory( Field("size", "integer", default=request.vars.planned_loc, comment="Planned size (estimated LOC)"), Field("prediction_interval", "integer", default="70", requires=IS_INT_IN_RANGE(0, 100), comment="Percentage (for LPI, UPI)"), Field("project_id", db.psp_project, requires=IS_IN_DB(db, db.psp_project.project_id, "%(name)s"), comment="Project to update plan"), ) if form.accepts(request.vars, session): # calculate regression parameters for historical LOC and tiem data: actual_loc, hours = get_projects_metrics() b0, b1 = calc_linear_regression(actual_loc, hours) # get LOC planned size and calculate development time size_k = form.vars.size time_t = b0 + b1 * size_k alpha = form.vars.prediction_interval / 100.0 redirect( URL("update_plan", args=form.vars.project_id, vars={ 'size_k': size_k, 'time_t': time_t, 'alpha': alpha })) return {'form': form}
def index(): "Estimate Time and Prediction Interval (UPI, LPI)" # use historical data of actual object size (LOC) and time to calculate # development time based on planned LOC [HUMPHREY95] pp.153-155 # TODO: calculate Upper and Lower Prediction Interval form = SQLFORM.factory( Field("size", "integer", default=request.vars.planned_loc, comment="Planned size (estimated LOC)"), Field( "prediction_interval", "integer", default="70", requires=IS_INT_IN_RANGE(0, 100), comment="Percentage (for LPI, UPI)", ), Field( "project_id", db.psp_project, requires=IS_IN_DB(db, db.psp_project.project_id, "%(name)s"), comment="Project to update plan", ), ) if form.accepts(request.vars, session): # calculate regression parameters for historical LOC and tiem data: actual_loc, hours = get_projects_metrics() b0, b1 = calc_linear_regression(actual_loc, hours) # get LOC planned size and calculate development time size_k = form.vars.size time_t = b0 + b1 * size_k alpha = form.vars.prediction_interval / 100.0 redirect( URL("update_plan", args=form.vars.project_id, vars={"size_k": size_k, "time_t": time_t, "alpha": alpha}) ) return {"form": form}
def linear_regression(): b0, b1 = calc_linear_regression(x_values, y_values) return {'b0': b0, 'b1': b1, 'ok': round(b0,3)==-0.351 and round(b1,3)==0.095}