Neutralizing input variables not in input dataframe and keep some crucial variables
505420
def neutralize_variables(self, tax_benefit_system):
        
        for variable_name, variable in tax_benefit_system.variables.items():
            if variable.formulas:
                continue
            if self.used_as_input_variables and (variable_name in self.used_as_input_variables):
                continue
            if self.non_neutralizable_variables and (variable_name in self.non_neutralizable_variables):
                continue
            if self.weight_column_name_by_entity and (variable_name in self.weight_column_name_by_entity.values()):
                continue

            tax_benefit_system.neutralize_variable(variable_name)
127922
function normalizeInput (data, field) {
    // replace empty strings with undefined
    if ((field.inputType === 'text' || field.inputType === 'select') && data[field.property] === '') {
        data[field.property] = undefined
    }
    // convert checkbox value to boolean
    else if (field.inputType === 'checkbox') {
        data[field.property] = data[field.property] ? true : false
    }
    // nested array input
    else if (field.nested && field.array) {
        // if input has property then remove last row if it is all empty
        if (Array.isArray(data[field.property])) {
            // get last row in array
            var item = data[field.property][data[field.property].length - 1]
            // flag set to true if any values found
            var hasValues = false
            // check all properties of item to see if any have non empty values
            _.each(item, value => {
                if (!hasValues && typeof value === 'string' && value.length) {
                    hasValues = true
                }
            })
            // if there are no values then remove last item from array
            if (!hasValues) {
                data[field.property].pop()
            }
        }
        // otherwise set property as empty array
        else {
            data[field.property] = []
        }
    }
}
1357044
def attention_mask_ignore_padding(inputs, dtype=tf.float32):
  
  inputs = rename_length_to_memory_length(inputs)
  return mtf.cast(mtf.equal(inputs, 0), dtype) * -1e9
1015127
private void restoreNestedVariables() {
	if (nestedVars != null) {
	    Iterator iter = nestedVars.iterator();
	    while (iter.hasNext()) {
		String varName = (String) iter.next();
		varName = findAlias(varName);
		Object obj = originalNestedVars.get(varName);
		if (obj != null) {
		    invokingJspCtxt.setAttribute(varName, obj);
		} else {
		    invokingJspCtxt.removeAttribute(varName, PAGE_SCOPE);
		}
	    }
	}
    }
930936
def _sanitize_params(prefix, suffix, dir):
    """"""
    output_type = _infer_return_type(prefix, suffix, dir)
    if suffix is None:
        suffix = output_type()
    if prefix is None:
        if output_type is str:
            prefix = "tmp"
        else:
            prefix = os.fsencode("tmp")
    if dir is None:
        if output_type is str:
            dir = gettempdir()
        else:
            dir = fs_encode(gettempdir())
    return prefix, suffix, dir, output_type
536149
def clean_int(v):
    """"""

    if v is None or not str(v).strip():
        return None

    return int(str(v).replace(',', ''))
881350
def _ignore_variable(filename, varname):
    
    return (
        varname in IGNORED_VARIABLE_NAMES or
        (varname.startswith('_') and not varname.startswith('__')) or
        _is_special_name(varname))
759377
def input_variables(self, exclude_specials=True):
        

        def has_write_access(accesses):
            return any(acc for acc in accesses if acc.access_type == 'write')

        def has_read_access(accesses):
            return any(acc for acc in accesses if acc.access_type == 'read')

        input_variables = [ ]

        for variable, accesses in self._variable_accesses.items():
            if not has_write_access(accesses) and has_read_access(accesses):
                if not exclude_specials or not variable.category:
                    input_variables.append(variable)

        return input_variables
1178968
def _check_params(ignored_variables, ignored_interactions):
    """"""

    if ignored_variables is None:
        ignored_variables = set()
    elif not isinstance(ignored_variables, abc.Container):
        ignored_variables = set(ignored_variables)

    if ignored_interactions is None:
        ignored_interactions = set()
    elif not isinstance(ignored_interactions, abc.Container):
        ignored_interactions = set(ignored_interactions)

    return ignored_variables, ignored_interactions
81534
def _variable_components(self, variable):
        """"""
        var_list = pd.Series(self.data.variable.unique())
        return var_list[pattern_match(var_list, '{}|*'.format(variable), 0)]
712906
def filter_missing_X_and_y(X, y):
    """"""
    y_nans = np.isnan(y)
    x_nans = np.isnan(X).any(axis=1)
    unioned_nans = np.logical_or(x_nans, y_nans)

    return X[~unioned_nans], y[~unioned_nans]
485008
private void addSubMatrixVariables(List<TokenList.Token> inputs, List<Variable> variables) {
        for (int i = 0; i < inputs.size(); i++) {
            TokenList.Token t = inputs.get(i);
            if( t.getType() != Type.VARIABLE )
                throw new ParseError("Expected variables only in sub-matrix input, not "+t.getType());
            Variable v = t.getVariable();
            if( v.getType() == VariableType.INTEGER_SEQUENCE || isVariableInteger(t) ) {
                variables.add(v);
            } else {
                throw new ParseError("Expected an integer, integer sequence, or array range to define a submatrix");
            }
        }
    }
101510
def _clean_salt_variables(params, variable_prefix="__"):
    '''
    
    '''
    list(list(map(params.pop, [k for k in params if k.startswith(variable_prefix)])))
    return params
1158848
def sanitize_index(data, index, copy=False):
    

    if index is None:
        return data

    if len(data) != len(index):
        raise ValueError('Length of values does not match length of index')

    if isinstance(data, ABCIndexClass) and not copy:
        pass
    elif isinstance(data, (ABCPeriodIndex, ABCDatetimeIndex)):
        data = data._values
        if copy:
            data = data.copy()

    elif isinstance(data, np.ndarray):

        # coerce datetimelike types
        if data.dtype.kind in ['M', 'm']:
            data = sanitize_array(data, index, copy=copy)

    return data
452217
def interp_na(self, dim=None, use_coordinate=True, method='linear', limit=None,
              **kwargs):
    ''''''

    if dim is None:
        raise NotImplementedError('dim is a required argument')

    if limit is not None:
        valids = _get_valid_fill_mask(self, dim, limit)

    # method
    index = get_clean_interp_index(self, dim, use_coordinate=use_coordinate,
                                   **kwargs)
    interp_class, kwargs = _get_interpolator(method, **kwargs)
    interpolator = partial(func_interpolate_na, interp_class, **kwargs)

    with warnings.catch_warnings():
        warnings.filterwarnings('ignore', 'overflow', RuntimeWarning)
        warnings.filterwarnings('ignore', 'invalid value', RuntimeWarning)
        arr = apply_ufunc(interpolator, index, self,
                          input_core_dims=[[dim], [dim]],
                          output_core_dims=[[dim]],
                          output_dtypes=[self.dtype],
                          dask='parallelized',
                          vectorize=True,
                          keep_attrs=True).transpose(*self.dims)

    if limit is not None:
        arr = arr.where(valids)

    return arr
890850
def destandardize_variables(self, tv, blin, bvar, errBeta, nonmissing):
        """"""
        return self.test_variables.destandardize(tv, blin, bvar, errBeta, nonmissing)
984253
def clean(self, value):
        """"""

        if isinstance(value, (list, tuple)):
            return [super(FeatureCollectionParameter, self).clean(x) for x in value]

        raise ParameterNotValidError