-
Notifications
You must be signed in to change notification settings - Fork 165
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
Add Compare Runs metric section #2798
Merged
openshift-merge-bot
merged 1 commit into
opendatahub-io:main
from
Gkrumbach07:story/RHOAIENG-2976-spike-determine-artifact-rendering-details
May 15, 2024
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
14 changes: 5 additions & 9 deletions
14
frontend/src/concepts/pipelines/apiHooks/mlmd/useGetArtifactTypes.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,18 @@ | ||
import React from 'react'; | ||
import { usePipelinesAPI } from '~/concepts/pipelines/context'; | ||
import { GetArtifactTypesRequest } from '~/third_party/mlmd'; | ||
import { ArtifactType, GetArtifactTypesRequest } from '~/third_party/mlmd'; | ||
import useFetchState, { FetchState, FetchStateCallbackPromise } from '~/utilities/useFetchState'; | ||
|
||
export const useGetArtifactTypeMap = (): FetchState<Record<number, string>> => { | ||
export const useGetArtifactTypes = (): FetchState<ArtifactType[]> => { | ||
const { metadataStoreServiceClient } = usePipelinesAPI(); | ||
|
||
const call = React.useCallback<FetchStateCallbackPromise<Record<number, string>>>(async () => { | ||
const call = React.useCallback<FetchStateCallbackPromise<ArtifactType[]>>(async () => { | ||
const request = new GetArtifactTypesRequest(); | ||
|
||
const res = await metadataStoreServiceClient.getArtifactTypes(request); | ||
|
||
const artifactTypeMap: Record<number, string> = {}; | ||
res.getArtifactTypesList().forEach((artifactType) => { | ||
artifactTypeMap[artifactType.getId()] = artifactType.getName(); | ||
}); | ||
return artifactTypeMap; | ||
return res.getArtifactTypesList(); | ||
}, [metadataStoreServiceClient]); | ||
|
||
return useFetchState(call, {}); | ||
return useFetchState(call, []); | ||
}; |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
121 changes: 121 additions & 0 deletions
121
frontend/src/concepts/pipelines/content/artifacts/charts/ROCCurve.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,121 @@ | ||
import React from 'react'; | ||
import { | ||
Chart, | ||
ChartAxis, | ||
ChartGroup, | ||
ChartLine, | ||
ChartVoronoiContainer, | ||
} from '@patternfly/react-charts'; | ||
import { | ||
chart_color_blue_100 as chartColorBlue100, | ||
chart_color_blue_200 as chartColorBlue200, | ||
chart_color_blue_300 as chartColorBlue300, | ||
chart_color_blue_400 as chartColorBlue400, | ||
chart_color_blue_500 as chartColorBlue500, | ||
chart_color_cyan_100 as chartColorCyan100, | ||
chart_color_cyan_200 as chartColorCyan200, | ||
chart_color_cyan_300 as chartColorCyan300, | ||
chart_color_cyan_400 as chartColorCyan400, | ||
chart_color_cyan_500 as chartColorCyan500, | ||
chart_color_black_100 as chartColorBlack100, | ||
} from '@patternfly/react-tokens'; | ||
|
||
export type ROCCurveConfig = { | ||
index: number; | ||
data: { | ||
name: string; | ||
x: number; | ||
y: number; | ||
index: number; | ||
}[]; | ||
}; | ||
|
||
export const RocCurveChartColorScale = [ | ||
chartColorBlue100.value, | ||
chartColorBlue200.value, | ||
chartColorBlue300.value, | ||
chartColorBlue400.value, | ||
chartColorBlue500.value, | ||
chartColorCyan100.value, | ||
chartColorCyan200.value, | ||
chartColorCyan300.value, | ||
chartColorCyan400.value, | ||
chartColorCyan500.value, | ||
]; | ||
|
||
type ROCCurveProps = { | ||
configs: ROCCurveConfig[]; | ||
maxDimension?: number; | ||
}; | ||
|
||
const ROCCurve: React.FC<ROCCurveProps> = ({ configs, maxDimension }) => { | ||
const width = Math.min(maxDimension || 800, 500); | ||
const height = width; | ||
const baseLineData = Array.from(Array(100).keys()).map((x) => ({ x: x / 100, y: x / 100 })); | ||
|
||
return ( | ||
<div style={{ width }}> | ||
<Chart | ||
ariaDesc="ROC Curve" | ||
ariaTitle="ROC Curve" | ||
containerComponent={ | ||
<ChartVoronoiContainer | ||
constrainToVisibleArea | ||
voronoiBlacklist={['baseline']} | ||
labels={({ datum }) => `threshold (Series #${datum.index + 1}): ${datum.name}`} | ||
/> | ||
} | ||
height={height} | ||
width={width} | ||
padding={{ bottom: 100, left: 100, right: 50, top: 50 }} | ||
legendAllowWrap | ||
legendPosition="bottom-left" | ||
legendData={configs.map((config) => ({ | ||
name: `Series #${config.index + 1}`, | ||
symbol: { | ||
fill: RocCurveChartColorScale[config.index % RocCurveChartColorScale.length], | ||
type: 'square', | ||
}, | ||
}))} | ||
> | ||
<ChartAxis | ||
showGrid | ||
dependentAxis | ||
label="True positive rate" | ||
tickValues={Array.from(Array(11).keys()).map((x) => x / 10)} | ||
/> | ||
<ChartAxis | ||
showGrid | ||
label="False positive rate" | ||
tickValues={Array.from(Array(21).keys()).map((x) => x / 20)} | ||
/> | ||
<ChartGroup> | ||
<ChartLine | ||
name="baseline" | ||
data={baseLineData} | ||
style={{ | ||
data: { | ||
strokeDasharray: '3,3', | ||
stroke: chartColorBlack100.value, | ||
}, | ||
}} | ||
/> | ||
{configs.map((config, idx) => ( | ||
<ChartLine | ||
key={idx} | ||
data={config.data} | ||
interpolation="basis" | ||
style={{ | ||
data: { | ||
stroke: RocCurveChartColorScale[config.index % RocCurveChartColorScale.length], | ||
}, | ||
}} | ||
/> | ||
))} | ||
</ChartGroup> | ||
</Chart> | ||
</div> | ||
); | ||
}; | ||
|
||
export default ROCCurve; |
70 changes: 70 additions & 0 deletions
70
...tend/src/concepts/pipelines/content/artifacts/charts/confusionMatrix/ConfusionMatrix.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
.confusionMatrix { | ||
margin: 20px; | ||
margin-right: 75px; | ||
display: flex; | ||
} | ||
|
||
.confusionMatrix-table { | ||
border-collapse: collapse; | ||
} | ||
|
||
.confusionMatrix-cell { | ||
border: solid 1px white; | ||
position: relative; | ||
text-align: center; | ||
vertical-align: middle; | ||
} | ||
|
||
.confusionMatrix-labelCell { | ||
text-align: right; | ||
white-space: nowrap; | ||
padding-right: 10px; | ||
} | ||
|
||
.confusionMatrix-gradientLegendOuter { | ||
display: flex; | ||
flex-direction: column; | ||
justify-content: space-between; | ||
} | ||
|
||
.confusionMatrix-gradientLegend { | ||
border-right: solid 1px #777; | ||
margin-left: 30px; | ||
min-width: 10px; | ||
position: relative; | ||
width: 10px; | ||
} | ||
|
||
.confusionMatrix-gradientLegendMaxOuter { | ||
top: 0; | ||
border-top: solid 1px #777; | ||
left: 100%; | ||
padding-left: 5px; | ||
position: absolute; | ||
width: 5px; | ||
} | ||
|
||
.confusionMatrix-gradientLegendMaxLabel { | ||
left: 15px; | ||
position: absolute; | ||
top: -7px; | ||
} | ||
|
||
.confusionMatrix-verticalMarker { | ||
writing-mode: vertical-lr; | ||
white-space: nowrap; | ||
} | ||
|
||
.confusionMatrix-markerLabel { | ||
border-top: solid 1px #777; | ||
left: 100%; | ||
padding-left: 5px; | ||
position: absolute; | ||
width: 5px; | ||
} | ||
|
||
.confusionMatrix-trueLabel { | ||
font-weight: bold; | ||
padding-left: 20px; | ||
} | ||
|
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this was added just to test out 500 px? Won't this always return 500?