init from sample