Gets a string description of {@code assignments} and their weights in
{@code this}.

@param assignments
@param includeZeros if {@code false}, zero weight assignments are omitted.
@return
8984
public String describeAssignments(List<Assignment> assignments, boolean includeZeros) {
    StringBuilder sb = new StringBuilder();
    for (Assignment assignment : assignments) {
      double unnormalizedProb = getUnnormalizedProbability(assignment);
      if (unnormalizedProb != 0.0 || includeZeros) {
        Outcome outcome = new Outcome(assignment, unnormalizedProb);
        sb.append(outcome.toString());
        sb.append("\n");
      }
    }
    return sb.toString();
  }
1294267
private HashMap<String, DBIDs> multipleAssignment(Relation<?> data) {
    HashMap<String, DBIDs> labelMap = new HashMap<>();

    for(DBIDIter iditer = data.iterDBIDs(); iditer.valid(); iditer.advance()) {
      String[] labels = data.get(iditer).toString().split(" ");
      for(String label : labels) {
        assign(labelMap, label, iditer);
      }
    }
    return labelMap;
  }
862881
function(node) {
    if (node.type !== 'AssignmentExpression') return false;

    return node.left.type === 'MemberExpression' &&
      node.left.object.type === 'Identifier' && node.left.object.name === 'module' &&
      node.left.property.type === 'Identifier' && node.left.property.name === 'exports';
    // TODO: detect module.exports.foo = (or exports.foo =) property assignments, non-default exports
  }
1125042
public static Assignments allUnassigned(Method testMethod,
            TestClass testClass) {
        List<ParameterSignature> signatures;
        signatures = ParameterSignature.signatures(testClass
                .getOnlyConstructor());
        signatures.addAll(ParameterSignature.signatures(testMethod));
        return new Assignments(new ArrayList<PotentialAssignment>(),
                signatures, testClass);
    }
847656
public static Map<String, String> getTopologyCodeLocations(
            Map<String, Assignment> assignments, String supervisorId) throws Exception {
        Map<String, String> rtn = new HashMap<>();
        for (Entry<String, Assignment> entry : assignments.entrySet()) {
            String topologyId = entry.getKey();
            Assignment assignmentInfo = entry.getValue();

            Set<ResourceWorkerSlot> workers = assignmentInfo.getWorkers();
            for (ResourceWorkerSlot worker : workers) {
                String node = worker.getNodeId();
                if (supervisorId.equals(node)) {
                    rtn.put(topologyId, assignmentInfo.getMasterCodeDir());
                    break;
                }
            }

        }
        return rtn;
    }
1282091
public DynamicAssignment fixedVariableOutcomeToAssignment(List<? extends Object> values) {
    return DynamicAssignment.fromAssignment(fixedVariables.outcomeToAssignment(values));
  }
322664
public static Assignment unionAll(Collection<Assignment> assignments) {
    int numVars = 0;
    for (Assignment assignment : assignments) {
      numVars += assignment.size();
    }

    int[] vars = new int[numVars];
    Object[] values = new Object[numVars];
    int numFilled = 0;
    for (Assignment assignment : assignments) {
      int[] assignmentVars = assignment.vars;
      Object[] assignmentValues = assignment.values;
      int numAssignmentVars = assignment.vars.length;
      for (int i = 0; i < numAssignmentVars; i++) {
        vars[numFilled] = assignmentVars[i];
        values[numFilled] = assignmentValues[i];
        numFilled++;
      }
    }
    Preconditions.checkState(numFilled == numVars);
    return Assignment.fromUnsortedArrays(vars, values);
  }
1168664
public static boolean containsZeros(Tensor tmFalseIn) {        
        Algebra s = tmFalseIn.getAlgebra();
        for (int c=0; c<tmFalseIn.size(); c++) {
            if (tmFalseIn.getValue(c) == s.zero()) {
                return true;
            }
        }
        return false;
    }
128889
public static String getLabel(ComponentJob job, boolean includeDescriptorName, boolean includeInputColumnNames,
            boolean includeRequirements) {
        final String jobName = job.getName();
        final StringBuilder label = new StringBuilder();
        if (Strings.isNullOrEmpty(jobName)) {
            if (job instanceof ConfigurableBeanJob) {
                BeanDescriptor<?> descriptor = ((ConfigurableBeanJob<?>) job).getDescriptor();
                label.append(descriptor.getDisplayName());
            } else {
                label.append(job.toString());
            }
        } else {
            label.append(jobName);
        }

        if (job instanceof AnalyzerJob) {
            AnalyzerJob analyzerJob = (AnalyzerJob) job;
            if (includeDescriptorName && !Strings.isNullOrEmpty(jobName)) {
                label.append(" (");
                label.append(analyzerJob.getDescriptor().getDisplayName());
                label.append(')');
            }

            final InputColumn<?>[] input = analyzerJob.getInput();
            if (input.length == 1) {
                if (input[0].getName().equals(jobName)) {
                    // special case where jobName is the same as the single
                    // input column - in that case we'll leave out the column
                    // name
                    includeInputColumnNames = false;
                }
            }
            if (includeInputColumnNames && input.length > 0) {

                label.append(" (");
                if (input.length < 5) {
                    for (int i = 0; i < input.length; i++) {
                        if (i != 0) {
                            label.append(',');
                        }
                        label.append(input[i].getName());
                    }
                } else {
                    label.append(input.length);
                    label.append(" columns");
                }
                label.append(")");
            }

            final ComponentRequirement requirement = analyzerJob.getComponentRequirement();
            if (includeRequirements && requirement != null) {
                label.append(" (");
                label.append(requirement.toString());
                label.append(")");
            }
        }

        return label.toString();
    }
611351
def cluster_assignments(self):
        
        array = javabridge.call(self.jobject, "getClusterAssignments", "()[D")
        if array is None:
            return None
        else:
            return javabridge.get_env().get_double_array_elements(array)
935901
public ZParams weights(final double... weights) {
    params.add(WEIGHTS.raw);
    for (final double weight : weights) {
      params.add(Protocol.toByteArray(weight));
    }

    return this;
  }
80050
public void setAssignmentStatuses(java.util.Collection<String> assignmentStatuses) {
        if (assignmentStatuses == null) {
            this.assignmentStatuses = null;
            return;
        }

        this.assignmentStatuses = new java.util.ArrayList<String>(assignmentStatuses);
    }
349216
public QueryBuilder<V> withBindVariableValues(Map<String, V> values) {
    valueMap.putAll(values);
    return this;
  }
802672
public Mean put(double[] vals, double[] weights) {
    assert (vals.length == weights.length);
    for(int i = 0, end = vals.length; i < end; i++) {
      put(vals[i], weights[i]);
    }
    return this;
  }
82551
function containsAssignment(node) {
			if (node.type === "AssignmentExpression") {
				return true;
			} else if (node.type === "ConditionalExpression" &&
				(node.consequent.type === "AssignmentExpression" || node.alternate.type === "AssignmentExpression")) {
				return true;
			} else if ((node.left && node.left.type === "AssignmentExpression") ||
				(node.right && node.right.type === "AssignmentExpression")) {
				return true;
			}

			return false;
		}
575070
private AssignmentInsn getEffectiveAssignmentInstruction(final Collection<AssignmentInsn> assignmentInstructions) {
        AssignmentInsn result = NullAssignmentInsn.getInstance();
        int maxInstructionNumber = -1;
        for (final AssignmentInsn assignmentInsn : assignmentInstructions) {
            final int indexOfAssignmentInstruction = assignmentInsn.getIndexWithinMethod();
            if (indexOfAssignmentInstruction > maxInstructionNumber) {
                maxInstructionNumber = indexOfAssignmentInstruction;
                result = assignmentInsn;
            }
        }
        return result;
    }
1364564
public void removeZero(Linear cl) {
		StringFeatureAlphabet feature = (StringFeatureAlphabet) cl.getAlphabetFactory().DefaultFeatureAlphabet();
		float[] weights = cl.getWeights();		
		int c = MyArrays.countNoneZero(weights);
		System.out.println("\n优化前");	
		System.out.println("字典索引个数"+feature.keysize());
		System.out.println("字典大小"+cl.getAlphabetFactory().DefaultFeatureAlphabet().size());
		System.out.println("权重长度"+weights.length);
		System.out.println("非零权重"+c);	
		boolean freeze = false;
		if (feature.isStopIncrement()) {
			feature.setStopIncrement(false);
			freeze = true;
		}


		TIntObjectHashMap<String> index = new TIntObjectHashMap<String>();
		TObjectIntIterator<String> it = feature.iterator();
		while (it.hasNext()) {
			it.advance();
			String value = it.key();
			int key = it.value();
			index.put(key, value);
		}
		int[] idx = index.keys();
		Arrays.sort(idx);
		int length = weights.length;
		IFeatureAlphabet newfeat = new StringFeatureAlphabet();
		cl.getAlphabetFactory().setDefaultFeatureAlphabet(newfeat);
		TFloatArrayList ww = new TFloatArrayList();
		float[] vars = new float[idx.length];
		float[] entropy = new float[idx.length];
		for (int i = 0; i < idx.length; i++) {
			int base = idx[i]; //一个特征段起始位置
			int end; //一个特征段结束位置
			if (i < idx.length - 1)
				end = idx[i + 1]; //对应下一个特征段起始位置
			else
				end  = length; //或者整个结束位置
			int interv = end - base;   //一个特征段长度
			float[] sw = new float[interv];
			for (int j = 0; j < interv; j++) {
				sw[j] = weights[base+j];
			}
			//计算方差
//			System.out.println(MyStrings.toString(sw, " "));
			vars[i] = MyArrays.viarance(sw);
			MyArrays.normalize(sw);
			MyArrays.normalize2Prop(sw);
			entropy[i] = MyArrays.entropy(sw);
			int[] maxe = new int[sw.length];
			for(int iii=0;iii<maxe.length;iii++){
				maxe[iii]=1;
			}
			float maxen = MyArrays.entropy(maxe);
			if (i==0||vars[i]>varsthresh&&entropy[i]<maxen*0.999) {
				String str = index.get(base);
				int id = newfeat.lookupIndex(str, interv);
				for (int j = 0; j < interv; j++) {
					ww.insert(id + j, weights[base + j]);
				}
			}else{
//								System.out.print(".");	
			}
		}
		System.out.println("方差均值："+MyArrays.average(vars));
		System.out.println("方差非零个数："+MyArrays.countNoneZero(vars));
		System.out.println("方差直方图："+MyStrings.toString(MyArrays.histogram(vars, 10)));
//		MyArrays.normalize2Prop(entropy);
		System.out.println("熵均值："+MyArrays.average(entropy));
		System.out.println("熵非零个数："+MyArrays.countNoneZero(entropy));
		System.out.println("熵直方图："+MyStrings.toString(MyArrays.histogram(entropy, 10)));
		
		newfeat.setStopIncrement(freeze);
		cl.setWeights(ww.toArray());

		float[] www = cl.getWeights();
		c = MyArrays.countNoneZero(www);

		System.out.println("\n优化后");	
		System.out.println("字典索引个数"+cl.getAlphabetFactory().DefaultFeatureAlphabet().keysize());
		System.out.println("字典大小"+cl.getAlphabetFactory().DefaultFeatureAlphabet().size());
		System.out.println("权重长度"+www.length);
		System.out.println("非零权重"+c);	

		index.clear();
		ww.clear();
	}