Belle II Software light-2405-quaxo
TSNE Class Reference
Inheritance diagram for TSNE:
Collaboration diagram for TSNE:

Public Member Functions

def add (self, data, columns, *masks)
 
def finish (self)
 

Detailed Description

Plots multivariate distribution using TSNE algorithm

Definition at line 1144 of file plotting.py.

Member Function Documentation

◆ add()

def add (   self,
  data,
  columns,
masks 
)
Add a new correlation plot.
@param data pandas.DataFrame containing all data
@param columns which are used to calculate the correlations
@param masks different classes to show in TSNE

Reimplemented from Plotter.

Definition at line 1149 of file plotting.py.

1149 def add(self, data, columns, *masks):
1150 """
1151 Add a new correlation plot.
1152 @param data pandas.DataFrame containing all data
1153 @param columns which are used to calculate the correlations
1154 @param masks different classes to show in TSNE
1155 """
1156 try:
1157 import sklearn
1158 import sklearn.manifold
1159 model = sklearn.manifold.TSNE(n_components=2, random_state=0)
1160 data = numpy.array([data[column] for column in columns]).T
1161 model.fit(data)
1162 for mask in masks:
1163 data = numpy.array([data[column][mask] for column in columns]).T
1164 data = model.transform(data)
1165 self.axis.scatter(data[:, 0], data[:, 1], rasterized=True)
1166 except ImportError:
1167 print("Cannot create TSNE plot. Install sklearn if you want it")
1168 return self
1169

◆ finish()

def finish (   self)
Sets limits, title, axis-labels and legend of the plot

Reimplemented from Plotter.

Definition at line 1170 of file plotting.py.

1170 def finish(self):
1171 """
1172 Sets limits, title, axis-labels and legend of the plot
1173 """
1174 return self
1175
1176

The documentation for this class was generated from the following file: