Skip to content

Conversation

@JamesHollyer
Copy link
Contributor

@JamesHollyer JamesHollyer commented Apr 27, 2023

Motivation for features / changes

The goals is to allow for dynamic HParam columns in the data table. This means that we cannot have an enum like ColumnHeaderType be the unique identifier for the column headers because we cannot encapsulate all possible hparams into an enum.

Technical description of changes

This change adds a name and displayName field to the ColumnHeader interface. The goal here is to make name be the unique identifier for columns. However, this PR does not use these fields at all. It simply adds them. THERE IS NO FUNCTIONAL CHANGE in this PR.

Upcoming changes will switch the code over to start using the name as the unique identifier and display the displayName.

(For POC to see how this change fits in googlers see cl/526767686)

Screenshots of UI changes (or N/A)

N/A

Detailed steps to verify changes work correctly (as executed by you)

POC works

Alternate designs / implementations considered (or N/A)

There were many alternatives considered. In fact I do not believe this is going to be the final structure.

One option is to remove the type and add a category field
export interface ColumnHeader {
name: string;
displayName: string;
Category: ColumnCategory(STATIC, HPARAM, METRIC)
enabled: boolean;
}

However, deciding how to calculate the value based on hardcoded name strings does not seem ideal.

Another option is to have a hierarchy. I expect it to look like this:
Interface ColumnHeaderBase {
name: string;
displayName: string;
type: ColumnHeaderType;
enabled: boolean;
}

export interface StaticColumnHeader extends ColumnHeaderBase{
category: “STATIC”
}

export interface HParamColumnHeader extends ColumnHeaderBase{
category: “HParam”
source: enum(data, config,....);
differs:boolean;
}

ColumnHeader = StaticColumnHeader | HParamColumnHeader

This may be the final form that we go with however, we are not sure the source and differs attributes need to go here or somewhere else yet. All code which works with the type defined in this PR will work with this proposal as well.

Lastly, there is the option which is the same as the hierarchy option above but with StaticColumnHeader being the only interface with a "type" attribute. This is a valid possibility but, I have decided that it just adds unnecessary complexity by requiring a type check in many more places.

@JamesHollyer JamesHollyer force-pushed the ReformatColumnHeader branch 3 times, most recently from e4a04df to 78ad536 Compare April 28, 2023 02:07
@JamesHollyer JamesHollyer force-pushed the ReformatColumnHeader branch from 78ad536 to 5492ab4 Compare May 1, 2023 23:33
@JamesHollyer JamesHollyer requested a review from rileyajones May 2, 2023 07:57
Copy link
Contributor

@rileyajones rileyajones left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am aware that this PR does not contain any real functional changes and that it is just adding some metadata in a bunch of places.

I have gone through and checked each of the enabled statuses in the tests and could not find any inconsistencies.

ChangeDetectionStrategy,
Component,
Input,
OnDestroy,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Was this unused before?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry that should not have been in this PR. But, that is correct it was an unused import.

@JamesHollyer JamesHollyer merged commit 914f662 into tensorflow:master May 2, 2023
JamesHollyer added a commit that referenced this pull request May 3, 2023
## Motivation for features / changes
In #6346 we added a displayName attribute to the ColumnHeader. This PR
uses that name to be displayed in the headers.

## Technical description of changes
I removed lots of headers from a test since now we do not need to test
that each type has the proper text displayed.
rileyajones pushed a commit to rileyajones/tensorboard that referenced this pull request May 5, 2023
## Motivation for features / changes
In tensorflow#6346 we added a displayName attribute to the ColumnHeader. This PR
uses that name to be displayed in the headers.

## Technical description of changes
I removed lots of headers from a test since now we do not need to test
that each type has the proper text displayed.
JamesHollyer added a commit to JamesHollyer/tensorboard that referenced this pull request May 5, 2023
The goals is to allow for dynamic HParam columns in the data table. This
means that we cannot have an enum like ColumnHeaderType be the unique
identifier for the column headers because we cannot encapsulate all
possible hparams into an enum.

This change adds a name and displayName field to the ColumnHeader
interface. The goal here is to make name be the unique identifier for
columns. However, this PR does not use these fields at all. It simply
adds them. THERE IS NO FUNCTIONAL CHANGE in this PR.

Upcoming changes will switch the code over to start using the name as
the unique identifier and display the displayName.

(For POC to see how this change fits in googlers see cl/526767686)

N/A

POC works

There were many alternatives considered. In fact I do not believe this
is going to be the final structure.

One option is to remove the type and add a category field
export interface ColumnHeader {
  name: string;
  displayName: string;
  Category: ColumnCategory(STATIC, HPARAM, METRIC)
  enabled: boolean;
}

However, deciding how to calculate the value based on hardcoded name
strings does not seem ideal.

Another option is to have a hierarchy. I expect it to look like this:
Interface ColumnHeaderBase {
  name: string;
  displayName: string;
  type: ColumnHeaderType;
  enabled: boolean;
}

export interface StaticColumnHeader extends ColumnHeaderBase{
	category: “STATIC”
}

export interface HParamColumnHeader extends ColumnHeaderBase{
	category: “HParam”
        source: enum(data, config,....);
        differs:boolean;
}

ColumnHeader = StaticColumnHeader | HParamColumnHeader

This may be the final form that we go with however, we are not sure the
source and differs attributes need to go here or somewhere else yet. All
code which works with the type defined in this PR will work with this
proposal as well.

Lastly, there is the option which is the same as the hierarchy option
above but with StaticColumnHeader being the only interface with a "type"
attribute. This is a valid possibility but, I have decided that it just
adds unnecessary complexity by requiring a type check in many more
places.
JamesHollyer added a commit to JamesHollyer/tensorboard that referenced this pull request May 5, 2023
The goals is to allow for dynamic HParam columns in the data table. This
means that we cannot have an enum like ColumnHeaderType be the unique
identifier for the column headers because we cannot encapsulate all
possible hparams into an enum.

This change adds a name and displayName field to the ColumnHeader
interface. The goal here is to make name be the unique identifier for
columns. However, this PR does not use these fields at all. It simply
adds them. THERE IS NO FUNCTIONAL CHANGE in this PR.

Upcoming changes will switch the code over to start using the name as
the unique identifier and display the displayName.

(For POC to see how this change fits in googlers see cl/526767686)

N/A

POC works

There were many alternatives considered. In fact I do not believe this
is going to be the final structure.

One option is to remove the type and add a category field
export interface ColumnHeader {
  name: string;
  displayName: string;
  Category: ColumnCategory(STATIC, HPARAM, METRIC)
  enabled: boolean;
}

However, deciding how to calculate the value based on hardcoded name
strings does not seem ideal.

Another option is to have a hierarchy. I expect it to look like this:
Interface ColumnHeaderBase {
  name: string;
  displayName: string;
  type: ColumnHeaderType;
  enabled: boolean;
}

export interface StaticColumnHeader extends ColumnHeaderBase{
	category: “STATIC”
}

export interface HParamColumnHeader extends ColumnHeaderBase{
	category: “HParam”
        source: enum(data, config,....);
        differs:boolean;
}

ColumnHeader = StaticColumnHeader | HParamColumnHeader

This may be the final form that we go with however, we are not sure the
source and differs attributes need to go here or somewhere else yet. All
code which works with the type defined in this PR will work with this
proposal as well.

Lastly, there is the option which is the same as the hierarchy option
above but with StaticColumnHeader being the only interface with a "type"
attribute. This is a valid possibility but, I have decided that it just
adds unnecessary complexity by requiring a type check in many more
places.
JamesHollyer added a commit that referenced this pull request May 5, 2023
## Motivation for features / changes
In #6346 we updated the ColumnHeader interface. However, objects using
this interface are stored in localStorage. This checks localStorage to
ensure it has the new interface. If it does not then it ignores those
values.

## Technical description of changes
I am simply checking if the first value has the name property to ensure
the values are valid. I could do a more thorough check but it seems
unnecessary.

## Detailed steps to verify changes work correctly (as executed by you)
It worked for me when running locally.
JamesHollyer added a commit to JamesHollyer/tensorboard that referenced this pull request May 8, 2023
The goals is to allow for dynamic HParam columns in the data table. This
means that we cannot have an enum like ColumnHeaderType be the unique
identifier for the column headers because we cannot encapsulate all
possible hparams into an enum.

This change adds a name and displayName field to the ColumnHeader
interface. The goal here is to make name be the unique identifier for
columns. However, this PR does not use these fields at all. It simply
adds them. THERE IS NO FUNCTIONAL CHANGE in this PR.

Upcoming changes will switch the code over to start using the name as
the unique identifier and display the displayName.

(For POC to see how this change fits in googlers see cl/526767686)

N/A

POC works

There were many alternatives considered. In fact I do not believe this
is going to be the final structure.

One option is to remove the type and add a category field
export interface ColumnHeader {
  name: string;
  displayName: string;
  Category: ColumnCategory(STATIC, HPARAM, METRIC)
  enabled: boolean;
}

However, deciding how to calculate the value based on hardcoded name
strings does not seem ideal.

Another option is to have a hierarchy. I expect it to look like this:
Interface ColumnHeaderBase {
  name: string;
  displayName: string;
  type: ColumnHeaderType;
  enabled: boolean;
}

export interface StaticColumnHeader extends ColumnHeaderBase{
	category: “STATIC”
}

export interface HParamColumnHeader extends ColumnHeaderBase{
	category: “HParam”
        source: enum(data, config,....);
        differs:boolean;
}

ColumnHeader = StaticColumnHeader | HParamColumnHeader

This may be the final form that we go with however, we are not sure the
source and differs attributes need to go here or somewhere else yet. All
code which works with the type defined in this PR will work with this
proposal as well.

Lastly, there is the option which is the same as the hierarchy option
above but with StaticColumnHeader being the only interface with a "type"
attribute. This is a valid possibility but, I have decided that it just
adds unnecessary complexity by requiring a type check in many more
places.
JamesHollyer added a commit to JamesHollyer/tensorboard that referenced this pull request May 8, 2023
The goals is to allow for dynamic HParam columns in the data table. This
means that we cannot have an enum like ColumnHeaderType be the unique
identifier for the column headers because we cannot encapsulate all
possible hparams into an enum.

This change adds a name and displayName field to the ColumnHeader
interface. The goal here is to make name be the unique identifier for
columns. However, this PR does not use these fields at all. It simply
adds them. THERE IS NO FUNCTIONAL CHANGE in this PR.

Upcoming changes will switch the code over to start using the name as
the unique identifier and display the displayName.

(For POC to see how this change fits in googlers see cl/526767686)

N/A

POC works

There were many alternatives considered. In fact I do not believe this
is going to be the final structure.

One option is to remove the type and add a category field
export interface ColumnHeader {
  name: string;
  displayName: string;
  Category: ColumnCategory(STATIC, HPARAM, METRIC)
  enabled: boolean;
}

However, deciding how to calculate the value based on hardcoded name
strings does not seem ideal.

Another option is to have a hierarchy. I expect it to look like this:
Interface ColumnHeaderBase {
  name: string;
  displayName: string;
  type: ColumnHeaderType;
  enabled: boolean;
}

export interface StaticColumnHeader extends ColumnHeaderBase{
	category: “STATIC”
}

export interface HParamColumnHeader extends ColumnHeaderBase{
	category: “HParam”
        source: enum(data, config,....);
        differs:boolean;
}

ColumnHeader = StaticColumnHeader | HParamColumnHeader

This may be the final form that we go with however, we are not sure the
source and differs attributes need to go here or somewhere else yet. All
code which works with the type defined in this PR will work with this
proposal as well.

Lastly, there is the option which is the same as the hierarchy option
above but with StaticColumnHeader being the only interface with a "type"
attribute. This is a valid possibility but, I have decided that it just
adds unnecessary complexity by requiring a type check in many more
places.
JamesHollyer added a commit to JamesHollyer/tensorboard that referenced this pull request May 8, 2023
The goals is to allow for dynamic HParam columns in the data table. This
means that we cannot have an enum like ColumnHeaderType be the unique
identifier for the column headers because we cannot encapsulate all
possible hparams into an enum.

This change adds a name and displayName field to the ColumnHeader
interface. The goal here is to make name be the unique identifier for
columns. However, this PR does not use these fields at all. It simply
adds them. THERE IS NO FUNCTIONAL CHANGE in this PR.

Upcoming changes will switch the code over to start using the name as
the unique identifier and display the displayName.

(For POC to see how this change fits in googlers see cl/526767686)

N/A

POC works

There were many alternatives considered. In fact I do not believe this
is going to be the final structure.

One option is to remove the type and add a category field
export interface ColumnHeader {
  name: string;
  displayName: string;
  Category: ColumnCategory(STATIC, HPARAM, METRIC)
  enabled: boolean;
}

However, deciding how to calculate the value based on hardcoded name
strings does not seem ideal.

Another option is to have a hierarchy. I expect it to look like this:
Interface ColumnHeaderBase {
  name: string;
  displayName: string;
  type: ColumnHeaderType;
  enabled: boolean;
}

export interface StaticColumnHeader extends ColumnHeaderBase{
	category: “STATIC”
}

export interface HParamColumnHeader extends ColumnHeaderBase{
	category: “HParam”
        source: enum(data, config,....);
        differs:boolean;
}

ColumnHeader = StaticColumnHeader | HParamColumnHeader

This may be the final form that we go with however, we are not sure the
source and differs attributes need to go here or somewhere else yet. All
code which works with the type defined in this PR will work with this
proposal as well.

Lastly, there is the option which is the same as the hierarchy option
above but with StaticColumnHeader being the only interface with a "type"
attribute. This is a valid possibility but, I have decided that it just
adds unnecessary complexity by requiring a type check in many more
places.
JamesHollyer added a commit that referenced this pull request May 9, 2023
## Motivation for features / changes
These attributes were added in #6346. There were then made optional in
#6369 to fix sync issues. The internal issues have now been resolved and
this changes them back to required fields.
JamesHollyer added a commit to JamesHollyer/tensorboard that referenced this pull request May 9, 2023
The goals is to allow for dynamic HParam columns in the data table. This
means that we cannot have an enum like ColumnHeaderType be the unique
identifier for the column headers because we cannot encapsulate all
possible hparams into an enum.

This change adds a name and displayName field to the ColumnHeader
interface. The goal here is to make name be the unique identifier for
columns. However, this PR does not use these fields at all. It simply
adds them. THERE IS NO FUNCTIONAL CHANGE in this PR.

Upcoming changes will switch the code over to start using the name as
the unique identifier and display the displayName.

(For POC to see how this change fits in googlers see cl/526767686)

N/A

POC works

There were many alternatives considered. In fact I do not believe this
is going to be the final structure.

One option is to remove the type and add a category field
export interface ColumnHeader {
  name: string;
  displayName: string;
  Category: ColumnCategory(STATIC, HPARAM, METRIC)
  enabled: boolean;
}

However, deciding how to calculate the value based on hardcoded name
strings does not seem ideal.

Another option is to have a hierarchy. I expect it to look like this:
Interface ColumnHeaderBase {
  name: string;
  displayName: string;
  type: ColumnHeaderType;
  enabled: boolean;
}

export interface StaticColumnHeader extends ColumnHeaderBase{
	category: “STATIC”
}

export interface HParamColumnHeader extends ColumnHeaderBase{
	category: “HParam”
        source: enum(data, config,....);
        differs:boolean;
}

ColumnHeader = StaticColumnHeader | HParamColumnHeader

This may be the final form that we go with however, we are not sure the
source and differs attributes need to go here or somewhere else yet. All
code which works with the type defined in this PR will work with this
proposal as well.

Lastly, there is the option which is the same as the hierarchy option
above but with StaticColumnHeader being the only interface with a "type"
attribute. This is a valid possibility but, I have decided that it just
adds unnecessary complexity by requiring a type check in many more
places.
JamesHollyer added a commit that referenced this pull request May 10, 2023
## Motivation for features / changes
The eventual goal is to allow dynamic HParam columns in the data table.
To do this we introduced the name and displayName attributes to the
ColumnHeader in #6346. The name attribute is now going to be the unique
identifier for a column instead of the type enum.

## Technical description of changes
The SelectedStepRunData is used to hold the data for the table for a
specific run. Previously this was an object with an optional property
for all values of the ColumnHeaderType enum. This will no longer work as
these values need to be more dynamic to allow for all possible Hparam
values. This PR changes that object to add an array which holds all the
data points associated with the name of the column which they correspond
to.

Unfortunately this breaks the sorting as the array of
SelectedStepRunData which is passed to the DataTable is sorted based on
which header type the user chose to sort by. So that had to be updated
to use the name of the column which the user chose to sort by.

## Alternate designs / implementations considered (or N/A)
I thought about adding a new field to the SelectedStepRunData object
called HParam value and keeping all the optional attributes. This was a
big headache for ordering and sorting.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants