Skip to content
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

Pass hyper params from client #21

Merged
merged 6 commits into from
May 13, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
updated api
SamuelGabriel committed May 8, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
commit c474a9d1cc156b0f9237ee1265a9395b34c94ba9
2 changes: 1 addition & 1 deletion quick_test.py
Original file line number Diff line number Diff line change
@@ -32,7 +32,7 @@

else:
tabpfn_classifier.init()
tabpfn = TabPFNClassifier(model="latest_tabpfn_hosted")
tabpfn = TabPFNClassifier(model="latest_tabpfn_hosted", n_estimators=3)
# print("checking estimator", check_estimator(tabpfn))
tabpfn.fit(X_train[:99], y_train[:99])
print("predicting")
2 changes: 1 addition & 1 deletion tabpfn_client/client.py
Original file line number Diff line number Diff line change
@@ -133,7 +133,7 @@ def predict(self, train_set_uid: str, x_test, tabpfn_config: dict | None=None):

self._validate_response(response, "predict")

return np.array(response.json()["y_pred"])
return np.array(response.json()["y_pred_proba"])

@staticmethod
def _validate_response(response, method_name, only_version_check=False):
2 changes: 1 addition & 1 deletion tabpfn_client/prompt_agent.py
Original file line number Diff line number Diff line change
@@ -51,7 +51,7 @@ def prompt_and_set_token(cls, user_auth_handler: "UserAuthenticationClient"):
# Registration
if choice == "1":
# validation_link = input(cls.indent("Please enter your secret code: "))
validation_link = "tabpfn-2023"
validation_link = "tabpfn-test"
while True:
email = input(cls.indent("Please enter your email: "))
# Send request to server to check if email is valid and not already taken.
13 changes: 7 additions & 6 deletions tabpfn_client/server_config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
## testing
#protocol: "http"
#host: "0.0.0.0"
#port: "8000"
protocol: "http"
host: "localhost"
port: "8080"

# production
protocol: "https"
host: "tabpfn-server-wjedmz7r5a-ez.a.run.app"
port: "443"
#protocol: "https"
#host: "tabpfn-server-wjedmz7r5a-ez.a.run.app"
#host: tabpfn-server-preprod-wjedmz7r5a-ez.a.run.app # preprod
#port: "443"
endpoints:
root:
path: "/"
2 changes: 1 addition & 1 deletion tabpfn_client/tabpfn_common_utils
2 changes: 1 addition & 1 deletion tabpfn_client/tests/integration/test_tabpfn_classifier.py
Original file line number Diff line number Diff line change
@@ -43,7 +43,7 @@ def test_use_remote_tabpfn_classifier(self, mock_server):
# mock prediction
mock_server.router.post(mock_server.endpoints.predict.path).respond(
200,
json={"y_pred": LocalTabPFNClassifier().fit(self.X_train, self.y_train).predict_proba(self.X_test).tolist()}
json={"y_pred_proba": LocalTabPFNClassifier().fit(self.X_train, self.y_train).predict_proba(self.X_test).tolist()}
)
pred = tabpfn.predict(self.X_test)
self.assertEqual(pred.shape[0], self.X_test.shape[0])
4 changes: 2 additions & 2 deletions tabpfn_client/tests/unit/test_client.py
Original file line number Diff line number Diff line change
@@ -91,15 +91,15 @@ def test_predict_with_valid_train_set_and_test_set(self, mock_server):

self.client.upload_train_set(self.X_train, self.y_train)

dummy_result = {"y_pred": [1, 2, 3]}
dummy_result = {"y_pred_proba": [1, 2, 3]}
mock_server.router.post(mock_server.endpoints.predict.path).respond(
200, json=dummy_result)

pred = self.client.predict(
train_set_uid=dummy_json["train_set_uid"],
x_test=self.X_test
)
self.assertTrue(np.array_equal(pred, dummy_result["y_pred"]))
self.assertTrue(np.array_equal(pred, dummy_result["y_pred_proba"]))

@with_mock_server()
def test_add_user_information(self, mock_server):
2 changes: 1 addition & 1 deletion tabpfn_client/tests/unit/test_tabpfn_classifier.py
Original file line number Diff line number Diff line change
@@ -52,7 +52,7 @@ def test_init_remote_classifier(self, mock_server, mock_prompt_for_terms_and_con
mock_predict_response = [[1, 0.],[.9, .1],[0.01, 0.99]]
predict_route = mock_server.router.post(mock_server.endpoints.predict.path)
predict_route.respond(
200, json={"y_pred": mock_predict_response}
200, json={"y_pred_proba": mock_predict_response}
)

tabpfn_classifier.init(use_server=True)
Loading