def main(argv):
    parser = argparse.ArgumentParser()
    parser.add_argument("estResNumber",
                        help="estimation result number",
                        type=int)
    parser.add_argument(
        "paramType",
        help=
        "Parameter type: indPointsPosteriorMean, indPointsPosteriorCov, indPointsLocs, kernel, embeddingC, embeddingD"
    )
    parser.add_argument(
        "--intermediateDesc",
        help="Descriptor of the intermediate model estimate to plot",
        type=str,
        default="None")
    parser.add_argument("--trial",
                        help="Parameter trial number",
                        type=int,
                        default=0)
    parser.add_argument("--latent",
                        help="Parameter latent number",
                        type=int,
                        default=0)
    parser.add_argument("--neuron",
                        help="Parameter neuron number",
                        type=int,
                        default=0)
    parser.add_argument("--kernelParamIndex",
                        help="Kernel parameter index",
                        type=int,
                        default=0)
    parser.add_argument("--indPointIndex",
                        help="Parameter inducing point index",
                        type=int,
                        default=0)
    parser.add_argument(
        "--indPointIndex2",
        help=
        "Parameter inducing point index2 (used for inducing points covariance parameters)",
        type=int,
        default=0)
    parser.add_argument("--paramValueStart",
                        help="Start parameter value",
                        type=float,
                        default=0.01)
    parser.add_argument("--paramValueEnd",
                        help="End parameters value",
                        type=float,
                        default=2.0)
    parser.add_argument("--paramValueStep",
                        help="Step for parameter values",
                        type=float,
                        default=0.01)
    parser.add_argument("--yMin",
                        help="Minimum y value",
                        type=float,
                        default=-math.inf)
    parser.add_argument("--yMax",
                        help="Minimum y value",
                        type=float,
                        default=+math.inf)
    parser.add_argument("--nQuad",
                        help="Number of quadrature points",
                        type=int,
                        default=200)

    args = parser.parse_args()
    estResNumber = args.estResNumber
    paramType = args.paramType
    intermediateDesc = args.intermediateDesc
    trial = args.trial
    latent = args.latent
    neuron = args.neuron
    kernelParamIndex = args.kernelParamIndex
    indPointIndex = args.indPointIndex
    indPointIndex2 = args.indPointIndex2
    paramValueStart = args.paramValueStart
    paramValueEnd = args.paramValueEnd
    paramValueStep = args.paramValueStep
    yMin = args.yMin
    yMax = args.yMax
    nQuad = args.nQuad

    if intermediateDesc == "None":
        modelFilename = "results/{:08d}_estimatedModel.pickle".format(
            estResNumber)
    else:
        modelFilename = "results/{:08d}_{:s}_estimatedModel.pickle".format(
            estResNumber, intermediateDesc)

    # create model
    with open(modelFilename, "rb") as f:
        modelRes = pickle.load(f)
    model = modelRes["model"]

    indPointsLocsKMSRegEpsilon = model._eLL._svEmbeddingAllTimes._svPosteriorOnLatents._indPointsLocsKMS._epsilon
    paramUpdateFun = lowerBoundVsOneParamUtils.getParamUpdateFun(
        paramType=paramType)
    paramValues = np.arange(paramValueStart, paramValueEnd, paramValueStep)
    conditionNumbers = np.empty(len(paramValues))
    for i in range(len(paramValues)):
        paramUpdateFun(model=model,
                       paramValue=paramValues[i],
                       trial=None,
                       latent=latent,
                       neuron=neuron,
                       kernelParamIndex=kernelParamIndex,
                       indPointIndex=indPointIndex,
                       indPointIndex2=indPointIndex2)
        Kzz = model._eLL._svEmbeddingAllTimes._svPosteriorOnLatents._indPointsLocsKMS._Kzz
        eValues, _ = torch.eig(Kzz[latent][trial, :, :])
        conditionNumbers[i] = eValues[:, 0].max() / eValues[:, 0].min()
    title = lowerBoundVsOneParamUtils.getParamTitle(
        paramType=paramType,
        trial=trial,
        latent=latent,
        neuron=neuron,
        kernelParamIndex=kernelParamIndex,
        indPointIndex=indPointIndex,
        indPointIndex2=indPointIndex2,
        indPointsLocsKMSRegEpsilon=indPointsLocsKMSRegEpsilon)
    figFilenamePattern = condNumberVsOneParamUtils.getFigFilenamePattern(
        prefixNumber=estResNumber,
        descriptor="estimatedParam",
        paramType=paramType,
        trial=trial,
        latent=latent,
        neuron=neuron,
        indPointsLocsKMSRegEpsilon=indPointsLocsKMSRegEpsilon,
        kernelParamIndex=kernelParamIndex,
        indPointIndex=indPointIndex,
        indPointIndex2=indPointIndex2)
    layout = {
        "title": title,
        "xaxis": {
            "title": "Parameter Value"
        },
        "yaxis": {
            "title": "Condition Number",
            "range": [yMin, yMax]
        },
    }
    data = []
    data.append(
        {
            "type": "scatter",
            "mode": "lines+markers",
            "x": paramValues,
            "y": conditionNumbers,
            "name": "cNum trial 0",
        }, )
    fig = go.Figure(
        data=data,
        layout=layout,
    )
    fig.write_image(figFilenamePattern.format("png"))
    fig.write_html(figFilenamePattern.format("html"))
    pio.renderers.default = "browser"
    fig.show()

    pdb.set_trace()
def main(argv):
    parser = argparse.ArgumentParser()
    parser.add_argument("estResNumber", help="estimation result number", type=int)
    parser.add_argument("paramType", help="Parameter type: indPointsPosteriorMean, indPointsPosteriorCov, indPointsLocs, kernel, embeddingC, embeddingD")
    parser.add_argument("--partialDesc", help="Descriptor of the partial result to plot", type=str, default="None")
    parser.add_argument("--trial", help="Parameter trial number", type=int, default=0)
    parser.add_argument("--latent", help="Parameter latent number", type=int, default=0)
    parser.add_argument("--neuron", help="Parameter neuron number", type=int, default=0)
    parser.add_argument("--kernelParamIndex", help="Kernel parameter index", type=int, default=0)
    parser.add_argument("--indPointIndex", help="Parameter inducing point index", type=int, default=0)
    parser.add_argument("--indPointIndex2", help="Parameter inducing point index2 (used for inducing points covariance parameters)", type=int, default=0)
    parser.add_argument("--scaledParamValueStart", help="Start scaled parameter value", type=float, default=1.0)
    parser.add_argument("--scaledParamValueEnd", help="End scaled parameters value", type=float, default=20.0)
    parser.add_argument("--scaledParamValueStep", help="Step for scaled parameter values", type=float, default=0.01)
    parser.add_argument("--yMin", help="Minimum y value", type=float, default=-math.inf)
    parser.add_argument("--yMax", help="Minimum y value", type=float, default=+math.inf)
    parser.add_argument("--percMargin", help="Percentage value for margin=perecMargin*max(abs(yMin), abs(yMax))", type=float, default=0.1)
    parser.add_argument("--nQuad", help="Number of quadrature points", type=int, default=200)

    args = parser.parse_args()
    estResNumber = args.estResNumber
    paramType = args.paramType
    partialDesc = args.partialDesc
    trial = args.trial
    latent = args.latent
    neuron = args.neuron
    kernelParamIndex = args.kernelParamIndex
    indPointIndex = args.indPointIndex
    indPointIndex2 = args.indPointIndex2
    scaledParamValueStart = args.scaledParamValueStart
    scaledParamValueEnd = args.scaledParamValueEnd
    scaledParamValueStep = args.scaledParamValueStep
    yMin = args.yMin
    yMax = args.yMax
    percMargin = args.percMargin
    nQuad = args.nQuad

    if paramType=="kernel":
        estMetaDataFilename = "results/{:08d}_estimation_metaData.ini".format(estResNumber)
        estMetaDataConfig = configparser.ConfigParser()
        estMetaDataConfig.read(estMetaDataFilename)
        estInitNumber = int(estMetaDataConfig["estimation_params"]["estInitNumber"])
        estInitConfig = configparser.ConfigParser()
        estInitFilename = "data/{:08d}_estimation_metaData.ini".format(estInitNumber)
        estInitConfig.read(estInitFilename)
        if kernelParamIndex==0:
            refParam0 = float(estInitConfig["kernel_params"]["kLengthscaleScaledValueLatent{:d}".format(latent)])
            refParam0Scale = float(estInitConfig["kernel_params"]["kLengthscaleScaleLatent{:d}".format(latent)])
        elif kernelParamIndex==1:
            refParam0 = float(estInitConfig["kernel_params"]["kPeriodScaledValueLatent{:d}".format(latent)])
            refParam0Scale = float(estInitConfig["kernel_params"]["kPeriodScaleLatent{:d}".format(latent)])
        else:
            raise NotImplementedError("Currently only kernelParamIndex=0 or 1 are supported")
    else:
        raise NotImplementedError("Currently only paramType=kernel is supported")

    if partialDesc=="None":
        modelFilename = "results/{:08d}_estimatedModel.pickle".format(estResNumber)
    else:
        modelFilename = "results/{:08d}_{:s}_estimatedModel.pickle".format(estResNumber, partialDesc)

    # create model
    with open(modelFilename, "rb") as f: modelRes = pickle.load(f)
    model = modelRes["model"]

    refParams = [refParam0]
    indPointsLocsKMSRegEpsilon = model._eLL._svEmbeddingAllTimes._svPosteriorOnLatents._indPointsLocsKMS._epsilon
    refParams.append(lowerBoundVsOneParamUtils.getReferenceParam(paramType=paramType, model=model, trial=trial, latent=latent, neuron=neuron, kernelParamIndex=kernelParamIndex, indPointIndex=indPointIndex, indPointIndex2=indPointIndex2)/refParam0Scale)
    paramUpdateFun = lowerBoundVsOneParamUtils.getParamUpdateFun(paramType=paramType)
    scaledParamValues = np.arange(scaledParamValueStart, scaledParamValueEnd, scaledParamValueStep)
    lowerBoundValues = np.empty(scaledParamValues.shape)
    for i in range(len(scaledParamValues)):
        paramUpdateFun(model=model, paramValue=scaledParamValues[i]*refParam0Scale, trial=trial, latent=latent, neuron=neuron, kernelParamIndex=kernelParamIndex, indPointIndex=indPointIndex, indPointIndex2=indPointIndex2)
#         if scaledParamValues[i]>=6.62:
#             pdb.set_trace()
        lowerBoundValues[i] = model.eval()
    title = lowerBoundVsOneParamUtils.getParamTitle(paramType=paramType, trial=trial, latent=latent, neuron=neuron, kernelParamIndex=kernelParamIndex, indPointIndex=indPointIndex, indPointIndex2=indPointIndex2, indPointsLocsKMSRegEpsilon=indPointsLocsKMSRegEpsilon)
    if partialDesc=="None":
        figDesc = "lowerBoundVs1DParam_estimatedParams"
    else:
        figDesc = "lowerBoundVs1DParam_{:s}_estimatedParams".format(partialDesc)
    figFilenamePattern = lowerBoundVsOneParamUtils.getFigFilenamePattern(prefixNumber=estResNumber, descriptor=figDesc, paramType=paramType, trial=trial, latent=latent, neuron=neuron, indPointsLocsKMSRegEpsilon=indPointsLocsKMSRegEpsilon, kernelParamIndex=kernelParamIndex, indPointIndex=indPointIndex, indPointIndex2=indPointIndex2)
    fig = plot.svGPFA.plotUtilsPlotly.getPlotLowerBoundVsOneParam(paramValues=scaledParamValues, lowerBoundValues=lowerBoundValues, refParams=refParams, title=title, yMin=yMin, yMax=yMax, lowerBoundLineColor="red", refParamsLineColors=["red", "magenta"], percMargin=percMargin)
    fig.write_image(figFilenamePattern.format("png"))
    fig.write_html(figFilenamePattern.format("html"))
    pio.renderers.default = "browser"
    fig.show()

    pdb.set_trace()
def main(argv):
    parser = argparse.ArgumentParser()
    parser.add_argument("estResNumber",
                        help="estimation result number",
                        type=int)
    parser.add_argument(
        "paramType",
        help=
        "Parameter type: indPointsPosteriorMean, indPointsPosteriorCov, indPointsLocs, kernel, embeddingC, embeddingD"
    )
    parser.add_argument("--trial",
                        help="Parameter trial number",
                        type=int,
                        default=0)
    parser.add_argument("--latent",
                        help="Parameter latent number",
                        type=int,
                        default=0)
    parser.add_argument("--neuron",
                        help="Parameter neuron number",
                        type=int,
                        default=0)
    parser.add_argument("--kernelParamIndex",
                        help="Kernel parameter index",
                        type=int,
                        default=0)
    parser.add_argument("--indPointIndex",
                        help="Parameter inducing point index",
                        type=int,
                        default=0)
    parser.add_argument(
        "--indPointIndex2",
        help=
        "Parameter inducing point index2 (used for inducing points covariance parameters)",
        type=int,
        default=0)
    parser.add_argument("--paramValueStart",
                        help="Start parameter value",
                        type=float,
                        default=1.0)
    parser.add_argument("--paramValueEnd",
                        help="End parameters value",
                        type=float,
                        default=20.0)
    parser.add_argument("--paramValueStep",
                        help="Step for parameter values",
                        type=float,
                        default=0.01)
    parser.add_argument("--yMin",
                        help="Minimum y value",
                        type=float,
                        default=-math.inf)
    parser.add_argument("--yMax",
                        help="Minimum y value",
                        type=float,
                        default=+math.inf)
    parser.add_argument("--nQuad",
                        help="Number of quadrature points",
                        type=int,
                        default=200)

    args = parser.parse_args()
    estResNumber = args.estResNumber
    paramType = args.paramType
    trial = args.trial
    latent = args.latent
    neuron = args.neuron
    kernelParamIndex = args.kernelParamIndex
    indPointIndex = args.indPointIndex
    indPointIndex2 = args.indPointIndex2
    paramValueStart = args.paramValueStart
    paramValueEnd = args.paramValueEnd
    paramValueStep = args.paramValueStep
    yMin = args.yMin
    yMax = args.yMax
    nQuad = args.nQuad

    modelFilename = "results/{:08d}_estimatedModel.pickle".format(estResNumber)

    # create model
    with open(modelFilename, "rb") as f:
        modelRes = pickle.load(f)
    model = modelRes["model"]

    indPointsLocsKMSRegEpsilon = model._eLL._svEmbeddingAllTimes._svPosteriorOnLatents._indPointsLocsKMS._epsilon
    refParam = lowerBoundVsOneParamUtils.getReferenceParam(
        paramType=paramType,
        model=model,
        trial=trial,
        latent=latent,
        neuron=neuron,
        kernelParamIndex=kernelParamIndex,
        indPointIndex=indPointIndex,
        indPointIndex2=indPointIndex2)
    paramUpdateFun = lowerBoundVsOneParamUtils.getParamUpdateFun(
        paramType=paramType)
    paramValues = np.arange(paramValueStart, paramValueEnd, paramValueStep)
    klTraceTerms = np.empty(paramValues.shape)
    for i in range(len(paramValues)):
        paramUpdateFun(model=model,
                       paramValue=paramValues[i],
                       trial=trial,
                       latent=latent,
                       neuron=neuron,
                       kernelParamIndex=kernelParamIndex,
                       indPointIndex=indPointIndex,
                       indPointIndex2=indPointIndex2)
        klTraceTerms[i] = -computeKLtraceTerm(model=model, k=0, trial=0)
    title = lowerBoundVsOneParamUtils.getParamTitle(
        paramType=paramType,
        trial=trial,
        latent=latent,
        neuron=neuron,
        kernelParamIndex=kernelParamIndex,
        indPointIndex=indPointIndex,
        indPointIndex2=indPointIndex2,
        indPointsLocsKMSRegEpsilon=indPointsLocsKMSRegEpsilon)
    figFilenamePattern = lowerBoundVsOneParamUtils.getFigFilenamePattern(
        prefixNumber=estResNumber,
        descriptor="klTraceTerm_estimatedParam",
        paramType=paramType,
        trial=trial,
        latent=latent,
        neuron=neuron,
        indPointsLocsKMSRegEpsilon=indPointsLocsKMSRegEpsilon,
        kernelParamIndex=kernelParamIndex,
        indPointIndex=indPointIndex,
        indPointIndex2=indPointIndex2)
    fig = plot.svGPFA.plotUtilsPlotly.getPlotLowerBoundVsOneParam(
        paramValues=paramValues,
        lowerBoundValues=klTraceTerms,
        refParam=refParam,
        ylab="-KL Trace Term",
        title=title,
        yMin=yMin,
        yMax=yMax,
        lowerBoundLineColor="red",
        refParamLineColor="magenta")
    fig.write_image(figFilenamePattern.format("png"))
    fig.write_html(figFilenamePattern.format("html"))
    pio.renderers.default = "browser"
    fig.show()

    pdb.set_trace()
Пример #4
0
def main(argv):
    parser = argparse.ArgumentParser()
    parser.add_argument("simResNumber",
                        help="simulation result number",
                        type=int)
    parser.add_argument(
        "paramType",
        help=
        "Parameter type: indPointsPosteriorMean, indPointsPosteriorCov, indPointsLocs, kernel, embeddingC, embeddingD"
    )
    parser.add_argument(
        "indPointsLocsKMSRegEpsilon",
        help=
        "regularization epsilon for the inducing points locations covariance",
        type=float)
    parser.add_argument("--trial",
                        help="Parameter trial number",
                        type=int,
                        default=0)
    parser.add_argument("--latent",
                        help="Parameter latent number",
                        type=int,
                        default=0)
    parser.add_argument("--neuron",
                        help="Parameter neuron number",
                        type=int,
                        default=0)
    parser.add_argument("--kernelParamIndex",
                        help="Kernel parameter index",
                        type=int,
                        default=0)
    parser.add_argument("--indPointIndex",
                        help="Parameter inducing point index",
                        type=int,
                        default=0)
    parser.add_argument(
        "--indPointIndex2",
        help=
        "Parameter inducing point index2 (used for inducing points covariance parameters)",
        type=int,
        default=0)
    parser.add_argument("--paramValueStart",
                        help="Start parameter value",
                        type=float,
                        default=1.0)
    parser.add_argument("--paramValueEnd",
                        help="End parameters value",
                        type=float,
                        default=20.0)
    parser.add_argument("--paramValueStep",
                        help="Step for parameter values",
                        type=float,
                        default=0.01)
    parser.add_argument("--yMin",
                        help="Minimum y value",
                        type=float,
                        default=-math.inf)
    parser.add_argument("--yMax",
                        help="Minimum y value",
                        type=float,
                        default=+math.inf)
    parser.add_argument("--nQuad",
                        help="Number of quadrature points",
                        type=int,
                        default=200)

    args = parser.parse_args()
    simResNumber = args.simResNumber
    paramType = args.paramType
    indPointsLocsKMSRegEpsilon = args.indPointsLocsKMSRegEpsilon
    trial = args.trial
    latent = args.latent
    neuron = args.neuron
    kernelParamIndex = args.kernelParamIndex
    indPointIndex = args.indPointIndex
    indPointIndex2 = args.indPointIndex2
    paramValueStart = args.paramValueStart
    paramValueEnd = args.paramValueEnd
    paramValueStep = args.paramValueStep
    yMin = args.yMin
    yMax = args.yMax
    nQuad = args.nQuad

    # load data and initial values
    simResConfigFilename = "results/{:08d}_simulation_metaData.ini".format(
        simResNumber)
    simResConfig = configparser.ConfigParser()
    simResConfig.read(simResConfigFilename)
    simInitConfigFilename = simResConfig["simulation_params"][
        "simInitConfigFilename"]
    simResFilename = simResConfig["simulation_results"]["simResFilename"]

    simInitConfig = configparser.ConfigParser()
    simInitConfig.read(simInitConfigFilename)
    nLatents = int(simInitConfig["control_variables"]["nLatents"])
    nNeurons = int(simInitConfig["control_variables"]["nNeurons"])
    trialsLengths = [
        float(str) for str in simInitConfig["control_variables"]
        ["trialsLengths"][1:-1].split(",")
    ]
    nTrials = len(trialsLengths)
    # firstIndPointLoc = float(simInitConfig["control_variables"]["firstIndPointLoc"])
    # indPointsLocsKMSRegEpsilon = float(simInitConfig["control_variables"]["indPointsLocsKMSRegEpsilon"])

    with open(simResFilename, "rb") as f:
        simRes = pickle.load(f)
    spikesTimes = simRes["spikes"]
    KzzChol = simRes["KzzChol"]
    indPointsMeans = simRes["indPointsMeans"]
    C, d = utils.svGPFA.configUtils.getLinearEmbeddingParams(
        CFilename=simInitConfig["embedding_params"]["C_filename"],
        dFilename=simInitConfig["embedding_params"]["d_filename"])

    legQuadPoints, legQuadWeights = utils.svGPFA.miscUtils.getLegQuadPointsAndWeights(
        nQuad=nQuad, trialsLengths=trialsLengths)

    kernels = utils.svGPFA.configUtils.getKernels(nLatents=nLatents,
                                                  config=simInitConfig,
                                                  forceUnitScale=True)
    kernelsParams0 = utils.svGPFA.initUtils.getKernelsParams0(kernels=kernels,
                                                              noiseSTD=0.0)

    # Z0 = utils.svGPFA.initUtils.getIndPointLocs0(nIndPointsPerLatent=nIndPointsPerLatent, trialsLengths=trialsLengths, firstIndPointLoc=firstIndPointLoc)
    Z0 = utils.svGPFA.configUtils.getIndPointsLocs0(nLatents=nLatents,
                                                    nTrials=nTrials,
                                                    config=simInitConfig)
    nIndPointsPerLatent = [Z0[k].shape[1] for k in range(nLatents)]

    # patch to acommodate Lea's equal number of inducing points across trials
    qMu0 = [[] for k in range(nLatents)]
    for k in range(nLatents):
        qMu0[k] = torch.empty((nTrials, nIndPointsPerLatent[k], 1),
                              dtype=torch.double)
        for r in range(nTrials):
            qMu0[k][r, :, :] = indPointsMeans[r][k]
    # end patch

    srQSigma0Vecs = utils.svGPFA.initUtils.getSRQSigmaVecsFromSRMatrices(
        srMatrices=KzzChol)

    qUParams0 = {"qMu0": qMu0, "srQSigma0Vecs": srQSigma0Vecs}
    kmsParams0 = {"kernelsParams0": kernelsParams0, "inducingPointsLocs0": Z0}
    qKParams0 = {
        "svPosteriorOnIndPoints": qUParams0,
        "kernelsMatricesStore": kmsParams0
    }
    qHParams0 = {"C0": C, "d0": d}
    initialParams = {
        "svPosteriorOnLatents": qKParams0,
        "svEmbedding": qHParams0
    }
    quadParams = {
        "legQuadPoints": legQuadPoints,
        "legQuadWeights": legQuadWeights
    }

    # create model
    model = stats.svGPFA.svGPFAModelFactory.SVGPFAModelFactory.buildModel(
        conditionalDist=stats.svGPFA.svGPFAModelFactory.PointProcess,
        linkFunction=stats.svGPFA.svGPFAModelFactory.ExponentialLink,
        embeddingType=stats.svGPFA.svGPFAModelFactory.LinearEmbedding,
        kernels=kernels)

    model.setMeasurements(measurements=spikesTimes)
    model.setInitialParams(initialParams=initialParams)
    model.setQuadParams(quadParams=quadParams)
    model.setIndPointsLocsKMSRegEpsilon(
        indPointsLocsKMSRegEpsilon=indPointsLocsKMSRegEpsilon)
    model.buildKernelsMatrices()

    refParam = lowerBoundVsOneParamUtils.getReferenceParam(
        paramType=paramType,
        model=model,
        trial=trial,
        latent=latent,
        neuron=neuron,
        kernelParamIndex=kernelParamIndex,
        indPointIndex=indPointIndex,
        indPointIndex2=indPointIndex2)
    paramUpdateFun = lowerBoundVsOneParamUtils.getParamUpdateFun(
        paramType=paramType)
    paramValues = np.arange(paramValueStart, paramValueEnd, paramValueStep)
    lowerBoundValues = np.empty(paramValues.shape)
    for i in range(len(paramValues)):
        paramUpdateFun(model=model,
                       paramValue=paramValues[i],
                       trial=trial,
                       latent=latent,
                       neuron=neuron,
                       kernelParamIndex=kernelParamIndex,
                       indPointIndex=indPointIndex,
                       indPointIndex2=indPointIndex2)
        Kzz = model._eLL._svEmbeddingAllTimes._svPosteriorOnLatents._indPointsLocsKMS._Kzz
        # begin debug code
        #         for k in range(nLatents):
        #             nTrial = Kzz[k].shape[0]
        #             for r in range(nTrial):
        #                 # torch.sum(torch.abs(torch.eig(Kzz[k][0,:,:]).eigenvalues[:,1]))==0
        #                 imEigenval = torch.eig(Kzz[k][0,:,:]).eigenvalues[:,1]
        #                 if torch.any(imEigenval!=0.0):
        #                     print("{:f}".format(paramValues[i]))
        #         if paramValues[i]>=16.48:
        #             pdb.set_trace()
        # end debug code
        #         if paramValues[i]>=4.0:
        #             pdb.set_trace()
        lowerBoundValues[i] = model.eval()
    # begin fix plotly problem with nInf values
    # nInfIndices = np.where(lowerBoundValues==-np.inf)[0]
    # minNoNInfLowerBound = lowerBoundValues[nInfIndices.max()+1]
    # lowerBoundNoNInfValues = lowerBoundValues
    # lowerBoundNoNInfValues[nInfIndices] = minNoNInfLowerBound
    # end fix plotly problem with nInf values

    # begin fix plotly problem with nInf values
    boundedLowerBound = lowerBoundValues
    smallIndices = np.where(lowerBoundValues < yMin)[0]
    boundedLowerBound[smallIndices] = None
    largeIndices = np.where(lowerBoundValues > yMax)[0]
    boundedLowerBound[largeIndices] = None
    # end fix plotly problem with nInf values
    title = lowerBoundVsOneParamUtils.getParamTitle(
        paramType=paramType,
        trial=trial,
        latent=latent,
        neuron=neuron,
        kernelParamIndex=kernelParamIndex,
        indPointIndex=indPointIndex,
        indPointIndex2=indPointIndex2,
        indPointsLocsKMSRegEpsilon=indPointsLocsKMSRegEpsilon)
    figFilenamePattern = lowerBoundVsOneParamUtils.getFigFilenamePattern(
        prefixNumber=simResNumber,
        descriptor="lowerBoundVs1DParam_generativeParams",
        paramType=paramType,
        trial=trial,
        latent=latent,
        neuron=neuron,
        indPointsLocsKMSRegEpsilon=indPointsLocsKMSRegEpsilon,
        kernelParamIndex=kernelParamIndex,
        indPointIndex=indPointIndex,
        indPointIndex2=indPointIndex2)
    fig = plot.svGPFA.plotUtilsPlotly.getPlotLowerBoundVsOneParam(
        paramValues=paramValues,
        lowerBoundValues=lowerBoundValues,
        refParams=[refParam],
        title=title,
        yMin=yMin,
        yMax=yMax,
        lowerBoundLineColor="blue",
        refParamsLineColors=["blue"])
    fig.write_image(figFilenamePattern.format("png"))
    fig.write_html(figFilenamePattern.format("html"))
    pio.renderers.default = "browser"
    fig.show()

    pdb.set_trace()