@@ -17,12 +17,7 @@ import {PolymerElement} from '@polymer/polymer';
1717import '../../../components/polymer/irons_and_papers' ;
1818import { LegacyElementMixin } from '../../../components/polymer/legacy_element_mixin' ;
1919import * as d3 from '../../../webapp/third_party/d3' ;
20- import {
21- ColorOption ,
22- ColumnStats ,
23- Projection ,
24- SpriteAndMetadataInfo ,
25- } from './data' ;
20+ import { ColorOption , ColumnStats , SpriteAndMetadataInfo } from './data' ;
2621import {
2722 DataProvider ,
2823 EmbeddingInfo ,
@@ -63,22 +58,13 @@ class DataPanel extends LegacyElementMixin(PolymerElement) {
6358 metadataEditorColumn : string ;
6459 @property ( { type : Boolean } )
6560 metadataEditorButtonDisabled : boolean ;
66- @property ( { type : String } )
67- superviseInput : string ;
68- @property ( { type : String } )
69- superviseInputLabel : string = 'Ignored label' ;
70- @property ( { type : String } )
71- superviseColumn : string ;
72- @property ( { type : Boolean } )
73- showSuperviseSettings : boolean = false ;
7461
7562 @property ( { type : String } )
7663 readonly _wordDelimiter = '[/=_,-]' ;
7764
7865 private labelOptions : string [ ] ;
7966 private colorOptions : ColorOption [ ] ;
8067 forceCategoricalColoring : boolean = false ;
81- private superviseInputSelected : string ;
8268 private selectedPointIndices : number [ ] ;
8369 private neighborsOfFirstPoint : knn . NearestEntry [ ] ;
8470 private dataProvider : DataProvider ;
@@ -97,7 +83,6 @@ class DataPanel extends LegacyElementMixin(PolymerElement) {
9783 ready ( ) {
9884 super . ready ( ) ;
9985 this . normalizeData = true ;
100- this . superviseInputSelected = '' ;
10186 }
10287 initialize ( projector : any , dp : DataProvider ) {
10388 this . projector = projector ;
@@ -180,27 +165,6 @@ class DataPanel extends LegacyElementMixin(PolymerElement) {
180165 // Make the default label the first non-numeric column.
181166 this . metadataEditorColumn = this . metadataFields [ Math . max ( 0 , labelIndex ) ] ;
182167 }
183- if (
184- this . superviseColumn == null ||
185- this . metadataFields . filter ( ( name ) => name === this . superviseColumn )
186- . length === 0
187- ) {
188- // Make the default supervise class the first non-numeric column.
189- this . superviseColumn = this . metadataFields [ Math . max ( 0 , labelIndex ) ] ;
190- this . superviseInput = '' ;
191- }
192- this . superviseInputChange ( ) ;
193- }
194- projectionChanged ( projection : Projection ) {
195- if ( projection ) {
196- switch ( projection . projectionType ) {
197- case 'tsne' :
198- this . set ( 'showSuperviseSettings' , true ) ;
199- break ;
200- default :
201- this . set ( 'showSuperviseSettings' , false ) ;
202- }
203- }
204168 }
205169 onProjectorSelectionChanged (
206170 selectedPointIndices : number [ ] ,
@@ -381,59 +345,6 @@ class DataPanel extends LegacyElementMixin(PolymerElement) {
381345 anyDownloadMetadataLink . click ( ) ;
382346 }
383347 }
384- private superviseInputTyping ( ) {
385- let value = this . superviseInput . trim ( ) ;
386- if ( value == null || value . trim ( ) === '' ) {
387- if ( this . superviseInputSelected === '' ) {
388- this . superviseInputLabel = 'No ignored label' ;
389- } else {
390- this . superviseInputLabel = `Supervising without '${ this . superviseInputSelected } '` ;
391- }
392- return ;
393- }
394- if ( this . projector && this . projector . dataSet ) {
395- let numMatches = this . projector . dataSet . points . filter (
396- ( p ) => p . metadata [ this . superviseColumn ] . toString ( ) . trim ( ) === value
397- ) . length ;
398- if ( numMatches === 0 ) {
399- this . superviseInputLabel = 'Label not found' ;
400- } else {
401- if ( this . projector . dataSet . superviseInput != value ) {
402- this . superviseInputLabel = `Supervise without '${ value } ' [${ numMatches } points]` ;
403- }
404- }
405- }
406- }
407- private superviseInputChange ( ) {
408- let value = this . superviseInput . trim ( ) ;
409- if ( value == null || value . trim ( ) === '' ) {
410- this . superviseInputSelected = '' ;
411- this . superviseInputLabel = 'No ignored label' ;
412- this . setSupervision ( this . superviseColumn , '' ) ;
413- return ;
414- }
415- if ( this . projector && this . projector . dataSet ) {
416- let numMatches = this . projector . dataSet . points . filter (
417- ( p ) => p . metadata [ this . superviseColumn ] . toString ( ) . trim ( ) === value
418- ) . length ;
419- if ( numMatches === 0 ) {
420- this . superviseInputLabel = `Supervising without '${ this . superviseInputSelected } '` ;
421- } else {
422- this . superviseInputSelected = value ;
423- this . superviseInputLabel = `Supervising without '${ value } ' [${ numMatches } points]` ;
424- this . setSupervision ( this . superviseColumn , value ) ;
425- }
426- }
427- }
428- private superviseColumnChanged ( ) {
429- this . superviseInput = '' ;
430- this . superviseInputChange ( ) ;
431- }
432- private setSupervision ( superviseColumn : string , superviseInput : string ) {
433- if ( this . projector && this . projector . dataSet ) {
434- this . projector . dataSet . setSupervision ( superviseColumn , superviseInput ) ;
435- }
436- }
437348 setNormalizeData ( normalizeData : boolean ) {
438349 this . normalizeData = normalizeData ;
439350 }
0 commit comments