Comments (3)
@Paethon - the plotting functionality was designed to work in both notebooks and in standalone html files that we use for generating "reports" that can be easily shared - so yes, other modes are definitely supported. We highlight the notebook usage on the site because in our experience that's the primary way users have interacted with the tool for visualizing the models & results.
Here's an example of how one can run the CNN on MNIST tutorial and get the contour plot in an html file:
import torch
import numpy as np
from ax.plot.contour import plot_contour
from ax.plot.trace import optimization_trace_single_method
from ax.service.managed_loop import optimize
from ax.utils.tutorials.cnn_utils import load_mnist, train, evaluate
# note these new imports!
from ax.plot.render import plot_config_to_html
from ax.utils.report.render import render_report_elements
dtype = torch.float
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
train_loader, valid_loader, test_loader = load_mnist()
def train_evaluate(parameterization):
net = train(train_loader=train_loader, parameters=parameterization, dtype=dtype, device=device)
return evaluate(
net=net,
data_loader=valid_loader,
dtype=dtype,
device=device,
)
best_parameters, values, experiment, model = optimize(
parameters=[
{"name": "lr", "type": "range", "bounds": [1e-6, 0.4], "log_scale": True},
{"name": "momentum", "type": "range", "bounds": [0.0, 1.0]},
],
evaluation_function=train_evaluate,
objective_name='accuracy',
)
plot_config = plot_contour(model=model, param_x='lr', param_y='momentum', metric_name='accuracy')
# create an Ax report
with open('report.html', 'w') as outfile:
outfile.write(render_report_elements(
"example_report",
html_elements=[plot_config_to_html(plot_config)],
header=False,
))
We're working on making the plotting a bit more modular (and not always depend on require.js), which will make it even easier to put together a barebones html file without using the render_report_elements
that handles the dependency management for you. I should note that when using the report functionality, you get access to a couple other utilities that make it easy to compose reports for viewing of results (see, e.g., benchmarking reports)
Are there other ways of plotting that you had in mind, or does outputting an html file work for you?
from ax.
Thanks!
Generating an HTML report is actually the best solution for me anyway. I found plot_config_to_html(plot_config)
and tried writing that directly to an html-file, but that did not really work out as intended 😄
from ax.
Great - happy that works for you. Once we do the refactor of the plotting, it should be possible to write plot_config_to_html(plot_config)
directly to HTML file and for that to work. Issue now is that you need a bunch of dependencies in the HTML head in order for rendering to work.
from ax.
Related Issues (20)
- Tracking of auxiliary metrics HOT 2
- `qMaxValueEntropy` doesn't seem to work with `ObjectiveProperties(minimize=True)` HOT 4
- when should we end the Bandit Optimization HOT 4
- Nontrivial parameter constraints HOT 2
- Can't control arguments in fit_gpytorch_mll under the hood. Getting ABNORMAL_TERMINATION_IN_LNSRCH warning HOT 1
- Different Errors when initializing my loop with Service API and Developer API HOT 7
- `_random_seed` not retained when using `ax_client.save_to_json_file()` and `AxClient.load_from_json_file()` HOT 2
- Question: SEBO optimization with parameter dependency | logistic parameter constrains HOT 4
- Tutorial Request: Deploying Runners on Clusters, Debugging Runners/Schedulers HOT 4
- Issue with tolerance for floating point and its relevance when using log_scale = True HOT 7
- Question: does Ax support working with Tensorflow models? HOT 2
- Feature Request: Conditional Parameter Constraints HOT 5
- Questions about define how to evaluate HOT 3
- get_countour_plot() not plotting all trials HOT 4
- Error: A list of 'ChoiceParameter' is not iterable HOT 4
- [Bug] Generation Strategy equality check error without call to repr HOT 1
- ax.dev, GitHub readme, and loop tutorial examples are ignoring `minimize` kwarg HOT 2
- Get Started code gives the same result regardless of random seed HOT 3
- Trouble with searching documentation (Algolia, API docs, etc.), for example `get_next_trials` HOT 1
- Issue when starting an AxClient with out-of-design points HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ax.