Save all concepts with non-zero |small_phi| to the
        |CauseEffectStructure|.
502940
def process_result(self, new_concept, concepts):
        
        if new_concept.phi > 0:
            # Replace the subsystem
            new_concept.subsystem = self.subsystem
            concepts.append(new_concept)
        return concepts
553449
def _save_assignment(self, node, name=None):
        """"""
        if self._global_names and node.name in self._global_names[-1]:
            node.root().set_local(node.name, node)
        else:
            node.parent.set_local(node.name, node)
701228
void initNodeRefs(long oldCapacity, long newCapacity) {
        for (long pointer = oldCapacity + N_EDGE_REF; pointer < newCapacity; pointer += nodeEntryBytes) {
            nodes.setInt(pointer, EdgeIterator.NO_EDGE);
        }
        if (extStorage.isRequireNodeField()) {
            for (long pointer = oldCapacity + N_ADDITIONAL; pointer < newCapacity; pointer += nodeEntryBytes) {
                nodes.setInt(pointer, extStorage.getDefaultNodeFieldValue());
            }
        }
    }
265514
def save(self):
        

        # create or update instance node
        if hasattr(self, 'id'):
            # update
            params = self.deflate(self.__properties__, self)
            query = "MATCH (n) WHERE id(n)={self} \n"
            query += "\n".join(["SET n.{0} = {{{1}}}".format(key, key) + "\n"
                                for key in params.keys()])
            for label in self.inherited_labels():
                query += "SET n:`{0}`\n".format(label)
            self.cypher(query, params)
        elif hasattr(self, 'deleted') and self.deleted:
            raise ValueError("{0}.save() attempted on deleted node".format(
                self.__class__.__name__))
        else:  # create
            self.id = self.create(self.__properties__)[0].id
        return self
340420
def save_prep(cls, instance_or_instances):
        
        instances = make_obj_list(instance_or_instances)

        tokens = set(cls.objects.get_available_tokens(
            count=len(instances),
            token_length=cls.token_length
        ))

        for instance in instances:
            if not instance.token:
                instance.token = tokens.pop()

        super(AbstractTokenModel, cls).save_prep(
            instance_or_instances=instances
        )
555439
def save(self):
        """"""
        spike_clusters = self.clustering.spike_clusters
        groups = {c: self.cluster_meta.get('group', c) or 'unsorted'
                  for c in self.clustering.cluster_ids}
        # List of tuples (field_name, dictionary).
        labels = [(field, self.get_labels(field))
                  for field in self.cluster_meta.fields
                  if field not in ('next_cluster')]
        # TODO: add option in add_field to declare a field unsavable.
        self.emit('request_save', spike_clusters, groups, *labels)
        # Cache the spikes_per_cluster array.
        self._save_spikes_per_cluster()
176829
public static void fixMicroheterogenity(Structure bioJavaStruct) {
		// Loop through the models
		for (int i=0; i<bioJavaStruct.nrModels(); i++){
			// Then the chains
			List<Chain> chains = bioJavaStruct.getModel(i);
			for (Chain c : chains) {
				// Build a new list of groups
				List<Group> outGroups = new ArrayList<>();
				for (Group g : c.getAtomGroups()) {
					List<Group> removeList = new ArrayList<>();
					for (Group altLoc : g.getAltLocs()) {
						// Check if they are not equal -> microheterogenity
						if(! altLoc.getPDBName().equals(g.getPDBName())) {
							// Now add this group to the main list
							removeList.add(altLoc);
						}
					}
					// Add this group
					outGroups.add(g);
					// Remove any microhet alt locs
					g.getAltLocs().removeAll(removeList);
					// Add these microhet alt locs
					outGroups.addAll(removeList);
				}
				c.setAtomGroups(outGroups);
			}
		}
	}
1049224
def save_object(fname, obj):
    """"""

    fd = gzip.open(fname, "wb")
    six.moves.cPickle.dump(obj, fd)
    fd.close()
1317735
function buildConcepts(item, fullDimensions) {
  function isInitiallyActive(dimensionId, value, index) {
    if (!defined(item.selectedInitially)) {
      return index === 0;
    }
    var dimensionSelectedInitially = item.selectedInitially[dimensionId];
    if (!defined(dimensionSelectedInitially)) {
      return index === 0;
    }
    return dimensionSelectedInitially.indexOf(value.id) >= 0;
  }

  var conceptDimensions = getShownDimensions(
    item,
    fullDimensions,
    fullDimensions
  );
  fixSelectedInitially(item, conceptDimensions); // Note side-effect.
  var concepts = conceptDimensions.map(function(dimension, i) {
    var allowMultiple =
      item.allSingleValuedDimensionIds.indexOf(dimension.id) === -1;
    var concept = new DisplayVariablesConcept(dimension.name, {
      isOpen: false,
      allowMultiple: allowMultiple,
      requireSomeActive: true,
      exclusiveChildIds: getTotalValueIdsForDimensionId(item, dimension.id)
    });
    concept.id = dimension.id;
    concept.items = dimension.values.map(function(value, index) {
      return new VariableConcept(renameValue(item, value.name), {
        parent: concept,
        id: value.id,
        active: isInitiallyActive(concept.id, value, index)
      });
    });
    return concept;
  });
  if (concepts.length > 0) {
    return [new SummaryConcept(undefined, { items: concepts, isOpen: false })];
  }
  return [];
}
1361322
public void balance() {
        if (!rootDir.exists())
            rootDir.mkdirs();
        if (!rootSaveDir.exists())
            rootSaveDir.mkdirs();

        if (paths == null)
            paths = Maps.newHashMap();
        if (labelRootDirs == null)
            labelRootDirs = Lists.newArrayList();

        for (int i = 0; i < numLabels; i++) {
            paths.put(i, new ArrayList<File>());
            labelRootDirs.add(new File(rootDir, String.valueOf(i)));
        }


        //lay out each example in their respective label directories tracking the paths along the way
        while (dataSetIterator.hasNext()) {
            DataSet next = dataSetIterator.next();
            //infer minibatch size from iterator
            if (miniBatchSize < 0)
                miniBatchSize = next.numExamples();
            for (int i = 0; i < next.numExamples(); i++) {
                DataSet currExample = next.get(i);
                if (!labelRootDirs.get(currExample.outcome()).exists())
                    labelRootDirs.get(currExample.outcome()).mkdirs();

                //individual example will be saved to: labelrootdir/examples.size()
                File example = new File(labelRootDirs.get(currExample.outcome()),
                                String.valueOf(paths.get(currExample.outcome()).size()));
                currExample.save(example);
                paths.get(currExample.outcome()).add(example);
            }
        }

        int numsSaved = 0;
        //loop till all file paths have been removed
        while (!paths.isEmpty()) {
            List<DataSet> miniBatch = new ArrayList<>();
            while (miniBatch.size() < miniBatchSize && !paths.isEmpty()) {
                for (int i = 0; i < numLabels; i++) {
                    if (paths.get(i) != null && !paths.get(i).isEmpty()) {
                        DataSet d = new DataSet();
                        d.load(paths.get(i).remove(0));
                        miniBatch.add(d);
                    } else
                        paths.remove(i);
                }
            }

            if (!rootSaveDir.exists())
                rootSaveDir.mkdirs();
            //save with an incremental count of the number of minibatches saved
            if (!miniBatch.isEmpty()) {
                DataSet merge = DataSet.merge(miniBatch);
                if (dataNormalization != null)
                    dataNormalization.transform(merge);
                merge.save(new File(rootSaveDir, String.format("dataset-%d.bin", numsSaved++)));
            }


        }

    }
1184882
def save_config(self):
        """"""
        self.config_section['match_fuzzy'] = self.model_completer.match_fuzzy
        self.config_section['enable_vi_bindings'] = self.enable_vi_bindings
        self.config_section['show_completion_columns'] = \
            self.show_completion_columns
        self.config_section['show_help'] = self.show_help
        self.config_section['theme'] = self.theme
        self.config_obj.write()
740996
private function SaveConstantsToPHP()
    {
        $output_file = fopen(
            $this->definitions_path . "constants.php", 
            "w"
        );
        
        fwrite($output_file, "<?php\n\n");
        
        fwrite($output_file, "use Peg\Lib\Definitions\Element\Constant;\n");
        
        foreach($this->symbols->headers as $header)
        {
            if(!$header->HasConstants())
                continue;
            
            foreach($header->namespaces as $namespace)
            {
                if(!$namespace->HasConstants())
                    continue;
                
                foreach($namespace->constants as $constant)
                {
                    $value = addslashes($constant->value);
                    $description = addslashes($constant->description);
                    $namespace_name = addslashes($namespace->name);
                    
                    $output = "\n";
                    $output .= '$symbols->AddConstant(' . "\n";
                    $output .= '    new Constant(' . "\n";
                    $output .= '        "'.$constant->name.'",' . "\n";
                    $output .= '        "'.$value.'",' . "\n";
                    $output .= '        "'.$description.'"' . "\n";
                    $output .= '    ),' . "\n";
                    $output .= '    "'.$header->name.'",' . "\n";
                    $output .= '    "'.$namespace_name.'"' . "\n";
                    $output .= ');' . "\n";
                    
                    fwrite($output_file, $output);
                }
            }
        }
        
        fclose($output_file);
    }
358760
def save(self, f):
        """"""
        return pickle.dump((self.perceptron.weights, self.tagdict, self.classes, self.clusters), f, protocol=pickle.HIGHEST_PROTOCOL)
91618
def add_named_concept_filters(self, named_filter_concepts):
        
        for concept_key, concept_name in named_filter_concepts.items():
            self.add_concept_filter(concept_key, concept_name=concept_name)
1306723
protected void sparsify()
    {
        final int N = vecs.size();
        int accSize = accelCache == null ? 0 : accelCache.size()/N;
        int svCount = 0;
        for(int i = 0; i < N; i++)
            if(alphas[i] != 0)//Its a support vector
            {
                ListUtils.swap(vecs, svCount, i);
                if(accelCache != null)
                    for(int j = i*accSize; j < (i+1)*accSize; j++)
                        ListUtils.swap(accelCache, svCount*accSize+j-i*accSize, j);
                alphas[svCount++] = alphas[i];
            }

        vecs = new ArrayList<Vec>(vecs.subList(0, svCount));
        alphas = Arrays.copyOfRange(alphas, 0, svCount);
    }
660873
def _save_model(self, steps=0):
        
        for brain_name in self.trainers.keys():
            self.trainers[brain_name].save_model()
        self.logger.info('Saved Model')
713581
def save_state(state, output_dir, keep=False):
  """"""
  params_file = os.path.join(output_dir, "model.pkl")
  with gfile.GFile(params_file, "wb") as f:
    pickle.dump((state.params, state.step, state.history), f)
  if keep:
    params_file = os.path.join(output_dir, "model_{}.pkl".format(state.step))
    with gfile.GFile(params_file, "wb") as f:
      pickle.dump((state.params, state.step, state.history), f)
  log("Model saved to %s" % params_file, stdout=False)