Belle II Software development
TSNE Class Reference
Inheritance diagram for TSNE:
Plotter

Public Member Functions

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

Detailed Description

Plots multivariate distribution using TSNE algorithm

Definition at line 1152 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 1157 of file plotting.py.

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

◆ finish()

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

Reimplemented from Plotter.

Definition at line 1178 of file plotting.py.

1178 def finish(self):
1179 """
1180 Sets limits, title, axis-labels and legend of the plot
1181 """
1182 return self
1183
1184

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