Coder Social home page Coder Social logo

Comments (4)

lena-kashtelyan avatar lena-kashtelyan commented on April 29, 2024 1

Hi @surajgattani, can you just use the Ax Service API (AxClient, tutorial: https://ax.dev/tutorials/gpei_hartmann_service.html)? That should resolve all the issues you are facing.

from ax.

surajgattani avatar surajgattani commented on April 29, 2024 1

Thanks a lot @lena-kashtelyan -- Appreciate the quick response
I will try this out and post any questions that I might have!

from ax.

lena-kashtelyan avatar lena-kashtelyan commented on April 29, 2024

How can I update the save and load functions to maintain backwards compatibility with the old json files?

Do you mean you'd like to be able to load old experiments essentially? You should be able to load them as AxClient.load_from_json_file. Let me know how that works out for you!

from ax.

surajgattani avatar surajgattani commented on April 29, 2024

@lena-kashtelyan I was able to solve all the issues with the save and load experiment from json store.
Also, the example in the tutorial -- link explains the custom metric definition as well which allowed me to replace the evaluation function from the previous implementation.
I changed the custom definition a tiny bit marked with --> which worked for me:

from ax import Data
import pandas as pd
from ax.utils.common.result import Ok

class BoothMetric(Metric):
    def fetch_trial_data(self, trial):
        records = []
        for arm_name, arm in trial.arms_by_name.items():
            params = arm.parameters
            records.append(
                {
                    "arm_name": arm_name,
                    "metric_name": self.name,
                    "trial_index": trial.index,
                    # in practice, the mean and sem will be looked up based on trial metadata
                    # but for this tutorial we will calculate them
                    "mean": (params["x1"] + 2 * params["x2"] - 7) ** 2
                    + (2 * params["x1"] + params["x2"] - 5) ** 2,
                    "sem": 0.0,
                }
            )
        ---> return Ok(value=Data(df=pd.DataFrame.from_records(records)))

    def is_available_while_running(self) -> bool:
        return True

Thanks a lot for your quick response! Appreciate it

from ax.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.