mirror of
				https://github.com/explosion/spaCy.git
				synced 2025-11-04 09:57:26 +03:00 
			
		
		
		
	* Remove unused regularize argument from _ml.Model
This commit is contained in:
		
							parent
							
								
									adeb57cb1e
								
							
						
					
					
						commit
						62424e6c76
					
				| 
						 | 
					@ -18,7 +18,7 @@ cdef int arg_max(const weight_t* scores, const int n_classes) nogil
 | 
				
			||||||
cdef class Model:
 | 
					cdef class Model:
 | 
				
			||||||
    cdef int n_classes
 | 
					    cdef int n_classes
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
    cdef const weight_t* score(self, atom_t* context, bint regularize) except NULL
 | 
					    cdef const weight_t* score(self, atom_t* context) except NULL
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cdef int update(self, atom_t* context, class_t guess, class_t gold, int cost) except -1
 | 
					    cdef int update(self, atom_t* context, class_t guess, class_t gold, int cost) except -1
 | 
				
			||||||
    
 | 
					    
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -33,7 +33,7 @@ cdef class Model:
 | 
				
			||||||
        if self.model_loc and path.exists(self.model_loc):
 | 
					        if self.model_loc and path.exists(self.model_loc):
 | 
				
			||||||
            self._model.load(self.model_loc, freq_thresh=0)
 | 
					            self._model.load(self.model_loc, freq_thresh=0)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    cdef const weight_t* score(self, atom_t* context, bint regularize) except NULL:
 | 
					    cdef const weight_t* score(self, atom_t* context) except NULL:
 | 
				
			||||||
        cdef int n_feats
 | 
					        cdef int n_feats
 | 
				
			||||||
        feats = self._extractor.get_feats(context, &n_feats)
 | 
					        feats = self._extractor.get_feats(context, &n_feats)
 | 
				
			||||||
        return self._model.get_scores(feats, n_feats)
 | 
					        return self._model.get_scores(feats, n_feats)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -274,7 +274,7 @@ cdef class EnPosTagger:
 | 
				
			||||||
        for i in range(tokens.length):
 | 
					        for i in range(tokens.length):
 | 
				
			||||||
            if tokens.data[i].pos == 0:
 | 
					            if tokens.data[i].pos == 0:
 | 
				
			||||||
                fill_context(context, i, tokens.data)
 | 
					                fill_context(context, i, tokens.data)
 | 
				
			||||||
                scores = self.model.score(context, False)
 | 
					                scores = self.model.score(context)
 | 
				
			||||||
                guess = arg_max(scores, self.model.n_classes)
 | 
					                guess = arg_max(scores, self.model.n_classes)
 | 
				
			||||||
                tokens.data[i].tag = self.strings[self.tag_names[guess]]
 | 
					                tokens.data[i].tag = self.strings[self.tag_names[guess]]
 | 
				
			||||||
                self.set_morph(i, &self.tags[guess], tokens.data)
 | 
					                self.set_morph(i, &self.tags[guess], tokens.data)
 | 
				
			||||||
| 
						 | 
					@ -301,7 +301,7 @@ cdef class EnPosTagger:
 | 
				
			||||||
        correct = 0
 | 
					        correct = 0
 | 
				
			||||||
        for i in range(tokens.length):
 | 
					        for i in range(tokens.length):
 | 
				
			||||||
            fill_context(context, i, tokens.data)
 | 
					            fill_context(context, i, tokens.data)
 | 
				
			||||||
            scores = self.model.score(context, True)
 | 
					            scores = self.model.score(context)
 | 
				
			||||||
            guess = arg_max(scores, self.model.n_classes)
 | 
					            guess = arg_max(scores, self.model.n_classes)
 | 
				
			||||||
            loss = guess != golds[i] if golds[i] != -1 else 0
 | 
					            loss = guess != golds[i] if golds[i] != -1 else 0
 | 
				
			||||||
            self.model.update(context, guess, golds[i], loss)
 | 
					            self.model.update(context, guess, golds[i], loss)
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user