<commit_before>"""
Author: Dr. <NAME> <<EMAIL>>
        Dr. <NAME>         <<EMAIL>>

Metamodels - a base class for metamodel methods
"""
#TODO: Extend to multifidelity problems by adding training_pts = {'approx': {}}

from __future__ import division

import numpy as np
import time

class SM(object):
    
    ''' 
    Base class for all model methods.

    '''
    
    def __init__(self, sm_options=None, printf_options=None):
        
        ''' 
        Constructor.
        
        Arguments
        ---------
        sm_options : dict
            Model-related options, in _default_options in the inheriting class

        printf_options : dict
            Output printing options
        '''
        
        #Initialization
        self._set_default_options()
        self.sm_options.update(sm_options)
        self.printf_options.update(printf_options)
        
        self.training_pts = {'exact': {}}
        self.times = {}
        self.printstr_time = '   %-14s : %10.7f'        


    #############################################################################
    # Model functions
    #############################################################################

        
    def add_training_pts(self, typ, xt, yt, kx=None):
        
        ''' 
        Adds nt training/sample data points

        Arguments
        ---------
        typ : str            
            'exact'  if this data are considered as a high-fidelty data
            'approx' if this data are considered as a low-fidelity data (TODO)
        xt : np.ndarray [nt, dim]
            Training point input variable values
        yt : np.ndarray [nt, 1]
            Training point output variable values or derivatives (a vector)
        kx : int, optional
            None if this data set represents output variable values
            int  if this data set represents derivatives
                 where it is differentiated w.r.t. the kx^{th} 
                 input variable (kx is 0-based)
        '''
<commit_msg>Update sm.py<commit_after>"""
Author: Dr. <NAME> <<EMAIL>>
        Dr. <NAME>         <<EMAIL>>

Metamodels - a base class for metamodel methods
"""
#TODO: Extend to multifidelity problems by adding training_pts = {'approx': {}}

from __future__ import division

import numpy as np
import time

class SM(object):
    
    ''' 
    Base class for all model methods.

    '''
    
    def __init__(self, sm_options=None, printf_options=None):
        
        ''' 
        Constructor.
        
        Arguments
        ---------
        sm_options : dict
            Model-related options, in _default_options in the inheriting class

        printf_options : dict
            Output printing options
        '''
        
        #Initialization
        self._set_default_options()
        self.sm_options.update(sm_options)
        self.printf_options.update(printf_options)
        
        self.training_pts = {'exact': {}}
        self.times = {}
        self.printstr_time = '   %-14s : %10.7f'        


    #############################################################################
    # Model functions
    #############################################################################

        
    def add_training_pts(self, typ, xt, yt, kx=None):
        
        ''' 
        Adds nt training/sample data points

        Arguments
        ---------
        typ : str            
            'exact'  if this data are considered as a high-fidelty data
            'approx' if this data are considered as a low-fidelity data (TODO)
        xt : np.ndarray [nt, dim]
            Training point input variable values
        yt : np.ndarray [nt, 1]
            Training point output variable values or derivatives (a vector)
        kx : int, optional
            None if this data set represents output variable values
            int  if this data set represents derivatives
                 where it is differentiated w.r.t. the kx^{th} 
                 input variable (kx is 0-based)
        '''
        yt = yt.reshape((xt.shape[0],1))
{'fraction_non_alphanumeric': 0.15874969234555747, 'fraction_numerical': 0.0039379768643859215, 'mean_word_length': 1.8802267895109852, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1134297', 'n_tokens_mistral': 1090, 'n_tokens_neox': 1016, 'n_words': 329}