未验证 提交 2c30dccc 编写于 作者: P Peter Pan 提交者: GitHub

fix: iteration state error when change dimensional in high-dimensional page (#936)

上级 74e2185f
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
import React, {FunctionComponent, useCallback, useState} from 'react'; import React, {FunctionComponent, useCallback, useEffect, useState} from 'react';
import Button from '~/components/Button'; import Button from '~/components/Button';
import Field from '~/components/Field'; import Field from '~/components/Field';
...@@ -33,6 +33,7 @@ export type TSNEDetailProps = { ...@@ -33,6 +33,7 @@ export type TSNEDetailProps = {
iteration: number; iteration: number;
perplexity: number; perplexity: number;
learningRate: number; learningRate: number;
is3D: boolean;
onChangePerplexity?: (perplexity: number) => void; onChangePerplexity?: (perplexity: number) => void;
onChangeLearningRate?: (learningRate: number) => void; onChangeLearningRate?: (learningRate: number) => void;
onPause?: () => void; onPause?: () => void;
...@@ -45,6 +46,7 @@ const TSNEDetail: FunctionComponent<TSNEDetailProps> = ({ ...@@ -45,6 +46,7 @@ const TSNEDetail: FunctionComponent<TSNEDetailProps> = ({
iteration, iteration,
perplexity, perplexity,
learningRate, learningRate,
is3D,
onChangePerplexity, onChangePerplexity,
onChangeLearningRate, onChangeLearningRate,
onPause, onPause,
...@@ -98,6 +100,11 @@ const TSNEDetail: FunctionComponent<TSNEDetailProps> = ({ ...@@ -98,6 +100,11 @@ const TSNEDetail: FunctionComponent<TSNEDetailProps> = ({
}); });
}, [onRerun, onStop]); }, [onRerun, onStop]);
useEffect(() => {
setPaused(false);
setStopped(false);
}, [is3D]);
return ( return (
<> <>
<Field label={t('high-dimensional:perplexity')}> <Field label={t('high-dimensional:perplexity')}>
......
...@@ -364,6 +364,7 @@ const HighDimensional: FunctionComponent = () => { ...@@ -364,6 +364,7 @@ const HighDimensional: FunctionComponent = () => {
iteration={(data as TSNEResult)?.step ?? 0} iteration={(data as TSNEResult)?.step ?? 0}
perplexity={perplexity} perplexity={perplexity}
learningRate={learningRate} learningRate={learningRate}
is3D={is3D}
onChangePerplexity={setPerplexity} onChangePerplexity={setPerplexity}
onChangeLearningRate={setLearningRate} onChangeLearningRate={setLearningRate}
onPause={chart.current?.pauseTSNE} onPause={chart.current?.pauseTSNE}
...@@ -377,7 +378,7 @@ const HighDimensional: FunctionComponent = () => { ...@@ -377,7 +378,7 @@ const HighDimensional: FunctionComponent = () => {
default: default:
return null as never; return null as never;
} }
}, [reduction, dimension, data, perplexity, learningRate, neighbors, runUMAP]); }, [reduction, dimension, data, perplexity, learningRate, is3D, neighbors, runUMAP]);
const aside = useMemo( const aside = useMemo(
() => ( () => (
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册