Beispiel #1
0
 def apply(self, block: Block, **kwargs ) -> Optional[xa.DataArray]:
     if (self.learned_mapping is None) or (self.learned_mapping.embedding is None):
         Task.taskNotAvailable( "Workflow violation", "Must learn a classication before it can be applied", **kwargs )
         return None
     point_data: xa.DataArray = block.getPointData( **kwargs )
     embedding: np.ndarray = self.learned_mapping.transform( point_data )
     return self.wrap_embedding( point_data.coords['samples'], embedding )
Beispiel #2
0
 def build_model(self, *args, **kwargs):
     if self.block is None:
         Task.taskNotAvailable( "Workflow violation", "Must load a block first", **kwargs )
     else:
         labels: xa.DataArray = self.getExtendedLabelPoints()
         umapManager.embed( self.block, labels, **kwargs )
         self.plot_markers_volume()
Beispiel #3
0
 def learn_classification( self, **kwargs  ):
     if self.block is None:
         Task.taskNotAvailable( "Workflow violation", "Must load a block and spread some labels first", **kwargs )
     else:
         full_labels: xa.DataArray = self.getExtendedLabelPoints()
         print( f"Learning Classification, labels shape = {full_labels.shape}, nLabels = {np.count_nonzero( full_labels > 0 )}")
         event = dict(event="classify", type="learn", data=self.block, labels=full_labels )
         self.submitEvent( event, EventMode.Gui )