-
Notifications
You must be signed in to change notification settings - Fork 136
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
model: scratch: Create Linear Regression model #59
Comments
dffml/model/tensorflow/dffml_model_tensorflow/model/dnn.py Lines 149 to 187 in b6e45e8
@pdxjohnny I was implementing applicable features and found it leaded to the following functions. Do they need to be re-implemented or can I pick them up from dnn and change the conditions (for starters the feature length should be 2 and so on) |
And can you suggest me how to debug my code like how can I go about testing (for now checking that whether I have received data successfully or not)? |
Here's an outline for 2.a.iv and 2.a.v from https://docs.google.com/document/d/16u9Tev3O0CcUDe2nfikHmrO3Xnd4ASJ45myFgQLpvzM/edit#heading=h.s3lkoesyhz9v Is this what you're talking about? class SimpleLinearRegression(Model):
async def applicable_features(self, features):
if len(features) != 1:
raise ValueError("simple LR only supports a single feature")
if features[0].dtype() != int and features[0].dtype() != float:
raise ValueError("simple LR only supports int or float feature")
if features[0].length() != 1:
raise ValueError("simple LR only supports single values (non-matrix / array)")
features_we_care_about = [features[0].NAME]
return features_we_care_about
async def train(self, sources, features):
features_we_care_about = self.applicable_features(features)
async for repo in sources.with_features(features_we_care_about):
# Grab a subset of the feature data being stored within the repo
# The subset is the feature_we_care_about and the feature we are want to predict
feature_data = repo.features(features_we_care_about + [self.parent.config.predict])
xData.append(feature_data[features_we_care_about[0]])
yData.append(feature_data[self.parent.config.predict]) |
well, this is pretty simple and understandable, I was using dnn as my reference wherein applicable features lead to self.features which in turn lead to feature_feature_column (which ultimately checked the types). |
ya dnn is complicated by tensorflow APIs :) |
Assignee: @yashlamba
./scripts/create.sh model scratch
Then fill out model with your implementation of linear regression. (Maybe
linear.py
)The text was updated successfully, but these errors were encountered: