我正在实施 talos ( https://github.com/autonomio/talos ) 并收到上述错误。完整的错误输出如下:
ERROR: itkwidgets 0.25.3 has requirement ipywidgets>=7.5.1, but you'll have ipywidgets 7.4.2 which is incompatible.
ERROR: ipympl 0.4.1 has requirement ipywidgets>=7.5.0, but you'll have ipywidgets 7.4.2 which is incompatible.
ERROR: hepdata-converter 0.1.34 has requirement matplotlib<3.0.0, but you'll have matplotlib 3.4.3 which is incompatible.
ERROR: caniusepython3 7.1.0 requires argparse, which is not installed.
ERROR: tensorflow 2.6.0 has requirement keras~=2.6, but you'll have keras 2.2.4 which is incompatible.
ERROR: tensorflow 2.6.0 has requirement numpy~=1.19.2, but you'll have numpy 1.18.1 which is incompatible.
ERROR: itkwidgets 0.25.3 has requirement ipywidgets>=7.5.1, but you'll have ipywidgets 7.4.2 which is incompatible.
ERROR: ipympl 0.4.1 has requirement ipywidgets>=7.5.0, but you'll have ipywidgets 7.4.2 which is incompatible.
ERROR: hepdata-converter 0.1.34 has requirement matplotlib<3.0.0, but you'll have matplotlib 3.1.0 which is incompatible.
ERROR: distributed 1.28.1 has requirement dask>=0.18.0, but you'll have dask 0+unknown which is incompatible.
ERROR: astroid 2.3.3 has requirement lazy_object_proxy==1.4.*, but you'll have lazy-object-proxy 1.3.1 which is incompatible.
ERROR: astroid 2.3.3 has requirement wrapt==1.11.*, but you'll have wrapt 1.12.1 which is incompatible.
ERROR: mplhep 0.3.12 has requirement matplotlib>=3.4, but you'll have matplotlib 3.1.0 which is incompatible.
WARNING: The script wheel is installed in '/afs/cern.ch/user/r/rbrener/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
WARNING: The script tensorboard is installed in '/afs/cern.ch/user/r/rbrener/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
WARNING: The scripts estimator_ckpt_converter, import_pb_to_tensorboard, saved_model_cli, tensorboard, tf_upgrade_v2, tflite_convert, toco and toco_from_protos are installed in '/afs/cern.ch/user/r/rbrener/.local/bin' which is not on PATH.
Consider adding this directory to PATH or, if you prefer to suppress this warning, use --no-warn-script-location.
Using TensorFlow backend.
WARNING: Logging before flag parsing goes to stderr.
W0928 23:09:49.878550 47331508921536 deprecation_wrapper.py:119] From Condor_ClassiferTraining_Talos.py:242: The name tf.ConfigProto is deprecated. Please use tf.compat.v1.ConfigProto instead.
W0928 23:09:49.878889 47331508921536 deprecation_wrapper.py:119] From Condor_ClassiferTraining_Talos.py:243: The name tf.OptimizerOptions is deprecated. Please use tf.compat.v1.OptimizerOptions instead.
W0928 23:09:49.879105 47331508921536 deprecation_wrapper.py:119] From Condor_ClassiferTraining_Talos.py:247: The name tf.Session is deprecated. Please use tf.compat.v1.Session instead.
2021-09-28 23:09:49.895900: I tensorflow/core/platform/cpu_feature_guard.cc:142] Your CPU supports instructions that this TensorFlow binary was not compiled to use: SSE4.1 SSE4.2 AVX AVX2 AVX512F FMA
2021-09-28 23:09:49.907658: I tensorflow/core/platform/profile_utils/cpu_utils.cc:94] CPU Frequency: 2100015000 Hz
2021-09-28 23:09:49.908164: I tensorflow/compiler/xla/service/service.cc:168] XLA service 0xa9713d0 executing computations on platform Host. Devices:
2021-09-28 23:09:49.908204: I tensorflow/compiler/xla/service/service.cc:175] StreamExecutor device (0): <undefined>, <undefined>
W0928 23:09:49.909552 47331508921536 deprecation_wrapper.py:119] From Condor_ClassiferTraining_Talos.py:251: The name tf.global_variables_initializer is deprecated. Please use tf.compat.v1.global_variables_initializer instead.
2021-09-28 23:09:49.918347: W tensorflow/compiler/jit/mark_for_compilation_pass.cc:1412] (One-time warning): Not using XLA:CPU for cluster because envvar TF_XLA_FLAGS=--tf_xla_cpu_global_jit was not set. If you want XLA:CPU, either set that envvar, or use experimental_jit_scope to enable XLA:CPU. To confirm that XLA is active, pass --vmodule=xla_compilation_cache=1 (as a proper command-line flag, not via TF_XLA_FLAGS) or set the envvar XLA_FLAGS=--xla_hlo_profile.
^M 0%| | 0/4 [00:00<?, ?it/s]W0928 23:09:50.266320 47331508921536 deprecation_wrapper.py:119] From /cvmfs/sft.cern.ch/lcg/views/LCG_97python3/x86_64-centos7-gcc8-opt/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:74: The name tf.get_default_graph is deprecated. Please use tf.compat.v1.get_default_graph instead.
W0928 23:09:50.290766 47331508921536 deprecation_wrapper.py:119] From /cvmfs/sft.cern.ch/lcg/views/LCG_97python3/x86_64-centos7-gcc8-opt/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py:3976: The name tf.nn.max_pool is deprecated. Please use tf.nn.max_pool2d instead.
W0928 23:09:50.395355 47331508921536 deprecation_wrapper.py:119] From /cvmfs/sft.cern.ch/lcg/views/LCG_97python3/x86_64-centos7-gcc8-opt/lib/python3.7/site-packages/keras/optimizers.py:790: The name tf.train.Optimizer is deprecated. Please use tf.compat.v1.train.Optimizer instead.
W0928 23:09:50.427289 47331508921536 deprecation.py:323] From /cvmfs/sft.cern.ch/lcg/views/LCG_97python3/x86_64-centos7-gcc8-opt/lib/python3.7/site-packages/tensorflow/python/ops/nn_impl.py:180: add_dispatch_support.<locals>.wrapper (from tensorflow.python.ops.array_ops) is deprecated and will be removed in a future version.
Instructions for updating:
Use tf.where in 2.0, which has the same broadcast rule as np.where
^M 25%|██▌ | 1/4 [00:09<00:29, 9.76s/it]Traceback (most recent call last):
File "/cvmfs/sft.cern.ch/lcg/views/LCG_97python3/x86_64-centos7-gcc8-opt/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 303, in __init__
fetch, allow_tensor=True, allow_operation=True))
File "/cvmfs/sft.cern.ch/lcg/views/LCG_97python3/x86_64-centos7-gcc8-opt/lib/python3.7/site-packages/tensorflow/python/framework/ops.py", line 3796, in as_graph_element
return self._as_graph_element_locked(obj, allow_tensor, allow_operation)
File "/cvmfs/sft.cern.ch/lcg/views/LCG_97python3/x86_64-centos7-gcc8-opt/lib/python3.7/site-packages/tensorflow/python/framework/ops.py", line 3875, in _as_graph_element_locked
raise ValueError("Tensor %s is not an element of this graph." % obj)
ValueError: Tensor Tensor("conv2d_1/kernel:0", shape=(3, 3, 1, 4), dtype=float32_ref) is not an element of this graph.
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "Condor_ClassiferTraining_Talos.py", line 294, in <module>
scan_object = talos.Scan(x=X_train, y=Y_train, x_val=X_val, y_val=Y_val, model=classifier_talos_training, params=p, experiment_name='talos_4_ClcwrkClassfr', fraction_limit=0.1)
File "/afs/cern.ch/user/r/rbrener/.local/lib/python3.7/site-packages/talos/scan/Scan.py", line 196, in __init__
scan_run(self)
File "/afs/cern.ch/user/r/rbrener/.local/lib/python3.7/site-packages/talos/scan/scan_run.py", line 26, in scan_run
self = scan_round(self)
File "/afs/cern.ch/user/r/rbrener/.local/lib/python3.7/site-packages/talos/scan/scan_round.py", line 19, in scan_round
self.model_history, self.round_model = ingest_model(self)
File "/afs/cern.ch/user/r/rbrener/.local/lib/python3.7/site-packages/talos/model/ingest_model.py", line 10, in ingest_model
self.round_params)
File "Condor_ClassiferTraining_Talos.py", line 289, in classifier_talos_training
out = model1.fit(X_train, Y_train, batch_size=params['batch_size'], epochs=500, validation_data=[X_val, Y_val], callbacks=[checkpoint]) #epochs = 500, default callback is checkpoint, testing early stopping with callbacks=[es,checkpoint]
File "/cvmfs/sft.cern.ch/lcg/views/LCG_97python3/x86_64-centos7-gcc8-opt/lib/python3.7/site-packages/keras/engine/training.py", line 1039, in fit
validation_steps=validation_steps)
File "/cvmfs/sft.cern.ch/lcg/views/LCG_97python3/x86_64-centos7-gcc8-opt/lib/python3.7/site-packages/keras/engine/training_arrays.py", line 217, in fit_loop
callbacks.on_epoch_end(epoch, epoch_logs)
File "/cvmfs/sft.cern.ch/lcg/views/LCG_97python3/x86_64-centos7-gcc8-opt/lib/python3.7/site-packages/keras/callbacks.py", line 79, in on_epoch_end
callback.on_epoch_end(epoch, logs)
File "/cvmfs/sft.cern.ch/lcg/views/LCG_97python3/x86_64-centos7-gcc8-opt/lib/python3.7/site-packages/keras/callbacks.py", line 446, in on_epoch_end
self.model.save(filepath, overwrite=True)
File "/cvmfs/sft.cern.ch/lcg/views/LCG_97python3/x86_64-centos7-gcc8-opt/lib/python3.7/site-packages/keras/engine/network.py", line 1090, in save
save_model(self, filepath, overwrite, include_optimizer)
File "/cvmfs/sft.cern.ch/lcg/views/LCG_97python3/x86_64-centos7-gcc8-opt/lib/python3.7/site-packages/keras/engine/saving.py", line 382, in save_model
_serialize_model(model, f, include_optimizer)
File "/cvmfs/sft.cern.ch/lcg/views/LCG_97python3/x86_64-centos7-gcc8-opt/lib/python3.7/site-packages/keras/engine/saving.py", line 97, in _serialize_model
weight_values = K.batch_get_value(symbolic_weights)
File "/cvmfs/sft.cern.ch/lcg/views/LCG_97python3/x86_64-centos7-gcc8-opt/lib/python3.7/site-packages/keras/backend/tensorflow_backend.py", line 2420, in batch_get_value
return get_session().run(ops)
File "/cvmfs/sft.cern.ch/lcg/views/LCG_97python3/x86_64-centos7-gcc8-opt/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 950, in run
run_metadata_ptr)
File "/cvmfs/sft.cern.ch/lcg/views/LCG_97python3/x86_64-centos7-gcc8-opt/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 1158, in _run
self._graph, fetches, feed_dict_tensor, feed_handles=feed_handles)
File "/cvmfs/sft.cern.ch/lcg/views/LCG_97python3/x86_64-centos7-gcc8-opt/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 474, in __init__
self._fetch_mapper = _FetchMapper.for_fetch(fetches)
File "/cvmfs/sft.cern.ch/lcg/views/LCG_97python3/x86_64-centos7-gcc8-opt/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 264, in for_fetch
return _ListFetchMapper(fetch)
File "/cvmfs/sft.cern.ch/lcg/views/LCG_97python3/x86_64-centos7-gcc8-opt/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 373, in __init__
self._mappers = [_FetchMapper.for_fetch(fetch) for fetch in fetches]
File "/cvmfs/sft.cern.ch/lcg/views/LCG_97python3/x86_64-centos7-gcc8-opt/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 373, in <listcomp>
self._mappers = [_FetchMapper.for_fetch(fetch) for fetch in fetches]
File "/cvmfs/sft.cern.ch/lcg/views/LCG_97python3/x86_64-centos7-gcc8-opt/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 274, in for_fetch
return _ElementFetchMapper(fetches, contraction_fn)
File "/cvmfs/sft.cern.ch/lcg/views/LCG_97python3/x86_64-centos7-gcc8-opt/lib/python3.7/site-packages/tensorflow/python/client/session.py", line 310, in __init__
'Tensor. (%s)' % (fetch, str(e)))
ValueError: Fetch argument <tf.Variable 'conv2d_1/kernel:0' shape=(3, 3, 1, 4) dtype=float32_ref> cannot be interpreted as a Tensor. (Tensor Tensor("conv2d_1/kernel:0", shape=(3, 3, 1, 4), dtype=float32_ref) is not an element of this graph.)
^M 25%|██▌ | 1/4 [00:11<00:33, 11.08s/it]
而相关代码在这里给出:
#Import
print("Starting program...")
print("")
print("Importing files...")
#Import standard
import math, numpy, scipy, random, os, sys
# np.set_printoptions(precision=4) # print arrays to 4 decimal places
import time
start0 = time.process_time()
import scipy.stats
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
#Directory
Directory = "/afs/cern.ch/user/r/rbrener/Clockwork/clockwork_project/clockwork-search/Classifier/"
#Import custom
sys.path.append(os.path.abspath('../SignalBackground_Generation'))
sys.path.append(os.path.abspath('../SignalBackground_Generation/Custom_Modules'))
from Custom_Modules import WT
import SigBkg_Functions as SB
#import ATLAS MPL Style
#import #mplhep as hep
#hep.set_style(hep.style.ROOT)
from itertools import product
#Machine learning
import keras, sklearn
import tensorflow as tf
import talos
from keras.callbacks import EarlyStopping
from keras.constraints import unit_norm
from keras.layers import Activation, Dense, Dropout, Flatten, Input, Lambda
from keras.layers import Convolution2D, Conv1D, Conv2D, Conv2DTranspose
from keras.layers import AveragePooling2D, BatchNormalization, GlobalAveragePooling2D, MaxPooling2D
from keras.layers.merge import add
from keras.models import load_model, Model, Sequential
from sklearn.model_selection import train_test_split
from keras import backend as K
#Options for overfitting(If needed)
# from keras.callbacks import EarlyStopping
import argparse
parser = argparse.ArgumentParser(description='Batch Selections')
parser.add_argument('-k', metavar='', help='K-value Of Clockwork Signal Model')
parser.add_argument('-M5', metavar='', help='M5-value Of Clockwork Signal Model')
parser.add_argument('-s', metavar='', help='Signal Model type')
parser.add_argument('-b', metavar='', help='Background Model type')
parser.add_argument('-test', metavar='', help='number of toy experiments')
parser.add_argument('-train', metavar='', help='number of training steps')
parser.add_argument('-kmin', metavar='', help='min k value to scan')
parser.add_argument('-M5min', metavar='', help='min M5 value to scan')
parser.add_argument('-Cone', metavar='', help='remove cone of influence')
parser.add_argument('-NconeR', metavar='', help='radius of cone to remove')
parser.add_argument('-uncertainty', metavar='', help='profile from uncertainity ensemble for toy experiments')
argus = parser.parse_args()
#Binning
#If running Diphoton 36.7 fb-1 limits needs different binning
if(argus.b=="Dielectron_Bkg"):
# xmin = 225
# xmax = 6000
# nBins = 5775 #2935
xmin = 225
xmax = 4200
nBins = 3975
mergeX = 60 #20
mergeY = 6 #2
if(argus.b=="Diphoton_36fb_Bkg"):
xmin = 150
xmax = 2700
nBins = 1275
mergeX = 20 #20
mergeY = 2 #2
if(argus.b=="HighMass_Diphoton_Bkg"):
xmin = 150
xmax = 5000
nBins = 4850
mergeX = 40 #20
mergeY = 4 #2
massList = numpy.linspace(xmin, xmax, nBins)
#Cone of influence
Cone = bool(argus.Cone)
NconeR = int(argus.NconeR) #2
print("Files imported.")
print("")
#Parameters of the signal
M5 = float(argus.M5)
k = float(argus.k)
print("Mass_5")
print(M5)
print("K")
print (k)
#Generate signal and Background
#####Signal#####
if(argus.s=="Tail_Damped_Sig"):
luminosity = 139
year = '2015-18'
SigFix = SB.SigFixed_ee_withCB(k, M5, xmin, xmax)
if(argus.s=="Theory_Diphoton_36fb_Sig"):
luminosity = 36.1
year = '2015-16'
SigFix, lum = SB.SigFix_Theory36fb_Diphoton(k, M5, xmin, xmax, nBins)
if(argus.s=="Theory_Dielectron_Sig"):
luminosity = 139
year = '2015-18'
SigFix, lum = SB.SigFix_Theory_Dielectron(k, M5, xmin, xmax, nBins)
if(argus.s=="Theory_HighMass_Diphoton_Sig"):
luminosity = 139
year = '2015-18'
SigFix, lum = SB.SigFix_Theory_HighMass_Diphoton(k, M5, xmin, xmax, nBins)
#####Background#####
if(argus.b=="Dielectron_Bkg"):
BkgFix = SB.Dielectron_Bkg(xmin, xmax, nBins)
if(argus.b=="Diphoton_36_Bkg"):
BkgFix = SB.BkgFix_Diphoton36fb_Theory(massList)
if(argus.b=="HighMass_Diphoton_Bkg"):
BkgFix = SB.HighMassDiphoton_Bkg(xmin, xmax, nBins)
print("Signal/Bkg evaluated.")
print("")
#Lets name a folder based on the signal and bkg to write all the outputs too and make it
try:
Output_Folder = "Outputs_"+(argus.b)+"_"+(argus.s)+"_test"+(argus.test)+"_train"+(argus.train)+"_Cone-"+(argus.Cone)+"_NconeR"+(argus.NconeR)+"_Uncertainty-"+(argus.uncertainty)+""
os.mkdir("Classifier_Condor_Outputs_Talos/"+Output_Folder)
os.mkdir("Classifier_Condor_Outputs_Talos/"+Output_Folder+"/ClassiferWeights_Condor")
os.mkdir("Classifier_Condor_Outputs_Talos/"+Output_Folder+"/Error_Condor")
os.mkdir("Classifier_Condor_Outputs_Talos/"+Output_Folder+"/History_Plots")
os.mkdir("Classifier_Condor_Outputs_Talos/"+Output_Folder+"/Logs_Condor")
os.mkdir("Classifier_Condor_Outputs_Talos/"+Output_Folder+"/Out_Condor")
os.mkdir("Classifier_Condor_Outputs_Talos/"+Output_Folder+"/Pvalues_Condor")
os.mkdir("Classifier_Condor_Outputs_Talos/"+Output_Folder+"/TestStatistic_plots")
except OSError:
print ("Creation of the directory %s failed" % Output_Folder)
else:
print ("Successfully created the directory %s" % Output_Folder)
#File to save weights and biases
nameModelFile = Directory+"Classifier_Condor_Outputs/"+Output_Folder+"/ClassiferWeights_Condor/Classifier_NNweights_biases_"+str(k)+"_"+str(M5)+".txt"
#Settings
print("Reading settings...")
#Simulation settings
nTraining = int(argus.train) #4000
nTrials1 = int(argus.test)
#Number of threads to use
NumberThreads = 8 #8
print("Setting read")
print("")
#Training neural network
print("Beginning generation of training events...")
print("")
#Generate events for training and testing
X_train = []
Y_train = []
for i in range(0, nTraining):
#Generate random parameters for signal
aStemp = random.randint(0, 1)
#Generate random binned events
eventsInt = SB.SigBkgPoissonToy(BkgFix, SigFix, 1, aStemp)
#Do wavelet transform
cwtmatBSIntNorm, _, _ = WT.WaveletTransform(eventsInt, mergeX, mergeY, Cone, NconeR)
#Append results
X_train.append(cwtmatBSIntNorm)
Y_train.append([aStemp])
#Make report
if i%100 == 0:
print(i)
#Convert to numpy array
X_train = numpy.array(X_train)
Y_train = numpy.array(Y_train)
#Dimension info
dimWX = (X_train.shape[1], X_train.shape[2])
dimWY = (Y_train.shape[1])
#Format
X_train = numpy.ravel(X_train)
Y_train = numpy.ravel(Y_train)
X_train = numpy.reshape(X_train, (nTraining, dimWX[0], dimWX[1], 1))
Y_train = numpy.reshape(Y_train, (nTraining, dimWY))
print ("This is type(X_train): ", type(X_train))
X_val = random.sample(list(X_train), round(len(X_train)*0.2))
Y_val = random.sample(list(Y_train), round(len(Y_train)*0.2))
X_val = numpy.array(X_val)
Y_val = numpy.array(Y_val)
#Save Xtrain shape to use in testing, save to weights folder, don't need to do this for every M5/k the shape depends mainly on the training steps do just call on M5/k to reduce ememory use. Pick the lowest k/M5
if k==int(argus.kmin) and M5==int(argus.M5min):
numpy.save(Directory+"Classifier_Condor_Outputs/"+Output_Folder+"/ClassiferWeights_Condor/Classifier_Xtrain_"+(str(argus.kmin))+".0_"+(str(argus.M5min))+".0.npy", X_train)
print('Generation of training events completed.')
print("")
#Define model for classifier
config = tf.ConfigProto()
jit_level = tf.OptimizerOptions.ON_1
config.graph_options.optimizer_options.global_jit_level = jit_level
config.intra_op_parallelism_threads = NumberThreads
config.inter_op_parallelism_threads = NumberThreads
sess = tf.Session(config=config)
graph1 = tf.Graph()
with graph1.as_default() as graph:
graph1_init_op = tf.global_variables_initializer()
sess1 = tf.Session(graph=graph1)
sess1.run(graph1_init_op)
#Parameter grid for talos scan
p = {'activation':['relu', 'elu', 'sigmoid', 'softmax'],
'optimizer':['Nadam','Adam'],
'loss': ['binary_crossentropy', 'mean_squared_error'],
'batch_size': [500, 1000, 1500]}
def classifier_talos_training(X_train, Y_train, X_val, Y_val, params):
model1 = Sequential()
#Add model layers
model1.add(Conv2D(4, kernel_size=3, activation=params['activation'], input_shape=(X_train.shape[1], X_train.shape[2], 1)))
model1.add(MaxPooling2D(pool_size=(2, 2)))
model1.add(Conv2D(8, kernel_size=3, activation=params['activation']))
model1.add(MaxPooling2D(pool_size=(2, 2)))
model1.add(Conv2D(16, kernel_size=3, activation=params['activation']))
model1.add(Flatten())
model1.add(Dense(200, activation=params['activation'])) #kernel_constraint=unit_norm()
model1.add(Dense(100, activation=params['activation'])) #kernel_constraint=unit_norm()
model1.add(Dense(Y_train.shape[1], activation=params['activation']))
# simple early stopping
# es = EarlyStopping(monitor='val_loss', mode='min', verbose=1, patience=200)
#Compile
model1.compile(optimizer=params['optimizer'], loss=params['loss'], metrics=['accuracy'])
#Checkpoint
checkpoint = keras.callbacks.ModelCheckpoint(nameModelFile, verbose=1, monitor='val_loss', save_best_only=True, mode='auto')
#Train model #epoch defualt 500, batch size 1000, shuffle=True????
out = model1.fit(X_train, Y_train, batch_size=params['batch_size'], epochs=500, validation_data=[X_val, Y_val], callbacks=[checkpoint]) #epochs = 500, default callback is checkpoint, testing early stopping with callbacks=[es,checkpoint]
return out, model1
scan_object = talos.Scan(x=X_train, y=Y_train, x_val=X_val, y_val=Y_val, model=classifier_talos_training, params=p, experiment_name='talos_4_ClcwrkClassfr', fraction_limit=0.1)
best_model = scan_object.best_model(metric='f1score', asc=False)
fig_history, ax = plt.subplots()
#ax = hep.atlas.label(data=False, paper=False, year=year, fontsize=19, lumi = luminosity, ax=ax)
plt.plot(best_model.history['loss'], label = 'loss')
plt.plot(best_model.history['val_loss'], label = 'val loss')
plt.legend(loc=0)
plt.ylabel('loss')
plt.xlabel('Epochs')
plt.margins(0)
plt.legend(['train', 'val'], loc='best')
fig_history.savefig(Directory+"Classifier_Condor_Outputs/"+Output_Folder+"/History_Plots/history_modelloss_"+str(k)+"_"+str(M5)+".png")
# summarize history for accuracy
fig_accuracy, ax = plt.subplots()
#ax = hep.atlas.label(data=False, paper=False, year=year, fontsize=19, lumi = luminosity, ax=ax)
plt.plot(best_model.history['acc'])
plt.plot(best_model.history['val_acc'])
plt.title('model accuracy')
plt.ylabel('accuracy')
plt.xlabel('epoch')
plt.legend(['train', 'test'], loc='best')
fig_accuracy.savefig(Directory+"Classifier_Condor_Outputs/"+Output_Folder+"/History_Plots/history_accuracy_"+str(k)+"_"+str(M5)+".png")
model1.save(Directory+"Classifier_Condor_Outputs/"+Output_Folder+"/ClassiferWeights_Condor/model_"+str(k)+"_"+str(M5)+".h5")
我曾认为带有tf.ConfigProto()
等的位以及带有的位tf.Graph(), tf.Session()
应该修复它,但可惜他们没有。任何帮助和建议都将受到热烈欢迎。