Error while running clustimage module assoicated with _t_sne.py file - embedding

An error occurrs while running this module, clustimage. The error refers to the 'embedding' setting when "embedding='tsne'". If I run the code while "embedding='none'", it works fine. The concern is that embedding is very practical for visual purposes and should be used. Any ideas why this error occurs and how to resolve it?
clustimage resource link:
https://erdogant.github.io/clustimage/pages/html/Abstract.html
clustimage module
cl = Clustimage(method='pca',
embedding='tsne',
grayscale=False,
dim=(128,128),
params_pca={'n_components':0.95},
store_to_disk=True,
verbose=50)
_t_sne.py code
update = momentum * update - learning_rate * grad
p += update
error
File "/Users/name/opt/anaconda3/lib/python3.8/site-packages/sklearn/manifold/_t_sne.py", line 372, in _gradient_descent
update = momentum * update - learning_rate * grad
UFuncTypeError: ufunc 'multiply' did not contain a loop with signature matching types (dtype('<U32'), dtype('<U32')) -> dtype('<U32')

The author of clustimage found the answer:
Thank you for reporting! I found the issue: learning_rate='auto' seems the problem. I simply removed the parameter.
Resolved.

Related

Garry's Mod Lua: Errors that request symbols that shouldn't be there?

I've been attempting to make a GMod gamemode, and as usual, lua is being annoying. It's requesting symbols that (as far as I know) shouldn't be there.
The errors:
gamemodes/gmdm/gamemode/init.lua:7: '(' expected near 'player_manager'
Code in question
function GM:PlayerSpawn
player_manager:SetPlayerClass( ply, "player_custom" )
Error:
gamemodes/gmdm/gamemode/player_class/player_custom.lua:4: '=' expected near 'player_manager'
1. unknown - gamemodes/gmdm/gamemode/player_class/player_default.lua:4
2. include - [C]:-1
3. unknown - gamemodes/gmdm/gamemode/shared.lua:1
4. include - [C]:-1
5. unknown - gamemodes/gmdm/gamemode/cl_init.lua:1
Code:
player_manager:SetPlayerClass( ply, "player_custom", )
(the other file lines it's referring to are the line include ("player_custom.lua") as well as shared.lua in cl_init.lua for some reason?)
Error:
gamemodes/gmdm/gamemode/shared.lua:10: attempt to call field 'Class' (a nil value)
1. unknown - gamemodes/gmdm/gamemode/shared.lua:10
Code:
player.Class( "player_default" )
player.Class( "player_custom" )
(it complains regardless of if it's Class or CLASS)
I have tried adding the symbols requested around the code but then it complains an unexpected symbol (presumably the ) ) is near the :
This one kind of confused me, as far as I know there's no reason there should be an = there.
As I said, I changed the capitalization, which didn't help.
I've been following the code from https://wiki.facepunch.com/gmod/Player_Classes as guide if using it as reference helps debug
Thank you very much for your time.

Errors - bootstrap GLM model - glmmBoot package

I'm trying to run a bootstrap resampling on a GLM model, but I keep running into errors and I can't find any solution online.
The first problem in which I ran into is "variable lenght differs" when i try to use a normalized variable (sub.size_z) and a continuous variable trasformed into factor (hours). I checked my dataset and there are no NAs anywhere, so i don't know how to tackle the problem.
The second error is "Error: Naming mismatch from base to list of coefs", which happens when i try to run the bootstrap using a GLM without having trasformed the variables that i previously mentioned.
Can anyone point me towards a solution? Thanks a lot!
Here's the code I used!
data <-read.delim2("C:/Users/BRIZ_/Desktop/analisi scratching/Hypothesis 3/Hypothesis 3/database.txt")
library(car)
library(lme4)
library(MASS)
library(dplyr)
library(blmeco)
library(MuMIn)
library(lmerTest)
library(AER)
library(DHARMa)
sub.size_z<-scale(sub.size, center=TRUE,scale=TRUE)
hours<- as.factor(hour)
modelboot<-glmmTMB(sc.count~ offset(log(DURATION)) + hours + general.activity + sub.size_z + approach5+ id,data=data, family=genpois(link = "log"))
summary(modelboot)
bootstrap_model(modelboot,base_data=data,resamples =100)

GCE Python API: oauth2client.util:execute() takes at most 1 positional argument (2 given)

I'm trying to get started with the Python API for Google Compute Engine using their "hello world" tutorial on https://developers.google.com/compute/docs/api/python_guide#setup
Whenever making the call response = request.execute(auth_http) though, I get the following error signaling that I can't authenticate:
WARNING:oauth2client.util:execute() takes at most 1 positional argument (2 given)
I'm clearly only passing one positional argument (auth_http), and I've looked into oauth2client/util.py, apiclient/http.py, and oauth2client/client.py for answers, but nothing seems amiss. I found another stack overflow post that encountered the same issue, but it seems that in the constructor of the OAuth2WebServerFlow class in oauth2client/client.py, 'access_type' is set to 'offline' already (though to be honest I don't completely understand what's going on here in terms of setting up oauth2.0 flows).
Any suggestions would be much appreciated, and thanks in advance!
Looking at the code, the #util.positional(1) annotation is throwing the warning. Avoid it using named parameters.
Instead of:
response = request.execute(auth_http)
Do:
response = request.execute(http=auth_http)
https://code.google.com/p/google-api-python-client/source/browse/apiclient/http.py#637
I think documentation is wrong. Please use the following:
auth_http = credentials.authorize(http)
# Build the service
gce_service = build('compute', API_VERSION, http=auth_http)
project_url = '%s%s' % (GCE_URL, PROJECT_ID)
# List instances
request = gce_service.instances().list(project=PROJECT_ID, filter=None, zone=DEFAULT_ZONE)
response = request.execute()
You can do one of three things here:
1 Ignore the warnings and do nothing.
2 Suppress the warnings and set the flag to ignore:
import oauth2client
import gflags
gflags.FLAGS['positional_parameters_enforcement'].value = 'IGNORE'
3 Figure out where the positional parameter is being provided and fix it:
import oauth2client
import gflags
gflags.FLAGS['positional_parameters_enforcement'].value = 'EXCEPTION'
# Implement a try and catch around your code:
try:
pass
except TypeError, e:
# Print the stack so you can fix the problem, see python exception traceback docs.
print str(e)

Cannot get SURF example in EMGU.CV to work?

I am trying to detect a pattern shown in two images. Hence I have been trying to use the SURF algorithim found in emgu.CV, but the "SURFFeature" example that is given gives me the following error:
An unhandled exception of type 'Emgu.CV.Util.CvException' occurred in Emgu.CV.dll
Additional information: OpenCV: norm == NORM_L1 || norm == NORM_L2 || norm == NORM_HAMMING
Any ideas how to fix this?
When I try the "Hello World" example and the face detection example, both seem to work fine.
Thanks for any advice!
Fouad.
PS: Emgu.CV can be downloaded from here: http://www.emgu.com/wiki/index.php/Main_Page
Apparently the build was messed up.
http://www.emgu.com/bugs/show_bug.cgi?format=multiple&id=74
Aha, found it. The error here is in Emgu.Cv.Gpu/GpuBruteForceMatcher.cs lines 22 and 27.
Line 22 currently reads:
L2Dist,
It should read: L2Dist = 4,
Line 27 currently reads: HammingDist
It should read: HammingDist = 6
Rebuild the Emgu.CV.Gpu dll with those changes and it works.

Can't figure out error while running CVB0Driver in Mahout

I've been trying for the last few hours to get CVB0Driver working and after much trial and error I've come to the following error which I can't figure out. (Using mahout-integration 0.7)
java.lang.Error: Unresolved compilation problem:
at org.apache.mahout.math.function.Functions.mult(Functions.java:770)
at org.apache.mahout.clustering.lda.cvb.TopicModel.<init>(TopicModel.java:139)
at org.apache.mahout.clustering.lda.cvb.TopicModel.<init>(TopicModel.java:113)
at org.apache.mahout.clustering.lda.cvb.TopicModel.<init>(TopicModel.java:108)
at org.apache.mahout.clustering.lda.cvb.TopicModel.<init>(TopicModel.java:92)
at org.apache.mahout.clustering.lda.cvb.CachingCVB0Mapper.setup(CachingCVB0Mapper.java:103)
at org.apache.hadoop.mapreduce.Mapper.run(Mapper.java:142)
at org.apache.hadoop.mapred.MapTask.runNewMapper(MapTask.java:764)
at org.apache.hadoop.mapred.MapTask.run(MapTask.java:370)
Here's the code I'm using, since I have yet to get it working I'm not sure if I'm on the right path, so feel free to comment if you see a mistake I'm making.
String [] args = {"-c","UTF-8","-i",input,"-o",output};
//create the seq file from the directory of text documents
ToolRunner.run(new SequenceFilesFromDirectory(),args);
//tokenize the documents
DocumentProcessor.tokenizeDocuments(new Path(inputDir), analyzer.getClass().asSubclass(Analyzer.class), tokenizedPath, conf);
//create tf vectors
DictionaryVectorizer.createTermFrequencyVectors(tokenizedPath,new Path(outputDir), DictionaryVectorizer.DOCUMENT_VECTOR_OUTPUT_FOLDER, conf, minSupport, maxNGramSize, minLLRValue, -1.0f, true, reduceTasks, chunkSize, sequentialAccessOutput, true);
//calculate the document frequencies
Pair<Long[], List<Path>> dfData = TFIDFConverter.calculateDF( new Path(outputDir, DictionaryVectorizer.DOCUMENT_VECTOR_OUTPUT_FOLDER), new Path(outputDir), conf, chunkSize);
//create tfidf vectors
TFIDFConverter.processTfIdf( new Path(outputDir , DictionaryVectorizer.DOCUMENT_VECTOR_OUTPUT_FOLDER), new Path(outputDir), conf, dfData, minDf, maxDFPercent, norm, true, sequentialAccessOutput, true, reduceTasks);
args = new String[]{"-i","tfidf-vectors/part-r-00000","-o","cvb"};
//create the matrix for cvb
RowIdJob.main(args);
CVB0Driver.run(conf, new Path("cvb/matrix"), mto, numTopics, numTerms, alpha, eta, maxIterations, iterationBlockSize, convergenceDelta, dictionaryPath, dto, msto, randomSeed, testFraction, numTrainThreads, numUpdateThreads, maxItersPerDoc, numReduceTasks, backfillPerplexity);
Any help would be much appreciated.
Okay, seems this was some conflict between maven/eclipse projects.
I had recently imported the mahout-integration 0.7 source into eclipse and somehow badly built it, there was issues with mahout-math and my other project maybe started referencing the badly built jar, I'm not too familiar with maven so I don't know if that was the case or eclipse just went a bit crazy.
After deleting this project from eclipse, everything started to run fine.
This question helped resolve this one - java-unresolved-compilation-problem

Resources